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

Violette Roche-Montane
29.43.2014 cf14c43b0ebddab920b3b198434f585e072c7c07
Checkpoint for OPENDJ-1343 Migrate dsconfig
** Dsconfig.java
- Removed FiXMe and unused comment.

** dsconfig.properties
- Fixed typo.

** BuildVersion.java
- gets now the version from the "fullVendorVersion" (RootDSEBackend) instead of the cn=monitor.

** CoreSchema.java
- Added FULL_VENDOR_VERSION_ATTRIBUTE_TYPE.

** RootDSE.java
- Added ATTR_FULL_VENDOR_VERSION.
- Added getFullVendorVersion().
- Modified SEARCH_REQUEST to add the ATTR_FULL_VENDOR_VERSION.
5 files modified
47 ■■■■■ changed files
opendj-config/src/main/java/org/forgerock/opendj/config/dsconfig/BuildVersion.java 9 ●●●● patch | view | raw | blame | history
opendj-config/src/main/java/org/forgerock/opendj/config/dsconfig/DSConfig.java 10 ●●●● patch | view | raw | blame | history
opendj-config/src/main/resources/com/forgerock/opendj/ldap/config.properties 2 ●●● patch | view | raw | blame | history
opendj-core/src/main/java/org/forgerock/opendj/ldap/RootDSE.java 15 ●●●●● patch | view | raw | blame | history
opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/CoreSchema.java 11 ●●●●● patch | view | raw | blame | history
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());
        }
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);
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.
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) {
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}.
     *