From 7e014d165df1bf3dd13ffc4a5d8906a0b1561eba Mon Sep 17 00:00:00 2001
From: jvergara <jvergara@localhost>
Date: Fri, 17 Aug 2007 00:53:26 +0000
Subject: [PATCH] The following modifications have the following goals:
---
opendj-sdk/opends/src/server/org/opends/server/admin/client/cli/SecureConnectionCliParser.java | 52 ++++++++++++++++++++++++++++++++++++++++++++++------
1 files changed, 46 insertions(+), 6 deletions(-)
diff --git a/opendj-sdk/opends/src/server/org/opends/server/admin/client/cli/SecureConnectionCliParser.java b/opendj-sdk/opends/src/server/org/opends/server/admin/client/cli/SecureConnectionCliParser.java
index cb99e31..09f6979 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/admin/client/cli/SecureConnectionCliParser.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/admin/client/cli/SecureConnectionCliParser.java
@@ -175,8 +175,7 @@
Logger.getLogger(SecureConnectionCliParser.class.getName());
/**
- * Creates a new instance of this subcommand argument parser with no
- * arguments.
+ * Creates a new instance of this argument parser with no arguments.
*
* @param mainClassName
* The fully-qualified name of the Java class that should
@@ -295,6 +294,32 @@
}
/**
+ * Get the password which has to be used for the command without prompting
+ * the user. If no password was specified, return null.
+ *
+ * @return The password stored into the specified file on by the
+ * command line argument, or null it if not specified.
+ */
+ public String getBindPassword()
+ {
+ String pwd;
+ if (bindPasswordArg.isPresent())
+ {
+ pwd = bindPasswordArg.getValue();
+ }
+ else
+ if (bindPasswordFileArg.isPresent())
+ {
+ pwd = bindPasswordFileArg.getValue();
+ }
+ else
+ {
+ pwd = null;
+ }
+ return pwd;
+ }
+
+ /**
* Initialize Global option.
*
* @param outStream
@@ -435,10 +460,11 @@
/**
* Indication if provided global options are validate.
*
- * @param err the stream to be used to print error message.
+ * @param buf the MessageBuilder to write the error messages.
* @return return code.
*/
- public int validateGlobalOption(PrintStream err) {
+ public int validateGlobalOption(MessageBuilder buf)
+ {
ArrayList<Message> errors = new ArrayList<Message>();
// Couldn't have at the same time bindPassword and bindPasswordFile
if (bindPasswordArg.isPresent() && bindPasswordFileArg.isPresent()) {
@@ -491,7 +517,6 @@
if (errors.size() > 0)
{
- MessageBuilder buf = new MessageBuilder();
for (Message error : errors)
{
if (buf.length() > 0)
@@ -500,12 +525,27 @@
}
buf.append(error);
}
- err.println(wrapText(buf.toString(), MAX_LINE_WIDTH));
return CONFLICTING_ARGS.getReturnCode();
}
return SUCCESSFUL_NOP.getReturnCode();
}
+ /**
+ * Indication if provided global options are validate.
+ *
+ * @param err the stream to be used to print error message.
+ * @return return code.
+ */
+ public int validateGlobalOption(PrintStream err)
+ {
+ MessageBuilder buf = new MessageBuilder();
+ int returnValue = validateGlobalOption(buf);
+ if (buf.length() > 0)
+ {
+ err.println(wrapText(buf.toString(), MAX_LINE_WIDTH));
+ }
+ return returnValue;
+ }
/**
* Indicate if the verbose mode is required.
--
Gitblit v1.10.0