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.
| | |
| | | */ |
| | | 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()); |
| | | } |
| | |
| | | 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(); |
| | |
| | | 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); |
| | |
| | | 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. |
| | |
| | | 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(), |
| | | "*"); |
| | |
| | | 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) { |
| | |
| | | = 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 |
| | |
| | | } |
| | | |
| | | /** |
| | | * 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}. |
| | | * |