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

Chris Ridd
20.19.2015 e9d8e51279f417f2f4948210b1cd1484cadf0bda
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.