From 326568b2dd4a079b023b977b9f96c321f5f2669d Mon Sep 17 00:00:00 2001
From: Matthew Swift <matthew.swift@forgerock.com>
Date: Wed, 29 Jun 2016 20:31:10 +0000
Subject: [PATCH] OPENDJ-3187 Remove support for upgrading from versions older than 2.6.0

---
 opendj-server-legacy/src/main/java/org/opends/server/tools/upgrade/Upgrade.java      |  207 -----------------------------------------
 opendj-server-legacy/src/main/java/org/opends/server/tools/upgrade/UpgradeTasks.java |   55 -----------
 opendj-server-legacy/src/main/java/org/opends/server/tools/upgrade/UpgradeUtils.java |    5 
 3 files changed, 3 insertions(+), 264 deletions(-)

diff --git a/opendj-server-legacy/src/main/java/org/opends/server/tools/upgrade/Upgrade.java b/opendj-server-legacy/src/main/java/org/opends/server/tools/upgrade/Upgrade.java
index 430f9ef..fc9c598 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/tools/upgrade/Upgrade.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/tools/upgrade/Upgrade.java
@@ -56,8 +56,8 @@
   /** Upgrade's logger. */
   private static LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass();
 
-  /** Upgrade supports version from 2.4.5. */
-  private static BuildVersion UPGRADE_SUPPORTS_VERSION_FROM = BuildVersion.valueOf("2.4.5.0000");
+  /** Minimum version for which upgrade is supported. */
+  private static BuildVersion UPGRADE_SUPPORTS_VERSION_FROM = BuildVersion.valueOf("2.6.0");
 
   /** The success exit code value. */
   static final int EXIT_CODE_SUCCESS = 0;
@@ -80,209 +80,6 @@
   static
   {
     // @formatter:off
-    /** See OPENDJ-2716 */
-    register("2.5.0",
-        newAttributeTypes(INFO_UPGRADE_TASK_2716_1_SUMMARY.get(),
-        "03-changelog.ldif", "1.3.6.1.4.1.36733.2.1.1.6"), // includedAttributes
-        newObjectClasses(INFO_UPGRADE_TASK_2716_2_SUMMARY.get(),
-        "03-changelog.ldif", "2.16.840.1.113730.3.2.1")); // changeLogEntry
-
-    register("2.5.0",
-        modifyConfigEntry(INFO_UPGRADE_TASK_6869_SUMMARY.get(),
-        "(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",
-        "-",
-        "delete: ds-cfg-collation",
-        "ds-cfg-collation: de:1.3.6.1.4.1.142.2.27.9.4.28.1",
-        "ds-cfg-collation: de-DE:1.3.6.1.4.1.142.2.27.9.4.28.1"));
-
-    register("2.5.0",
-        modifyConfigEntry(INFO_UPGRADE_TASK_7192_SUMMARY.get(),
-        "(objectClass=ds-cfg-password-policy)",
-        "add: objectClass",
-        "objectClass: ds-cfg-authentication-policy",
-        "-",
-        "add: ds-cfg-java-class",
-        "ds-cfg-java-class: org.opends.server.core.PasswordPolicyFactory"));
-
-    register("2.5.0",
-        modifyConfigEntry(INFO_UPGRADE_TASK_7364_SUMMARY.get(),
-        "(ds-cfg-java-class=org.opends.server.loggers.TextAuditLogPublisher)",
-        "add: objectClass",
-        "objectClass: ds-cfg-file-based-audit-log-publisher",
-        "-",
-        "delete: objectClass",
-        "objectClass: ds-cfg-file-based-access-log-publisher"));
-
-    register("2.5.0",
-        renameSnmpSecurityConfig(INFO_UPGRADE_TASK_7466_SUMMARY.get()));
-
-    register("2.5.0",
-        newAttributeTypes(INFO_UPGRADE_TASK_7748_1_SUMMARY.get(),
-        "00-core.ldif", "1.3.6.1.4.1.36733.2.1.1.59"), //etag
-        addConfigEntry(INFO_UPGRADE_TASK_7748_2_SUMMARY.get(),
-        "dn: cn=etag,cn=Virtual Attributes,cn=config",
-        "changetype: add",
-        "objectClass: top",
-        "objectClass: ds-cfg-virtual-attribute",
-        "objectClass: ds-cfg-entity-tag-virtual-attribute",
-        "cn: etag",
-        "ds-cfg-java-class: org.opends.server.extensions."
-            + "EntityTagVirtualAttributeProvider",
-        "ds-cfg-enabled: true",
-        "ds-cfg-attribute-type: etag",
-        "ds-cfg-conflict-behavior: real-overrides-virtual",
-        "ds-cfg-checksum-algorithm: adler-32",
-        "ds-cfg-excluded-attribute: ds-sync-hist"));
-
-    register("2.5.0",
-        addConfigEntry(INFO_UPGRADE_TASK_7834_SUMMARY.get(),
-        "dn: cn=Password Expiration Time,cn=Virtual Attributes,cn=config",
-        "changetype: add",
-        "objectClass: top",
-        "objectClass: ds-cfg-virtual-attribute",
-        "objectClass: ds-cfg-password-expiration-time-virtual-attribute",
-        "cn: Password Expiration Time",
-        "ds-cfg-java-class: org.opends.server.extensions."
-            + "PasswordExpirationTimeVirtualAttributeProvider",
-        "ds-cfg-enabled: true",
-        "ds-cfg-attribute-type: ds-pwp-password-expiration-time",
-        "ds-cfg-conflict-behavior: virtual-overrides-real"));
-
-    register("2.5.0",
-        modifyConfigEntry(INFO_UPGRADE_TASK_7979_SUMMARY.get(),
-        "(ds-cfg-java-class=org.opends.server.schema.CertificateSyntax)",
-        "add: objectClass",
-        "objectClass: ds-cfg-certificate-attribute-syntax",
-        "-",
-        "add: ds-cfg-strict-format",
-        "ds-cfg-strict-format: false"));
-
-    register("2.6.0",
-        modifyConfigEntry(INFO_UPGRADE_TASK_8124_SUMMARY.get(),
-        "(ds-cfg-java-class=org.opends.server.schema.JPEGSyntax)",
-        "add: objectClass",
-        "objectClass: ds-cfg-jpeg-attribute-syntax",
-        "-",
-        "add: ds-cfg-strict-format",
-        "ds-cfg-strict-format: false"));
-
-    register("2.6.0",
-        modifyConfigEntry(INFO_UPGRADE_TASK_8133_SUMMARY.get(),
-        "(ds-cfg-java-class=org.opends.server.schema.CountryStringSyntax)",
-        "add: objectClass",
-        "objectClass: ds-cfg-country-string-attribute-syntax",
-        "-",
-        "add: ds-cfg-strict-format",
-        "ds-cfg-strict-format: false"));
-
-    register("2.6.0",
-        requireConfirmation(INFO_UPGRADE_TASK_8214_DESCRIPTION.get(), YES,
-            modifyConfigEntry(INFO_UPGRADE_TASK_8214_SUMMARY.get(),
-                "(ds-cfg-java-class=org.opends.server.extensions.IsMemberOfVirtualAttributeProvider)",
-                "add: ds-cfg-filter",
-                "ds-cfg-filter: (|(objectClass=person)(objectClass=groupOfNames)"
-                    + "(objectClass=groupOfUniqueNames)(objectClass=groupOfEntries))",
-                "-",
-                "delete: ds-cfg-filter",
-                "ds-cfg-filter: (objectClass=person)")));
-
-    register("2.6.0",
-        modifyConfigEntry(INFO_UPGRADE_TASK_8387_SUMMARY.get(),
-        "(objectClass=ds-cfg-dictionary-password-validator)",
-        "add: ds-cfg-check-substrings",
-        "ds-cfg-check-substrings: false"));
-
-    register("2.6.0",
-        modifyConfigEntry(INFO_UPGRADE_TASK_8389_SUMMARY.get(),
-        "(objectClass=ds-cfg-attribute-value-password-validator)",
-        "add: ds-cfg-check-substrings",
-        "ds-cfg-check-substrings: false"));
-
-    register("2.6.0",
-        addConfigEntry(INFO_UPGRADE_TASK_8487_SUMMARY.get(),
-        "dn: cn=PBKDF2,cn=Password Storage Schemes,cn=config",
-        "changetype: add",
-        "objectClass: top",
-        "objectClass: ds-cfg-password-storage-scheme",
-        "objectClass: ds-cfg-pbkdf2-password-storage-scheme",
-        "cn: PBKDF2",
-        "ds-cfg-java-class: org.opends.server.extensions."
-            + "PBKDF2PasswordStorageScheme",
-        "ds-cfg-enabled: true"));
-
-    register("2.6.0",
-        addConfigFile("http-config.json"),
-        addConfigEntry(INFO_UPGRADE_TASK_8613_SUMMARY.get(),
-        "dn: cn=HTTP Connection Handler,cn=Connection Handlers,cn=config",
-        "changetype: add",
-        "objectClass: ds-cfg-http-connection-handler",
-        "objectClass: ds-cfg-connection-handler",
-        "objectClass: top",
-        "ds-cfg-listen-port: 8080",
-        "cn: HTTP Connection Handler",
-        "ds-cfg-max-blocked-write-time-limit: 2 minutes",
-        "ds-cfg-ssl-client-auth-policy: optional",
-        "ds-cfg-use-tcp-keep-alive: true",
-        "ds-cfg-max-request-size: 5 megabytes",
-        "ds-cfg-use-tcp-no-delay: true",
-        "ds-cfg-allow-tcp-reuse-address: true",
-        "ds-cfg-accept-backlog: 128",
-        "ds-cfg-authentication-required: true",
-        "ds-cfg-buffer-size: 4096 bytes",
-        "ds-cfg-config-file: config/http-config.json",
-        "ds-cfg-listen-address: 0.0.0.0",
-        "ds-cfg-java-class: " +
-          "org.opends.server.protocols.http.HTTPConnectionHandler",
-        "ds-cfg-keep-stats: true",
-        "ds-cfg-ssl-cert-nickname: server-cert",
-        "ds-cfg-use-ssl: false",
-        "ds-cfg-enabled: false"));
-
-    register("2.6.0",
-        addConfigEntry(INFO_UPGRADE_TASK_8832_SUMMARY.get(),
-        "dn: cn=File-Based HTTP Access Logger,cn=Loggers,cn=config",
-        "changetype: add",
-        "objectClass: ds-cfg-file-based-http-access-log-publisher",
-        "objectClass: top",
-        "objectClass: ds-cfg-http-access-log-publisher",
-        "objectClass: ds-cfg-log-publisher",
-        "cn: File-Based HTTP Access Logger",
-        "ds-cfg-java-class: " +
-          "org.opends.server.loggers.TextHTTPAccessLogPublisher",
-        "ds-cfg-asynchronous: true",
-        "ds-cfg-log-file: logs/http-access",
-        "ds-cfg-rotation-policy: " +
-          "cn=24 Hours Time Limit Rotation Policy," +
-          "cn=Log Rotation Policies,cn=config",
-        "ds-cfg-rotation-policy: " +
-          "cn=Size Limit Rotation Policy,cn=Log Rotation Policies,cn=config",
-        "ds-cfg-retention-policy: " +
-          "cn=File Count Retention Policy,cn=Log Retention Policies,cn=config",
-        "ds-cfg-log-file-permissions: 640",
-        "ds-cfg-enabled: false"));
-
-    register("2.6.0",
-        newAttributeTypes(INFO_UPGRADE_TASK_8985_1_SUMMARY.get(),
-        "00-core.ldif", "1.2.840.113549.1.9.1"), // emailAddress
-        modifyConfigEntry(INFO_UPGRADE_TASK_8985_2_SUMMARY.get(),
-        "&(ds-cfg-java-class=org.opends.server.extensions." +
-        "SubjectAttributeToUserAttributeCertificateMapper)" +
-        "(ds-cfg-subject-attribute-mapping=e:mail)",
-        "delete:ds-cfg-subject-attribute-mapping",
-        "ds-cfg-subject-attribute-mapping: e:mail",
-        "-",
-        "add:ds-cfg-subject-attribute-mapping",
-        "ds-cfg-subject-attribute-mapping: emailAddress:mail"));
-
-    /** See OPENDJ-992 */
-    register("2.6.0",
-        regressionInVersion("2.5.0",
-            rebuildIndexesNamed(INFO_UPGRADE_TASK_9013_DESCRIPTION.get(),
-                "ds-sync-hist")));
-
     /* See OPENDJ-1284 */
     register("2.8.0", // userCertificate OID / cACertificate OID
         newAttributeTypes(INFO_UPGRADE_TASK_10133_1_SUMMARY.get(),
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/tools/upgrade/UpgradeTasks.java b/opendj-server-legacy/src/main/java/org/opends/server/tools/upgrade/UpgradeTasks.java
index e219179..2059687 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/tools/upgrade/UpgradeTasks.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/tools/upgrade/UpgradeTasks.java
@@ -830,61 +830,6 @@
   }
 
   /**
-   * Renames the SNMP security config file if it exists. Since 2.5.0.7466 this
-   * file has been renamed.
-   *
-   * @param summary
-   *          The summary of this upgrade task.
-   * @return An upgrade task which renames the old SNMP security config file if
-   *         it exists.
-   */
-  public static UpgradeTask renameSnmpSecurityConfig(final LocalizableMessage summary)
-  {
-    return new AbstractUpgradeTask()
-    {
-      @Override
-      public void perform(final UpgradeContext context) throws ClientException
-      {
-        /*
-         * Snmp config file contains old name in old version(like 2.4.5), in
-         * order to make sure the process will still work after upgrade, we need
-         * to rename it - only if it exists.
-         */
-        final File snmpDir = UpgradeUtils.configSnmpSecurityDirectory;
-        if (snmpDir.exists())
-        {
-          ProgressNotificationCallback pnc = new ProgressNotificationCallback(INFORMATION, summary, 0);
-          try
-          {
-            final File oldSnmpConfig = new File(snmpDir, "opends-snmp.security");
-            if (oldSnmpConfig.exists())
-            {
-              context.notifyProgress(pnc.setProgress(20));
-              logger.debug(summary);
-
-              final File snmpConfig = new File(snmpDir, "opendj-snmp.security");
-              FileManager.rename(oldSnmpConfig, snmpConfig);
-
-              context.notifyProgress(pnc.setProgress(100));
-            }
-          }
-          catch (final Exception ex)
-          {
-            LocalizableMessage msg = ERR_UPGRADE_RENAME_SNMP_SECURITY_CONFIG_FILE.get(ex.getMessage());
-            throw unexpectedException(context, pnc, msg);
-          }
-        }
-      }
-
-      @Override
-      public String toString()
-      {
-        return String.valueOf(summary);
-      }
-    };
-  }
-
-  /**
    * Removes the specified file from the file-system.
    *
    * @param file
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/tools/upgrade/UpgradeUtils.java b/opendj-server-legacy/src/main/java/org/opends/server/tools/upgrade/UpgradeUtils.java
index e6df160..262ca6c 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/tools/upgrade/UpgradeUtils.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/tools/upgrade/UpgradeUtils.java
@@ -78,16 +78,13 @@
   /** The {@code config/schema} folder of the current instance. */
   static final File configSchemaDirectory = new File(configDirectory, SCHEMA_PATH_RELATIVE);
   /** The {@code config/upgrade} folder of the current instance. */
-  static final File configUpgradeDirectory = new File(configDirectory, "upgrade");
+  private static final File configUpgradeDirectory = new File(configDirectory, "upgrade");
   /** The {@code template} folder of the current installation. */
   private static final File templateDirectory = new File(getInstallationPath(), TEMPLATE_RELATIVE_PATH);
   /** The {@code template/config} folder of the current installation. */
   static final File templateConfigDirectory = new File(templateDirectory, CONFIG_PATH_RELATIVE);
   /** The {@code template/config/schema} folder of the current installation. */
   static final File templateConfigSchemaDirectory = new File(templateConfigDirectory, SCHEMA_PATH_RELATIVE);
-  /** The {@code config/snmp/security} folder of the current instance. */
-  static final File configSnmpSecurityDirectory = new File(
-      configDirectory + File.separator + SNMP_PATH_RELATIVE + File.separator + SECURITY_PATH_RELATIVE);
   /** The {@code lib} folder of the current installation. */
   static final File libDirectory = new File(getInstallationPath(), LIB_RELATIVE_PATH);
   /** The {@code bin} folder of the current installation. */

--
Gitblit v1.10.0