mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

Violette Roche-Montane
07.15.2014 73302adac1b5e9aa946418ca776df8be9613ced4
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