commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brit...@apache.org
Subject [11/40] commons-cli git commit: An Avalon implementation of a commons vargs codebase - split onto its own branch so we can start focusing on the CLI parts individually
Date Thu, 08 Jun 2017 17:38:00 GMT
http://git-wip-us.apache.org/repos/asf/commons-cli/blob/9e65354f/src/java/org/apache/commons/cli2/DisplaySetting.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/cli2/DisplaySetting.java b/src/java/org/apache/commons/cli2/DisplaySetting.java
deleted file mode 100644
index eacd1cd..0000000
--- a/src/java/org/apache/commons/cli2/DisplaySetting.java
+++ /dev/null
@@ -1,154 +0,0 @@
-/**
- * Copyright 2003-2004 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.commons.cli2;
-
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Set;
-
-/**
- * An enum of possible display settings. These settings are used to control the
- * presence of various features in the String representations of options,
- * CommandLines and usage strings.  Usually a Set of DisplaySetting instances
- * will be passed to a method that will lookup the presence of the values.
- */
-public class DisplaySetting {
-	
-    private static final Set all = new HashSet();
-
-    /**
-     * A Set guarenteed to contain all possible DisplaySetting values
-     */
-    public static final Set ALL = Collections.unmodifiableSet(all);
-    
-    /**
-     * A Set guarenteed to contain no DisplaySetting values
-     */
-    public static final Set NONE = Collections.EMPTY_SET;
-    
-    /**
-     * Indicates that aliases should be included
-     */
-    public static final DisplaySetting DISPLAY_ALIASES =
-        new DisplaySetting("DISPLAY_ALIASES");
-    
-    /**
-     * Indicates that optionality should be included
-     */
-    public static final DisplaySetting DISPLAY_OPTIONAL =
-        new DisplaySetting("DISPLAY_OPTIONAL");
-    
-    /**
-     * Indicates that property options should be included
-     */
-    public static final DisplaySetting DISPLAY_PROPERTY_OPTION =
-        new DisplaySetting("DISPLAY_PROPERTY_OPTION");
-    
-    /**
-     * Indicates that switches should be included enabled
-     */
-    public static final DisplaySetting DISPLAY_SWITCH_ENABLED =
-        new DisplaySetting("DISPLAY_SWITCH_ENABLED");
-    
-    /**
-     * Indicates that switches should be included disabled
-     */
-    public static final DisplaySetting DISPLAY_SWITCH_DISABLED =
-        new DisplaySetting("DISPLAY_SWITCH_DISABLED");
-    
-    /**
-     * Indicates that group names should be included
-     */
-    public static final DisplaySetting DISPLAY_GROUP_NAME =
-        new DisplaySetting("DISPLAY_GROUP_NAME");
-    
-    /**
-     * Indicates that groups should be included expanded
-     */
-    public static final DisplaySetting DISPLAY_GROUP_EXPANDED =
-        new DisplaySetting("DISPLAY_GROUP_EXPANDED");
-    
-    /**
-     * Indicates that group arguments should be included
-     */
-    public static final DisplaySetting DISPLAY_GROUP_ARGUMENT =
-        new DisplaySetting("DISPLAY_GROUP_ARGUMENT");
-    
-    /**
-     * Indicates that group outer brackets should be included
-     */
-    public static final DisplaySetting DISPLAY_GROUP_OUTER =
-        new DisplaySetting("DISPLAY_GROUP_OUTER");
-    
-    /**
-     * Indicates that arguments should be included numbered
-     */
-    public static final DisplaySetting DISPLAY_ARGUMENT_NUMBERED =
-        new DisplaySetting("DISPLAY_ARGUMENT_NUMBERED");
-    
-    /**
-     * Indicates that arguments should be included bracketed
-     */
-    public static final DisplaySetting DISPLAY_ARGUMENT_BRACKETED =
-        new DisplaySetting("DISPLAY_ARGUMENT_BRACKETED");
-    
-    /**
-     * Indicates that arguments of Parents should be included
-     */
-    public static final DisplaySetting DISPLAY_PARENT_ARGUMENT =
-        new DisplaySetting("DISPLAY_PARENT_ARGUMENT");
-    
-    /**
-     * Indicates that children of Parents should be included
-     */
-    public static final DisplaySetting DISPLAY_PARENT_CHILDREN =
-        new DisplaySetting("DISPLAY_PARENT_CHILDREN");
-    
-    /**
-     * The name of the setting
-     */
-    private final String name;
-    
-    /**
-     * The hashCode of the setting
-     */
-    private final int hashCode;
-
-    /**
-     * Creates a new DisplaySetting with the specified name
-     * @param name the name of the setting
-     */
-    private DisplaySetting(final String name) {
-        this.name = name;
-        this.hashCode = name.hashCode();
-        all.add(this);
-    }
-
-    public int hashCode() {
-        return hashCode;
-    }
-
-    public boolean equals(final Object that) {
-        if (that instanceof DisplaySetting) {
-            return name.compareTo(that.toString()) == 0;
-        }
-        return false;
-    }
-
-    public String toString() {
-        return name;
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-cli/blob/9e65354f/src/java/org/apache/commons/cli2/Group.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/cli2/Group.java b/src/java/org/apache/commons/cli2/Group.java
deleted file mode 100644
index 90ae08c..0000000
--- a/src/java/org/apache/commons/cli2/Group.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/**
- * Copyright 2003-2004 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.commons.cli2;
-
-import java.util.Comparator;
-import java.util.Set;
-
-/**
- * An Option representing a choice or group of Options in the form "-a|-b|-c".
- */
-public interface Group extends Option {
-
-    /**
-     * Appends usage information to the specified StringBuffer
-     * 
-     * @param buffer the buffer to append to
-     * @param helpSettings a set of display settings @see DisplaySetting
-     * @param comp a comparator used to sort the Options
-     * @param separator the String used to separate member Options 
-     */
-    void appendUsage(
-        final StringBuffer buffer,
-        final Set helpSettings,
-        final Comparator comp,
-        final String separator);
-
-    /**
-     * Indicates whether group members must be present for the CommandLine to be
-     * valid.
-     *
-     * @see #getMinimum()
-     * @see #getMaximum()
-     * @return true iff the CommandLine will be invalid without at least one 
-     *         member option
-     */
-    boolean isRequired();
-
-    /**
-     * Retrieves the minimum number of members required for a valid Group
-     *
-     * @return the minimum number of members
-     */
-    int getMinimum();
-
-    /**
-     * Retrieves the maximum number of members acceptable for a valid Group
-     *
-     * @return the maximum number of members
-     */
-    int getMaximum();
-}

http://git-wip-us.apache.org/repos/asf/commons-cli/blob/9e65354f/src/java/org/apache/commons/cli2/HelpLine.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/cli2/HelpLine.java b/src/java/org/apache/commons/cli2/HelpLine.java
deleted file mode 100644
index a7ad5b7..0000000
--- a/src/java/org/apache/commons/cli2/HelpLine.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/**
- * Copyright 2003-2004 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.commons.cli2;
-
-import java.util.Comparator;
-import java.util.Set;
-
-/**
- * Represents a line of help for a particular Option.
- */
-public interface HelpLine {
-
-    /**
-     * @return The description of the option
-     */
-    String getDescription();
-
-    /**
-     * @return The level of indentation for this line
-     */
-    int getIndent();
-
-    /**
-     * @return The Option that the help line relates to
-     */
-    Option getOption();
-
-    /**
-     * Builds a usage string for the option using the specified settings and
-     * comparator.
-     * 
-     * @param helpSettings
-     *            the settings to apply
-     * @param comparator
-     *            a comparator to sort options when applicable
-     * @return the usage string
-     */
-    String usage(final Set helpSettings, final Comparator comparator);
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/commons-cli/blob/9e65354f/src/java/org/apache/commons/cli2/Option.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/cli2/Option.java b/src/java/org/apache/commons/cli2/Option.java
deleted file mode 100644
index c650939..0000000
--- a/src/java/org/apache/commons/cli2/Option.java
+++ /dev/null
@@ -1,196 +0,0 @@
-/*
- * Copyright 2003-2005 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.commons.cli2;
-
-import java.util.Comparator;
-import java.util.List;
-import java.util.ListIterator;
-import java.util.Set;
-
-/**
- * The super type of all options representing a particular element of the
- * command line interface.
- */
-public interface Option {
-
-    /**
-     * Processes String arguments into a CommandLine.
-     * 
-     * The iterator will initially point at the first argument to be processed
-     * and at the end of the method should point to the first argument not
-     * processed. This method MUST process at least one argument from the
-     * ListIterator.
-     * 
-     * @param commandLine
-     *            The CommandLine object to store results in
-     * @param args
-     *            The arguments to process
-     * @throws OptionException
-     *             if any problems occur
-     */
-    void process(
-        final WriteableCommandLine commandLine,
-        final ListIterator args)
-        throws OptionException;
-    
-    /**
-     * Adds defaults to a CommandLine.
-     * 
-     * Any defaults for this option are applied as well as the defaults for 
-     * any contained options
-     * 
-     * @param commandLine
-     *            The CommandLine object to store defaults in
-     */
-    void defaults(final WriteableCommandLine commandLine);
-
-    /**
-     * Indicates whether this Option will be able to process the particular
-     * argument.
-     * 
-     * @param argument
-     *            The argument to be tested
-     * @return true if the argument can be processed by this Option
-     */
-    boolean canProcess(final WriteableCommandLine commandLine, final String argument);
-
-    /**
-     * Indicates whether this Option will be able to process the particular
-     * argument. The ListIterator must be restored to the initial state before
-     * returning the boolean.
-     * 
-     * @see #canProcess(WriteableCommandLine,String)
-     * @param arguments
-     *            the ListIterator over String arguments
-     * @return true if the argument can be processed by this Option
-     */
-    boolean canProcess(final WriteableCommandLine commandLine, final ListIterator arguments);
-
-    /**
-     * Identifies the argument prefixes that should trigger this option. This
-     * is used to decide which of many Options should be tried when processing
-     * a given argument string.
-     * 
-     * The returned Set must not be null.
-     * 
-     * @return The set of triggers for this Option
-     */
-    Set getTriggers();
-
-    /**
-     * Identifies the argument prefixes that should be considered options. This
-     * is used to identify whether a given string looks like an option or an
-     * argument value. Typically an option would return the set [--,-] while
-     * switches might offer [-,+].
-     * 
-     * The returned Set must not be null.
-     * 
-     * @return The set of prefixes for this Option
-     */
-    Set getPrefixes();
-
-    /**
-     * Checks that the supplied CommandLine is valid with respect to this
-     * option.
-     * 
-     * @param commandLine
-     *            The CommandLine to check.
-     * @throws OptionException
-     *             if the CommandLine is not valid.
-     */
-    void validate(final WriteableCommandLine commandLine)
-        throws OptionException;
-
-    /**
-     * Builds up a list of HelpLineImpl instances to be presented by HelpFormatter.
-     * 
-     * @see HelpLine
-     * @see org.apache.commons.cli2.util.HelpFormatter
-     * @param depth
-     *            the initial indent depth
-     * @param helpSettings
-     *            the HelpSettings that should be applied
-     * @param comp
-     *            a comparator used to sort options when applicable.
-     * @return a List of HelpLineImpl objects
-     */
-    List helpLines(
-        final int depth,
-        final Set helpSettings,
-        final Comparator comp);
-
-    /**
-     * Appends usage information to the specified StringBuffer
-     * 
-     * @param buffer the buffer to append to
-     * @param helpSettings a set of display settings @see DisplaySetting
-     * @param comp a comparator used to sort the Options
-     */
-    void appendUsage(
-        final StringBuffer buffer,
-        final Set helpSettings,
-        final Comparator comp);
-
-    /**
-     * The preferred name of an option is used for generating help and usage
-     * information.
-     * 
-     * @return The preferred name of the option
-     */
-    String getPreferredName();
-
-    /**
-     * Returns a description of the option. This string is used to build help
-     * messages as in the HelpFormatter.
-     * 
-     * @see org.apache.commons.cli2.util.HelpFormatter
-     * @return a description of the option.
-     */
-    String getDescription();
-
-    /**
-     * Returns the id of the option.  This can be used in a loop and switch 
-     * construct:
-     * 
-     * <code>
-     * for(Option o : cmd.getOptions()){
-     *     switch(o.getId()){
-     *         case POTENTIAL_OPTION:
-     *             ...
-     *     }
-     * }
-     * </code> 
-     * 
-     * The returned value is not guarenteed to be unique.
-     * 
-     * @return the id of the option.
-     */
-    int getId();
-
-	/**
-	 * Recursively searches for an option with the supplied trigger.
-	 *
-	 * @param trigger the trigger to search for.
-	 * @return the matching option or null.
-	 */
-	Option findOption(final String trigger);
-
-    /**
-     * Indicates whether this option is required to be present.
-     * @return true iff the CommandLine will be invalid without this Option
-     */
-    boolean isRequired();
-}

http://git-wip-us.apache.org/repos/asf/commons-cli/blob/9e65354f/src/java/org/apache/commons/cli2/OptionException.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/cli2/OptionException.java b/src/java/org/apache/commons/cli2/OptionException.java
deleted file mode 100644
index 613f9ae..0000000
--- a/src/java/org/apache/commons/cli2/OptionException.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * Copyright 2003-2005 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.commons.cli2;
-
-import java.util.Collections;
-import java.util.Set;
-
-import org.apache.commons.cli2.resource.ResourceHelper;
-
-/**
- * A problem found while dealing with command line options.
- */
-public class OptionException
-    extends Exception {
-    /**
-     * The settings used when displaying the related Option.
-     *
-     * @see DisplaySetting
-     */
-    public static final Set HELP_SETTINGS =
-        Collections.unmodifiableSet(Collections.singleton(DisplaySetting.DISPLAY_PROPERTY_OPTION));
-
-    /** resource helper instance */
-    private static final ResourceHelper helper = ResourceHelper.getResourceHelper();
-
-    /** The Option the exception relates to */
-    private final Option option;
-
-    /** The message explaining the Exception */
-    private final String message;
-
-    /**
-     * Creates a new OptionException.
-     *
-     * @param option
-     *            The Option the exception relates to
-     */
-    public OptionException(final Option option) {
-        this(option, null, null);
-    }
-
-    /**
-     * Creates a new OptionException.
-     * @param option the Option the exception relates to
-     * @param messageKey the id of the message to display
-     */
-    public OptionException(final Option option,
-                           final String messageKey) {
-        this(option, messageKey, null);
-    }
-
-    /**
-     * Creates a new OptionException.
-     * @param option the Option the exception relates to
-     * @param messageKey the id of the message to display
-     * @param value a value to display with the message
-     */
-    public OptionException(final Option option,
-                           final String messageKey,
-                           final String value) {
-        this.option = option;
-
-        if (messageKey != null) {
-            final StringBuffer buffer = new StringBuffer();
-
-            if (value != null) {
-                buffer.append(helper.getMessage(messageKey, value));
-            } else {
-                buffer.append(helper.getMessage(messageKey));
-            }
-
-            buffer.append(" ");
-
-            option.appendUsage(buffer, HELP_SETTINGS, null);
-            message = buffer.toString();
-        } else {
-            message = "";
-        }
-    }
-
-    /**
-     * Gets the Option the exception relates to
-     *
-     * @return The related Option
-     */
-    public Option getOption() {
-        return option;
-    }
-
-    public String getMessage() {
-        return message;
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-cli/blob/9e65354f/src/java/org/apache/commons/cli2/Parent.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/cli2/Parent.java b/src/java/org/apache/commons/cli2/Parent.java
deleted file mode 100644
index bf9d5a5..0000000
--- a/src/java/org/apache/commons/cli2/Parent.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/**
- * Copyright 2003-2004 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.commons.cli2;
-
-import java.util.ListIterator;
-
-/**
- * An Option that can have an argument and/or group of child Options in the form 
- * "-f &lt;arg&gt; [-a|-b|-c]".
- */
-public interface Parent extends Option {
-
-    /**
-     * Processes the parent part of the Option.  The combination of parent,
-     * argument and children is handled by the process method.
-     * @see Option#process(WriteableCommandLine, ListIterator)
-     * 
-     * @param commandLine the CommandLine to write results to
-     * @param args a ListIterator over argument strings positioned at the next
-     *             argument to process
-     * @throws OptionException if an error occurs while processing
-     */
-    void processParent(
-        final WriteableCommandLine commandLine,
-        final ListIterator args)
-        throws OptionException;
-}

http://git-wip-us.apache.org/repos/asf/commons-cli/blob/9e65354f/src/java/org/apache/commons/cli2/WriteableCommandLine.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/cli2/WriteableCommandLine.java b/src/java/org/apache/commons/cli2/WriteableCommandLine.java
deleted file mode 100644
index 64be37f..0000000
--- a/src/java/org/apache/commons/cli2/WriteableCommandLine.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/**
- * Copyright 2003-2004 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.commons.cli2;
-
-import java.util.List;
-
-/**
- * A CommandLine that detected values and options can be written to.
- */
-public interface WriteableCommandLine extends CommandLine {
-    
-    /**
-     * Adds an Option to the CommandLine
-     * @param option the Option to add
-     */
-    void addOption(final Option option);
-    
-    /**
-     * Adds a value to an Option in the CommandLine.
-     * @param option the Option to add to
-     * @param value the value to add
-     */
-    void addValue(final Option option, final Object value);
-
-    /**
-     * Sets the default values for an Option in the CommandLine
-     * @param option the Option to add to
-     * @param defaultValues the defaults for the option
-     */
-    void setDefaultValues(final Option option, final List defaultValues);
-    
-    /**
-     * Adds a switch value to an Option in the CommandLine.
-     * @param option the Option to add to
-     * @param value the switch value to add
-     * @throws IllegalStateException if the switch has already been added
-     */
-    void addSwitch(final Option option, final boolean value) throws IllegalStateException;
-    
-    /**
-     * Sets the default state for a Switch in the CommandLine.
-     * @param option the Option to add to
-     * @param defaultSwitch the defaults state for ths switch
-     */
-    void setDefaultSwitch(final Option option, final Boolean defaultSwitch);
-    
-    /**
-     * Adds a property value to a name in the CommandLine.
-     * Replaces any existing value for the property.
-     * 
-     * @param property the name of the property
-     * @param value the value of the property
-     */
-    void addProperty(final String property, final String value);
-    
-    /**
-     * Detects whether the argument looks like an Option trigger 
-     * @param argument the argument to test
-     * @return true if the argument looks like an Option trigger
-     */
-    boolean looksLikeOption(final String argument);
-}

http://git-wip-us.apache.org/repos/asf/commons-cli/blob/9e65354f/src/java/org/apache/commons/cli2/builder/ArgumentBuilder.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/cli2/builder/ArgumentBuilder.java b/src/java/org/apache/commons/cli2/builder/ArgumentBuilder.java
deleted file mode 100644
index f039993..0000000
--- a/src/java/org/apache/commons/cli2/builder/ArgumentBuilder.java
+++ /dev/null
@@ -1,285 +0,0 @@
-/*
- * Copyright 2003-2005 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.commons.cli2.builder;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.commons.cli2.Argument;
-import org.apache.commons.cli2.option.ArgumentImpl;
-import org.apache.commons.cli2.resource.ResourceConstants;
-import org.apache.commons.cli2.resource.ResourceHelper;
-import org.apache.commons.cli2.validation.Validator;
-
-/**
- * Builds Argument instances.
- */
-public class ArgumentBuilder {
-
-	/** i18n */
-	private final static ResourceHelper resources = ResourceHelper.getResourceHelper();
-	
-    /** name of the argument. Used for display and lookups in CommandLine */
-    private String name;
-
-    /** description of the argument. Used in the automated online help */
-    private String description;
-
-    /** minimum number of values required */
-    private int minimum;
-
-    /** maximum number of values permitted */
-    private int maximum;
-
-    /** character used to separate the values from the option */
-    private char initialSeparator;
-
-    /** character used to separate the values from each other */
-    private char subsequentSeparator;
-
-    /** object that should be used to ensure the values are valid */
-    private Validator validator;
-
-    /** used to identify the consume remaining option, typically "--" */
-    private String consumeRemaining;
-
-    /** default values for argument */
-    private List defaultValues;
-
-    /** id of the argument */
-    private int id;
-
-    /**
-     * Creates a new ArgumentBuilder instance
-     */
-    public ArgumentBuilder() {
-        reset();
-    }
-
-    /**
-     * Creates a new Argument instance using the options specified in this
-     * ArgumentBuilder.
-     * 
-     * @return A new Argument instance using the options specified in this
-     * ArgumentBuilder.
-     */
-    public final Argument create() {
-        final Argument argument =
-            new ArgumentImpl(
-                name,
-                description,
-                minimum,
-                maximum,
-                initialSeparator,
-                subsequentSeparator,
-                validator,
-                consumeRemaining,
-                defaultValues,
-                id);
-
-        reset();
-
-        return argument;
-    }
-
-    /**
-     * Resets the ArgumentBuilder to the defaults for a new Argument. The
-     * method is called automatically at the end of a create() call.
-     */
-    public final ArgumentBuilder reset() {
-        name = "arg";
-        description = null;
-        minimum = 0;
-        maximum = Integer.MAX_VALUE;
-        initialSeparator = ArgumentImpl.DEFAULT_INITIAL_SEPARATOR;
-        subsequentSeparator = ArgumentImpl.DEFAULT_SUBSEQUENT_SEPARATOR;
-        validator = null;
-        consumeRemaining = "--";
-        defaultValues = null;
-        id = 0;
-        return this;
-    }
-
-    /**
-     * Sets the name of the argument. The name is used when displaying usage
-     * information and to allow lookups in the CommandLine object.
-     * 
-     * @see org.apache.commons.cli2.CommandLine#getValue(String)
-     * 
-     * @param newName the name of the argument
-     * @return this ArgumentBuilder
-     */
-    public final ArgumentBuilder withName(final String newName) {
-    	if (newName == null) {
-    		throw new IllegalArgumentException(resources.getMessage(ResourceConstants.ARGUMENT_BUILDER_NULL_NAME));
-    	}
-    	if ("".equals(newName)) {
-    		throw new IllegalArgumentException(resources.getMessage(ResourceConstants.ARGUMENT_BUILDER_EMPTY_NAME));
-    	}
-        this.name = newName;
-        return this;
-    }
-
-    /**
-     * Sets the description of the argument.
-     * 
-     * The description is used when displaying online help.
-     * 
-     * @param newDescription a description of the argument
-     * @return this ArgumentBuilder
-     */
-    public final ArgumentBuilder withDescription(final String newDescription) {
-        this.description = newDescription;
-        return this;
-    }
-
-    /**
-     * Sets the minimum number of values needed for the argument to be valid.
-     * 
-     * @param newMinimum the number of values needed
-     * @return this ArgumentBuilder
-     */
-    public final ArgumentBuilder withMinimum(final int newMinimum) {
-    	if (newMinimum < 0) {
-    		throw new IllegalArgumentException(resources.getMessage(ResourceConstants.ARGUMENT_BUILDER_NEGATIVE_MINIMUM));
-    	}
-        this.minimum = newMinimum;
-        return this;
-    }
-
-    /**
-     * Sets the maximum number of values allowed for the argument to be valid.
-     * 
-     * @param newMaximum the number of values allowed
-     * @return this ArgumentBuilder
-     */
-    public final ArgumentBuilder withMaximum(final int newMaximum) {
-    	if (newMaximum < 0) {
-    		throw new IllegalArgumentException(resources.getMessage(ResourceConstants.ARGUMENT_BUILDER_NEGATIVE_MAXIMUM));
-    	}
-        this.maximum = newMaximum;
-        return this;
-    }
-
-    /**
-     * Sets the character used to separate the values from the option. When an
-     * argument is of the form -libs:dir1,dir2,dir3 the initialSeparator would
-     * be ':'.
-     * 
-     * @param newInitialSeparator the character used to separate the values 
-     * from the option
-     * @return this ArgumentBuilder
-     */
-    public final ArgumentBuilder withInitialSeparator(
-        final char newInitialSeparator) {
-
-        this.initialSeparator = newInitialSeparator;
-        return this;
-    }
-
-    /**
-     * Sets the character used to separate the values from each other. When an
-     * argument is of the form -libs:dir1,dir2,dir3 the subsequentSeparator
-     * would be ','.
-     * 
-     * @param newSubsequentSeparator the character used to separate the values 
-     * from each other
-     * @return this ArgumentBuilder
-     */
-    public final ArgumentBuilder withSubsequentSeparator(
-        final char newSubsequentSeparator) {
-
-        this.subsequentSeparator = newSubsequentSeparator;
-        return this;
-    }
-
-    /**
-     * Sets the validator instance used to perform validation on the Argument
-     * values.
-     * 
-     * @param newValidator a Validator instance
-     * @return this ArgumentBuilder
-     */
-    public final ArgumentBuilder withValidator(final Validator newValidator) {
-    	if (newValidator == null) {
-    		throw new IllegalArgumentException(resources.getMessage(ResourceConstants.ARGUMENT_BUILDER_NULL_VALIDATOR));
-    	}
-        this.validator = newValidator;
-        return this;
-    }
-
-    /**
-     * Sets the "consume remaining" option, defaults to "--". Use this if you
-     * want to allow values that might be confused with option strings.
-     * 
-     * @param newConsumeRemaining the string to use for the consume 
-     * remaining option
-     * @return this ArgumentBuilder
-     */
-    public final ArgumentBuilder withConsumeRemaining(final String newConsumeRemaining) {
-    	if (newConsumeRemaining == null) {
-    		throw new IllegalArgumentException(resources.getMessage(ResourceConstants.ARGUMENT_BUILDER_NULL_CONSUME_REMAINING));
-    	} 
-    	if ( "".equals(newConsumeRemaining)) {
-    		throw new IllegalArgumentException(resources.getMessage(ResourceConstants.ARGUMENT_BUILDER_EMPTY_CONSUME_REMAINING));
-    	}
-        this.consumeRemaining = newConsumeRemaining;
-        return this;
-    }
-
-    /**
-     * Sets the default value.
-     * 
-     * @param defaultValue the default value for the Argument
-     * @return this ArgumentBuilder
-     */
-    public final ArgumentBuilder withDefault(final Object defaultValue) {
-    	if (defaultValue == null) {
-    		throw new IllegalArgumentException(resources.getMessage(ResourceConstants.ARGUMENT_BUILDER_NULL_DEFAULT));
-    	}
-    	
-        if (this.defaultValues == null) {
-            this.defaultValues = new ArrayList(1);
-        }
-        this.defaultValues.add(defaultValue);
-        return this;
-    }
-
-    /**
-     * Sets the default values.
-     * 
-     * @param newDefaultValues the default values for the Argument
-     * @return this ArgumentBuilder
-     */
-    public final ArgumentBuilder withDefaults(final List newDefaultValues) {
-    	if (newDefaultValues == null) {
-    		throw new IllegalArgumentException(resources.getMessage(ResourceConstants.ARGUMENT_BUILDER_NULL_DEFAULTS));
-    	}
-        this.defaultValues = newDefaultValues;
-        return this;
-    }
-
-    /**
-     * Sets the id
-     * 
-     * @param newId the id of the Argument
-     * @return this ArgumentBuilder
-     */
-    public final ArgumentBuilder withId(final int newId) {
-        this.id = newId;
-        return this;
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-cli/blob/9e65354f/src/java/org/apache/commons/cli2/builder/CommandBuilder.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/cli2/builder/CommandBuilder.java b/src/java/org/apache/commons/cli2/builder/CommandBuilder.java
deleted file mode 100644
index 5a8a8a2..0000000
--- a/src/java/org/apache/commons/cli2/builder/CommandBuilder.java
+++ /dev/null
@@ -1,186 +0,0 @@
-/*
- * Copyright 2003-2005 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.commons.cli2.builder;
-
-import java.util.HashSet;
-import java.util.Set;
-
-import org.apache.commons.cli2.Argument;
-import org.apache.commons.cli2.Group;
-import org.apache.commons.cli2.option.Command;
-import org.apache.commons.cli2.resource.ResourceConstants;
-import org.apache.commons.cli2.resource.ResourceHelper;
-
-/**
- * Builds Command instances
- */
-public class CommandBuilder {
-    /** the preferred name of the command */
-    private String preferredName;
-
-    /** the description of the command */
-    private String description;
-
-    /** the aliases of the command */
-    private Set aliases;
-
-    /** whether the command is required or not */
-    private boolean required;
-
-    /** the argument of the command */
-    private Argument argument;
-
-    /** the children of the command */
-    private Group children;
-
-    /** the id of the command */
-    private int id;
-
-    /**
-     * Creates a new <code>CommandBuilder</code> instance.
-     */
-    public CommandBuilder() {
-        reset();
-    }
-
-    /**
-     * Creates a new <code>Command</code> instance using the properties of the
-     * <code>CommandBuilder</code>.
-     *
-     * @return the new Command instance
-     */
-    public Command create() {
-        // check we have a valid name
-        if (preferredName == null) {
-            throw new IllegalStateException(ResourceHelper.getResourceHelper().getMessage(ResourceConstants.OPTION_NO_NAME));
-        }
-
-        // build the command
-        final Command option =
-            new Command(preferredName, description, aliases, required, argument, children, id);
-
-        // reset the builder
-        reset();
-
-        return option;
-    }
-
-    /**
-     * Resets the CommandBuilder to the defaults for a new Command.
-     *
-     * This method is called automatically at the end of the
-     * {@link #create() create} method.
-     */
-    public CommandBuilder reset() {
-        preferredName = null;
-        description = null;
-        aliases = new HashSet();
-        required = false;
-        argument = null;
-        children = null;
-        id = 0;
-
-        return this;
-    }
-
-    /**
-     * Specifies the name for the next <code>Command</code>
-     * that is created.  The first name is used as the preferred
-     * display name for the <code>Command</code> and then
-     * later names are used as aliases.
-     *
-     * @param name the name for the next <code>Command</code>
-     * that is created.
-     * @return this <code>CommandBuilder</code>.
-     */
-    public CommandBuilder withName(final String name) {
-        if (preferredName == null) {
-            preferredName = name;
-        } else {
-            aliases.add(name);
-        }
-
-        return this;
-    }
-
-    /**
-     * Specifies the description for the next <code>Command</code>
-     * that is created.  This description is used to produce
-     * help documentation for the <code>Command</code>.
-     *
-     * @param newDescription the description for the next
-     * <code>Command</code> that is created.
-     * @return this <code>CommandBuilder</code>.
-     */
-    public CommandBuilder withDescription(final String newDescription) {
-        this.description = newDescription;
-
-        return this;
-    }
-
-    /**
-     * Specifies whether the next <code>Command</code> created is
-     * required or not.
-     * @param newRequired whether the next <code>Command</code> created is
-     * required or not.
-     * @return this <code>CommandBuilder</code>.
-     */
-    public CommandBuilder withRequired(final boolean newRequired) {
-        this.required = newRequired;
-
-        return this;
-    }
-
-    /**
-     * Specifies the children for the next <code>Command</code>
-     * that is created.
-     *
-     * @param newChildren the child options for the next <code>Command</code>
-     * that is created.
-     * @return this <code>CommandBuilder</code>.
-     */
-    public CommandBuilder withChildren(final Group newChildren) {
-        this.children = newChildren;
-
-        return this;
-    }
-
-    /**
-     * Specifies the argument for the next <code>Command</code>
-     * that is created.
-     *
-     * @param newArgument the argument for the next <code>Command</code>
-     * that is created.
-     * @return this <code>CommandBuilder</code>.
-     */
-    public CommandBuilder withArgument(final Argument newArgument) {
-        this.argument = newArgument;
-
-        return this;
-    }
-
-    /**
-     * Specifies the id for the next <code>Command</code> that is created.
-     *
-     * @param newId the id for the next <code>Command</code> that is created.
-     * @return this <code>CommandBuilder</code>.
-     */
-    public final CommandBuilder withId(final int newId) {
-        this.id = newId;
-
-        return this;
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-cli/blob/9e65354f/src/java/org/apache/commons/cli2/builder/DefaultOptionBuilder.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/cli2/builder/DefaultOptionBuilder.java b/src/java/org/apache/commons/cli2/builder/DefaultOptionBuilder.java
deleted file mode 100644
index bc172d8..0000000
--- a/src/java/org/apache/commons/cli2/builder/DefaultOptionBuilder.java
+++ /dev/null
@@ -1,214 +0,0 @@
-/*
- * Copyright 2003-2005 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.commons.cli2.builder;
-
-import java.util.HashSet;
-import java.util.Set;
-
-import org.apache.commons.cli2.Argument;
-import org.apache.commons.cli2.Group;
-import org.apache.commons.cli2.option.DefaultOption;
-import org.apache.commons.cli2.resource.ResourceConstants;
-import org.apache.commons.cli2.resource.ResourceHelper;
-
-/**
- * Builds DefaultOption instances.
- */
-public class DefaultOptionBuilder {
-    private final String shortPrefix;
-    private final String longPrefix;
-    private final boolean burstEnabled;
-    private String preferredName;
-    private Set aliases;
-    private Set burstAliases;
-    private boolean required;
-    private String description;
-    private Argument argument;
-    private Group children;
-    private int id;
-
-    /**
-     * Creates a new DefaultOptionBuilder using defaults
-     * @see DefaultOption#DEFAULT_SHORT_PREFIX
-     * @see DefaultOption#DEFAULT_LONG_PREFIX
-     * @see DefaultOption#DEFAULT_BURST_ENABLED
-     */
-    public DefaultOptionBuilder() {
-        this(DefaultOption.DEFAULT_SHORT_PREFIX, DefaultOption.DEFAULT_LONG_PREFIX,
-             DefaultOption.DEFAULT_BURST_ENABLED);
-    }
-
-    /**
-     * Creates a new DefaultOptionBuilder
-     * @param shortPrefix the prefix to use for short options
-     * @param longPrefix the prefix to use for long options
-     * @param burstEnabled whether to allow gnu style bursting
-     * @throws IllegalArgumentException if either prefix is less than on
-     *                                  character long
-     */
-    public DefaultOptionBuilder(final String shortPrefix,
-                                final String longPrefix,
-                                final boolean burstEnabled)
-        throws IllegalArgumentException {
-        if ((shortPrefix == null) || (shortPrefix.length() == 0)) {
-            throw new IllegalArgumentException(ResourceHelper.getResourceHelper().getMessage(ResourceConstants.OPTION_ILLEGAL_SHORT_PREFIX));
-        }
-
-        if ((longPrefix == null) || (longPrefix.length() == 0)) {
-            throw new IllegalArgumentException(ResourceHelper.getResourceHelper().getMessage(ResourceConstants.OPTION_ILLEGAL_LONG_PREFIX));
-        }
-
-        this.shortPrefix = shortPrefix;
-        this.longPrefix = longPrefix;
-        this.burstEnabled = burstEnabled;
-        reset();
-    }
-
-    /**
-     * Creates a DefaultOption instance
-     * @return the new instance
-     * @throws IllegalStateException if no names have been supplied
-     */
-    public DefaultOption create()
-        throws IllegalStateException {
-        if (preferredName == null) {
-            throw new IllegalStateException(ResourceHelper.getResourceHelper().getMessage(ResourceConstants.OPTION_NO_NAME));
-        }
-
-        final DefaultOption option =
-            new DefaultOption(shortPrefix, longPrefix, burstEnabled, preferredName, description,
-                              aliases, burstAliases, required, argument, children, id);
-
-        reset();
-
-        return option;
-    }
-
-    /**
-     * Resets the builder
-     */
-    public DefaultOptionBuilder reset() {
-        preferredName = null;
-        description = null;
-        aliases = new HashSet();
-        burstAliases = new HashSet();
-        required = false;
-        argument = null;
-        children = null;
-        id = 0;
-
-        return this;
-    }
-
-    /**
-     * Use this short option name. The first name is used as the preferred
-     * display name for the Command and then later names are used as aliases.
-     *
-     * @param shortName the name to use
-     * @return this builder
-     */
-    public DefaultOptionBuilder withShortName(final String shortName) {
-        final String name = shortPrefix + shortName;
-
-        if (preferredName == null) {
-            preferredName = name;
-        } else {
-            aliases.add(name);
-        }
-
-        if (burstEnabled && (name.length() == (shortPrefix.length() + 1))) {
-            burstAliases.add(name);
-        }
-
-        return this;
-    }
-
-    /**
-     * Use this long option name.  The first name is used as the preferred
-     * display name for the Command and then later names are used as aliases.
-     *
-     * @param longName the name to use
-     * @return this builder
-     */
-    public DefaultOptionBuilder withLongName(final String longName) {
-        final String name = longPrefix + longName;
-
-        if (preferredName == null) {
-            preferredName = name;
-        } else {
-            aliases.add(name);
-        }
-
-        return this;
-    }
-
-    /**
-     * Use this option description
-     * @param newDescription the description to use
-     * @return this builder
-     */
-    public DefaultOptionBuilder withDescription(final String newDescription) {
-        this.description = newDescription;
-
-        return this;
-    }
-
-    /**
-     * Use this optionality
-     * @param newRequired true iff the Option is required
-     * @return this builder
-     */
-    public DefaultOptionBuilder withRequired(final boolean newRequired) {
-        this.required = newRequired;
-
-        return this;
-    }
-
-    /**
-     * Use this child Group
-     * @param newChildren the child Group to use
-     * @return this builder
-     */
-    public DefaultOptionBuilder withChildren(final Group newChildren) {
-        this.children = newChildren;
-
-        return this;
-    }
-
-    /**
-     * Use this Argument
-     * @param newArgument the argument to use
-     * @return this builder
-     */
-    public DefaultOptionBuilder withArgument(final Argument newArgument) {
-        this.argument = newArgument;
-
-        return this;
-    }
-
-    /**
-     * Sets the id
-     *
-     * @param newId
-     *            the id of the DefaultOption
-     * @return this DefaultOptionBuilder
-     */
-    public final DefaultOptionBuilder withId(final int newId) {
-        this.id = newId;
-
-        return this;
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-cli/blob/9e65354f/src/java/org/apache/commons/cli2/builder/GroupBuilder.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/cli2/builder/GroupBuilder.java b/src/java/org/apache/commons/cli2/builder/GroupBuilder.java
deleted file mode 100644
index a375539..0000000
--- a/src/java/org/apache/commons/cli2/builder/GroupBuilder.java
+++ /dev/null
@@ -1,117 +0,0 @@
-/**
- * Copyright 2003-2004 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.commons.cli2.builder;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.commons.cli2.Group;
-import org.apache.commons.cli2.Option;
-import org.apache.commons.cli2.option.GroupImpl;
-
-/**
- * Builds Group instances
- */
-public class GroupBuilder {
-
-    private String name;
-    private String description;
-    private List options;
-    private int minimum;
-    private int maximum;
-
-    /**
-     * Creates a new GroupBuilder
-     */
-    public GroupBuilder() {
-        reset();
-    }
-
-    /**
-     * Creates a new Group instance
-     * @return the new Group instance
-     */
-    public Group create() {
-        final GroupImpl group =
-            new GroupImpl(options, name, description, minimum, maximum);
-
-        reset();
-
-        return group;
-    }
-
-    /**
-     * Resets the builder
-     */
-    public GroupBuilder reset() {
-        name = null;
-        description = null;
-        options = new ArrayList();
-        minimum = 0;
-        maximum = Integer.MAX_VALUE;
-        return this;
-    }
-
-    /**
-     * Use this option description
-     * @param newDescription the description to use
-     * @return this builder
-     */
-    public GroupBuilder withDescription(final String newDescription) {
-        this.description = newDescription;
-        return this;
-    }
-
-    /**
-     * Use this option name
-     * @param newName the name to use
-     * @return this builder
-     */
-    public GroupBuilder withName(final String newName) {
-        this.name = newName;
-        return this;
-    }
-
-    /**
-     * A valid group requires at least this many options present
-     * @param newMinimum the minimum Options required
-     * @return this builder
-     */
-    public GroupBuilder withMinimum(final int newMinimum) {
-        this.minimum = newMinimum;
-        return this;
-    }
-
-    /**
-     * A valid group requires at most this many options present
-     * @param newMaximum the maximum Options allowed
-     * @return this builder
-     */
-    public GroupBuilder withMaximum(final int newMaximum) {
-        this.maximum = newMaximum;
-        return this;
-    }
-
-    /**
-     * Add this option to the group
-     * @param option the Option to add
-     * @return this builder
-     */
-    public GroupBuilder withOption(final Option option) {
-        this.options.add(option);
-        return this;
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-cli/blob/9e65354f/src/java/org/apache/commons/cli2/builder/PatternBuilder.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/cli2/builder/PatternBuilder.java b/src/java/org/apache/commons/cli2/builder/PatternBuilder.java
deleted file mode 100644
index 1bb9bc8..0000000
--- a/src/java/org/apache/commons/cli2/builder/PatternBuilder.java
+++ /dev/null
@@ -1,201 +0,0 @@
-/**
- * Copyright 2003-2004 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.commons.cli2.builder;
-
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Set;
-
-import org.apache.commons.cli2.Argument;
-import org.apache.commons.cli2.Option;
-import org.apache.commons.cli2.validation.ClassValidator;
-import org.apache.commons.cli2.validation.DateValidator;
-import org.apache.commons.cli2.validation.FileValidator;
-import org.apache.commons.cli2.validation.NumberValidator;
-import org.apache.commons.cli2.validation.UrlValidator;
-import org.apache.commons.cli2.validation.Validator;
-
-/**
- * Builds Options using a String pattern
- */
-//TODO Document and link to the acceptable patterns
-public class PatternBuilder {
-
-    private final GroupBuilder gbuilder;
-    private final DefaultOptionBuilder obuilder;
-    private final ArgumentBuilder abuilder;
-
-    /**
-     * Creates a new PatternBuilder
-     */
-    public PatternBuilder() {
-        this(
-            new GroupBuilder(),
-            new DefaultOptionBuilder(),
-            new ArgumentBuilder());
-    }
-
-    /**
-     * Creates a new PatternBuilder
-     * @param gbuilder the GroupBuilder to use
-     * @param obuilder the DefaultOptionBuilder to use
-     * @param abuilder the ArgumentBuilder to use
-     */
-    public PatternBuilder(
-        final GroupBuilder gbuilder,
-        final DefaultOptionBuilder obuilder,
-        final ArgumentBuilder abuilder) {
-        this.gbuilder = gbuilder;
-        this.obuilder = obuilder;
-        this.abuilder = abuilder;
-    }
-
-    private final Set options = new HashSet();
-
-    /**
-     * Creates a new Option instance.
-     * @return a new Option instance
-     */
-    public Option create() {
-        final Option option;
-
-        if (options.size() == 1) {
-            option = (Option)options.iterator().next();
-        }
-        else {
-            gbuilder.reset();
-            for (final Iterator i = options.iterator(); i.hasNext();) {
-                gbuilder.withOption((Option)i.next());
-            }
-            option = gbuilder.create();
-        }
-
-        reset();
-
-        return option;
-    }
-
-    /**
-     * Resets this builder
-     */
-    public PatternBuilder reset() {
-        options.clear();
-        return this;
-    }
-
-    private void createOption(
-        final char type,
-        final boolean required,
-        final char opt) {
-        final Argument argument;
-        if (type != ' ') {
-            abuilder.reset();
-            abuilder.withValidator(validator(type));
-            if (required) {
-                abuilder.withMinimum(1);
-            }
-            if (type != '*') {
-                abuilder.withMaximum(1);
-            }
-            argument = abuilder.create();
-        }
-        else {
-            argument = null;
-        }
-
-        obuilder.reset();
-        obuilder.withArgument(argument);
-        obuilder.withShortName(String.valueOf(opt));
-        obuilder.withRequired(required);
-
-        options.add(obuilder.create());
-    }
-
-    /**
-     * Builds an Option using a pattern string.
-     * @param pattern the pattern to build from
-     */
-    public void withPattern(final String pattern) {
-        int sz = pattern.length();
-
-        char opt = ' ';
-        char ch = ' ';
-        char type = ' ';
-        boolean required = false;
-
-        for (int i = 0; i < sz; i++) {
-            ch = pattern.charAt(i);
-
-            switch (ch) {
-                case '!' :
-                    required = true;
-                    break;
-                case '@' :
-                case ':' :
-                case '%' :
-                case '+' :
-                case '#' :
-                case '<' :
-                case '>' :
-                case '*' :
-                case '/' :
-                    type = ch;
-                    break;
-                default :
-                    if (opt != ' ') {
-                        createOption(type, required, opt);
-                        required = false;
-                        type = ' ';
-                    }
-
-                    opt = ch;
-            }
-        }
-
-        if (opt != ' ') {
-            createOption(type, required, opt);
-        }
-    }
-
-    private static Validator validator(final char c) {
-        switch (c) {
-            case '@' :
-                final ClassValidator classv = new ClassValidator();
-                classv.setInstance(true);
-                return classv;
-            case '+' :
-                final ClassValidator instancev = new ClassValidator();
-                return instancev;
-                //case ':':// no validator needed for a string
-            case '%' :
-                return NumberValidator.getNumberInstance();
-            case '#' :
-                return DateValidator.getDateInstance();
-            case '<' :
-                final FileValidator existingv = new FileValidator();
-                existingv.setExisting(true);
-                existingv.setFile(true);
-                return existingv;
-            case '>' :
-            case '*' :
-                return new FileValidator();
-            case '/' :
-                return new UrlValidator();
-            default :
-                return null;
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-cli/blob/9e65354f/src/java/org/apache/commons/cli2/builder/SwitchBuilder.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/cli2/builder/SwitchBuilder.java b/src/java/org/apache/commons/cli2/builder/SwitchBuilder.java
deleted file mode 100644
index 0baab08..0000000
--- a/src/java/org/apache/commons/cli2/builder/SwitchBuilder.java
+++ /dev/null
@@ -1,193 +0,0 @@
-/*
- * Copyright 2003-2005 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.commons.cli2.builder;
-
-import java.util.HashSet;
-import java.util.Set;
-
-import org.apache.commons.cli2.Argument;
-import org.apache.commons.cli2.Group;
-import org.apache.commons.cli2.option.Switch;
-import org.apache.commons.cli2.resource.ResourceConstants;
-import org.apache.commons.cli2.resource.ResourceHelper;
-
-/**
- * Builds Switch instance.
- */
-public class SwitchBuilder {
-    private final String enabledPrefix;
-    private final String disabledPrefix;
-    private String description;
-    private String preferredName;
-    private Set aliases;
-    private boolean required;
-    private Argument argument;
-    private Group children;
-    private int id;
-    private Boolean switchDefault;
-
-    /**
-     * Creates a new SwitchBuilder using defaults.
-     * @see Switch#DEFAULT_ENABLED_PREFIX
-     * @see Switch#DEFAULT_DISABLED_PREFIX
-     */
-    public SwitchBuilder() {
-        this(Switch.DEFAULT_ENABLED_PREFIX, Switch.DEFAULT_DISABLED_PREFIX);
-    }
-
-    /**
-     * Creates a new SwitchBuilder
-     * @param enabledPrefix the prefix to use for enabling the option
-     * @param disabledPrefix the prefix to use for disabling the option
-     * @throws IllegalArgumentException if either prefix is less than 1
-     *                                  character long or the prefixes match
-     */
-    public SwitchBuilder(final String enabledPrefix,
-                         final String disabledPrefix)
-        throws IllegalArgumentException {
-        if ((enabledPrefix == null) || (enabledPrefix.length() < 1)) {
-            throw new IllegalArgumentException(ResourceHelper.getResourceHelper().getMessage(ResourceConstants.SWITCH_ILLEGAL_ENABLED_PREFIX));
-        }
-
-        if ((disabledPrefix == null) || (disabledPrefix.length() < 1)) {
-            throw new IllegalArgumentException(ResourceHelper.getResourceHelper().getMessage(ResourceConstants.SWITCH_ILLEGAL_DISABLED_PREFIX));
-        }
-
-        if (enabledPrefix.equals(disabledPrefix)) {
-            throw new IllegalArgumentException(ResourceHelper.getResourceHelper().getMessage(ResourceConstants.SWITCH_IDENTICAL_PREFIXES));
-        }
-
-        this.enabledPrefix = enabledPrefix;
-        this.disabledPrefix = disabledPrefix;
-        reset();
-    }
-
-    /**
-     * Creates a new Switch instance
-     * @return a new Switch instance
-     */
-    public Switch create() {
-        final Switch option =
-            new Switch(enabledPrefix, disabledPrefix, preferredName, aliases, description,
-                       required, argument, children, id, switchDefault);
-
-        reset();
-
-        return option;
-    }
-
-    /**
-     * Resets the builder
-     */
-    public SwitchBuilder reset() {
-        description = null;
-        preferredName = null;
-        required = false;
-        aliases = new HashSet();
-        argument = null;
-        children = null;
-        id = 0;
-        switchDefault = null;
-
-        return this;
-    }
-
-    /**
-     * Use this option description
-     * @param newDescription the description to use
-     * @return this builder
-     */
-    public SwitchBuilder withDescription(final String newDescription) {
-        this.description = newDescription;
-
-        return this;
-    }
-
-    /**
-     * Use this option name. The first name is used as the preferred
-     * display name for the Command and then later names are used as aliases.
-     *
-     * @param name the name to use
-     * @return this builder
-     */
-    public SwitchBuilder withName(final String name) {
-        if (preferredName == null) {
-            preferredName = name;
-        } else {
-            aliases.add(name);
-        }
-
-        return this;
-    }
-
-    /**
-     * Use this optionality
-     * @param newRequired true iff the Option is required
-     * @return this builder
-     */
-    public SwitchBuilder withRequired(final boolean newRequired) {
-        this.required = newRequired;
-
-        return this;
-    }
-
-    /**
-     * Use this Argument
-     * @param newArgument the argument to use
-     * @return this builder
-     */
-    public SwitchBuilder withArgument(final Argument newArgument) {
-        this.argument = newArgument;
-
-        return this;
-    }
-
-    /**
-     * Use this child Group
-     * @param newChildren the child Group to use
-     * @return this builder
-     */
-    public SwitchBuilder withChildren(final Group newChildren) {
-        this.children = newChildren;
-
-        return this;
-    }
-
-    /**
-     * Sets the id
-     *
-     * @param newId
-     *            the id of the Switch
-     * @return this SwitchBuilder
-     */
-    public final SwitchBuilder withId(final int newId) {
-        this.id = newId;
-
-        return this;
-    }
-
-    /**
-     * Sets the default state for this switch
-     *
-     * @param newSwitchDefault the default state
-     * @return this SwitchBuilder
-     */
-    public final SwitchBuilder withSwitchDefault(final Boolean newSwitchDefault) {
-        this.switchDefault = newSwitchDefault;
-
-        return this;
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-cli/blob/9e65354f/src/java/org/apache/commons/cli2/commandline/CommandLineImpl.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/cli2/commandline/CommandLineImpl.java b/src/java/org/apache/commons/cli2/commandline/CommandLineImpl.java
deleted file mode 100644
index dd9abef..0000000
--- a/src/java/org/apache/commons/cli2/commandline/CommandLineImpl.java
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- * Copyright 2003-2005 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.commons.cli2.commandline;
-
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.List;
-
-import org.apache.commons.cli2.CommandLine;
-import org.apache.commons.cli2.Option;
-import org.apache.commons.cli2.resource.ResourceConstants;
-import org.apache.commons.cli2.resource.ResourceHelper;
-
-/**
- * Instances of CommandLine represent a command line that has been processed
- * according to the definition supplied to the parser.
- */
-public abstract class CommandLineImpl implements CommandLine {
-    public final boolean hasOption(final String trigger) {
-        return hasOption(getOption(trigger));
-    }
-
-    public final List getValues(final String trigger) {
-        return getValues(getOption(trigger), Collections.EMPTY_LIST);
-    }
-
-    public final List getValues(final String trigger,
-                                final List defaultValues) {
-        return getValues(getOption(trigger), defaultValues);
-    }
-
-    public final List getValues(final Option option) {
-        return getValues(option, Collections.EMPTY_LIST);
-    }
-
-    public final Object getValue(final String trigger) {
-        return getValue(getOption(trigger), null);
-    }
-
-    public final Object getValue(final String trigger,
-                                 final Object defaultValue) {
-        return getValue(getOption(trigger), defaultValue);
-    }
-
-    public final Object getValue(final Option option) {
-        return getValue(option, null);
-    }
-
-    public final Object getValue(final Option option,
-                                 final Object defaultValue) {
-        final List values;
-
-        if (defaultValue == null) {
-            values = getValues(option);
-        } else {
-            values = getValues(option, Collections.singletonList(defaultValue));
-        }
-
-        if (values.size() > 1) {
-            throw new IllegalStateException(ResourceHelper.getResourceHelper().getMessage(ResourceConstants.ARGUMENT_TOO_MANY_VALUES));
-        }
-
-        if (values.isEmpty()) {
-            return defaultValue;
-        }
-
-        return values.get(0);
-    }
-
-    public final Boolean getSwitch(final String trigger) {
-        return getSwitch(getOption(trigger), null);
-    }
-
-    public final Boolean getSwitch(final String trigger,
-                                   final Boolean defaultValue) {
-        return getSwitch(getOption(trigger), defaultValue);
-    }
-
-    public final Boolean getSwitch(final Option option) {
-        return getSwitch(option, null);
-    }
-
-    public final String getProperty(final String property) {
-        return getProperty(property, null);
-    }
-
-    public final int getOptionCount(final String trigger) {
-        return getOptionCount(getOption(trigger));
-    }
-
-    public final int getOptionCount(final Option option) {
-        if (option == null) {
-            return 0;
-        }
-
-        int count = 0;
-
-        for (Iterator i = getOptions().iterator(); i.hasNext();) {
-            if (option.equals(i.next())) {
-                ++count;
-            }
-        }
-
-        return count;
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-cli/blob/9e65354f/src/java/org/apache/commons/cli2/commandline/DefaultingCommandLine.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/cli2/commandline/DefaultingCommandLine.java b/src/java/org/apache/commons/cli2/commandline/DefaultingCommandLine.java
deleted file mode 100644
index 153f32d..0000000
--- a/src/java/org/apache/commons/cli2/commandline/DefaultingCommandLine.java
+++ /dev/null
@@ -1,171 +0,0 @@
-/**
- * Copyright 2004 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.commons.cli2.commandline;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-
-import org.apache.commons.cli2.CommandLine;
-import org.apache.commons.cli2.Option;
-
-/**
- * Manages a queue of default CommandLines. This CommandLine implementation is
- * backed by a queue of CommandLine instances which are queried in turn until a
- * suitable result is found.
- * 
- * CommandLine instances can either be added to the back of the queue or can be
- * pushed in at a specific position.
- * 
- * @see #appendCommandLine(CommandLine)
- * @see #insertCommandLine(int, CommandLine)
- */
-public class DefaultingCommandLine extends CommandLineImpl {
-
-    /**
-     * The list of default CommandLine instances
-     */
-    private final List commandLines = new ArrayList();
-
-    /**
-     * Adds a CommandLine instance to the back of the queue. The supplied
-     * CommandLine will be used as defaults when all other CommandLines produce
-     * no result
-     * 
-     * @param commandLine
-     *            the default values to use if all CommandLines
-     */
-    public void appendCommandLine(final CommandLine commandLine) {
-        commandLines.add(commandLine);
-    }
-    
-    /**
-     * Adds a CommandLine instance to a specified position in the queue.
-     * 
-     * @param index ths position at which to insert
-     * @param commandLine the CommandLine to insert
-     */
-    public void insertCommandLine(
-        final int index,
-        final CommandLine commandLine) {
-        commandLines.add(index, commandLine);
-    }
-    
-    /**
-     * Builds an iterator over the build in CommandLines.
-     * 
-     * @return an unmodifiable iterator
-     */
-    public Iterator commandLines(){
-    	return Collections.unmodifiableList(commandLines).iterator();
-    }
-
-    public Option getOption(String trigger) {
-        for (final Iterator i = commandLines.iterator(); i.hasNext();) {
-            final CommandLine commandLine = (CommandLine)i.next();
-            final Option actual = commandLine.getOption(trigger);
-            if (actual != null) {
-                return actual;
-            }
-        }
-        return null;
-    }
-
-    public List getOptions() {
-        final List options = new ArrayList();
-
-        final List temp = new ArrayList();
-        for (final Iterator i = commandLines.iterator(); i.hasNext();) {
-            final CommandLine commandLine = (CommandLine)i.next();
-            temp.clear();
-            temp.addAll(commandLine.getOptions());
-            temp.removeAll(options);
-            options.addAll(temp);
-        }
-
-        return Collections.unmodifiableList(options);
-    }
-
-    public Set getOptionTriggers() {
-        final Set all = new HashSet();
-        for (final Iterator i = commandLines.iterator(); i.hasNext();) {
-            final CommandLine commandLine = (CommandLine)i.next();
-            all.addAll(commandLine.getOptionTriggers());
-        }
-
-        return Collections.unmodifiableSet(all);
-    }
-
-    public boolean hasOption(Option option) {
-        for (final Iterator i = commandLines.iterator(); i.hasNext();) {
-            final CommandLine commandLine = (CommandLine)i.next();
-            if (commandLine.hasOption(option)) {
-                return true;
-            }
-        }
-        return false;
-    }
-
-    public List getValues(Option option, List defaultValues) {
-        for (final Iterator i = commandLines.iterator(); i.hasNext();) {
-            final CommandLine commandLine = (CommandLine)i.next();
-            final List actual = commandLine.getValues(option);
-            if (actual != null && !actual.isEmpty()) {
-                return actual;
-            }
-        }
-        if(defaultValues==null){
-        	return Collections.EMPTY_LIST;
-        }
-        else{
-        	return defaultValues;
-        }
-    }
-
-    public Boolean getSwitch(Option option, Boolean defaultValue) {
-        for (final Iterator i = commandLines.iterator(); i.hasNext();) {
-            final CommandLine commandLine = (CommandLine)i.next();
-            final Boolean actual = commandLine.getSwitch(option);
-            if (actual != null) {
-                return actual;
-            }
-        }
-        return defaultValue;
-    }
-
-    public String getProperty(String property, String defaultValue) {
-        for (final Iterator i = commandLines.iterator(); i.hasNext();) {
-            final CommandLine commandLine = (CommandLine)i.next();
-            final String actual = commandLine.getProperty(property);
-            if (actual != null) {
-                return actual;
-            }
-        }
-        return defaultValue;
-    }
-
-    public Set getProperties() {
-        final Set all = new HashSet();
-        for (final Iterator i = commandLines.iterator(); i.hasNext();) {
-            final CommandLine commandLine = (CommandLine)i.next();
-            all.addAll(commandLine.getProperties());
-        }
-        return Collections.unmodifiableSet(all);
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-cli/blob/9e65354f/src/java/org/apache/commons/cli2/commandline/Parser.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/cli2/commandline/Parser.java b/src/java/org/apache/commons/cli2/commandline/Parser.java
deleted file mode 100644
index 3adbc47..0000000
--- a/src/java/org/apache/commons/cli2/commandline/Parser.java
+++ /dev/null
@@ -1,177 +0,0 @@
-/*
- * Copyright 2003-2005 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.commons.cli2.commandline;
-
-import java.io.IOException;
-
-import java.util.LinkedList;
-import java.util.List;
-import java.util.ListIterator;
-
-import org.apache.commons.cli2.CommandLine;
-import org.apache.commons.cli2.Group;
-import org.apache.commons.cli2.Option;
-import org.apache.commons.cli2.OptionException;
-import org.apache.commons.cli2.WriteableCommandLine;
-import org.apache.commons.cli2.resource.ResourceConstants;
-import org.apache.commons.cli2.util.HelpFormatter;
-
-/**
- * A class that implements the <code>Parser</code> interface can parse a
- * String array according to the {@link Group}specified and return a
- * {@link CommandLine}.
- *
- * @author John Keyes (john at integralsource.com)
- */
-public class Parser {
-    private HelpFormatter helpFormatter = new HelpFormatter();
-    private Option helpOption = null;
-    private String helpTrigger = null;
-    private Group group = null;
-
-    /**
-     * Parse the arguments according to the specified options and properties.
-     *
-     * @param arguments
-     *            the command line arguments
-     *
-     * @return the list of atomic option and value tokens
-     * @throws OptionException
-     *             if there are any problems encountered while parsing the
-     *             command line tokens.
-     */
-    public CommandLine parse(final String[] arguments)
-        throws OptionException {
-        // build a mutable list for the arguments
-        final List argumentList = new LinkedList();
-
-        // copy the arguments into the new list
-        for (int i = 0; i < arguments.length; i++) {
-            final String argument = arguments[i];
-
-            // ensure non intern'd strings are used 
-            // so that == comparisons work as expected
-            argumentList.add(new String(argument));
-        }
-
-        // wet up a command line for this group
-        final WriteableCommandLine commandLine = new WriteableCommandLineImpl(group, argumentList);
-
-        // pick up any defaults from the model
-        group.defaults(commandLine);
-
-        // process the options as far as possible
-        final ListIterator iterator = argumentList.listIterator();
-        Object previous = null;
-
-        while (group.canProcess(commandLine, iterator)) {
-            // peek at the next item and backtrack
-            final Object next = iterator.next();
-            iterator.previous();
-
-            // if we have just tried to process this instance
-            if (next == previous) {
-                // abort
-                break;
-            }
-
-            // remember previous
-            previous = next;
-
-            group.process(commandLine, iterator);
-        }
-
-        // if there are more arguments we have a problem
-        if (iterator.hasNext()) {
-            final String arg = (String) iterator.next();
-            throw new OptionException(group, ResourceConstants.UNEXPECTED_TOKEN, arg);
-        }
-
-        // no need to validate if the help option is present
-        if (!commandLine.hasOption(helpOption) && !commandLine.hasOption(helpTrigger)) {
-            group.validate(commandLine);
-        }
-
-        return commandLine;
-    }
-
-    /**
-     * Parse the arguments according to the specified options and properties and
-     * displays the usage screen if the CommandLine is not valid or the help
-     * option was specified.
-     *
-     * @param arguments the command line arguments
-     * @return a valid CommandLine or null if the parse was unsuccessful
-     * @throws IOException if an error occurs while formatting help
-     */
-    public CommandLine parseAndHelp(final String[] arguments) {
-        helpFormatter.setGroup(group);
-
-        try {
-            // attempt to parse the command line
-            final CommandLine commandLine = parse(arguments);
-
-            if (!commandLine.hasOption(helpOption) && !commandLine.hasOption(helpTrigger)) {
-                return commandLine;
-            }
-        } catch (final OptionException oe) {
-            // display help regarding the exception
-            helpFormatter.setException(oe);
-        }
-
-        // print help
-        helpFormatter.print();
-
-        return null;
-    }
-
-    /**
-     * Sets the Group of options to parse against
-     * @param group the group of options to parse against
-     */
-    public void setGroup(final Group group) {
-        this.group = group;
-    }
-
-    /**
-     * Sets the HelpFormatter to use with the simplified parsing.
-     * @see #parseAndHelp(String[])
-     * @param helpFormatter the HelpFormatter to use with the simplified parsing
-     */
-    public void setHelpFormatter(final HelpFormatter helpFormatter) {
-        this.helpFormatter = helpFormatter;
-    }
-
-    /**
-     * Sets the help option to use with the simplified parsing.  For example
-     * <code>--help</code>, <code>-h</code> and <code>-?</code> are often used.
-     * @see #parseAndHelp(String[])
-     * @param helpOption the help Option
-     */
-    public void setHelpOption(final Option helpOption) {
-        this.helpOption = helpOption;
-    }
-
-    /**
-     * Sets the help option to use with the simplified parsing.  For example
-     * <code>--help</code>, <code>-h</code> and <code>-?</code> are often used.
-     * @see #parseAndHelp(String[])
-     * @param helpTrigger the trigger of the help Option
-     */
-    public void setHelpTrigger(final String helpTrigger) {
-        this.helpTrigger = helpTrigger;
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-cli/blob/9e65354f/src/java/org/apache/commons/cli2/commandline/PreferencesCommandLine.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/commons/cli2/commandline/PreferencesCommandLine.java b/src/java/org/apache/commons/cli2/commandline/PreferencesCommandLine.java
deleted file mode 100644
index ddfa828..0000000
--- a/src/java/org/apache/commons/cli2/commandline/PreferencesCommandLine.java
+++ /dev/null
@@ -1,169 +0,0 @@
-/**
- * Copyright 2004 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.commons.cli2.commandline;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-import java.util.StringTokenizer;
-import java.util.prefs.BackingStoreException;
-import java.util.prefs.Preferences;
-
-import org.apache.commons.cli2.Option;
-
-/**
- * A CommandLine implementation using the Preferences API, useful when
- * constructing a complex DefaultingCommandLine
- *
- * This implementation uses the children of a single preference node to populate
- * the CommandLine.  Options are keyed from their preferred name and presence in
- * the Preferences object is taken as presence in the CommandLine.  Argument
- * values are taken from the Preference value and are optionally separated using
- * the separator char defined, at construction time.  Switch values can be
- * specified using a simple value of <code>true</code> or <code>false</code>;
- * obviously this means that Switches with Arguments are not supported by this
- * implementation.
- *
- * @see java.util.prefs.Preferences
- * @see org.apache.commons.cli2.commandline.DefaultingCommandLine
- * @see org.apache.commons.cli2.Option#getPreferredName() 
- */
-public class PreferencesCommandLine extends CommandLineImpl {
-	
-	private static final char NUL = '\0';
-	private final Preferences preferences;
-	private final Option root;
-	private final char separator;
-	
-	/**
-     * Creates a new PreferencesCommandLine using the specified root Option and
-     * Preferences node.  Argument values will be separated using the char 0.
-     * 
-	 * @param root the CommandLine's root Option
-	 * @param preferences the Preferences node to get values from
-	 */
-	public PreferencesCommandLine(final Option root, final Preferences preferences){
-		this(root,preferences,NUL);
-	}
-	
-    /**
-     * Creates a new PreferencesCommandLine using the specified root Option,
-     * Preferences node and value separator.
-     * 
-     * @param root the CommandLine's root Option
-     * @param preferences the Preferences node to get values from
-     * @param separator the character to split argument values
-     */
-	public PreferencesCommandLine(final Option root, final Preferences preferences, final char separator){
-		this.root = root;
-		this.preferences = preferences;
-		this.separator = separator;
-	}
-	
-	public boolean hasOption(Option option) {
-		if(option==null){
-			return false;
-		}
-		else{
-			try {
-				return Arrays.asList(preferences.keys()).contains(option.getPreferredName());
-			} catch (BackingStoreException e) {
-				return false;
-			}
-		}
-	}
-
-	public Option getOption(String trigger) {
-		return root.findOption(trigger);
-	}
-
-	public List getValues(final Option option, final List defaultValues) {
-		final String value = preferences.get(option.getPreferredName(),null);
-		
-		if(value==null){
-			return defaultValues;
-		}
-		else if(separator>NUL){
-			final List values = new ArrayList();
-			final StringTokenizer tokens = new StringTokenizer(value,String.valueOf(separator));
-			
-			while(tokens.hasMoreTokens()){
-				values.add(tokens.nextToken());
-			}
-			
-			return values;
-		}
-		else{
-			return Collections.singletonList(value);
-		}
-	}
-
-	public Boolean getSwitch(final Option option, final Boolean defaultValue) {
-		final String value = preferences.get(option.getPreferredName(),null);
-		if("true".equals(value)){
-			return Boolean.TRUE;
-		}
-		else if("false".equals(value)){
-			return Boolean.FALSE;
-		}
-		else{
-			return defaultValue;
-		}
-	}
-	
-	public String getProperty(final String property, final String defaultValue) {
-		return preferences.get(property, defaultValue);
-	}
-
-	public Set getProperties() {
-		try {
-			return new HashSet(Arrays.asList(preferences.keys()));
-		} catch (BackingStoreException e) {
-			return Collections.EMPTY_SET;
-		}
-	}
-
-	public List getOptions() {
-		try {
-			final List options = new ArrayList();
-			final Iterator keys = Arrays.asList(preferences.keys()).iterator();
-			while (keys.hasNext()) {
-				final String trigger = (String) keys.next();
-				final Option option = root.findOption(trigger);
-				if (option != null) {
-					options.add(option);
-				}
-			}
-			return Collections.unmodifiableList(options);
-		} catch (BackingStoreException e) {
-			return Collections.EMPTY_LIST;
-		}
-	}
-
-	public Set getOptionTriggers() {
-		final Set triggers = new HashSet();
-		final Iterator options = getOptions().iterator();
-		while(options.hasNext()){
-			final Option option = (Option)options.next();
-			triggers.addAll(option.getTriggers());
-		}
-		return Collections.unmodifiableSet(triggers);
-	}
-}


Mime
View raw message