From 68d1cc39007696bf12d0844eba88ea7ac81d8786 Mon Sep 17 00:00:00 2001
From: jvergara <jvergara@localhost>
Date: Wed, 29 Aug 2007 11:50:00 +0000
Subject: [PATCH] Improve the status command-line interaction by asking the user for the BIndDN to use when this was not provided. Before asking to use SSL or startTLS check that they can actually be used.
---
opends/src/guitools/org/opends/guitools/statuspanel/StatusCli.java | 46 ++++++++++++++++++++++++++++++++++++++++------
1 files changed, 40 insertions(+), 6 deletions(-)
diff --git a/opends/src/guitools/org/opends/guitools/statuspanel/StatusCli.java b/opends/src/guitools/org/opends/guitools/statuspanel/StatusCli.java
index 4a02cfd..6f0f360 100644
--- a/opends/src/guitools/org/opends/guitools/statuspanel/StatusCli.java
+++ b/opends/src/guitools/org/opends/guitools/statuspanel/StatusCli.java
@@ -137,7 +137,7 @@
static private final Logger LOG = Logger.getLogger(StatusCli.class.getName());
// The argument parser
- private StatusCliParser argParser;
+ private StatusCliArgumentParser argParser;
/**
* Constructor for the StatusCli object.
@@ -169,7 +169,7 @@
/**
* 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.
*
@@ -183,7 +183,7 @@
/**
* 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.
@@ -252,7 +252,7 @@
DirectoryServer.bootstrapClient();
}
- argParser = new StatusCliParser(StatusCli.class.getName());
+ argParser = new StatusCliArgumentParser(StatusCli.class.getName());
try
{
argParser.initializeGlobalArguments(err);
@@ -300,12 +300,11 @@
*/
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();
@@ -313,17 +312,48 @@
{
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
@@ -355,6 +385,7 @@
useStartTLS =
confirm(INFO_CLI_USESTARTTLS_PROMPT.get(), useStartTLS);
}
+ prompted = true;
}
catch (NamingException ne)
{
@@ -369,6 +400,7 @@
{
cancelled = true;
}
+ prompted = true;
}
else
{
@@ -392,6 +424,7 @@
useStartTLS =
confirm(INFO_CLI_USESTARTTLS_PROMPT.get(), useStartTLS);
}
+ prompted = true;
}
}
}
@@ -412,6 +445,7 @@
}
else
{
+ bindDn = argParser.getBindDN();
bindPwd = argParser.getBindPassword();
if (bindDn == null)
--
Gitblit v1.10.0