CR-2675 OPENDJ-1241 Server does not start after upgrade - Part II
- fixed upgrade (removed white spaces in upgrade tasks, added Filter instead of LDAPFilter, added matcher and setting schema default matching rule/syntax.)
| | |
| | | // @formatter:off |
| | | register("2.5.0.6869", |
| | | modifyConfigEntry(INFO_UPGRADE_TASK_6869_SUMMARY.get(), |
| | | "(objectClass= ds-cfg-collation-matching-rule)", |
| | | "(objectClass=ds-cfg-collation-matching-rule)", |
| | | "add: ds-cfg-collation", |
| | | "ds-cfg-collation: de:1.3.6.1.4.1.42.2.27.9.4.28.1", |
| | | "ds-cfg-collation: de-DE:1.3.6.1.4.1.42.2.27.9.4.28.1", |
| | |
| | | |
| | | register("2.5.0.7192", |
| | | modifyConfigEntry(INFO_UPGRADE_TASK_7192_SUMMARY.get(), |
| | | "(objectClass= ds-cfg-password-policy)", |
| | | "(objectClass=ds-cfg-password-policy)", |
| | | "add: objectClass", |
| | | "objectClass: ds-cfg-authentication-policy", |
| | | "-", |
| | |
| | | |
| | | register("2.5.0.7364", |
| | | modifyConfigEntry(INFO_UPGRADE_TASK_7364_SUMMARY.get(), |
| | | "(ds-cfg-java-class= org.opends.server.loggers.TextAuditLogPublisher)", |
| | | "(ds-cfg-java-class=org.opends.server.loggers.TextAuditLogPublisher)", |
| | | "add: objectClass", |
| | | "objectClass: ds-cfg-file-based-audit-log-publisher", |
| | | "-", |
| | |
| | | |
| | | register("2.5.0.7979", |
| | | modifyConfigEntry(INFO_UPGRADE_TASK_7979_SUMMARY.get(), |
| | | "(ds-cfg-java-class= org.opends.server.schema.CertificateSyntax)", |
| | | "(ds-cfg-java-class=org.opends.server.schema.CertificateSyntax)", |
| | | "add: objectClass", |
| | | "objectClass: ds-cfg-certificate-attribute-syntax", |
| | | "-", |
| | |
| | | |
| | | register("2.5.0.8124", |
| | | modifyConfigEntry(INFO_UPGRADE_TASK_8124_SUMMARY.get(), |
| | | "(ds-cfg-java-class= org.opends.server.schema.JPEGSyntax)", |
| | | "(ds-cfg-java-class=org.opends.server.schema.JPEGSyntax)", |
| | | "add: objectClass", |
| | | "objectClass: ds-cfg-jpeg-attribute-syntax", |
| | | "-", |
| | |
| | | |
| | | register("2.5.0.8133", |
| | | modifyConfigEntry(INFO_UPGRADE_TASK_8133_SUMMARY.get(), |
| | | "(ds-cfg-java-class= org.opends.server.schema.CountryStringSyntax)", |
| | | "(ds-cfg-java-class=org.opends.server.schema.CountryStringSyntax)", |
| | | "add: objectClass", |
| | | "objectClass: ds-cfg-country-string-attribute-syntax", |
| | | "-", |
| | |
| | | |
| | | register("2.5.0.8387", |
| | | modifyConfigEntry(INFO_UPGRADE_TASK_8387_SUMMARY.get(), |
| | | "(objectClass= ds-cfg-dictionary-password-validator)", |
| | | "(objectClass=ds-cfg-dictionary-password-validator)", |
| | | "add: ds-cfg-check-substrings", |
| | | "ds-cfg-check-substrings: false")); |
| | | |
| | | register("2.5.0.8389", |
| | | modifyConfigEntry(INFO_UPGRADE_TASK_8389_SUMMARY.get(), |
| | | "(objectClass= ds-cfg-attribute-value-password-validator)", |
| | | "(objectClass=ds-cfg-attribute-value-password-validator)", |
| | | "add: ds-cfg-check-substrings", |
| | | "ds-cfg-check-substrings: false")); |
| | | |
| | |
| | | import javax.security.auth.callback.ConfirmationCallback; |
| | | import javax.security.auth.callback.TextOutputCallback; |
| | | |
| | | import org.forgerock.opendj.ldap.Filter; |
| | | import org.forgerock.opendj.ldap.schema.UnknownSchemaElementException; |
| | | import org.opends.messages.Message; |
| | | import org.opends.server.protocols.ldap.LDAPFilter; |
| | | import org.opends.server.tools.ClientException; |
| | | import org.opends.server.tools.RebuildIndex; |
| | | import org.opends.server.util.BuildVersion; |
| | |
| | | Installation.CURRENT_CONFIG_FILE_NAME); |
| | | |
| | | final int changeCount = |
| | | updateConfigFile(configFile.getPath(), LDAPFilter |
| | | .decode(filter), ChangeOperationType.MODIFY, ldif); |
| | | updateConfigFile(configFile.getPath(), Filter.valueOf(filter), |
| | | ChangeOperationType.MODIFY, ldif); |
| | | |
| | | displayChangeCount(configFile.getPath(), changeCount); |
| | | |
| | |
| | | import org.forgerock.opendj.ldap.requests.ModifyRequest; |
| | | import org.forgerock.opendj.ldap.requests.Requests; |
| | | import org.forgerock.opendj.ldap.requests.SearchRequest; |
| | | import org.forgerock.opendj.ldap.schema.CoreSchema; |
| | | import org.forgerock.opendj.ldap.schema.Schema; |
| | | import org.forgerock.opendj.ldap.schema.SchemaBuilder; |
| | | import org.forgerock.opendj.ldap.schema.SchemaValidationPolicy; |
| | | import org.forgerock.opendj.ldap.schema.UnknownSchemaElementException; |
| | | import org.forgerock.opendj.ldif.EntryReader; |
| | | import org.forgerock.opendj.ldif.LDIF; |
| | |
| | | import org.forgerock.opendj.ldif.LDIFEntryWriter; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.core.SchemaConfigManager; |
| | | import org.opends.server.protocols.ldap.LDAPFilter; |
| | | import org.opends.server.util.ChangeOperationType; |
| | | import org.opends.server.util.SetupUtils; |
| | | import org.opends.server.util.StaticUtils; |
| | |
| | | * @return The changes number that have occurred. |
| | | */ |
| | | static int updateConfigFile(final String configPath, |
| | | final LDAPFilter filter, final ChangeOperationType changeType, |
| | | final Filter filter, final ChangeOperationType changeType, |
| | | final String... lines) throws IOException |
| | | { |
| | | final File original = new File(configPath); |
| | |
| | | LDIFEntryWriter writer = null; |
| | | try |
| | | { |
| | | entryReader = new LDIFEntryReader(new FileInputStream(configPath)); |
| | | entryReader.setSchemaValidationPolicy(SchemaValidationPolicy.ignoreAll()); |
| | | Schema schema = |
| | | new SchemaBuilder(Schema.getCoreSchema()).defaultMatchingRule( |
| | | CoreSchema.getCaseExactMatchingRule()).defaultSyntax( |
| | | CoreSchema.getDirectoryStringSyntax()).toSchema() |
| | | .asNonStrictSchema(); |
| | | |
| | | entryReader = |
| | | new LDIFEntryReader(new FileInputStream(configPath)) |
| | | .setSchema(schema); |
| | | |
| | | writer = new LDIFEntryWriter(new FileOutputStream(copyConfig)); |
| | | writer.setWrapColumn(80); |
| | |
| | | // For an Add, the first line should start with dn: |
| | | dn = lines[0].replaceFirst("dn: ",""); |
| | | } |
| | | final Matcher matcher = |
| | | filter != null ? filter.matcher(schema) : Filter.alwaysFalse() |
| | | .matcher(schema); |
| | | while (entryReader.hasNext()) |
| | | { |
| | | Entry entry = entryReader.readEntry(); |
| | | // Searching for the related entries |
| | | if (filter != null |
| | | && Filter.valueOf(filter.toString()).matches(entry) |
| | | == ConditionResult.TRUE) |
| | | if (matcher.matches(entry) == ConditionResult.TRUE) |
| | | { |
| | | try |
| | | { |