| | |
| | | static private final Logger LOG = Logger.getLogger(StatusCli.class.getName()); |
| | | |
| | | // The argument parser |
| | | private StatusCliParser argParser; |
| | | private StatusCliArgumentParser argParser; |
| | | |
| | | /** |
| | | * Constructor for the StatusCli object. |
| | |
| | | |
| | | /** |
| | | * Parses the provided command-line arguments and uses that information to |
| | | * run the replication tool. |
| | | * run the status tool. |
| | | * |
| | | * @param args the command-line arguments provided to this program. |
| | | * |
| | |
| | | |
| | | /** |
| | | * Parses the provided command-line arguments and uses that information to |
| | | * run the replication tool. |
| | | * run the status tool. |
| | | * |
| | | * @param args The command-line arguments provided to this |
| | | * program. |
| | |
| | | DirectoryServer.bootstrapClient(); |
| | | } |
| | | |
| | | argParser = new StatusCliParser(StatusCli.class.getName()); |
| | | argParser = new StatusCliArgumentParser(StatusCli.class.getName()); |
| | | try |
| | | { |
| | | argParser.initializeGlobalArguments(err); |
| | |
| | | */ |
| | | ConfigFromFile offLineConf = new ConfigFromFile(); |
| | | offLineConf.readConfiguration(); |
| | | |
| | | try |
| | | { |
| | | if (isServerRunning) |
| | | { |
| | | String bindDn = argParser.getBindDN(); |
| | | String bindDn; |
| | | String bindPwd; |
| | | boolean useSSL = argParser.useSSL(); |
| | | boolean useStartTLS = argParser.useStartTLS(); |
| | |
| | | { |
| | | boolean connected = false; |
| | | boolean cancelled = false; |
| | | boolean prompted = false; |
| | | |
| | | boolean canUseSSL = offLineConf.getLDAPSURL() != null; |
| | | boolean canUseStartTLS = offLineConf.getStartTLSURL() != null; |
| | | |
| | | bindDn = argParser.getExplicitBindDn(); |
| | | bindPwd = argParser.getBindPassword(); |
| | | if (bindDn == null) |
| | | { |
| | | bindDn = promptForString( |
| | | INFO_CLI_BINDDN_PROMPT.get(), argParser.getDefaultBindDn()); |
| | | prompted = true; |
| | | } |
| | | if (bindPwd == null) |
| | | { |
| | | bindPwd = promptForPassword( |
| | | INFO_LDAPAUTH_PASSWORD_PROMPT.get(bindDn)); |
| | | prompted = true; |
| | | } |
| | | |
| | | if (!useSSL && !useStartTLS) |
| | | { |
| | | if (canUseSSL) |
| | | { |
| | | useSSL = confirm(INFO_CLI_USESSL_PROMPT.get(), useSSL); |
| | | } |
| | | if (!useSSL && canUseStartTLS) |
| | | { |
| | | useStartTLS = |
| | | confirm(INFO_CLI_USESTARTTLS_PROMPT.get(), useStartTLS); |
| | | } |
| | | prompted = true; |
| | | } |
| | | |
| | | InitialLdapContext ctx = null; |
| | | while (!connected && !cancelled) |
| | | { |
| | | if (prompted) |
| | | { |
| | | printLineBreak(); |
| | | } |
| | | |
| | | String host = "localhost"; |
| | | int port = 389; |
| | | try |
| | |
| | | useStartTLS = |
| | | confirm(INFO_CLI_USESTARTTLS_PROMPT.get(), useStartTLS); |
| | | } |
| | | prompted = true; |
| | | } |
| | | catch (NamingException ne) |
| | | { |
| | |
| | | { |
| | | cancelled = true; |
| | | } |
| | | prompted = true; |
| | | } |
| | | else |
| | | { |
| | |
| | | useStartTLS = |
| | | confirm(INFO_CLI_USESTARTTLS_PROMPT.get(), useStartTLS); |
| | | } |
| | | prompted = true; |
| | | } |
| | | } |
| | | } |
| | |
| | | } |
| | | else |
| | | { |
| | | bindDn = argParser.getBindDN(); |
| | | bindPwd = argParser.getBindPassword(); |
| | | |
| | | if (bindDn == null) |