From 73302adac1b5e9aa946418ca776df8be9613ced4 Mon Sep 17 00:00:00 2001
From: Violette Roche-Montane <violette.roche-montane@forgerock.com>
Date: Fri, 07 Feb 2014 10:15:15 +0000
Subject: [PATCH] Checkpoint commit for OPENDJ-1303 - Extracted CLI arguments identifiers from CliConstants to ArgumentConstants. - Moved default CLI values like DEFAULT_LDAP_PORT, DEFAULT_ADMIN_PORT to CliConstants. - Code cleanup.
---
opendj-cli/src/main/java/com/forgerock/opendj/cli/ArgumentParser.java | 41 ++++++++++++++++++++++++++++++-----------
1 files changed, 30 insertions(+), 11 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 4683791..ca53343 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
@@ -27,8 +27,7 @@
package com.forgerock.opendj.cli;
import static com.forgerock.opendj.cli.CliMessages.*;
-import static com.forgerock.opendj.cli.CliConstants.*;
-import static com.forgerock.opendj.cli.Utils.PROPERTY_SCRIPT_NAME;
+import static com.forgerock.opendj.cli.ArgumentConstants.*;
import static com.forgerock.opendj.cli.Utils.wrapText;
import static com.forgerock.opendj.util.StaticUtils.EOL;
import static com.forgerock.opendj.util.StaticUtils.getBytes;
@@ -65,6 +64,27 @@
*/
public class ArgumentParser {
/**
+ * The name of the OpenDJ configuration direction in the user home
+ * directory.
+ */
+ public static final String DEFAULT_OPENDJ_CONFIG_DIR = ".opendj";
+
+ /**
+ * The default properties file name.
+ */
+ public static final String DEFAULT_OPENDJ_PROPERTIES_FILE_NAME = "tools";
+
+ /**
+ * The default properties file extension.
+ */
+ public static final String DEFAULT_OPENDJ_PROPERTIES_FILE_EXTENSION = ".properties";
+
+ /**
+ * The name of a command-line script used to launch a tool.
+ */
+ public static final String PROPERTY_SCRIPT_NAME = "com.forgerock.opendj.ldap.tools.scriptName";
+
+ /**
* The argument that will be used to indicate the file properties.
*/
private StringArgument filePropertiesPathArgument;
@@ -313,13 +333,9 @@
if (versionArgument != null) {
if (shortID != null && shortID.equals(versionArgument.getShortIdentifier())) {
- // Update the version argument to not display its short
- // identifier.
+ // Update the version argument to not display its short identifier.
try {
- versionArgument =
- new BooleanArgument(OPTION_LONG_PRODUCT_VERSION, null,
- OPTION_LONG_PRODUCT_VERSION, INFO_DESCRIPTION_PRODUCT_VERSION
- .get());
+ versionArgument = getVersionArgument(false);
this.generalArgGroup.addArgument(versionArgument);
} catch (final ArgumentException e) {
// ignore
@@ -359,6 +375,11 @@
argumentGroups.add(group);
}
+ private BooleanArgument getVersionArgument(final boolean displayShortIdentifier) throws ArgumentException {
+ return new BooleanArgument(OPTION_LONG_PRODUCT_VERSION, displayShortIdentifier ? OPTION_SHORT_PRODUCT_VERSION
+ : null, OPTION_LONG_PRODUCT_VERSION, INFO_DESCRIPTION_PRODUCT_VERSION.get());
+ }
+
/**
* Adds the provided argument to the set of arguments handled by this parser
* and puts the arguement in the default group.
@@ -1451,9 +1472,7 @@
this.argumentGroups.add(ioArgGroup);
try {
- versionArgument =
- new BooleanArgument(OPTION_LONG_PRODUCT_VERSION, OPTION_SHORT_PRODUCT_VERSION,
- OPTION_LONG_PRODUCT_VERSION, INFO_DESCRIPTION_PRODUCT_VERSION.get());
+ versionArgument = getVersionArgument(true);
this.generalArgGroup.addArgument(versionArgument);
} catch (final ArgumentException e) {
// ignore
--
Gitblit v1.10.0