From e14ffab7771d005424baf5d7021ec9a2b3817efc Mon Sep 17 00:00:00 2001
From: Violette Roche-Montane <violette.roche-montane@forgerock.com>
Date: Wed, 05 Feb 2014 15:02:28 +0000
Subject: [PATCH] OPENDJ 1303 Checkpoint commit - Modified classes for their future use in the opendj3-server-dev - Migrate tests from server.
---
opendj-cli/src/main/java/com/forgerock/opendj/cli/ArgumentParser.java | 35 +++++++++++++++++++++++++++--------
1 files changed, 27 insertions(+), 8 deletions(-)
diff --git a/opendj-cli/src/main/java/com/forgerock/opendj/cli/ArgumentParser.java b/opendj-cli/src/main/java/com/forgerock/opendj/cli/ArgumentParser.java
index 264ead1..4683791 100644
--- a/opendj-cli/src/main/java/com/forgerock/opendj/cli/ArgumentParser.java
+++ b/opendj-cli/src/main/java/com/forgerock/opendj/cli/ArgumentParser.java
@@ -165,7 +165,7 @@
* properties file, no-prompt etc. These will appear toward the bottom of
* the usage statement.
*/
- private final ArgumentGroup ioArgGroup = new ArgumentGroup(INFO_DESCRIPTION_IO_ARGS.get(),
+ protected final ArgumentGroup ioArgGroup = new ArgumentGroup(INFO_DESCRIPTION_IO_ARGS.get(),
Integer.MIN_VALUE + 1);
/**
@@ -369,7 +369,7 @@
* If the provided argument conflicts with another argument that
* has already been defined.
*/
- void addDefaultArgument(final Argument argument) throws ArgumentException {
+ protected void addDefaultArgument(final Argument argument) throws ArgumentException {
addArgument(argument, defaultArgGroup);
}
@@ -397,7 +397,7 @@
* If the provided argument conflicts with another argument that
* has already been defined.
*/
- void addInputOutputArgument(final Argument argument) throws ArgumentException {
+ public void addInputOutputArgument(final Argument argument) throws ArgumentException {
addArgument(argument, ioArgGroup);
}
@@ -522,7 +522,7 @@
* @return The argument with the specified long identifier, or
* <CODE>null</CODE> if there is no such argument.
*/
- Argument getArgumentForLongID(final String longID) {
+ public Argument getArgumentForLongID(final String longID) {
return longIDMap.get(longID);
}
@@ -545,7 +545,7 @@
* @return The list of all arguments that have been defined for this
* argument parser.
*/
- LinkedList<Argument> getArgumentList() {
+ public LinkedList<Argument> getArgumentList() {
return argumentList;
}
@@ -671,7 +671,7 @@
* @return A string containing usage information based on the defined
* arguments.
*/
- String getUsage() {
+ public String getUsage() {
final StringBuilder buffer = new StringBuilder();
getUsage(buffer);
@@ -825,7 +825,7 @@
* @return <CODE>true</CODE> if the usage argument was provided and
* <CODE>false</CODE> otherwise.
*/
- boolean isUsageArgumentPresent() {
+ public boolean isUsageArgumentPresent() {
boolean isUsageArgumentPresent = false;
if (usageArgument != null) {
isUsageArgumentPresent = usageArgument.isPresent();
@@ -840,7 +840,7 @@
* @return <CODE>true</CODE> if the version argument was provided and
* <CODE>false</CODE> otherwise.
*/
- boolean isVersionArgumentPresent() {
+ public boolean isVersionArgumentPresent() {
return versionPresent;
}
@@ -1631,4 +1631,23 @@
}
}
}
+
+ /**
+ * Get the password which has to be used for the command without prompting the user. If no password was specified,
+ * return null.
+ *
+ * @param clearArg
+ * The password StringArgument argument.
+ * @param fileArg
+ * The password FileBased argument.
+ * @return The password stored into the specified file on by the command line argument, or null it if not specified.
+ */
+ public static String getBindPassword(StringArgument clearArg, FileBasedArgument fileArg) {
+ if (clearArg.isPresent()) {
+ return clearArg.getValue();
+ } else if (fileArg.isPresent()) {
+ return fileArg.getValue();
+ }
+ return null;
+ }
}
--
Gitblit v1.10.0