| | |
| | | rebuildIndexesNamed(INFO_UPGRADE_TASK_9013_DESCRIPTION.get(), |
| | | "ds-sync-hist"))); |
| | | |
| | | /** See OPENDJ-1284 */ |
| | | /* See OPENDJ-1284 */ |
| | | register("2.8.0", // userCertificate OID / cACertificate OID |
| | | newAttributeTypes(INFO_UPGRADE_TASK_10133_1_SUMMARY.get(), |
| | | "00-core.ldif", "2.5.4.36", "2.5.4.37"), |
| | |
| | | "ds-cfg-enabled: true")); |
| | | |
| | | |
| | | /** See OPENDJ-1295 */ |
| | | /* See OPENDJ-1295 */ |
| | | register("2.8.0", |
| | | copySchemaFile("03-pwpolicyextension.ldif")); |
| | | |
| | | /** See OPENDJ-1490 and OPENDJ-1454 */ |
| | | /* See OPENDJ-1490 and OPENDJ-1454 */ |
| | | register("2.8.0", |
| | | deleteConfigEntry(INFO_UPGRADE_TASK_10733_1_SUMMARY.get(), |
| | | "dn: ds-cfg-backend-id=replicationChanges,cn=Backends,cn=config"), |
| | |
| | | + "(version 3.0; acl \"Replication backend access\"; " |
| | | + "deny (all) userdn=\"ldap:///anyone\";)")); |
| | | |
| | | /** See OPENDJ-1351 */ |
| | | /* See OPENDJ-1351 */ |
| | | register("2.8.0", |
| | | modifyConfigEntry(INFO_UPGRADE_TASK_10820_SUMMARY.get(), |
| | | "(objectClass=ds-cfg-root-dn)", |
| | | "add: ds-cfg-default-root-privilege-name", |
| | | "ds-cfg-default-root-privilege-name: changelog-read")); |
| | | |
| | | /** See OPENDJ-1580 */ |
| | | /* See OPENDJ-1580 */ |
| | | register("2.8.0", |
| | | addConfigEntry(INFO_UPGRADE_TASK_10908_SUMMARY.get(), |
| | | "dn: cn=PKCS5S2,cn=Password Storage Schemes,cn=config", |
| | |
| | | "ds-cfg-java-class: org.opends.server.extensions.PKCS5S2PasswordStorageScheme", |
| | | "ds-cfg-enabled: true")); |
| | | |
| | | /** See OPENDJ-1322 and OPENDJ-1067 */ |
| | | /* See OPENDJ-1322 and OPENDJ-1067 */ |
| | | register("2.8.0", |
| | | rerunJavaPropertiesTool(INFO_UPGRADE_TASK_9206_SUMMARY.get())); |
| | | |
| | |
| | | "add:ds-cfg-override-severity", |
| | | "ds-cfg-override-severity: SYNC=INFO,ERROR,WARNING,NOTICE")); |
| | | |
| | | /** See OPENDJ-1545 */ |
| | | /* See OPENDJ-1545 */ |
| | | register("2.8.0", |
| | | deleteConfigEntry(INFO_UPGRADE_TASK_11237_1_SUMMARY.get(), |
| | | "dn: cn=Network Groups,cn=config"), |
| | |
| | | deleteConfigEntry(INFO_UPGRADE_TASK_11339_SUMMARY.get(), |
| | | "dn: cn=Extensions,cn=config")); |
| | | |
| | | /** See OPENDJ-1701 */ |
| | | /* See OPENDJ-1701 */ |
| | | register("2.8.0", |
| | | deleteConfigEntry(INFO_UPGRADE_TASK_11476_SUMMARY.get(), |
| | | "dn: cn=File System,cn=Entry Caches,cn=config")); |
| | | |
| | | /** See OPENDJ-1869 */ |
| | | /* See OPENDJ-1869 */ |
| | | register("2.8.0", |
| | | modifyConfigEntry(INFO_UPGRADE_TASK_12226_SUMMARY.get(), |
| | | "(objectclass=ds-cfg-root-config)", |
| | | "delete: ds-cfg-entry-cache-preload")); |
| | | |
| | | /** See OPENDJ-2054 */ |
| | | /* See OPENDJ-2054 */ |
| | | register("2.8.0", |
| | | deleteFile(new File(binDirectory, "dsframework")), |
| | | deleteFile(new File(batDirectory, "dsframework.bat"))); |
| | | |
| | | /** If the upgraded version is a non OEM one, migrates local-db backends to JE Backend, see OPENDJ-2364 **/ |
| | | /* If the upgraded version is a non OEM one, migrates local-db backends to JE Backend, see OPENDJ-2364 **/ |
| | | register("3.0.0", |
| | | conditionalUpgradeTasks( |
| | | new UpgradeCondition() { |
| | |
| | | ) |
| | | ); |
| | | |
| | | /** If the upgraded version is OEM, migrates local-db backends to PDB, see OPENDJ-2364 **/ |
| | | /* If the upgraded version is OEM, migrates local-db backends to PDB, see OPENDJ-2364 **/ |
| | | register("3.0.0", |
| | | conditionalUpgradeTasks( |
| | | new UpgradeCondition() { |
| | |
| | | ) |
| | | ); |
| | | |
| | | /** Remove dbtest tool (replaced by backendstat in 3.0.0) - see OPENDJ-1791 **/ |
| | | /* Remove dbtest tool (replaced by backendstat in 3.0.0) - see OPENDJ-1791 **/ |
| | | register("3.0.0", |
| | | deleteFile(new File(binDirectory, "dbtest")), |
| | | deleteFile(new File(batDirectory, "dbtest.bat"))); |
| | | |
| | | /** |
| | | /* |
| | | * Rebuild all indexes when upgrading to 3.0.0. |
| | | * |
| | | * 1) matching rules have changed in 2.8.0 and again in 3.0.0- see OPENDJ-1637 |
| | |
| | | register("3.0.0", |
| | | rebuildAllIndexes(INFO_UPGRADE_TASK_11260_SUMMARY.get())); |
| | | |
| | | /** See OPENDJ-1742 */ |
| | | /* See OPENDJ-1742 */ |
| | | register("3.0.0", |
| | | clearReplicationDbDirectory()); |
| | | |
| | | /** See OPENDJ-2435 */ |
| | | /* See OPENDJ-2435 */ |
| | | register("3.5.0", |
| | | addConfigEntry(INFO_UPGRADE_TASK_BCRYPT_SCHEME_SUMMARY.get(), |
| | | "dn: cn=Bcrypt,cn=Password Storage Schemes,cn=config", |
| | |
| | | "ds-cfg-java-class: org.opends.server.extensions.BcryptPasswordStorageScheme", |
| | | "ds-cfg-enabled: true")); |
| | | |
| | | /** See OPENDJ-2683 */ |
| | | /* See OPENDJ-2683 */ |
| | | register("3.5.0", |
| | | deleteConfigEntry(INFO_UPGRADE_TASK_REMOVE_MATCHING_RULES.get(), |
| | | "cn=Auth Password Exact Equality Matching Rule,cn=Matching Rules,cn=config", |
| | |
| | | "cn=UUID Ordering Matching Rule,cn=Matching Rules,cn=config", |
| | | "cn=Word Equality Matching Rule,cn=Matching Rules,cn=config")); |
| | | |
| | | /** see OPENDJ-2730 */ |
| | | /* see OPENDJ-2730 */ |
| | | register("3.5.0", removeOldJarFiles()); |
| | | |
| | | register("3.5.0", |
| | |
| | | addConfigFile("rest2ldap") |
| | | ); |
| | | |
| | | /** All upgrades will refresh the server configuration schema and generate a new upgrade folder. */ |
| | | /* All upgrades will refresh the server configuration schema and generate a new upgrade folder. */ |
| | | registerLast( |
| | | performOEMMigrationIfNeeded(), |
| | | copySchemaFile("02-config.ldif"), |
| | |
| | | throw new ClientException(ReturnCode.SUCCESS, message); |
| | | } |
| | | |
| | | // The upgrade only supports version >= 2.4.5. |
| | | // Exclude upgrade from very old versions. |
| | | if (context.getFromVersion().compareTo(UPGRADE_SUPPORTS_VERSION_FROM) < 0) |
| | | { |
| | | final LocalizableMessage message = |
| | |
| | | import com.sleepycat.je.TransactionConfig; |
| | | |
| | | /** Factory methods for create new upgrade tasks. */ |
| | | public final class UpgradeTasks |
| | | final class UpgradeTasks |
| | | { |
| | | /** Logger for the upgrade. */ |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | |
| | | * @return A new upgrade task which applies an LDIF record to all |
| | | * configuration entries matching the provided filter. |
| | | */ |
| | | public static UpgradeTask addConfigEntry(final LocalizableMessage summary, |
| | | static UpgradeTask addConfigEntry(final LocalizableMessage summary, |
| | | final String... ldif) |
| | | { |
| | | return updateConfigEntry(summary, null, ChangeOperationType.ADD, ldif); |
| | |
| | | * @return A new upgrade task which applies an LDIF record to all |
| | | * configuration entries matching the provided filter. |
| | | */ |
| | | public static UpgradeTask addConfigEntry(final String... ldif) |
| | | static UpgradeTask addConfigEntry(final String... ldif) |
| | | { |
| | | return new AbstractUpgradeTask() |
| | | { |
| | |
| | | * config / schema folder. If the file already exists, it's |
| | | * overwritten. |
| | | */ |
| | | public static UpgradeTask copySchemaFile(final String fileName) |
| | | static UpgradeTask copySchemaFile(final String fileName) |
| | | { |
| | | return new AbstractUpgradeTask() |
| | | { |
| | |
| | | * @return A task which copy the the file placed in parameter within the |
| | | * config folder. If the file already exists, it's overwritten. |
| | | */ |
| | | public static UpgradeTask addConfigFile(final String fileName) |
| | | static UpgradeTask addConfigFile(final String fileName) |
| | | { |
| | | return new AbstractUpgradeTask() |
| | | { |
| | |
| | | * @return A new upgrade task which applies an LDIF record to all configuration entries matching |
| | | * the provided filter. |
| | | */ |
| | | public static UpgradeTask deleteConfigEntry(final LocalizableMessage summary, final String... dnsInLDIF) |
| | | static UpgradeTask deleteConfigEntry(final LocalizableMessage summary, final String... dnsInLDIF) |
| | | { |
| | | return updateConfigEntry(summary, null, ChangeOperationType.DELETE, dnsInLDIF); |
| | | } |
| | |
| | | * @return A new upgrade task which applies an LDIF record to all |
| | | * configuration entries matching the provided filter. |
| | | */ |
| | | public static UpgradeTask modifyConfigEntry(final LocalizableMessage summary, |
| | | static UpgradeTask modifyConfigEntry(final LocalizableMessage summary, |
| | | final String filter, final String... ldif) |
| | | { |
| | | return updateConfigEntry(summary, filter, ChangeOperationType.MODIFY, ldif); |
| | |
| | | * previously in the configuration template files, reads the |
| | | * definition and adds it onto the file specified in {@code fileName} |
| | | */ |
| | | public static UpgradeTask newAttributeTypes(final LocalizableMessage summary, |
| | | static UpgradeTask newAttributeTypes(final LocalizableMessage summary, |
| | | final String fileName, final String... attributeOids) |
| | | { |
| | | return new AbstractUpgradeTask() |
| | |
| | | * The summary of the task. |
| | | * @return An upgrade task which runs dsjavaproperties. |
| | | */ |
| | | public static UpgradeTask rerunJavaPropertiesTool(final LocalizableMessage summary) |
| | | static UpgradeTask rerunJavaPropertiesTool(final LocalizableMessage summary) |
| | | { |
| | | return new AbstractUpgradeTask() |
| | | { |
| | |
| | | * @return An upgrade task which will only be invoked if the current version |
| | | * is more recent than the provided version. |
| | | */ |
| | | public static UpgradeTask regressionInVersion(final String versionString, final UpgradeTask... tasks) |
| | | static UpgradeTask regressionInVersion(final String versionString, final UpgradeTask... tasks) |
| | | { |
| | | final BuildVersion version = BuildVersion.valueOf(versionString); |
| | | return conditionalUpgradeTasks(new UpgradeCondition() |
| | |
| | | * The summary of this upgrade task. |
| | | * @return An Upgrade task which rebuild all the indexes. |
| | | */ |
| | | public static UpgradeTask rebuildAllIndexes(final LocalizableMessage summary) |
| | | static UpgradeTask rebuildAllIndexes(final LocalizableMessage summary) |
| | | { |
| | | return new AbstractUpgradeTask() |
| | | { |
| | |
| | | * The indexes to rebuild. |
| | | * @return The rebuild index task. |
| | | */ |
| | | public static UpgradeTask rebuildIndexesNamed(final LocalizableMessage summary, final String... indexNames) |
| | | static UpgradeTask rebuildIndexesNamed(final LocalizableMessage summary, final String... indexNames) |
| | | { |
| | | return new AbstractUpgradeTask() |
| | | { |
| | |
| | | * |
| | | * @return The post upgrade rebuild indexes task. |
| | | */ |
| | | public static UpgradeTask postUpgradeRebuildIndexes() |
| | | static UpgradeTask postUpgradeRebuildIndexes() |
| | | { |
| | | return new AbstractUpgradeTask() |
| | | { |
| | |
| | | * new schema.ldif.rev which is needed after schema customization for |
| | | * starting correctly the server. |
| | | */ |
| | | public static UpgradeTask updateConfigUpgradeFolder() |
| | | static UpgradeTask updateConfigUpgradeFolder() |
| | | { |
| | | return new AbstractUpgradeTask() |
| | | { |
| | |
| | | * The file to be removed. |
| | | * @return An upgrade task which removes the specified file from the file-system. |
| | | */ |
| | | public static UpgradeTask deleteFile(final File file) |
| | | static UpgradeTask deleteFile(final File file) |
| | | { |
| | | return new AbstractUpgradeTask() |
| | | { |
| | |
| | | * |
| | | * @return An upgrade task which is responsible for preparing local-db backend JE databases. |
| | | */ |
| | | public static UpgradeTask migrateLocalDBBackendsToJEBackends() { |
| | | static UpgradeTask migrateLocalDBBackendsToJEBackends() { |
| | | return new AbstractUpgradeTask() { |
| | | /** Properties of JE backends to be migrated. */ |
| | | class Backend { |
| | |
| | | * but not in the concatenated schema then append its definition to the concatenated schema, |
| | | * omitting the trailing spaces. |
| | | * |
| | | * See OPENDJ-3081 |
| | | * |
| | | * @return The relevant upgrade task |
| | | * @see OPENDJ-3081 |
| | | */ |
| | | static UpgradeTask restoreCsvDelimiterAttributeTypeInConcatenatedSchemaFile() |
| | | { |
| | |
| | | final String path = getInstallPath(classPaths); |
| | | if (path == null) |
| | | { |
| | | return installPath; |
| | | return null; |
| | | } |
| | | |
| | | /* |
| | |
| | | final Filter filter, final ChangeOperationType changeType, |
| | | final String... ldifLines) throws IOException |
| | | { |
| | | final File original = configFile; |
| | | final File copyConfig = |
| | | File.createTempFile("copyConfig", ".tmp", original.getParentFile()); |
| | | File.createTempFile("copyConfig", ".tmp", configFile.getParentFile()); |
| | | |
| | | int changeCount = 0; |
| | | final Schema schema = getUpgradeSchema(); |
| | |
| | | if (changeType == ADD && !entryAlreadyExist) |
| | | { |
| | | writer.writeEntry(Requests.newAddRequest(ldifLines)); |
| | | logger.debug(LocalizableMessage.raw("Entry successfully added %s in %s", ldifDN, original.getAbsolutePath())); |
| | | logger.debug(LocalizableMessage.raw("Entry successfully added %s in %s", ldifDN, configFile.getAbsolutePath())); |
| | | changeCount++; |
| | | } |
| | | } |
| | |
| | | catch (IOException e) |
| | | { |
| | | logger.error(LocalizableMessage.raw(e.getMessage())); |
| | | deleteRecursively(original); |
| | | deleteRecursively(configFile); |
| | | throw e; |
| | | } |
| | | } |
| | |
| | | return changeCount; |
| | | } |
| | | |
| | | private static Entry readFirstEntryFromTemplate(final File destination) throws DecodeException, IOException |
| | | private static Entry readFirstEntryFromTemplate(final File destination) throws IOException |
| | | { |
| | | try (LDIFEntryReader r = new LDIFEntryReader(new FileInputStream(destination))) |
| | | { |