| | |
| | | * Portions Copyright 2006-2007 Sun Microsystems, Inc. |
| | | */ |
| | | package org.opends.server.tools; |
| | | import org.opends.messages.Message; |
| | | |
| | | |
| | | |
| | |
| | | import org.opends.server.util.args.StringArgument; |
| | | |
| | | import static org.opends.server.config.ConfigConstants.*; |
| | | import static org.opends.server.messages.ConfigMessages.*; |
| | | import static org.opends.server.messages.ExtensionsMessages.*; |
| | | import static org.opends.server.messages.MessageHandler.*; |
| | | import static org.opends.server.messages.ProtocolMessages.*; |
| | | import static org.opends.server.messages.ToolMessages.*; |
| | | import static org.opends.messages.ConfigMessages.*; |
| | | import static org.opends.messages.ExtensionMessages.*; |
| | | import static org.opends.messages.ProtocolMessages.*; |
| | | import static org.opends.messages.ToolMessages.*; |
| | | import static org.opends.server.util.ServerConstants.*; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | import static org.opends.server.tools.ToolConstants.*; |
| | |
| | | StringArgument certNickName; |
| | | StringArgument keyManagerPath; |
| | | |
| | | String toolDescription = getMessage(MSGID_CONFIGDS_TOOL_DESCRIPTION); |
| | | Message toolDescription = INFO_CONFIGDS_TOOL_DESCRIPTION.get(); |
| | | ArgumentParser argParser = new ArgumentParser(CLASS_NAME, toolDescription, |
| | | false); |
| | | try |
| | | { |
| | | configFile = new StringArgument("configfile", 'c', "configFile", true, |
| | | false, true, "{configFile}", null, null, |
| | | MSGID_DESCRIPTION_CONFIG_FILE); |
| | | INFO_DESCRIPTION_CONFIG_FILE.get()); |
| | | configFile.setHidden(true); |
| | | argParser.addArgument(configFile); |
| | | |
| | |
| | | OPTION_LONG_CONFIG_CLASS, false, |
| | | false, true, OPTION_VALUE_CONFIG_CLASS, |
| | | ConfigFileHandler.class.getName(), null, |
| | | MSGID_DESCRIPTION_CONFIG_CLASS); |
| | | INFO_DESCRIPTION_CONFIG_CLASS.get()); |
| | | configClass.setHidden(true); |
| | | argParser.addArgument(configClass); |
| | | |
| | |
| | | "ldapPort", false, false, |
| | | true, "{ldapPort}", 389, null, true, 1, |
| | | true, 65535, |
| | | MSGID_CONFIGDS_DESCRIPTION_LDAP_PORT); |
| | | INFO_CONFIGDS_DESCRIPTION_LDAP_PORT.get()); |
| | | argParser.addArgument(ldapPort); |
| | | |
| | | ldapsPort = new IntegerArgument("ldapsPort", 'P', "ldapsPort", false, |
| | | false, true, "{ldapPort}", 636, null, true, 1, true, 65535, |
| | | MSGID_CONFIGDS_DESCRIPTION_LDAPS_PORT); |
| | | INFO_CONFIGDS_DESCRIPTION_LDAPS_PORT.get()); |
| | | argParser.addArgument(ldapsPort); |
| | | |
| | | enableStartTLS = new BooleanArgument("enableStartTLS", |
| | | OPTION_SHORT_START_TLS, "enableStartTLS", |
| | | MSGID_CONFIGDS_DESCRIPTION_ENABLE_START_TLS); |
| | | INFO_CONFIGDS_DESCRIPTION_ENABLE_START_TLS.get()); |
| | | argParser.addArgument(enableStartTLS); |
| | | |
| | | jmxPort = new IntegerArgument("jmxport", 'x', "jmxPort", false, false, |
| | | true, "{jmxPort}", SetupUtils.getDefaultJMXPort(), null, true, 1, |
| | | true, 65535, |
| | | MSGID_CONFIGDS_DESCRIPTION_JMX_PORT); |
| | | INFO_CONFIGDS_DESCRIPTION_JMX_PORT.get()); |
| | | argParser.addArgument(jmxPort); |
| | | |
| | | keyManagerProviderDN = new StringArgument("keymanagerproviderdn", |
| | |
| | | true, "{keyManagerProviderDN}", |
| | | null, |
| | | null, |
| | | MSGID_CONFIGDS_DESCRIPTION_KEYMANAGER_PROVIDER_DN); |
| | | INFO_CONFIGDS_DESCRIPTION_KEYMANAGER_PROVIDER_DN.get()); |
| | | argParser.addArgument(keyManagerProviderDN); |
| | | |
| | | trustManagerProviderDN = new StringArgument("trustmanagerproviderdn", |
| | |
| | | true, "{trustManagerProviderDN}", |
| | | null, |
| | | null, |
| | | MSGID_CONFIGDS_DESCRIPTION_TRUSTMANAGER_PROVIDER_DN); |
| | | INFO_CONFIGDS_DESCRIPTION_TRUSTMANAGER_PROVIDER_DN.get()); |
| | | argParser.addArgument(trustManagerProviderDN); |
| | | |
| | | keyManagerPath = new StringArgument("keymanagerpath", |
| | |
| | | "{keyManagerPath}", |
| | | null, |
| | | null, |
| | | MSGID_CONFIGDS_DESCRIPTION_KEYMANAGER_PATH); |
| | | INFO_CONFIGDS_DESCRIPTION_KEYMANAGER_PATH.get()); |
| | | argParser.addArgument(keyManagerPath); |
| | | |
| | | certNickName = new StringArgument("certnickname", |
| | |
| | | true, "{certNickName}", |
| | | null, |
| | | null, |
| | | MSGID_CONFIGDS_DESCRIPTION_CERTNICKNAME); |
| | | INFO_CONFIGDS_DESCRIPTION_CERTNICKNAME.get()); |
| | | argParser.addArgument(certNickName); |
| | | |
| | | baseDNString = new StringArgument("basedn", OPTION_SHORT_BASEDN, |
| | | OPTION_LONG_BASEDN, false, true, |
| | | true, OPTION_VALUE_BASEDN, |
| | | "dc=example,dc=com", |
| | | null, |
| | | MSGID_CONFIGDS_DESCRIPTION_BASE_DN); |
| | | baseDNString = new StringArgument( |
| | | "basedn", OPTION_SHORT_BASEDN, |
| | | OPTION_LONG_BASEDN, false, true, |
| | | true, OPTION_VALUE_BASEDN, |
| | | "dc=example,dc=com", |
| | | null, |
| | | INFO_CONFIGDS_DESCRIPTION_BASE_DN.get()); |
| | | argParser.addArgument(baseDNString); |
| | | |
| | | rootDNString = new StringArgument("rootdn", OPTION_SHORT_ROOT_USER_DN, |
| | | OPTION_LONG_ROOT_USER_DN, false, false, |
| | | true, OPTION_VALUE_ROOT_USER_DN, |
| | | "cn=Directory Manager", null, |
| | | MSGID_CONFIGDS_DESCRIPTION_ROOT_DN); |
| | | rootDNString = new StringArgument( |
| | | "rootdn", OPTION_SHORT_ROOT_USER_DN, |
| | | OPTION_LONG_ROOT_USER_DN, false, false, |
| | | true, OPTION_VALUE_ROOT_USER_DN, |
| | | "cn=Directory Manager", null, |
| | | INFO_CONFIGDS_DESCRIPTION_ROOT_DN.get()); |
| | | argParser.addArgument(rootDNString); |
| | | |
| | | rootPassword = new StringArgument("rootpw", OPTION_SHORT_BINDPWD, |
| | | "rootPassword", false, |
| | | false, true, "{rootUserPW}", null, null, |
| | | MSGID_CONFIGDS_DESCRIPTION_ROOT_PW); |
| | | rootPassword = new StringArgument( |
| | | "rootpw", OPTION_SHORT_BINDPWD, |
| | | "rootPassword", false, |
| | | false, true, "{rootUserPW}", null, null, |
| | | INFO_CONFIGDS_DESCRIPTION_ROOT_PW.get()); |
| | | argParser.addArgument(rootPassword); |
| | | |
| | | rootPasswordFile = new FileBasedArgument("rootpwfile", |
| | | OPTION_SHORT_BINDPWD_FILE, |
| | | "rootPasswordFile", false, false, |
| | | "{filename}", null, null, |
| | | MSGID_CONFIGDS_DESCRIPTION_ROOT_PW_FILE); |
| | | rootPasswordFile = new FileBasedArgument( |
| | | "rootpwfile", |
| | | OPTION_SHORT_BINDPWD_FILE, |
| | | "rootPasswordFile", false, false, |
| | | "{filename}", null, null, |
| | | INFO_CONFIGDS_DESCRIPTION_ROOT_PW_FILE.get()); |
| | | argParser.addArgument(rootPasswordFile); |
| | | |
| | | showUsage = new BooleanArgument("showusage", OPTION_SHORT_HELP, |
| | | OPTION_LONG_HELP, |
| | | MSGID_DESCRIPTION_USAGE); |
| | | INFO_DESCRIPTION_USAGE.get()); |
| | | argParser.addArgument(showUsage); |
| | | argParser.setUsageArgument(showUsage); |
| | | } |
| | | catch (ArgumentException ae) |
| | | { |
| | | int msgID = MSGID_CANNOT_INITIALIZE_ARGS; |
| | | String message = getMessage(msgID, ae.getMessage()); |
| | | Message message = ERR_CANNOT_INITIALIZE_ARGS.get(ae.getMessage()); |
| | | System.err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | | return 1; |
| | | } |
| | |
| | | } |
| | | catch (ArgumentException ae) |
| | | { |
| | | int msgID = MSGID_ERROR_PARSING_ARGS; |
| | | String message = getMessage(msgID, ae.getMessage()); |
| | | Message message = ERR_ERROR_PARSING_ARGS.get(ae.getMessage()); |
| | | |
| | | System.err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | | System.err.println(argParser.getUsage()); |
| | |
| | | if (! (baseDNString.isPresent() || ldapPort.isPresent() || |
| | | jmxPort.isPresent() || rootDNString.isPresent())) |
| | | { |
| | | int msgID = MSGID_CONFIGDS_NO_CONFIG_CHANGES; |
| | | String message = getMessage(msgID); |
| | | Message message = ERR_CONFIGDS_NO_CONFIG_CHANGES.get(); |
| | | System.err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | | System.err.println(argParser.getUsage()); |
| | | return 1; |
| | |
| | | { |
| | | if (ports.contains(ldapsPort.getIntValue())) |
| | | { |
| | | int msgID = MSGID_CONFIGDS_PORT_ALREADY_SPECIFIED; |
| | | String message = getMessage(msgID, |
| | | String.valueOf(ldapsPort.getIntValue())); |
| | | Message message = ERR_CONFIGDS_PORT_ALREADY_SPECIFIED.get( |
| | | String.valueOf(ldapsPort.getIntValue())); |
| | | System.err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | | System.err.println(argParser.getUsage()); |
| | | return 1; |
| | |
| | | { |
| | | if (ports.contains(jmxPort.getIntValue())) |
| | | { |
| | | int msgID = MSGID_CONFIGDS_PORT_ALREADY_SPECIFIED; |
| | | String message = getMessage(msgID, |
| | | String.valueOf(jmxPort.getIntValue())); |
| | | Message message = ERR_CONFIGDS_PORT_ALREADY_SPECIFIED.get( |
| | | String.valueOf(jmxPort.getIntValue())); |
| | | System.err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | | System.err.println(argParser.getUsage()); |
| | | return 1; |
| | |
| | | } |
| | | catch (ArgumentException ae) |
| | | { |
| | | int msgID = MSGID_CANNOT_INITIALIZE_ARGS; |
| | | String message = getMessage(msgID, ae.getMessage()); |
| | | Message message = ERR_CANNOT_INITIALIZE_ARGS.get(ae.getMessage()); |
| | | System.err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | | return 1; |
| | | } |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | int msgID = MSGID_CONFIGDS_CANNOT_INITIALIZE_JMX; |
| | | String message = getMessage(msgID, |
| | | String.valueOf(configFile.getValue()), |
| | | e.getMessage()); |
| | | Message message = ERR_CONFIGDS_CANNOT_INITIALIZE_JMX.get( |
| | | String.valueOf(configFile.getValue()), |
| | | e.getMessage()); |
| | | System.err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | | return 1; |
| | | } |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | int msgID = MSGID_CONFIGDS_CANNOT_INITIALIZE_CONFIG; |
| | | String message = getMessage(msgID, |
| | | String.valueOf(configFile.getValue()), |
| | | e.getMessage()); |
| | | Message message = ERR_CONFIGDS_CANNOT_INITIALIZE_CONFIG.get( |
| | | String.valueOf(configFile.getValue()), |
| | | e.getMessage()); |
| | | System.err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | | return 1; |
| | | } |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | int msgID = MSGID_CONFIGDS_CANNOT_INITIALIZE_SCHEMA; |
| | | String message = getMessage(msgID, |
| | | String.valueOf(configFile.getValue()), |
| | | e.getMessage()); |
| | | Message message = ERR_CONFIGDS_CANNOT_INITIALIZE_SCHEMA.get( |
| | | String.valueOf(configFile.getValue()), |
| | | e.getMessage()); |
| | | System.err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | | return 1; |
| | | } |
| | |
| | | if (! LockFileManager.acquireExclusiveLock(serverLockFileName, |
| | | failureReason)) |
| | | { |
| | | int msgID = MSGID_CONFIGDS_CANNOT_ACQUIRE_SERVER_LOCK; |
| | | String message = getMessage(msgID, String.valueOf(serverLockFileName), |
| | | String.valueOf(failureReason)); |
| | | Message message = ERR_CONFIGDS_CANNOT_ACQUIRE_SERVER_LOCK.get( |
| | | String.valueOf(serverLockFileName), |
| | | String.valueOf(failureReason)); |
| | | System.err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | | return 1; |
| | | } |
| | |
| | | } |
| | | catch (DirectoryException de) |
| | | { |
| | | int msgID = MSGID_CONFIGDS_CANNOT_PARSE_BASE_DN; |
| | | String message = getMessage(msgID, String.valueOf(dnString), |
| | | de.getErrorMessage()); |
| | | Message message = ERR_CONFIGDS_CANNOT_PARSE_BASE_DN.get( |
| | | String.valueOf(dnString), |
| | | de.getMessageObject()); |
| | | System.err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | | return 1; |
| | | } |
| | |
| | | } |
| | | catch (DirectoryException de) |
| | | { |
| | | int msgID = MSGID_CONFIGDS_CANNOT_PARSE_ROOT_DN; |
| | | String message = getMessage(msgID, |
| | | String.valueOf(rootDNString.getValue()), |
| | | de.getErrorMessage()); |
| | | Message message = ERR_CONFIGDS_CANNOT_PARSE_ROOT_DN.get( |
| | | String.valueOf(rootDNString.getValue()), |
| | | de.getMessageObject()); |
| | | System.err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | | return 1; |
| | | } |
| | |
| | | } |
| | | else |
| | | { |
| | | int msgID = MSGID_CONFIGDS_NO_ROOT_PW; |
| | | String message = getMessage(msgID); |
| | | Message message = ERR_CONFIGDS_NO_ROOT_PW.get(); |
| | | System.err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | | return 1; |
| | | } |
| | |
| | | } |
| | | catch (DirectoryException de) |
| | | { |
| | | int msgID = MSGID_CONFIGDS_CANNOT_PARSE_KEYMANAGER_PROVIDER_DN; |
| | | String message = getMessage(msgID, |
| | | keyManagerProviderDN.getValue(), |
| | | de.getErrorMessage()); |
| | | Message message = |
| | | ERR_CONFIGDS_CANNOT_PARSE_KEYMANAGER_PROVIDER_DN.get( |
| | | keyManagerProviderDN.getValue(), |
| | | de.getMessageObject()); |
| | | System.err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | | return 1; |
| | | } |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | int msgID = MSGID_CONFIG_KEYMANAGER_CANNOT_GET_BASE; |
| | | String message = getMessage(msgID, |
| | | keyManagerProviderDN.getValue(), |
| | | Message message = ERR_CONFIG_KEYMANAGER_CANNOT_GET_BASE.get( |
| | | String.valueOf(e)); |
| | | System.err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | | return 1; |
| | |
| | | } |
| | | catch (DirectoryException de) |
| | | { |
| | | int msgID = MSGID_CONFIGDS_CANNOT_PARSE_TRUSTMANAGER_PROVIDER_DN; |
| | | String message = getMessage(msgID, |
| | | trustManagerProviderDN.getValue(), |
| | | de.getErrorMessage()); |
| | | Message message = ERR_CONFIGDS_CANNOT_PARSE_TRUSTMANAGER_PROVIDER_DN. |
| | | get(trustManagerProviderDN.getValue(), de.getMessageObject()); |
| | | System.err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | | return 1; |
| | | } |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | int msgID = MSGID_CONFIG_TRUSTMANAGER_CANNOT_GET_BASE; |
| | | String message = getMessage(msgID, |
| | | trustManagerProviderDN.getValue(), |
| | | String.valueOf(e)); |
| | | Message message = ERR_CONFIG_TRUSTMANAGER_CANNOT_GET_BASE.get( |
| | | String.valueOf(e)); |
| | | System.err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | | return 1; |
| | | } |
| | |
| | | { |
| | | if (!keyManagerProviderDN.isPresent()) |
| | | { |
| | | int msgID = MSGID_CONFIGDS_KEYMANAGER_PROVIDER_DN_REQUIRED; |
| | | String message = getMessage(msgID, |
| | | keyManagerProviderDN.getLongIdentifier(), |
| | | Message message = ERR_CONFIGDS_KEYMANAGER_PROVIDER_DN_REQUIRED.get( |
| | | keyManagerProviderDN.getLongIdentifier(), |
| | | keyManagerPath.getLongIdentifier()); |
| | | System.err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | | return 1; |
| | |
| | | DN jeBackendDN = DN.decode(DN_JE_BACKEND); |
| | | ConfigEntry configEntry = configHandler.getConfigEntry(jeBackendDN); |
| | | |
| | | int msgID = MSGID_CONFIG_BACKEND_ATTR_DESCRIPTION_BASE_DNS; |
| | | DNConfigAttribute baseDNAttr = |
| | | new DNConfigAttribute(ATTR_BACKEND_BASE_DN, getMessage(msgID), |
| | | new DNConfigAttribute( |
| | | ATTR_BACKEND_BASE_DN, |
| | | INFO_CONFIG_BACKEND_ATTR_DESCRIPTION_BASE_DNS.get(), |
| | | true, true, false, baseDNs); |
| | | configEntry.putConfigAttribute(baseDNAttr); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | int msgID = MSGID_CONFIGDS_CANNOT_UPDATE_BASE_DN; |
| | | String message = getMessage(msgID, String.valueOf(e)); |
| | | Message message = ERR_CONFIGDS_CANNOT_UPDATE_BASE_DN.get( |
| | | String.valueOf(e)); |
| | | System.err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | | return 1; |
| | | } |
| | |
| | | ConfigEntry configEntry = |
| | | configHandler.getConfigEntry(ldapListenerDN); |
| | | |
| | | int msgID = MSGID_LDAP_CONNHANDLER_DESCRIPTION_LISTEN_PORT; |
| | | |
| | | IntegerConfigAttribute portAttr = |
| | | new IntegerConfigAttribute(ATTR_LISTEN_PORT, getMessage(msgID), |
| | | new IntegerConfigAttribute(ATTR_LISTEN_PORT, |
| | | INFO_LDAP_CONNHANDLER_DESCRIPTION_LISTEN_PORT.get(), |
| | | true, false, true, true, 1, true, |
| | | 65535, ldapPort.getIntValue()); |
| | | configEntry.putConfigAttribute(portAttr); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | int msgID = MSGID_CONFIGDS_CANNOT_UPDATE_LDAP_PORT; |
| | | String message = getMessage(msgID, String.valueOf(e)); |
| | | Message message = ERR_CONFIGDS_CANNOT_UPDATE_LDAP_PORT.get( |
| | | String.valueOf(e)); |
| | | System.err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | | return 1; |
| | | } |
| | |
| | | ConfigEntry configEntry = |
| | | configHandler.getConfigEntry(ldapListenerDN); |
| | | |
| | | int msgID = MSGID_LDAP_CONNHANDLER_DESCRIPTION_LISTEN_PORT; |
| | | |
| | | IntegerConfigAttribute portAttr = |
| | | new IntegerConfigAttribute(ATTR_LISTEN_PORT, getMessage(msgID), |
| | | new IntegerConfigAttribute(ATTR_LISTEN_PORT, |
| | | INFO_LDAP_CONNHANDLER_DESCRIPTION_LISTEN_PORT.get(), |
| | | true, false, true, true, 1, true, |
| | | 65535, ldapsPort.getIntValue()); |
| | | configEntry.putConfigAttribute(portAttr); |
| | | msgID = MSGID_LDAPS_CONNHANDLER_DESCRIPTION_ENABLE; |
| | | |
| | | BooleanConfigAttribute enablePortAttr = |
| | | new BooleanConfigAttribute(ATTR_CONNECTION_HANDLER_ENABLED, |
| | | getMessage(msgID), true, true, true); |
| | | INFO_LDAPS_CONNHANDLER_DESCRIPTION_ENABLE.get(), |
| | | true, true, true); |
| | | configEntry.putConfigAttribute(enablePortAttr); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | int msgID = MSGID_CONFIGDS_CANNOT_UPDATE_LDAPS_PORT; |
| | | String message = getMessage(msgID, String.valueOf(e)); |
| | | Message message = ERR_CONFIGDS_CANNOT_UPDATE_LDAPS_PORT.get( |
| | | String.valueOf(e)); |
| | | System.err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | | return 1; |
| | | } |
| | |
| | | ConfigEntry configEntry = |
| | | configHandler.getConfigEntry(jmxListenerDN); |
| | | |
| | | int msgID = MSGID_JMX_CONNHANDLER_DESCRIPTION_LISTEN_PORT; |
| | | IntegerConfigAttribute portAttr = |
| | | new IntegerConfigAttribute(ATTR_LISTEN_PORT, getMessage(msgID), |
| | | true, false, true, true, 1, true, |
| | | 65535, jmxPort.getIntValue()); |
| | | new IntegerConfigAttribute( |
| | | ATTR_LISTEN_PORT, |
| | | INFO_JMX_CONNHANDLER_DESCRIPTION_LISTEN_PORT.get(), |
| | | true, false, true, true, 1, true, |
| | | 65535, jmxPort.getIntValue()); |
| | | configEntry.putConfigAttribute(portAttr); |
| | | msgID = MSGID_JMX_CONNHANDLER_DESCRIPTION_ENABLE; |
| | | |
| | | BooleanConfigAttribute enablePortAttr = |
| | | new BooleanConfigAttribute(ATTR_CONNECTION_HANDLER_ENABLED, |
| | | getMessage(msgID), true, true, true); |
| | | INFO_JMX_CONNHANDLER_DESCRIPTION_ENABLE.get(), |
| | | true, true, true); |
| | | configEntry.putConfigAttribute(enablePortAttr); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | int msgID = MSGID_CONFIGDS_CANNOT_UPDATE_JMX_PORT; |
| | | String message = getMessage(msgID, String.valueOf(e)); |
| | | Message message = ERR_CONFIGDS_CANNOT_UPDATE_JMX_PORT.get( |
| | | String.valueOf(e)); |
| | | System.err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | | return 1; |
| | | } |
| | |
| | | ConfigEntry configEntry = |
| | | configHandler.getConfigEntry(ldapListenerDN); |
| | | |
| | | int msgID = MSGID_LDAP_CONNHANDLER_DESCRIPTION_ALLOW_STARTTLS; |
| | | |
| | | BooleanConfigAttribute startTLS = |
| | | new BooleanConfigAttribute(ATTR_ALLOW_STARTTLS, |
| | | getMessage(msgID), true, true, true); |
| | | INFO_LDAP_CONNHANDLER_DESCRIPTION_ALLOW_STARTTLS.get(), |
| | | true, true, true); |
| | | configEntry.putConfigAttribute(startTLS); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | int msgID = MSGID_CONFIGDS_CANNOT_ENABLE_STARTTLS; |
| | | String message = getMessage(msgID, String.valueOf(e)); |
| | | Message message = ERR_CONFIGDS_CANNOT_ENABLE_STARTTLS.get( |
| | | String.valueOf(e)); |
| | | System.err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | | return 1; |
| | | } |
| | |
| | | DN dn = DN.decode(keyManagerProviderDN.getValue()); |
| | | ConfigEntry configEntry = configHandler.getConfigEntry(dn); |
| | | |
| | | int msgID = MSGID_CONFIG_KEYMANAGER_DESCRIPTION_ENABLED; |
| | | BooleanConfigAttribute enableAttr = |
| | | new BooleanConfigAttribute(ATTR_KEYMANAGER_ENABLED, |
| | | getMessage(msgID), true, true, true); |
| | | INFO_CONFIG_KEYMANAGER_DESCRIPTION_ENABLED.get(), |
| | | true, true, true); |
| | | configEntry.putConfigAttribute(enableAttr); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | int msgID = MSGID_CONFIGDS_CANNOT_ENABLE_KEYMANAGER; |
| | | String message = getMessage(msgID, String.valueOf(e)); |
| | | Message message = ERR_CONFIGDS_CANNOT_ENABLE_KEYMANAGER.get( |
| | | String.valueOf(e)); |
| | | System.err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | | return 1; |
| | | } |
| | |
| | | ConfigEntry configEntry = |
| | | configHandler.getConfigEntry(ldapListenerDN); |
| | | |
| | | int msgID = MSGID_LDAP_CONNHANDLER_DESCRIPTION_KEYMANAGER_DN; |
| | | StringConfigAttribute keyManagerProviderAttr = |
| | | new StringConfigAttribute(ATTR_KEYMANAGER_DN, getMessage(msgID), |
| | | new StringConfigAttribute(ATTR_KEYMANAGER_DN, |
| | | INFO_LDAP_CONNHANDLER_DESCRIPTION_KEYMANAGER_DN.get(), |
| | | false, false, true, keyManagerProviderDN.getValue()); |
| | | configEntry.putConfigAttribute(keyManagerProviderAttr); |
| | | } |
| | |
| | | ConfigEntry configEntry = |
| | | configHandler.getConfigEntry(ldapsListenerDN); |
| | | |
| | | int msgID = MSGID_LDAP_CONNHANDLER_DESCRIPTION_KEYMANAGER_DN; |
| | | StringConfigAttribute keyManagerProviderAttr = |
| | | new StringConfigAttribute(ATTR_KEYMANAGER_DN, |
| | | getMessage(msgID), false, false, |
| | | INFO_LDAP_CONNHANDLER_DESCRIPTION_KEYMANAGER_DN.get(), |
| | | false, false, |
| | | true, keyManagerProviderDN.getValue()); |
| | | configEntry.putConfigAttribute(keyManagerProviderAttr); |
| | | } |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | int msgID = MSGID_CONFIGDS_CANNOT_UPDATE_KEYMANAGER_REFERENCE; |
| | | String message = getMessage(msgID, String.valueOf(e)); |
| | | Message message = ERR_CONFIGDS_CANNOT_UPDATE_KEYMANAGER_REFERENCE.get( |
| | | String.valueOf(e)); |
| | | System.err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | | return 1; |
| | | } |
| | |
| | | DN dn = DN.decode(keyManagerProviderDN.getValue()); |
| | | ConfigEntry configEntry = configHandler.getConfigEntry(dn); |
| | | |
| | | int msgID = MSGID_FILE_KEYMANAGER_DESCRIPTION_FILE; |
| | | StringConfigAttribute pathAttr = |
| | | new StringConfigAttribute(ATTR_KEYSTORE_FILE, |
| | | getMessage(msgID), true, true, true, |
| | | INFO_FILE_KEYMANAGER_DESCRIPTION_FILE.get(), true, true, true, |
| | | keyManagerPath.getValue()); |
| | | configEntry.putConfigAttribute(pathAttr); |
| | | } |
| | |
| | | DN dn = DN.decode(trustManagerProviderDN.getValue()); |
| | | ConfigEntry configEntry = configHandler.getConfigEntry(dn); |
| | | |
| | | int msgID = MSGID_CONFIG_TRUSTMANAGER_DESCRIPTION_ENABLED; |
| | | BooleanConfigAttribute enableAttr = |
| | | new BooleanConfigAttribute(ATTR_TRUSTMANAGER_ENABLED, |
| | | getMessage(msgID), true, true, true); |
| | | ERR_CONFIG_TRUSTMANAGER_DESCRIPTION_ENABLED.get(), |
| | | true, true, true); |
| | | configEntry.putConfigAttribute(enableAttr); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | int msgID = MSGID_CONFIGDS_CANNOT_ENABLE_TRUSTMANAGER; |
| | | String message = getMessage(msgID, String.valueOf(e)); |
| | | Message message = ERR_CONFIGDS_CANNOT_ENABLE_TRUSTMANAGER.get( |
| | | String.valueOf(e)); |
| | | System.err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | | return 1; |
| | | } |
| | |
| | | ConfigEntry configEntry = |
| | | configHandler.getConfigEntry(ldapListenerDN); |
| | | |
| | | int msgID = MSGID_LDAP_CONNHANDLER_DESCRIPTION_TRUSTMANAGER_DN; |
| | | StringConfigAttribute trustManagerProviderAttr = |
| | | new StringConfigAttribute(ATTR_TRUSTMANAGER_DN, |
| | | getMessage(msgID), false, false, |
| | | INFO_LDAP_CONNHANDLER_DESCRIPTION_TRUSTMANAGER_DN.get(), |
| | | false, false, |
| | | true, trustManagerProviderDN.getValue()); |
| | | configEntry.putConfigAttribute(trustManagerProviderAttr); |
| | | } |
| | |
| | | ConfigEntry configEntry = |
| | | configHandler.getConfigEntry(ldapsListenerDN); |
| | | |
| | | int msgID = MSGID_LDAP_CONNHANDLER_DESCRIPTION_TRUSTMANAGER_DN; |
| | | StringConfigAttribute trustManagerProviderAttr = |
| | | new StringConfigAttribute(ATTR_TRUSTMANAGER_DN, |
| | | getMessage(msgID), false, false, |
| | | INFO_LDAP_CONNHANDLER_DESCRIPTION_TRUSTMANAGER_DN.get(), |
| | | false, false, |
| | | true, trustManagerProviderDN.getValue()); |
| | | configEntry.putConfigAttribute(trustManagerProviderAttr); |
| | | } |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | int msgID = MSGID_CONFIGDS_CANNOT_UPDATE_TRUSTMANAGER_REFERENCE; |
| | | String message = getMessage(msgID, String.valueOf(e)); |
| | | Message message = |
| | | ERR_CONFIGDS_CANNOT_UPDATE_TRUSTMANAGER_REFERENCE.get( |
| | | String.valueOf(e)); |
| | | System.err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | | return 1; |
| | | } |
| | |
| | | { |
| | | try |
| | | { |
| | | int msgID = MSGID_LDAP_CONNHANDLER_DESCRIPTION_SSL_CERT_NICKNAME; |
| | | StringConfigAttribute certNickNameAttr = |
| | | new StringConfigAttribute(ATTR_SSL_CERT_NICKNAME, getMessage(msgID), |
| | | new StringConfigAttribute( |
| | | ATTR_SSL_CERT_NICKNAME, |
| | | INFO_LDAP_CONNHANDLER_DESCRIPTION_SSL_CERT_NICKNAME.get(), |
| | | false, false, true, certNickName.getValue()); |
| | | |
| | | if (ldapPort.isPresent()) |
| | |
| | | |
| | | if (jmxPort.isPresent()) |
| | | { |
| | | msgID = MSGID_JMX_CONNHANDLER_DESCRIPTION_SSL_CERT_NICKNAME; |
| | | certNickNameAttr = new StringConfigAttribute(ATTR_SSL_CERT_NICKNAME, |
| | | getMessage(msgID), false, false, true, certNickName.getValue()); |
| | | INFO_JMX_CONNHANDLER_DESCRIPTION_SSL_CERT_NICKNAME.get(), |
| | | false, false, true, certNickName.getValue()); |
| | | |
| | | // Use the key manager specified for the JMX connection handler. |
| | | DN jmxListenerDN = DN.decode(DN_JMX_CONNECTION_HANDLER); |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | int msgID = MSGID_CONFIGDS_CANNOT_UPDATE_CERT_NICKNAME; |
| | | String message = getMessage(msgID, String.valueOf(e)); |
| | | Message message = ERR_CONFIGDS_CANNOT_UPDATE_CERT_NICKNAME.get( |
| | | String.valueOf(e)); |
| | | System.err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | | return 1; |
| | | } |
| | |
| | | DN rootUserDN = DN.decode(DN_ROOT_USER); |
| | | ConfigEntry configEntry = configHandler.getConfigEntry(rootUserDN); |
| | | |
| | | int msgID = MSGID_CONFIG_ROOTDN_DESCRIPTION_ALTERNATE_BIND_DN; |
| | | DNConfigAttribute bindDNAttr = |
| | | new DNConfigAttribute(ATTR_ROOTDN_ALTERNATE_BIND_DN, |
| | | getMessage(msgID), false, true, false, |
| | | new DNConfigAttribute( |
| | | ATTR_ROOTDN_ALTERNATE_BIND_DN, |
| | | INFO_CONFIG_ROOTDN_DESCRIPTION_ALTERNATE_BIND_DN.get(), |
| | | false, true, false, |
| | | rootDN); |
| | | configEntry.putConfigAttribute(bindDNAttr); |
| | | |
| | |
| | | String encodedPassword = |
| | | SaltedSHA512PasswordStorageScheme.encodeOffline(rootPWBytes); |
| | | StringConfigAttribute bindPWAttr = |
| | | new StringConfigAttribute(ATTR_USER_PASSWORD, "", false, false, |
| | | false, encodedPassword); |
| | | new StringConfigAttribute(ATTR_USER_PASSWORD, Message.EMPTY, |
| | | false, false, false, encodedPassword); |
| | | configEntry.putConfigAttribute(bindPWAttr); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | int msgID = MSGID_CONFIGDS_CANNOT_UPDATE_ROOT_USER; |
| | | String message = getMessage(msgID, String.valueOf(e)); |
| | | Message message = ERR_CONFIGDS_CANNOT_UPDATE_ROOT_USER.get( |
| | | String.valueOf(e)); |
| | | System.err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | | return 1; |
| | | } |
| | |
| | | { |
| | | configHandler.writeUpdatedConfig(); |
| | | |
| | | int msgID = MSGID_CONFIGDS_WROTE_UPDATED_CONFIG; |
| | | String message = getMessage(msgID); |
| | | Message message = INFO_CONFIGDS_WROTE_UPDATED_CONFIG.get(); |
| | | System.out.println(wrapText(message, MAX_LINE_WIDTH)); |
| | | } |
| | | catch (DirectoryException de) |
| | | { |
| | | int msgID = MSGID_CONFIGDS_CANNOT_WRITE_UPDATED_CONFIG; |
| | | String message = getMessage(msgID, de.getErrorMessage()); |
| | | Message message = ERR_CONFIGDS_CANNOT_WRITE_UPDATED_CONFIG.get( |
| | | de.getMessageObject()); |
| | | System.err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | | return 1; |
| | | } |