ConfigureDS.java revision 7c02aa90fad0f4eaf27856ad1afcf2ffd90b64fc
325N/A * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
325N/A * file and include the License file at legal-notices/CDDLv1_0.txt.
public class ConfigureDS
private static final boolean WRONG_USAGE = true;
private final int returnedErrorCode;
private final boolean wrongUsage;
final boolean showUsage)
super(parentException);
return errorMessage;
private boolean isWrongUsage()
return wrongUsage;
private int getErrorCode()
return returnedErrorCode;
private static final String JCKES_TRUST_MANAGER_DN = "cn=JCEKS,cn=Trust Manager Providers,cn=config";
public static final String DN_LDAP_CONNECTION_HANDLER = "cn=LDAP Connection Handler," + DN_CONNHANDLER_BASE;
private static final String DN_LDAPS_CONNECTION_HANDLER = "cn=LDAPS Connection Handler," + DN_CONNHANDLER_BASE;
private static final String DN_JMX_CONNECTION_HANDLER = "cn=JMX Connection Handler," + DN_CONNHANDLER_BASE;
public static final String DN_DIGEST_MD5_SASL_MECHANISM = "cn=DIGEST-MD5,cn=SASL Mechanisms,cn=config";
private static final class DefaultIndex
private final boolean shouldCreateSubstringIndex;
public static int configMain(final String[] args, final OutputStream outStream, final OutputStream errStream)
private ConfigureDS(final String[] args, final OutputStream outStream, final OutputStream errStream)
private int run()
return SUCCESS;
checkManagerProvider(keyManagerProviderDN, JCKES_KEY_MANAGER_DN, JCKES_KEY_MANAGER_LDIF_ENTRY, true);
checkManagerProvider(trustManagerProviderDN, JCKES_TRUST_MANAGER_DN, JCKES_TRUST_MANAGER_LDIF_ENTRY, false);
return SUCCESS;
catch (final ConfigureDSException e)
if (e.isWrongUsage())
return e.getErrorCode();
catch (final Exception e)
4444, "adminConnectorPort", true, 1, true, 65535, INFO_INSTALLDS_DESCRIPTION_ADMINCONNECTORPORT.get());
CliConstants.DEFAULT_JMX_PORT, null, true, 1, true, 65535, INFO_CONFIGDS_DESCRIPTION_JMX_PORT.get());
return SUCCESS;
throw new ConfigureDSException(ERR_CONFIGDS_PORT_ALREADY_SPECIFIED.get(portArg.getIntValue()), WRONG_USAGE);
} catch (final InitializationException e) {
catch (final Exception e)
final LocalizableMessage msg = ERR_CONFIGDS_CANNOT_INITIALIZE_JMX.get(configFile.getValue(), e.getMessage());
catch (final Exception e)
final LocalizableMessage msg = ERR_CONFIGDS_CANNOT_INITIALIZE_CONFIG.get(configFile.getValue(), e.getMessage());
catch (final Exception e)
final LocalizableMessage msg = ERR_CONFIGDS_CANNOT_INITIALIZE_SCHEMA.get(configFile.getValue(), e.getMessage());
throw new ConfigureDSException(ERR_CONFIGDS_CANNOT_ACQUIRE_SERVER_LOCK.get(serverLockFileName, failureReason));
catch (final Exception e)
return baseDNs;
return rootDN;
return rootPW;
catch (final Exception e)
final LocalizableMessage message = isKeyManager ? ERR_CONFIG_KEYMANAGER_CANNOT_CREATE_JCEKS_PROVIDER.get(e)
catch (final Exception e)
private void updateBaseDNs(final List<org.forgerock.opendj.ldap.DN> baseDNs) throws ConfigureDSException
final ManagedObjectDefinition<?, ?> backend = InstallDS.retrieveBackendTypeFromName(backendTypeName);
throw new ConfigureDSException(
final ManagementContext context = LDAPManagementContext.newManagementContext(co, LDAPProfile.getInstance());
catch (final Exception e)
private void createBackend(final RootCfgClient rootConfiguration, final List<org.forgerock.opendj.ldap.DN> baseDNs,
final ConfigEntry configEntry = configHandler.getConfigEntry(DN.valueOf(DN_LDAP_CONNECTION_HANDLER));
catch (final Exception e)
catch (final Exception e)
final ConfigEntry configEntry = configHandler.getConfigEntry(DN.valueOf(DN_LDAPS_CONNECTION_HANDLER));
catch (final Exception e)
final ConfigEntry configEntry = configHandler.getConfigEntry(DN.valueOf(DN_JMX_CONNECTION_HANDLER));
catch (final Exception e)
final ConfigEntry configEntry = configHandler.getConfigEntry(DN.valueOf(DN_LDAP_CONNECTION_HANDLER));
catch (final Exception e)
final ConfigEntry configEntry = configHandler.getConfigEntry(DN.valueOf(keyManagerProviderDN.getValue()));
catch (final Exception e)
final ConfigEntry configEntry = configHandler.getConfigEntry(DN.valueOf(keyManagerProviderDN.getValue()));
catch (final Exception e)
throws ConfigureDSException
catch (final Exception e)
final ConfigEntry configEntry = configHandler.getConfigEntry(DN.valueOf(trustManagerProviderDN.getValue()));
catch (final Exception e)
private void putTrustManagerAttribute(final Argument arg, final String attributeDN) throws ConfigureDSException
catch (final Exception e)
catch (final Exception e)
catch (final Exception e)
false, true, false, rootDN);
catch (final Exception e)
final ConfigEntry configEntry = configHandler.getConfigEntry(DN.valueOf(DN_DIGEST_MD5_SASL_MECHANISM));
catch (final Exception e)
final StringPropertyDefinition prop = cryptoManager.getKeyWrappingTransformationPropertyDefinition();
if (p instanceof DefinedDefaultBehaviorProvider)
false, false, true, alternativeCipher);
catch (final Exception e)
throw new ConfigureDSException(de, ERR_CONFIGDS_CANNOT_WRITE_UPDATED_CONFIG.get(de.getMessageObject()));
catch (final Throwable t)
return alternativeCipher;