From cf14c43b0ebddab920b3b198434f585e072c7c07 Mon Sep 17 00:00:00 2001
From: Violette Roche-Montane <violette.roche-montane@forgerock.com>
Date: Tue, 29 Apr 2014 12:43:51 +0000
Subject: [PATCH] Checkpoint for OPENDJ-1343 Migrate dsconfig ** Dsconfig.java - Removed FiXMe and unused comment.

---
 opendj-config/src/main/java/org/forgerock/opendj/config/dsconfig/DSConfig.java     |   10 +---------
 opendj-core/src/main/java/org/forgerock/opendj/ldap/RootDSE.java                   |   15 +++++++++++++++
 opendj-config/src/main/resources/com/forgerock/opendj/ldap/config.properties       |    2 +-
 opendj-config/src/main/java/org/forgerock/opendj/config/dsconfig/BuildVersion.java |    9 ++-------
 opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/CoreSchema.java         |   11 +++++++++++
 5 files changed, 30 insertions(+), 17 deletions(-)

diff --git a/opendj-config/src/main/java/org/forgerock/opendj/config/dsconfig/BuildVersion.java b/opendj-config/src/main/java/org/forgerock/opendj/config/dsconfig/BuildVersion.java
index cfdc798..0054b12 100644
--- a/opendj-config/src/main/java/org/forgerock/opendj/config/dsconfig/BuildVersion.java
+++ b/opendj-config/src/main/java/org/forgerock/opendj/config/dsconfig/BuildVersion.java
@@ -85,13 +85,8 @@
      */
     public static BuildVersion binaryVersion(final Connection connection) throws ConfigException {
         try {
-            final SearchResultEntry entry = connection.readEntry("cn=Version,cn=monitor", "majorVersion",
-                    "minorVersion", "pointVersion", "revisionNumber");
-            final int eMajor = Integer.valueOf(entry.getAttribute("majorVersion").firstValueAsString());
-            final int eMinor = Integer.valueOf(entry.getAttribute("minorVersion").firstValueAsString());
-            final int ePoint = Integer.valueOf(entry.getAttribute("pointVersion").firstValueAsString());
-            final long eRev = Long.valueOf(entry.getAttribute("revisionNumber").firstValueAsString());
-            return new BuildVersion(eMajor, eMinor, ePoint, eRev);
+            final SearchResultEntry entry = connection.readEntry("", "fullVendorVersion");
+            return valueOf(entry.getAttribute("fullVendorVersion").firstValueAsString());
         } catch (ErrorResultException e) {
             throw new ConfigException(ERR_CONFIGVERSION_NOT_FOUND.get());
         }
diff --git a/opendj-config/src/main/java/org/forgerock/opendj/config/dsconfig/DSConfig.java b/opendj-config/src/main/java/org/forgerock/opendj/config/dsconfig/DSConfig.java
index 5d8faa5..4d0f48c 100644
--- a/opendj-config/src/main/java/org/forgerock/opendj/config/dsconfig/DSConfig.java
+++ b/opendj-config/src/main/java/org/forgerock/opendj/config/dsconfig/DSConfig.java
@@ -293,9 +293,7 @@
     public static int main(String[] args, OutputStream outStream, OutputStream errStream) {
         final DSConfig app = new DSConfig(System.in, outStream, errStream);
         app.sessionStartTime = System.currentTimeMillis();
-        /*
-         * FIXME: obtain path info from system properties.
-         */
+
         if (!ConfigurationFramework.getInstance().isInitialized()) {
             try {
                 ConfigurationFramework.getInstance().initialize();
@@ -613,12 +611,6 @@
             return ReturnCode.CONFLICTING_ARGS.get();
         }
 
-        // Checks the version - if upgrade required, the tool is unusable
-        /*
-         * try { BuildVersion.checkVersionMismatch(); } catch (ConfigException e) { println(e.getMessageObject());
-         * return ReturnCode.ERROR_USER_DATA.get(); }
-         */
-
         // Handle batch file if any
         if (batchFileArgument.isPresent()) {
             handleBatchFile(args);
diff --git a/opendj-config/src/main/resources/com/forgerock/opendj/ldap/config.properties b/opendj-config/src/main/resources/com/forgerock/opendj/ldap/config.properties
index 952acb3..6a77275 100644
--- a/opendj-config/src/main/resources/com/forgerock/opendj/ldap/config.properties
+++ b/opendj-config/src/main/resources/com/forgerock/opendj/ldap/config.properties
@@ -940,4 +940,4 @@
 ERR_BUILDVERSION_NOT_FOUND_737=The version of the installed OpenDJ could not be determined \
 because the version file '%s' could not be found. Restore it from backup before continuing
 ERR_CONFIGVERSION_NOT_FOUND_738=The version of the installed OpenDJ could not be determined \
-because tan error occurs during reading the current configuration.
+because an error occurs during reading the current configuration.
diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/RootDSE.java b/opendj-core/src/main/java/org/forgerock/opendj/ldap/RootDSE.java
index a914081..d970971 100644
--- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/RootDSE.java
+++ b/opendj-core/src/main/java/org/forgerock/opendj/ldap/RootDSE.java
@@ -113,11 +113,15 @@
     private static final AttributeDescription ATTR_VENDOR_VERSION = AttributeDescription
             .create(CoreSchema.getVendorNameAttributeType());
 
+    private static final AttributeDescription ATTR_FULL_VENDOR_VERSION = AttributeDescription
+            .create(CoreSchema.getFullVendorVersionAttributeType());
+
     private static final SearchRequest SEARCH_REQUEST = Requests.newSearchRequest(DN.rootDN(),
             SearchScope.BASE_OBJECT, Filter.objectClassPresent(), ATTR_ALT_SERVER.toString(),
             ATTR_NAMING_CONTEXTS.toString(), ATTR_SUPPORTED_CONTROL.toString(),
             ATTR_SUPPORTED_EXTENSION.toString(), ATTR_SUPPORTED_FEATURE.toString(),
             ATTR_SUPPORTED_LDAP_VERSION.toString(), ATTR_SUPPORTED_SASL_MECHANISMS.toString(),
+            ATTR_FULL_VENDOR_VERSION.toString(),
             ATTR_VENDOR_NAME.toString(), ATTR_VENDOR_VERSION.toString(),
             ATTR_SUPPORTED_AUTH_PASSWORD_SCHEMES.toString(), ATTR_SUBSCHEMA_SUBENTRY.toString(),
             "*");
@@ -405,6 +409,17 @@
         return getSingleValuedAttribute(ATTR_VENDOR_VERSION, Functions.byteStringToString());
     }
 
+    /**
+     * Returns a string which represents the full version of the Directory Server
+     * implementation.
+     *
+     * @return The full version of the Directory Server implementation, or
+     *         {@code null} if the vendor version is not provided.
+     */
+    public String getFullVendorVersion() {
+        return getSingleValuedAttribute(ATTR_FULL_VENDOR_VERSION, Functions.byteStringToString());
+    }
+
     private <N> Collection<N> getMultiValuedAttribute(
             final AttributeDescription attributeDescription,
             final Function<ByteString, N, Void> function) {
diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/CoreSchema.java b/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/CoreSchema.java
index 007bad9..53f4bce 100644
--- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/CoreSchema.java
+++ b/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/CoreSchema.java
@@ -266,6 +266,8 @@
         = CoreSchemaImpl.getInstance().getAttributeType("1.3.6.1.1.16.4");
     private static final AttributeType FACSIMILE_TELEPHONE_NUMBER_ATTRIBUTE_TYPE
         = CoreSchemaImpl.getInstance().getAttributeType("2.5.4.23");
+    private static final AttributeType FULL_VENDOR_VERSION_ATTRIBUTE_TYPE
+        = CoreSchemaImpl.getInstance().getAttributeType("1.3.6.1.4.1.36733.2.1.1.136");
     private static final AttributeType GENERATION_QUALIFIER_ATTRIBUTE_TYPE
         = CoreSchemaImpl.getInstance().getAttributeType("2.5.4.44");
     private static final AttributeType GIVEN_NAME_ATTRIBUTE_TYPE
@@ -610,6 +612,15 @@
     }
 
     /**
+     * Returns a reference to the {@code Full Vendor Version} which has the OID {@code 1.3.6.1.4.1.36733.2.1.1.136}.
+     *
+     * @return A reference to the {@code Full Vendor Version}.
+     */
+    public static AttributeType getFullVendorVersionAttributeType() {
+        return FULL_VENDOR_VERSION_ATTRIBUTE_TYPE;
+    }
+
+    /**
      * Returns a reference to the {@code Generalized Time Syntax} which has the OID
      * {@code 1.3.6.1.4.1.1466.115.121.1.24}.
      *

--
Gitblit v1.10.0