mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

Chris Ridd
20.19.2015 e9d8e51279f417f2f4948210b1cd1484cadf0bda
CR-8001 OPENDJ-2216 Add upgrade task which reruns dsjavaproperties
5 files modified
50 ■■■■ changed files
opendj-server-legacy/src/main/java/org/opends/quicksetup/installer/InstallerHelper.java 10 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/tools/JavaPropertiesTool.java 2 ●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/tools/upgrade/Upgrade.java 4 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/tools/upgrade/UpgradeTasks.java 31 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/messages/org/opends/messages/tool.properties 3 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/quicksetup/installer/InstallerHelper.java
@@ -1147,14 +1147,8 @@
    final String destinationFile = Utils.getPath(libDir, isWindows() ? Installation.SET_JAVA_PROPERTIES_FILE_WINDOWS
                                                                     : Installation.SET_JAVA_PROPERTIES_FILE_UNIX);
    // Launch the script
    String[] args =
    {
        "--propertiesFile", propertiesFile,
        "--destinationFile", destinationFile,
        "--quiet"
    };
    int returnValue = JavaPropertiesTool.mainCLI(args);
    int returnValue = JavaPropertiesTool.mainCLI(
        "--propertiesFile", propertiesFile, "--destinationFile", destinationFile, "--quiet");
    if (JavaPropertiesTool.ErrorReturnCode.SUCCESSFUL.getReturnCode() != returnValue &&
        JavaPropertiesTool.ErrorReturnCode.SUCCESSFUL_NOP.getReturnCode() != returnValue)
    {
opendj-server-legacy/src/main/java/org/opends/server/tools/JavaPropertiesTool.java
@@ -156,7 +156,7 @@
   * @return The error code.
   */
  public static int mainCLI(String[] args)
  public static int mainCLI(String... args)
  {
    return mainCLI(args, System.out, System.err, System.in);
  }
opendj-server-legacy/src/main/java/org/opends/server/tools/upgrade/Upgrade.java
@@ -403,6 +403,10 @@
        deleteFile(new File(binDirectory, "dsframework")),
        deleteFile(new File(batDirectory, "dsframework.bat")));
    /** See OPENDJ-1322 and OPENDJ-1067 */
    register("2.7.0.9206",
        rerunJavaPropertiesTool(INFO_UPGRADE_TASK_9206_SUMMARY.get()));
    /*
     * All upgrades will refresh the server configuration schema and generate
     * a new upgrade folder.
opendj-server-legacy/src/main/java/org/opends/server/tools/upgrade/UpgradeTasks.java
@@ -38,6 +38,7 @@
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.i18n.slf4j.LocalizedLogger;
import org.forgerock.opendj.ldap.Filter;
import org.opends.server.tools.JavaPropertiesTool;
import org.opends.server.tools.RebuildIndex;
import org.opends.server.util.BuildVersion;
import org.opends.server.util.ChangeOperationType;
@@ -335,6 +336,36 @@
  }
  /**
   * Re-run the dsjavaproperties tool to rewrite the set-java-home script/batch file.
   *
   * @param summary
   *          The summary of the task.
   * @return An upgrade task which runs dsjavaproperties.
   */
  public static UpgradeTask rerunJavaPropertiesTool(final LocalizableMessage summary)
  {
    return new AbstractUpgradeTask()
    {
      @Override
      public void perform(UpgradeContext context) throws ClientException
      {
        logger.debug(summary);
        final ProgressNotificationCallback pnc = new ProgressNotificationCallback(0, summary, 50);
        context.notifyProgress(pnc);
        int returnValue = JavaPropertiesTool.mainCLI("--quiet");
        context.notifyProgress(pnc.setProgress(100));
        if (JavaPropertiesTool.ErrorReturnCode.SUCCESSFUL.getReturnCode() != returnValue &&
                JavaPropertiesTool.ErrorReturnCode.SUCCESSFUL_NOP.getReturnCode() != returnValue) {
          throw new ClientException(ReturnCode.ERROR_UNEXPECTED, ERR_UPGRADE_DSJAVAPROPERTIES_FAILED.get());
        }
      }
    };
  }
  /**
   * Creates a group of tasks which will only be invoked if the current version
   * is more recent than the provided version. This may be useful in cases where
   * a regression was introduced in version X and resolved in a later version Y.
opendj-server-legacy/src/messages/org/opends/messages/tool.properties
@@ -2568,6 +2568,8 @@
stops
INFO_UPGRADE_CLASSES_FOLDER_RENAMED_1852=The classes folder has been renamed to \
'%s' to avoid compatibility issues
ERR_UPGRADE_DSJAVAPROPERTIES_FAILED_1853=The dsjavaproperties tool failed to run. \
Please rerun dsjavaproperties manually
# Upgrade tasks
INFO_UPGRADE_TASK_6869_SUMMARY_10000=Fixing de-DE collation matching rule OID
@@ -2616,6 +2618,7 @@
INFO_UPGRADE_TASK_11339_SUMMARY_10036=Removing config for 'Extensions'
INFO_UPGRADE_TASK_11476_SUMMARY_10037=Removing config for 'File System Entry Cache'
INFO_UPGRADE_TASK_12226_SUMMARY_10038=Removing config for 'Entry Cache Preload'
INFO_UPGRADE_TASK_9206_SUMMARY_10039=Rerunning dsjavaproperties
# Strings for generated reference documentation.
REF_SHORT_DESC_BACKUP_15000=back up OpenDJ directory data