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

Jean-Noel Rouvignac
18.07.2014 4be554ddc1e28746716c15fe1e81c1eb86402fa4
OPENDJ-1545 Remove Workflow, NetworkGroups and related attempts at building a proxy

Added upgrade tasks for the already removed configs.


Upgrade.java:
In the static intializer, added upgrade tasks for the already removed configs.

tools.properties:
Added new upgrade messages.
2 files modified
111 ■■■■ changed files
opendj3-server-dev/src/messages/messages/tools.properties 6 ●●●● patch | view | raw | blame | history
opendj3-server-dev/src/server/org/opends/server/tools/upgrade/Upgrade.java 105 ●●●●● patch | view | raw | blame | history
opendj3-server-dev/src/messages/messages/tools.properties
@@ -2578,7 +2578,7 @@
INFO_UPGRADE_TASK_8985_2_SUMMARY_10018=Updating subject attribute to user attribute configuration
INFO_UPGRADE_TASK_9013_DESCRIPTION_10019=OpenDJ 2.5.0-Xpress1 introduced a \
 regression in the ds-sync-hist ordering index. This index has to be rebuilt and this could take a long time \
 to proceed. Do you want to launch this process at automatically at the end of the upgrade?
 to proceed. Do you want to launch this process automatically at the end of the upgrade?
ERR_TASK_TOOL_LDAP_ERROR_10020=ERROR:  The server rejected the task for the following reason: %s
INFO_UPGRADE_TASK_10133_1_SUMMARY_10021=Changing matching rule for 'userCertificate' and \
'caCertificate' to CertificateExactMatch
@@ -2591,3 +2591,7 @@
INFO_UPGRADE_TASK_10733_2_SUMMARY_10028=Removing ACI for 'dc=replicationchanges'
INFO_UPGRADE_TASK_10820_SUMMARY_10029=Adding default privilege 'changelog-read' to all root DNs
INFO_UPGRADE_TASK_10908_SUMMARY_10030=Adding PKCS5S2 password storage scheme configuration
INFO_UPGRADE_TASK_11237_1_SUMMARY_10031=Removing config for 'Network Groups'
INFO_UPGRADE_TASK_11237_2_SUMMARY_10032=Removing config for 'Workflows'
INFO_UPGRADE_TASK_11237_3_SUMMARY_10033=Removing config for 'Workflow Elements'
INFO_UPGRADE_TASK_11239_1_SUMMARY_10034=Removing config for 'Network Group Plugin'
opendj3-server-dev/src/server/org/opends/server/tools/upgrade/Upgrade.java
@@ -23,15 +23,8 @@
 *
 *      Portions Copyright 2013-2014 ForgeRock AS
 */
package org.opends.server.tools.upgrade;
import static org.opends.messages.ToolMessages.*;
import static org.opends.server.tools.upgrade.FormattedNotificationCallback.*;
import static org.opends.server.tools.upgrade.UpgradeTasks.*;
import static org.opends.server.tools.upgrade.LicenseFile.*;
import static com.forgerock.opendj.cli.Utils.LINE_SEPARATOR;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
@@ -41,18 +34,24 @@
import java.util.NavigableMap;
import java.util.TreeMap;
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.i18n.slf4j.LocalizedLogger;
import javax.security.auth.callback.ConfirmationCallback;
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.i18n.slf4j.LocalizedLogger;
import org.opends.server.core.LockFileManager;
import org.opends.server.util.BuildVersion;
import org.opends.server.util.StaticUtils;
import com.forgerock.opendj.cli.ClientException;
import com.forgerock.opendj.cli.ReturnCode;
import org.opends.server.util.BuildVersion;
import org.opends.server.util.StaticUtils;
import static com.forgerock.opendj.cli.Utils.*;
import static javax.security.auth.callback.TextOutputCallback.*;
import static org.opends.messages.ToolMessages.*;
import static org.opends.server.tools.upgrade.FormattedNotificationCallback.*;
import static org.opends.server.tools.upgrade.LicenseFile.*;
import static org.opends.server.tools.upgrade.UpgradeTasks.*;
/**
 * This class contains the table of upgrade tasks that need performing when
@@ -60,25 +59,15 @@
 */
public final class Upgrade
{
  /**
   * Upgrade's logger.
   */
  private final static LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass();
  /** Upgrade's logger. */
  private static LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass();
  /**
   * Upgrade supports version from 2.4.5.
   */
  private final static BuildVersion UPGRADESUPPORTSVERSIONFROM = BuildVersion
      .valueOf("2.4.5.0000");
  /** Upgrade supports version from 2.4.5. */
  private static BuildVersion UPGRADESUPPORTSVERSIONFROM = BuildVersion.valueOf("2.4.5.0000");
  /**
   * The success exit code value.
   */
  /** The success exit code value. */
  static final int EXIT_CODE_SUCCESS = 0;
  /**
   * The error exit code value.
   */
  /** The error exit code value. */
  static final int EXIT_CODE_ERROR = 1;
  /**
@@ -87,14 +76,10 @@
   */
  static final int EXIT_CODE_MANUAL_INTERVENTION = 2;
  /**
   * If the upgrade contains some post upgrade tasks to do.
   */
  static boolean hasPostUpgradeTask = false;
  /** If the upgrade contains some post upgrade tasks to do. */
  static boolean hasPostUpgradeTask;
  /**
   * Developers should register upgrade tasks below.
   */
  /** Developers should register upgrade tasks below. */
  private static final NavigableMap<BuildVersion, List<UpgradeTask>> TASKS =
      new TreeMap<BuildVersion, List<UpgradeTask>>();
  private static final List<UpgradeTask> MANDATORY_TASKS =
@@ -385,6 +370,18 @@
            "ds-cfg-java-class: org.opends.server.extensions.PKCS5S2PasswordStorageScheme",
            "ds-cfg-enabled: true"));
    /** See OPENDJ-1545 */
    register("3.0.0.11237",
        deleteConfigEntry(INFO_UPGRADE_TASK_11237_1_SUMMARY.get(),
            "dn: cn=Network Groups,cn=config"),
        deleteConfigEntry(INFO_UPGRADE_TASK_11237_2_SUMMARY.get(),
            "dn: cn=Workflows,cn=config"),
        deleteConfigEntry(INFO_UPGRADE_TASK_11237_3_SUMMARY.get(),
            "dn: cn=Workflow Elements,cn=config"));
    register("3.0.0.11239",
        deleteConfigEntry(INFO_UPGRADE_TASK_11239_1_SUMMARY.get(),
            "dn: cn=Network Group,cn=Plugins,cn=config"));
    /*
     * All upgrades will refresh the server configuration schema and generate
     * a new upgrade folder.
@@ -483,9 +480,7 @@
    }
    // Starts upgrade
    final int userResponse =
        context.confirmYN(INFO_UPGRADE_DISPLAY_CONFIRM_START.get(),
            ConfirmationCallback.YES);
    final int userResponse = context.confirmYN(INFO_UPGRADE_DISPLAY_CONFIRM_START.get(), ConfirmationCallback.YES);
    if (userResponse == ConfirmationCallback.NO)
    {
      final LocalizableMessage message = INFO_UPGRADE_ABORTED_BY_USER.get();
@@ -524,7 +519,7 @@
      /*
       * Performs the post upgrade tasks.
       */
      if (hasPostUpgradeTask && (UpgradeTasks.countErrors == 0))
      if (hasPostUpgradeTask && UpgradeTasks.countErrors == 0)
      {
        context
            .notify(INFO_UPGRADE_PERFORMING_POST_TASKS.get(), TITLE_CALLBACK);
@@ -545,8 +540,7 @@
    }
    finally
    {
      context.notify(INFO_UPGRADE_GENERAL_SEE_FOR_DETAILS.get(UpgradeUtils
          .getInstallationPath()
      context.notify(INFO_UPGRADE_GENERAL_SEE_FOR_DETAILS.get(UpgradeUtils.getInstallationPath()
          + File.separator + UpgradeLog.UPGRADELOGNAME), NOTICE_CALLBACK);
      logger.info(INFO_UPGRADE_PROCESS_END);
    }
@@ -584,7 +578,8 @@
    List<UpgradeTask> taskList = TASKS.get(version);
    if (taskList == null)
    {
      TASKS.put(version, (taskList = new LinkedList<UpgradeTask>()));
      taskList = new LinkedList<UpgradeTask>();
      TASKS.put(version, taskList);
    }
    taskList.addAll(Arrays.asList(tasks));
  }
@@ -600,8 +595,7 @@
   * @throws ClientException
   *           An exception is thrown if the server is currently running.
   */
  private final static void checkIfServerIsRunning(final UpgradeContext context)
      throws ClientException
  private static void checkIfServerIsRunning(final UpgradeContext context) throws ClientException
  {
    final String lockFile = LockFileManager.getServerLockFileName();
@@ -698,9 +692,7 @@
      throws ClientException
  {
    // Check license
    if (!LicenseFile.isAlreadyApproved())
    {
      if (LicenseFile.exists())
    if (LicenseFile.exists() && !LicenseFile.isAlreadyApproved())
      {
        context.notify(LocalizableMessage.raw(LINE_SEPARATOR + LicenseFile.getText()));
        context.notify(INFO_LICENSE_DETAILS_CLI_LABEL.get());
@@ -719,9 +711,7 @@
          }
          else
          {
            answer =
                context.confirmYN(INFO_LICENSE_ACCEPT.get(),
                    ConfirmationCallback.NO);
          answer = context.confirmYN(INFO_LICENSE_ACCEPT.get(), ConfirmationCallback.NO);
          }
          if (answer == ConfirmationCallback.NO)
@@ -742,7 +732,6 @@
        }
      }
    }
  }
  /**
   * The classes folder is renamed by the script launcher to avoid
@@ -755,13 +744,13 @@
  {
    try
    {
      final File backup =
          new File(UpgradeUtils.getInstancePath(), "classes.disabled");
      if (backup.exists() && backup.listFiles() != null
          && backup.listFiles().length > 0)
      final File backup = new File(UpgradeUtils.getInstancePath(), "classes.disabled");
      if (backup.exists()) {
        final File[] files = backup.listFiles();
        if (files != null && files.length > 0)
      {
        logger.warn(INFO_UPGRADE_CLASSES_FOLDER_RENAMED.get(backup
            .getAbsoluteFile()));
          logger.warn(INFO_UPGRADE_CLASSES_FOLDER_RENAMED, backup.getAbsoluteFile());
        }
      }
    }
    catch (SecurityException se)
@@ -791,7 +780,7 @@
    Upgrade.hasPostUpgradeTask = hasPostUpgradeTask;
  }
  // Prevent instantiation.
  /** Prevent instantiation. */
  private Upgrade()
  {
    // Nothing to do.