Example usage for org.apache.commons.cli2.validation InvalidArgumentException InvalidArgumentException

List of usage examples for org.apache.commons.cli2.validation InvalidArgumentException InvalidArgumentException

Introduction

In this page you can find the example usage for org.apache.commons.cli2.validation InvalidArgumentException InvalidArgumentException.

Prototype

public InvalidArgumentException(final String message) 

Source Link

Document

Creates a new exception

Usage

From source file:it.geosolutions.utils.db.Gml2Orcl.java

@Override
protected void buildOptions() {

    // /////////////////////////////////////////////////////////////////////
    // Options for the command line
    // /////////////////////////////////////////////////////////////////////
    gmlfileOpt = optionBuilder.withShortName("s").withLongName("gmlfile")
            .withArgument(argumentBuilder.withName("filename").withMinimum(1).withMaximum(1).create())
            .withDescription("gmlfile to import").withRequired(true).create();
    inputCrsOpt = optionBuilder.withShortName("c").withLongName("crs")
            .withArgument(argumentBuilder.withName("crscode").withMinimum(1).withMaximum(1).create())
            .withDescription("crscode, e.g. EPSG:4326").withRequired(false).create();

    hostnameOpt = optionBuilder.withShortName("H").withLongName("hostname")
            .withArgument(argumentBuilder.withName("hostname").withMinimum(1).withMaximum(1).create())
            .withDescription("database host").withRequired(true).create();
    databaseOpt = optionBuilder.withShortName("d").withShortName("db").withLongName("database")
            .withArgument(argumentBuilder.withName("dbname").withMinimum(1).withMaximum(1).create())
            .withDescription("database name").withRequired(true).create();
    schemaOpt = optionBuilder.withShortName("S").withLongName("schema")
            .withArgument(argumentBuilder.withName("schema").withMinimum(1).withMaximum(1).create())
            .withDescription("database schema").withRequired(true).create();
    userOpt = optionBuilder.withShortName("u").withLongName("user")
            .withArgument(argumentBuilder.withName("username").withMinimum(1).withMaximum(1).create())
            .withDescription("username").withRequired(false).create();
    passwordOpt = optionBuilder.withShortName("p").withLongName("password")
            .withArgument(argumentBuilder.withName("password").withMinimum(1).withMaximum(1).create())
            .withDescription("password").withRequired(false).create();
    portOpt = optionBuilder.withShortName("P").withLongName("port").withDescription("database port")
            .withArgument(argumentBuilder.withName("portnumber").withMinimum(1).withMaximum(1)
                    .withValidator(new Validator() {

                        public void validate(List args) throws InvalidArgumentException {
                            final int size = args.size();
                            if (size > 1) {
                                throw new InvalidArgumentException("Only one port at a time can be defined");
                            }/*from www  . j av a2s.  c  o  m*/

                            final String val = (String) args.get(0);

                            final int value = Integer.parseInt(val);
                            if ((value <= 0) || (value > 65536)) {
                                throw new InvalidArgumentException("Invalid port specification");
                            }

                        }
                    }).create())
            .withRequired(false).create();

    addOption(gmlfileOpt);
    addOption(inputCrsOpt);
    addOption(databaseOpt);
    addOption(hostnameOpt);
    addOption(portOpt);
    addOption(schemaOpt);
    addOption(userOpt);
    addOption(passwordOpt);

}

From source file:org.geotools.utils.coveragetiler.CoverageTiler.java

/**
 * Default constructor//from ww  w  . j  a va2  s.  com
 */
public CoverageTiler() {
    super(NAME, VERSION);

    // /////////////////////////////////////////////////////////////////////
    // Options for the command line
    // /////////////////////////////////////////////////////////////////////
    inputLocationOpt = optionBuilder.withShortName("s").withLongName("src_coverage")
            .withArgument(argumentBuilder.withName("source").withMinimum(1).withMaximum(1).create())
            .withDescription("path where the source code is located").withRequired(true).create();
    outputLocationOpt = optionBuilder.withShortName("d").withLongName("dest_directory")
            .withArgument(argumentBuilder.withName("destination").withMinimum(0).withMaximum(1).create())
            .withDescription("output directory, if none is provided, the \"tiled\" directory will be used")
            .withRequired(false).create();
    tileDimOpt = optionBuilder.withShortName("t").withLongName("tile_dimension")
            .withArgument(argumentBuilder.withName("t").withMinimum(1).withMaximum(1).create())
            .withDescription("Width and height of each tile we generate").withRequired(true).create();

    internalTileDimOpt = optionBuilder.withShortName("it").withLongName("internal_tile_dimension")
            .withArgument(argumentBuilder.withName("it").withMinimum(0).withMaximum(1).create())
            .withDescription("Internal width and height of each tile we generate").withRequired(false).create();

    compressionTypeOpt = optionBuilder.withShortName("z").withLongName("compressionType")
            .withDescription("compression type.").withArgument(argumentBuilder.withName("compressionType")
                    .withMinimum(0).withMaximum(1).withValidator(new Validator() {

                        public void validate(List args) throws InvalidArgumentException {
                            final int size = args.size();
                            if (size > 1)
                                throw new InvalidArgumentException(
                                        "Only one scaling algorithm at a time can be chosen");

                        }
                    }).create())
            .withRequired(false).create();

    compressionRatioOpt = optionBuilder.withShortName("r").withLongName("compressionRatio")
            .withDescription("compression ratio.").withArgument(argumentBuilder.withName("compressionRatio")
                    .withMinimum(0).withMaximum(1).withValidator(new Validator() {

                        public void validate(List args) throws InvalidArgumentException {
                            final int size = args.size();
                            if (size > 1)
                                throw new InvalidArgumentException(
                                        "Only one scaling algorithm at a time can be chosen");
                            final String val = (String) args.get(0);

                            final double value = Double.parseDouble(val);
                            if (value <= 0 || value > 1)
                                throw new InvalidArgumentException("Invalid compressio ratio");

                        }
                    }).create())
            .withRequired(false).create();

    addOption(tileDimOpt);
    addOption(inputLocationOpt);
    addOption(outputLocationOpt);
    addOption(internalTileDimOpt);
    addOption(compressionTypeOpt);
    addOption(compressionRatioOpt);

    // /////////////////////////////////////////////////////////////////////
    //
    // Help Formatter
    //
    // /////////////////////////////////////////////////////////////////////
    finishInitialization();

}

From source file:org.geotools.utils.imageoverviews.OverviewsEmbedder.java

/**
 * Simple constructor for a pyramid generator. Use the input string in order
 * to read an image.//  w w  w  . j  av  a 2s.  co m
 * 
 * 
 */
public OverviewsEmbedder() {
    super(NAME, VERSION);
    // /////////////////////////////////////////////////////////////////////
    // Options for the command line
    // /////////////////////////////////////////////////////////////////////
    locationOpt = optionBuilder.withShortName("s").withLongName("source").withArgument(
            argumentBuilder.withName("source").withMinimum(1).withMaximum(1).withValidator(new Validator() {

                public void validate(List args) throws InvalidArgumentException {
                    final int size = args.size();
                    if (size > 1)
                        throw new InvalidArgumentException("Source can be a single file or  directory ");
                    final File source = new File((String) args.get(0));
                    if (!source.exists())
                        throw new InvalidArgumentException(new StringBuilder("The provided source is invalid! ")

                                .toString());
                }

            }).create()).withDescription("path where files are located").withRequired(true).create();

    tileDimOpt = optionBuilder.withShortName("t").withLongName("tiled_dimension")
            .withArgument(argumentBuilder.withName("t").withMinimum(0).withMaximum(1).create())
            .withDescription("tile dimensions as a couple width,height in pixels").withRequired(false).create();

    externalOpt = optionBuilder.withShortName("ext").withLongName("external_overviews")
            .withArgument(argumentBuilder.withName("extt").withMinimum(0).withMaximum(1).create())
            .withDescription("create externalOverviews overviews").withRequired(false).create();

    scaleFactorOpt = optionBuilder.withShortName("f").withLongName("scale_factor").withArgument(
            argumentBuilder.withName("f").withMinimum(1).withMaximum(1).withValidator(new Validator() {
                public void validate(List args) throws InvalidArgumentException {
                    final int size = args.size();
                    if (size > 1)
                        throw new InvalidArgumentException("Only one scale factor at a time can be chosen");
                    int factor = Integer.parseInt((String) args.get(0));
                    if (factor <= 0)
                        throw new InvalidArgumentException(
                                new StringBuilder("The provided scale factor is negative! ")

                                        .toString());
                    if (factor == 1) {
                        LOGGER.warning("The scale factor is 1, program will exit!");
                        System.exit(0);
                    }
                }

            }).create()).withDescription("integer scale factor").withRequired(true).create();

    wildcardOpt = optionBuilder.withShortName("w").withLongName("wildcardOpt")
            .withArgument(argumentBuilder.withName("wildcardOpt").withMinimum(0).withMaximum(1).create())
            .withDescription("wildcardOpt to use for selecting files").withRequired(false).create();

    numStepsOpt = optionBuilder.withShortName("n").withLongName("num_steps").withArgument(
            argumentBuilder.withName("n").withMinimum(1).withMaximum(1).withValidator(new Validator() {

                public void validate(List args) throws InvalidArgumentException {
                    final int size = args.size();
                    if (size > 1)
                        throw new InvalidArgumentException("Only one  number of step at a time can be chosen");
                    int steps = Integer.parseInt((String) args.get(0));
                    if (steps <= 0)
                        throw new InvalidArgumentException(
                                new StringBuilder("The provided number of step is negative! ")

                                        .toString());

                }

            }).create()).withDescription("integer scale factor").withRequired(true).create();

    scaleAlgorithmOpt = optionBuilder.withShortName("a").withLongName("scaling_algorithm").withArgument(
            argumentBuilder.withName("a").withMinimum(0).withMaximum(1).withValidator(new Validator() {

                public void validate(List args) throws InvalidArgumentException {
                    final int size = args.size();
                    if (size > 1)
                        throw new InvalidArgumentException(
                                "Only one scaling algorithm at a time can be chosen");
                    final SubsampleAlgorithm algorithm = SubsampleAlgorithm.valueOf((String) args.get(0));
                    if (algorithm == null)
                        throw new InvalidArgumentException(new StringBuilder("The scaling algorithm ")
                                .append(args.get(0)).append(" is not supported").toString());

                }
            }).create())
            .withDescription(
                    "name of the scaling algorithm, eeither one of average (a), filtered    (f), bilinear (bil), nearest neigbhor (nn)")
            .withRequired(false).create();

    compressionTypeOpt = optionBuilder.withShortName("z").withLongName("compressionType")
            .withDescription("compression type.").withArgument(argumentBuilder.withName("compressionType")
                    .withMinimum(0).withMaximum(1).withValidator(new Validator() {

                        public void validate(List args) throws InvalidArgumentException {
                            final int size = args.size();
                            if (size > 1)
                                throw new InvalidArgumentException(
                                        "Only one scaling algorithm at a time can be chosen");

                        }
                    }).create())
            .withRequired(false).create();

    compressionRatioOpt = optionBuilder.withShortName("r").withLongName("compressionRatio")
            .withDescription("compression ratio.").withArgument(argumentBuilder.withName("compressionRatio")
                    .withMinimum(0).withMaximum(1).withValidator(new Validator() {

                        public void validate(List args) throws InvalidArgumentException {
                            final int size = args.size();
                            if (size > 1)
                                throw new InvalidArgumentException(
                                        "Only one scaling algorithm at a time can be chosen");
                            final String val = (String) args.get(0);

                            final double value = Double.parseDouble(val);
                            if (value <= 0 || value > 1)
                                throw new InvalidArgumentException("Invalid compressio ratio");

                        }
                    }).create())
            .withRequired(false).create();

    addOption(locationOpt);
    addOption(tileDimOpt);
    addOption(scaleFactorOpt);
    addOption(scaleAlgorithmOpt);
    addOption(numStepsOpt);
    addOption(wildcardOpt);
    addOption(compressionTypeOpt);
    addOption(compressionRatioOpt);
    addOption(externalOpt);

    // /////////////////////////////////////////////////////////////////////
    //
    // Help Formatter
    //
    // /////////////////////////////////////////////////////////////////////
    finishInitialization();
}

From source file:org.geotools.utils.imagepyramid.PyramidBuilder.java

/**
 * Simple constructor for a pyramid generator. Use the input string in order
 * to read an image.//from  ww  w .j  a v  a2 s.c  o m
 * 
 * 
 */
public PyramidBuilder() {
    super(NAME, VERSION);
    // /////////////////////////////////////////////////////////////////////
    // Options for the command line
    // /////////////////////////////////////////////////////////////////////

    internalTileDimOpt = optionBuilder.withShortName("it").withLongName("internal_tile_dimension")
            .withArgument(argumentBuilder.withName("it").withMinimum(0).withMaximum(1).create())
            .withDescription("Internal width and height of each tile we generate").withRequired(false).create();

    locationOpt = optionBuilder.withShortName("s").withLongName("source").withArgument(
            argumentBuilder.withName("source").withMinimum(1).withMaximum(1).withValidator(new Validator() {

                public void validate(List args) throws InvalidArgumentException {
                    final int size = args.size();
                    if (size > 1)
                        throw new InvalidArgumentException("Source can be a single file or directory ");
                    final File source = new File((String) args.get(0));
                    if (!source.exists())
                        throw new InvalidArgumentException(new StringBuffer("The provided source is invalid! ")

                                .toString());
                }

            }).create()).withDescription("path where files are located").withRequired(true).create();

    nameOpt = optionBuilder.withShortName("name").withLongName("pyramid_name")
            .withArgument(argumentBuilder.withName("name").withMinimum(0).withMaximum(1).create())
            .withDescription("name for the pyramid property file").withRequired(false).create();

    tileDimOpt = optionBuilder.withShortName("t").withLongName("tiled_dimension")
            .withArgument(argumentBuilder.withName("t").withMinimum(0).withMaximum(1).create())
            .withDescription("tile dimensions as a couple width,height in pixels").withRequired(true).create();

    scaleFactorOpt = optionBuilder.withShortName("f").withLongName("scale_factor").withArgument(
            argumentBuilder.withName("f").withMinimum(1).withMaximum(1).withValidator(new Validator() {

                public void validate(List args) throws InvalidArgumentException {
                    final int size = args.size();
                    if (size > 1)
                        throw new InvalidArgumentException(
                                "Only one scaling algorithm at a time can be chosen");
                    int factor = Integer.parseInt((String) args.get(0));
                    if (factor <= 0)
                        throw new InvalidArgumentException(
                                new StringBuffer("The provided scale factor is negative! ")

                                        .toString());
                    if (factor == 1) {
                        LOGGER.warning("The scale factor is 1, program will exit!");
                        System.exit(0);
                    }
                }

            }).create()).withDescription("integer scale factor").withRequired(true).create();

    numStepsOpt = optionBuilder.withShortName("n").withLongName("num_steps").withArgument(
            argumentBuilder.withName("n").withMinimum(1).withMaximum(1).withValidator(new Validator() {

                public void validate(List args) throws InvalidArgumentException {
                    final int size = args.size();
                    if (size > 1)
                        throw new InvalidArgumentException(
                                "Only one scaling algorithm at a time can be chosen");
                    int steps = Integer.parseInt((String) args.get(0));
                    if (steps <= 0)
                        throw new InvalidArgumentException(
                                new StringBuffer("The provided scale factor is negative! ")

                                        .toString());

                }

            }).create()).withDescription("integer scale factor").withRequired(true).create();

    scaleAlgorithmOpt = optionBuilder.withShortName("a").withLongName("scaling_algorithm").withArgument(
            argumentBuilder.withName("a").withMinimum(0).withMaximum(1).withValidator(new Validator() {

                public void validate(List args) throws InvalidArgumentException {
                    final int size = args.size();
                    if (size > 1)
                        throw new InvalidArgumentException(
                                "Only one scaling algorithm at a time can be chosen");
                    if (!scalingAlgorithms.contains(args.get(0)))
                        throw new InvalidArgumentException(new StringBuffer("The output format ")
                                .append(args.get(0)).append(" is not permitted").toString());

                }
            }).create())
            .withDescription(
                    "name of the scaling algorithm, eeither one of average (a), filtered (f), bilinear (bil), nearest neigbhor (nn)")
            .withRequired(false).create();

    overwriteOpt = optionBuilder.withShortName("w").withLongName("overwrite")
            .withDescription("completely wipe out existing layer dirs before proceeding.").withRequired(false)
            .create();

    compressionTypeOpt = optionBuilder.withShortName("z").withLongName("compressionType")
            .withDescription("compression type.").withArgument(argumentBuilder.withName("compressionType")
                    .withMinimum(0).withMaximum(1).withValidator(new Validator() {

                        public void validate(List args) throws InvalidArgumentException {
                            final int size = args.size();
                            if (size > 1)
                                throw new InvalidArgumentException(
                                        "Only one scaling algorithm at a time can be chosen");

                        }
                    }).create())
            .withRequired(false).create();

    compressionRatioOpt = optionBuilder.withShortName("r").withLongName("compressionRatio")
            .withDescription("compression ratio.").withArgument(argumentBuilder.withName("compressionRatio")
                    .withMinimum(0).withMaximum(1).withValidator(new Validator() {

                        public void validate(List args) throws InvalidArgumentException {
                            final int size = args.size();
                            if (size > 1)
                                throw new InvalidArgumentException(
                                        "Only one scaling algorithm at a time can be chosen");
                            final String val = (String) args.get(0);

                            final double value = Double.parseDouble(val);
                            if (value <= 0 || value > 1)
                                throw new InvalidArgumentException("Invalid compressio ratio");

                        }
                    }).create())
            .withRequired(false).create();

    addOption(compressionTypeOpt);
    addOption(compressionRatioOpt);
    addOption(locationOpt);
    addOption(tileDimOpt);
    addOption(scaleFactorOpt);
    addOption(scaleAlgorithmOpt);
    addOption(numStepsOpt);
    addOption(overwriteOpt);
    addOption(internalTileDimOpt);
    finishInitialization();
}

From source file:org.geotools.utils.imagepyramid.PyramidLayerBuilder.java

public PyramidLayerBuilder() {
    super(NAME, VERSION);
    // /////////////////////////////////////////////////////////////////////
    // Options for the command line
    // /////////////////////////////////////////////////////////////////////
    inputLocationOpt = optionBuilder.withShortName("s").withLongName("source_directory").withArgument(
            argumentBuilder.withName("source").withMinimum(1).withMaximum(1).withValidator(new Validator() {

                public void validate(List args) throws InvalidArgumentException {
                    final int size = args.size();
                    if (size > 1)
                        throw new InvalidArgumentException("Only one location can be chosen");
                    final File source = new File((String) args.get(0));
                    if (!source.isFile() || !source.exists())
                        throw new InvalidArgumentException(new StringBuilder("The provided source is invalid! ")

                                .toString());
                }//from ww w.j a  v a2 s .  co m

            }).create()).withDescription("path where files are located").withRequired(true).create();

    outputLocationOpt = optionBuilder.withShortName("d").withLongName("dest_directory")
            .withArgument(argumentBuilder.withName("destination").withMinimum(0).withMaximum(1).create())
            .withDescription("output directory, if none is provided, the \"tiled\" directory will be used")
            .withRequired(false).create();

    tileDimOpt = optionBuilder.withShortName("t").withLongName("tiled_dimension")
            .withArgument(argumentBuilder.withName("t").withMinimum(1).withMaximum(1).create())
            .withDescription("tile dimensions as a couple width,height in pixels").withRequired(true).create();

    scaleFactorOpt = optionBuilder.withShortName("f").withLongName("scale_factor").withArgument(
            argumentBuilder.withName("f").withMinimum(1).withMaximum(1).withValidator(new Validator() {

                public void validate(List args) throws InvalidArgumentException {
                    final int size = args.size();
                    if (size > 1)
                        throw new InvalidArgumentException(
                                "Only one scaling algorithm at a time can be chosen");
                    int factor = Integer.parseInt((String) args.get(0));
                    if (factor <= 0)
                        throw new InvalidArgumentException(
                                new StringBuilder("The provided scale factor is negative! ")

                                        .toString());
                    if (factor == 1) {
                        LOGGER.warning("The scale factor is 1!");
                        System.exit(0);
                    }
                }

            }).create()).withDescription("integer scale factor").withRequired(true).create();

    scaleAlgorithmOpt = optionBuilder.withShortName("a").withLongName("scaling_algorithm").withArgument(
            argumentBuilder.withName("a").withMinimum(0).withMaximum(1).withValidator(new Validator() {

                public void validate(List args) throws InvalidArgumentException {
                    final int size = args.size();
                    if (size > 1)
                        throw new InvalidArgumentException(
                                "Only one scaling algorithm at a time can be chosen");
                    if (!scalingAlgorithms.contains(args.get(0)))
                        throw new InvalidArgumentException(new StringBuilder("The output format ")
                                .append(args.get(0)).append(" is not permitted").toString());

                }
            }).create())
            .withDescription(
                    "name of the scaling algorithm, eeither one of average (a), filtered    (f), bilinear (bil), nearest neigbhor (nn)")
            .withRequired(false).create();

    outFormatOpt = optionBuilder.withShortName("o").withLongName("out_format")
            .withArgument(
                    argumentBuilder.withName("o").withMinimum(0).withMaximum(1).withDescription("output format")
                            // .withDefault("gtiff")
                            .withValidator(new Validator() {

                                public void validate(List args) throws InvalidArgumentException {
                                    final int size = args.size();
                                    if (size > 1)
                                        throw new InvalidArgumentException(
                                                "Only one output format at a time can be specified");
                                    if (!outputFormats.contains(args.get(0)))
                                        throw new InvalidArgumentException(
                                                new StringBuilder("The output format ").append(args.get(0))
                                                        .append(" is not permitted").toString());

                                }
                            }).create())
            .withDescription("output format").withRequired(false).create();

    compressionTypeOpt = optionBuilder.withShortName("z").withLongName("compressionType")
            .withDescription("compression type.").withArgument(argumentBuilder.withName("compressionType")
                    .withMinimum(0).withMaximum(1).withValidator(new Validator() {

                        public void validate(List args) throws InvalidArgumentException {
                            final int size = args.size();
                            if (size > 1)
                                throw new InvalidArgumentException(
                                        "Only one scaling algorithm at a time can be chosen");

                        }
                    }).create())
            .withRequired(false).create();

    compressionRatioOpt = optionBuilder.withShortName("r").withLongName("compressionRatio")
            .withDescription("compression ratio.").withArgument(argumentBuilder.withName("compressionRatio")
                    .withMinimum(0).withMaximum(1).withValidator(new Validator() {

                        public void validate(List args) throws InvalidArgumentException {
                            final int size = args.size();
                            if (size > 1)
                                throw new InvalidArgumentException(
                                        "Only one scaling algorithm at a time can be chosen");
                            final String val = (String) args.get(0);

                            final double value = Double.parseDouble(val);
                            if (value <= 0 || value > 1)
                                throw new InvalidArgumentException("Invalid compressio ratio");

                        }
                    }).create())
            .withRequired(false).create();

    internalTileDimOpt = optionBuilder.withShortName("it").withLongName("internal_tile_dimension")
            .withArgument(argumentBuilder.withName("it").withMinimum(0).withMaximum(1).create())
            .withDescription("Internal width and height of each tile we generate").withRequired(false).create();

    addOption(compressionTypeOpt);
    addOption(compressionRatioOpt);
    addOption(inputLocationOpt);
    addOption(tileDimOpt);
    addOption(scaleFactorOpt);
    addOption(scaleAlgorithmOpt);
    addOption(internalTileDimOpt);

    // /////////////////////////////////////////////////////////////////////
    //
    // Help Formatter
    //
    // /////////////////////////////////////////////////////////////////////
    finishInitialization();
}

From source file:org.rzo.yajsw.WrapperExe.java

/**
 * Builds the options.// w  w w  .j av  a2 s .c  o m
 */
private static void buildOptions() {
    DefaultOptionBuilder oBuilder = new DefaultOptionBuilder("-", "--", true);
    ArgumentBuilder aBuilder = new ArgumentBuilder();
    GroupBuilder gBuilder = new GroupBuilder();

    gBuilder.withOption(oBuilder.reset().withId(OPTION_C).withShortName("c").withLongName("console")
            .withDescription("run as a Console application").create());
    gBuilder.withOption(oBuilder.reset().withId(OPTION_T).withShortName("t").withLongName("start")
            .withDescription("starT an NT service or Unix daemon").create());
    gBuilder.withOption(oBuilder.reset().withId(OPTION_P).withShortName("p").withLongName("stop")
            .withDescription("stoP a running NT service or Unix daemon").create());
    gBuilder.withOption(oBuilder.reset().withId(OPTION_TX).withShortName("tx").withLongName("startx")
            .withDescription("starT -internal a Posix daemon").create());
    gBuilder.withOption(oBuilder.reset().withId(OPTION_PX).withShortName("px").withLongName("stopx")
            .withDescription("stoP -internal- a running Posix daemon").create());
    gBuilder.withOption(oBuilder.reset().withId(OPTION_I).withShortName("i").withLongName("install")
            .withDescription("Install an NT service or Unix daemon").create());
    gBuilder.withOption(oBuilder.reset().withId(OPTION_R).withShortName("r").withLongName("remove")
            .withDescription("Remove an NT service or Unix daemon").create());
    gBuilder.withOption(oBuilder.reset().withId(OPTION_Q).withShortName("q").withLongName("query")
            .withDescription("Query the status of an NT service or Unix daemon").create());
    gBuilder.withOption(oBuilder.reset().withId(OPTION_Y).withShortName("y").withLongName("tray")
            .withDescription("Start System Tray Icon").create());
    gBuilder.withOption(oBuilder.reset().withId(OPTION_QS).withShortName("qs").withLongName("querysilent")
            .withDescription("Silent Query the status of an NT service or Unix daemon").create());

    Argument pid = aBuilder.reset().withName(PID).withDescription("PID of process to reconnect to")
            .withMinimum(1).withMaximum(1).withValidator(NumberValidator.getIntegerInstance()).create();

    gBuilder.withOption(oBuilder.reset().withId(OPTION_N).withShortName("n").withLongName("reconnect")
            .withDescription("recoNnect to existing application").withArgument(pid).create());

    Argument pid2 = aBuilder.reset().withName(PID).withDescription("PID of process to reconnect to")
            .withMinimum(1).withMaximum(1).withValidator(NumberValidator.getIntegerInstance()).create();

    Argument defaultFile = aBuilder.reset().withName(DEFAULT_FILE).withDescription("Default Configuration File")
            .withMinimum(0).withMaximum(1)
            .withValidator(VFSFileValidator.getExistingFileInstance().setBase(".")).create();
    /*
     * GroupBuilder childGbuilder = new GroupBuilder(); DefaultOptionBuilder
     * childoObuilder = new DefaultOptionBuilder("-", "--", true);
     * 
     * childGbuilder.withName(DEFAULT_FILE).withMinimum(0).withMaximum(1).
     * withOption(
     * childoObuilder.withId(OPTION_D).withArgument(defaultFile).
     * withShortName("d").withLongName("defaultConf").withDescription(
     * "Default Configuration File").create());
     * 
     * 
     * gBuilder.withOption(oBuilder.reset().withId(OPTION_G).withShortName("g"
     * ).withLongName("genconf").withDescription(
     * "Generate configuration file from pid"
     * ).withArgument(pid2).withChildren(childGbuilder.create()).create());
     */

    gBuilder.withOption(oBuilder.reset().withId(OPTION_D).withShortName("d").withLongName("defaultConf")
            .withDescription("Default Configuration File").withArgument(defaultFile).create());

    gBuilder.withOption(oBuilder.reset().withId(OPTION_G).withShortName("g").withLongName("genconf")
            .withDescription("Generate configuration file from pid").withArgument(pid2).create());

    FileValidator fValidator = VFSFileValidator.getExistingFileInstance().setBase(".");
    fValidator.setFile(false);
    // fValidator.setReadable(true);
    gBuilder.withOption(aBuilder.reset().withName(CONF_FILE)
            .withDescription("is the wrapper.conf to use.  Name must be absolute or relative").withMinimum(0)
            .withMaximum(1).create());

    Validator pValidator = new Validator() {

        public void validate(List values) throws InvalidArgumentException {
            for (Iterator it = values.iterator(); it.hasNext();) {
                String p = (String) it.next();
                if (!Pattern.matches("wrapper\\..*=.*", p)) {
                    throw new InvalidArgumentException(p);
                }
            }

        }

    };
    gBuilder.withOption(aBuilder.reset().withName(PROPERTIES)
            .withDescription(
                    "are configuration name-value pairs which override values. For example: wrapper.debug=true")
            .withMinimum(0).withValidator(pValidator).create());

    gBuilder.withMaximum(3);
    group = gBuilder.create();

}