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

Jean-Noel Rouvignac
20.51.2015 3493cfbfe6e815454ce102a32152b088b89c5308
Removed the fields that SubCommandArgumentParser duplicates from superclass ArgumentParser.
2 files modified
41 ■■■■ changed files
opendj-cli/src/main/java/com/forgerock/opendj/cli/ArgumentParser.java 9 ●●●●● patch | view | raw | blame | history
opendj-cli/src/main/java/com/forgerock/opendj/cli/SubCommandArgumentParser.java 32 ●●●●● patch | view | raw | blame | history
opendj-cli/src/main/java/com/forgerock/opendj/cli/ArgumentParser.java
@@ -1237,6 +1237,15 @@
    }
    /**
     * Sets the raw set of arguments.
     *
     * @param rawArguments the raw set of arguments to set
     */
    void setRawArguments(String[] rawArguments) {
        this.rawArguments = rawArguments;
    }
    /**
     * Sets the provided argument as one which will automatically trigger the
     * output of usage information if it is provided on the command line and no
     * further argument validation will be performed. Note that the caller will
opendj-cli/src/main/java/com/forgerock/opendj/cli/SubCommandArgumentParser.java
@@ -45,7 +45,6 @@
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.i18n.LocalizableMessageBuilder;
import org.forgerock.i18n.slf4j.LocalizedLogger;
/**
 * This class defines a variant of the argument parser that can be used with applications that use subcommands to
@@ -57,14 +56,11 @@
 */
public class SubCommandArgumentParser extends ArgumentParser {
    private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass();
    private static final String INDENT = "    ";
    /** The arguments that will be used to trigger the display of usage information for groups of sub-commands. */
    private final Map<Argument, Collection<SubCommand>> usageGroupArguments =
        new HashMap<Argument, Collection<SubCommand>>();
    /** The set of unnamed trailing arguments that were provided for this parser. */
    private final ArrayList<String> trailingArguments = new ArrayList<String>();
    /** The set of global arguments defined for this parser, referenced by short ID. */
    private final Map<Character, Argument> globalShortIDMap = new HashMap<Character, Argument>();
@@ -77,8 +73,6 @@
    /** The set of subcommands defined for this parser, referenced by subcommand name. */
    private final SortedMap<String, SubCommand> subCommands = new TreeMap<String, SubCommand>();
    /** The raw set of command-line arguments that were provided. */
    private String[] rawArguments;
    /**The subcommand requested by the user as part of the command-line arguments.     */
    private SubCommand subCommand;
@@ -238,17 +232,6 @@
    }
    /**
     * Retrieves the raw set of arguments that were provided.
     *
     * @return The raw set of arguments that were provided, or <CODE>null</CODE> if the argument list has not yet been
     *         parsed.
     */
    @Override
    public String[] getRawArguments() {
        return rawArguments;
    }
    /**
     * Adds the provided argument to the set of global arguments handled by this parser.
     *
     * @param argument
@@ -460,9 +443,10 @@
     */
    @Override
    public void parseArguments(String[] rawArguments, Properties argumentProperties) throws ArgumentException {
        this.rawArguments = rawArguments;
        setRawArguments(rawArguments);
        this.subCommand = null;
        this.trailingArguments.clear();
        final ArrayList<String> trailingArguments = getTrailingArguments();
        trailingArguments.clear();
        setUsageOrVersionDisplayed(false);
        boolean inTrailingArgs = false;
@@ -956,16 +940,6 @@
    }
    /**
     * Retrieves the set of unnamed trailing arguments that were provided on the command line.
     *
     * @return The set of unnamed trailing arguments that were provided on the command line.
     */
    @Override
    public ArrayList<String> getTrailingArguments() {
        return trailingArguments;
    }
    /**
     * Adds the provided subcommand to this argument parser. This is only intended for use by the
     * <CODE>SubCommand</CODE> constructor and does not do any validation of its own to ensure that there are no
     * conflicts with the subcommand or any of its arguments.