Example usage for org.apache.commons.cli OptionGroup OptionGroup

List of usage examples for org.apache.commons.cli OptionGroup OptionGroup

Introduction

In this page you can find the example usage for org.apache.commons.cli OptionGroup OptionGroup.

Prototype

OptionGroup

Source Link

Usage

From source file:com.imgur.backup.SnapshotS3Util.java

/**
 * Returns the command-line options supported.
 * @return the command-line options/*w  w  w  . jav a2  s.co  m*/
 */
private static Options getOptions() {
    Option tableName = new Option("t", "table", true,
            "The table name to create a snapshot from. Required for creating a snapshot");
    Option snapshotName = new Option("n", "snapshot", true,
            "The snapshot name. Required for importing from S3");
    Option accessId = new Option("k", "awsAccessKey", true, "The AWS access key");
    Option accessSecret = new Option("s", "awsAccessSecret", true, "The AWS access secret string");
    Option bucketName = new Option("b", "bucketName", true, "The S3 bucket name where snapshots are stored");
    Option s3Path = new Option("p", "s3Path", true, "The snapshot directory in S3. Default is '/hbase'");
    Option hdfsPath = new Option("d", "hdfsPath", true, "The snapshot directory in HDFS. Default is '/hbase'");
    Option mappers = new Option("m", "mappers", true,
            "The number of parallel copiers if copying to/from S3. Default: 1");
    Option useS3n = new Option("a", "s3n", false,
            "Use s3n protocol instead of s3. Might work better, but beware of 5GB file limit imposed by S3");
    Option snapshotTtl = new Option("l", "snapshotTtl", true,
            "Delete snapshots older than this value (seconds) from running HBase cluster");

    tableName.setRequired(false);
    snapshotName.setRequired(false);
    accessId.setRequired(true);
    accessSecret.setRequired(true);
    bucketName.setRequired(true);
    s3Path.setRequired(false);
    hdfsPath.setRequired(false);
    mappers.setRequired(false);
    useS3n.setRequired(false);
    snapshotTtl.setRequired(false);

    Option createSnapshot = new Option("c", "create", false, "Create HBase snapshot");
    Option createExportSnapshot = new Option("x", "createExport", false,
            "Create HBase snapshot AND export to S3");
    Option exportSnapshot = new Option("e", "export", false, "Export HBase snapshot to S3");
    Option importSnapshot = new Option("i", "import", false,
            "Import HBase snapshot from S3. May need to run as hbase user if importing into HBase");

    OptionGroup actions = new OptionGroup();
    actions.setRequired(true);
    actions.addOption(createSnapshot);
    actions.addOption(createExportSnapshot);
    actions.addOption(exportSnapshot);
    actions.addOption(importSnapshot);

    Options options = new Options();
    options.addOptionGroup(actions);
    options.addOption(tableName);
    options.addOption(snapshotName);
    options.addOption(accessId);
    options.addOption(accessSecret);
    options.addOption(bucketName);
    options.addOption(s3Path);
    options.addOption(hdfsPath);
    options.addOption(mappers);
    options.addOption(useS3n);
    options.addOption(snapshotTtl);

    return options;
}

From source file:edu.usc.scrc.PriorityPruner.CommandLineOptions.java

/**
 * Initiates options with input arguments from user, and adds them to a
 * collection.// www .j a  v a  2s  .  com
 * 
 * @return an Options-object, which is a collection of all Option-objects
 */
private Options initOptions() {
    // when defining required options/changing descriptions, notice the
    // temporary solution for printing out missing required options (when a
    // MissingOptionException is caught)

    Options options = new Options();

    //max-distance
    Option maxDistance = createOptionOneName(1, "integer",
            "Max distance in base pairs between SNPs to calculate pair-wise LD. Default is 500,000.", false,
            "max_distance");

    //min-maf
    Option minMaf = createOptionOneName(1, "float",
            "Minimum minor allele frequency (MAF) for a SNP to be selected. Does not apply to force-selected SNPs. Default is 0.",
            false, "min_maf");

    //min-hwe
    //      Option minHwPvalue = createOptionOneName(1, "float",
    //            "Minimum Hardy-Weinberg p-value for a SNP to be selected. Does not apply to force-selected SNPs. Default is 0.", false, "min_hwe");

    //min-snp-callrate
    Option minSnpCallRate = createOptionOneName(1, "float",
            "Minimum SNP call rate for a SNP to be selected. Does not apply to force-selected SNPs. Default is 0.",
            false, "min_snp_callrate");

    //min-design-score
    Option minDesignScore = createOptionOneName(1, "float",
            "Minimum design score for a SNP to be selected. Does not apply to force-selected SNPs. Default is 0.",
            false, "min_design_score");

    //      Option absMinDesignScore = createOptionTwoNames(1,
    //            "0.0 - no upper limit", "absmindesignscore",
    //            "Set absolute minimum design score value allowed", false,
    //            "amds");

    //metric
    Option metric = createOptionOneName(2, "name, weight", "Specify name and weight of a metric.", false,
            "metric");

    //st
    Option surrogateThreshold = createOptionOneName(2, "p-value, num_surrogates",
            "Add surrogate-threshold, specify both p-value and the number of surrogates", false, "st");

    //r2t
    Option r2Threshold = createOptionOneName(2, "p-value, r2",
            "Add p-value dependent r^2-threshold, specify both p-value and r^2-threshold.", false, "r2t");

    //r2
    Option fixedR2 = createOptionOneName(1, "r2", "Add a fixed r^2-threshold (valid for all p-values)", false,
            "r2");

    //chromosome
    Option chromosome = createOptionOneName(1, "chromosome",
            "Specify chromosome, if none chosen - all chromosomes will be included", false, "chr");

    //out
    Option outputFile = createOptionOneName(1, "output_prefix", "Define output file prefix.", false, "out");

    //force_include
    Option forceIncludeFilePath = createOptionOneName(1, "filename",
            "Specify file path for a file containing SNPs that are to be force included", false,
            "force_include");

    //do_not_pick_force_included_first
    Option doNotPickForceIncludedFirst = createOptionOneName(0, "none",
            "Force-included SNPs are processed in the same order as all other SNPs (i.e., by increasing p-value)",
            false, "do_not_pick_force_included_first");

    //snp_table 
    Option snpTable = createOptionOneName(1, "input_filename", "Specify file path for SNP input table", false,
            "snp_table");

    //tped
    Option tped = createOptionOneName(1, "input_filename", "Specify file path for tped file", false, "tped");

    //tfam
    Option tfam = createOptionOneName(1, "input_filename", "Specify file path for tfam file", false, "tfam");

    //tfile
    Option tfile = createOptionOneName(1, "input_file_prefix", "Specify file prefix of tped and tfam files",
            false, "tfile");

    //add_surrogate_for_non_passing_index_snps
    Option additionalSurrogates = createOptionOneName(0, "none",
            "Specify that an additional surrogate will be added instead of choosing a new index SNP, in the case current index SNP does not pass the design score minimum",
            false, "add_surrogate_for_non_passing_index_snps");

    //verbose
    Option verbose = createOptionOneName(0, "none",
            "Specify that detailed information should be printed out and stored in the log file", false,
            "verbose");

    //outputLDTable
    Option outputLDTable = createOptionOneName(0, "none",
            "Directs the software to output a table containing all LD calculations made by the software", false,
            "ld");

    //remove
    Option remove = createOptionOneName(1, "filename",
            "Specify file path for a file containing family ID and individual ID of individuals that should be removed from current sample",
            false, "remove");

    //keep
    Option keep = createOptionOneName(1, "filename",
            "Specify file path for a file containing family ID and individual ID of individuals that should be kept, rest will be removed from current sample",
            false, "keep");

    //keep_random
    Option keepRandom = createOptionOneName(1, "float",
            "Specify a percentage value (as a decimal) to get a random selection of individuals of that size",
            false, "keep_random");

    //no_surrogates_for_force_included_snps
    Option noSurrogatesForForceIncluded = createOptionOneName(0, "none",
            "Specify that surrogates should not be added for force included SNPs", false,
            "no_surrogates_for_force_included_snps");

    Option seed = createOptionOneName(1, "long",
            "Integer seed for random number generator. If not specified, a random seed is used instead.", false,
            "seed");

    //help
    Option help = createOptionTwoNames(0, "none", "help", "Print help", false, "h");

    // adds a special set of sample options that are mutually exclusive, to
    // an option group
    OptionGroup keepRemoveGroup = new OptionGroup();
    keepRemoveGroup.addOption(remove);
    keepRemoveGroup.addOption(keep);
    keepRemoveGroup.addOption(keepRandom);

    // adds the two different r^2-options to an option group, to make them
    // mutually exclusive
    OptionGroup r2Group = new OptionGroup();
    r2Group.addOption(r2Threshold);
    r2Group.addOption(fixedR2);
    //r2Group.setRequired(true);

    // adds all options to an option collection

    options.addOption(maxDistance);
    options.addOption(minMaf);
    //options.addOption(minHwPvalue);
    options.addOption(minSnpCallRate);
    options.addOption(minDesignScore);
    //options.addOption(absMinDesignScore);
    options.addOption(metric);
    options.addOption(surrogateThreshold);
    options.addOption(r2Threshold);
    options.addOption(chromosome);
    options.addOption(outputFile);
    options.addOption(forceIncludeFilePath);
    options.addOption(doNotPickForceIncludedFirst);
    options.addOption(snpTable);
    options.addOption(tped);
    options.addOption(tfam);
    options.addOption(tfile);
    options.addOption(additionalSurrogates);
    options.addOption(verbose);
    options.addOption(outputLDTable);
    options.addOption(noSurrogatesForForceIncluded);
    options.addOption(r2Threshold);
    options.addOption(fixedR2);
    options.addOption(seed);
    options.addOption(help);
    options.addOptionGroup(keepRemoveGroup);
    options.addOptionGroup(r2Group);

    return options;
}

From source file:com.upload.DcmSnd.java

private static CommandLine parse(String[] args) {
    Options opts = new Options();

    OptionBuilder.withArgName("name");
    OptionBuilder.hasArg();/*w w  w.j  a  v  a  2 s  . com*/
    OptionBuilder.withDescription("set device name, use DCMSND by default");
    opts.addOption(OptionBuilder.create("device"));

    OptionBuilder.withArgName("aet[@host][:port]");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription("set AET, local address and listening port of local "
            + "Application Entity, use device name and pick up any valid "
            + "local address to bind the socket by default");
    opts.addOption(OptionBuilder.create("L"));

    opts.addOption("ts1", false,
            "offer Default Transfer Syntax in " + "separate Presentation Context. By default offered with "
                    + "Explicit VR Little Endian TS in one PC.");

    opts.addOption("fileref", false,
            "send objects without pixel data, but with a reference to "
                    + "the DICOM file using DCM4CHE URI Referenced Transfer Syntax "
                    + "to import DICOM objects on a given file system to a DCM4CHEE " + "archive.");

    OptionBuilder.withArgName("username");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription(
            "enable User Identity Negotiation with specified username and " + " optional passcode");
    opts.addOption(OptionBuilder.create("username"));

    OptionBuilder.withArgName("passcode");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription(
            "optional passcode for User Identity Negotiation, " + "only effective with option -username");
    opts.addOption(OptionBuilder.create("passcode"));

    opts.addOption("uidnegrsp", false,
            "request positive User Identity Negotation response, " + "only effective with option -username");

    OptionBuilder.withArgName("NULL|3DES|AES");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription("enable TLS connection without, 3DES or AES encryption");
    opts.addOption(OptionBuilder.create("tls"));

    OptionGroup tlsProtocol = new OptionGroup();
    tlsProtocol.addOption(new Option("tls1", "disable the use of SSLv3 and SSLv2 for TLS connections"));
    tlsProtocol.addOption(new Option("ssl3", "disable the use of TLSv1 and SSLv2 for TLS connections"));
    tlsProtocol.addOption(new Option("no_tls1", "disable the use of TLSv1 for TLS connections"));
    tlsProtocol.addOption(new Option("no_ssl3", "disable the use of SSLv3 for TLS connections"));
    tlsProtocol.addOption(new Option("no_ssl2", "disable the use of SSLv2 for TLS connections"));
    opts.addOptionGroup(tlsProtocol);

    opts.addOption("noclientauth", false, "disable client authentification for TLS");

    OptionBuilder.withArgName("file|url");
    OptionBuilder.hasArg();
    OptionBuilder
            .withDescription("file path or URL of P12 or JKS keystore, resource:tls/test_sys_2.p12 by default");
    opts.addOption(OptionBuilder.create("keystore"));

    OptionBuilder.withArgName("password");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription("password for keystore file, 'secret' by default");
    opts.addOption(OptionBuilder.create("keystorepw"));

    OptionBuilder.withArgName("password");
    OptionBuilder.hasArg();
    OptionBuilder
            .withDescription("password for accessing the key in the keystore, keystore password by default");
    opts.addOption(OptionBuilder.create("keypw"));

    OptionBuilder.withArgName("file|url");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription("file path or URL of JKS truststore, resource:tls/mesa_certs.jks by default");
    opts.addOption(OptionBuilder.create("truststore"));

    OptionBuilder.withArgName("password");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription("password for truststore file, 'secret' by default");
    opts.addOption(OptionBuilder.create("truststorepw"));

    OptionBuilder.withArgName("aet@host:port");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription("request storage commitment of (successfully) sent objects "
            + "afterwards in new association to specified remote " + "Application Entity");
    opts.addOption(OptionBuilder.create("stgcmtae"));

    opts.addOption("stgcmt", false,
            "request storage commitment of (successfully) sent objects " + "afterwards in same association");

    OptionBuilder.withArgName("attr=value");
    OptionBuilder.hasArgs();
    OptionBuilder.withValueSeparator('=');
    OptionBuilder.withDescription("Replace value of specified attribute "
            + "with specified value in transmitted objects. attr can be "
            + "specified by name or tag value (in hex), e.g. PatientName " + "or 00100010.");
    opts.addOption(OptionBuilder.create("set"));

    OptionBuilder.withArgName("salt");
    OptionBuilder.hasArgs();
    OptionBuilder.withDescription(
            "Anonymize the files.  Set to 0 for a random anonymization (not repeatable) or 1 for a daily anonymization or another"
                    + " value for a specific salt for reproducible anonymization (useful for allowing studies to be sent at a later date and still correctly named/associated)");
    OptionBuilder.withLongOpt("anonymize");
    opts.addOption(OptionBuilder.create("a"));

    OptionBuilder.withArgName("sx1[:sx2[:sx3]");
    OptionBuilder.hasArgs();
    OptionBuilder.withValueSeparator(':');
    OptionBuilder.withDescription(
            "Suffix SOP [,Series [,Study]] " + "Instance UID with specified value[s] in transmitted objects.");
    opts.addOption(OptionBuilder.create("setuid"));

    OptionBuilder.withArgName("maxops");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription("maximum number of outstanding operations it may invoke "
            + "asynchronously, unlimited by default.");
    opts.addOption(OptionBuilder.create("async"));

    opts.addOption("pdv1", false, "send only one PDV in one P-Data-TF PDU, "
            + "pack command and data PDV in one P-DATA-TF PDU by default.");
    opts.addOption("tcpdelay", false, "set TCP_NODELAY socket option to false, true by default");

    OptionBuilder.withArgName("ms");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription("timeout in ms for TCP connect, no timeout by default");
    opts.addOption(OptionBuilder.create("connectTO"));

    OptionBuilder.withArgName("ms");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription("delay in ms for Socket close after sending A-ABORT, " + "50ms by default");
    opts.addOption(OptionBuilder.create("soclosedelay"));

    OptionBuilder.withArgName("ms");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription("delay in ms for closing the listening socket, " + "1000ms by default");
    opts.addOption(OptionBuilder.create("shutdowndelay"));

    OptionBuilder.withArgName("ms");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription("period in ms to check for outstanding DIMSE-RSP, " + "10s by default");
    opts.addOption(OptionBuilder.create("reaper"));

    OptionBuilder.withArgName("ms");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription("timeout in ms for receiving DIMSE-RSP, 10s by default");
    opts.addOption(OptionBuilder.create("rspTO"));

    OptionBuilder.withArgName("ms");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription("timeout in ms for receiving A-ASSOCIATE-AC, 5s by default");
    opts.addOption(OptionBuilder.create("acceptTO"));

    OptionBuilder.withArgName("ms");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription("timeout in ms for receiving A-RELEASE-RP, 5s by default");
    opts.addOption(OptionBuilder.create("releaseTO"));

    OptionBuilder.withArgName("KB");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription("maximal length in KB of received P-DATA-TF PDUs, 16KB by default");
    opts.addOption(OptionBuilder.create("rcvpdulen"));

    OptionBuilder.withArgName("KB");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription("maximal length in KB of sent P-DATA-TF PDUs, 16KB by default");
    opts.addOption(OptionBuilder.create("sndpdulen"));

    OptionBuilder.withArgName("KB");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription("set SO_RCVBUF socket option to specified value in KB");
    opts.addOption(OptionBuilder.create("sorcvbuf"));

    OptionBuilder.withArgName("KB");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription("set SO_SNDBUF socket option to specified value in KB");
    opts.addOption(OptionBuilder.create("sosndbuf"));

    OptionBuilder.withArgName("KB");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription("transcoder buffer size in KB, 1KB by default");
    opts.addOption(OptionBuilder.create("bufsize"));

    OptionBuilder.withArgName("count");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription("Batch size - Number of files to be sent in each batch, "
            + "where a storage commit is done between batches ");
    opts.addOption(OptionBuilder.create("batchsize"));

    opts.addOption("lowprior", false, "LOW priority of the C-STORE operation, MEDIUM by default");
    opts.addOption("highprior", false, "HIGH priority of the C-STORE operation, MEDIUM by default");
    opts.addOption("h", "help", false, "print this message");
    opts.addOption("V", "version", false, "print the version information and exit");
    CommandLine cl = null;
    try {
        cl = new GnuParser().parse(opts, args);
    } catch (ParseException e) {
        exit("dcmsnd: " + e.getMessage());
        throw new RuntimeException("unreachable");
    }
    if (cl.hasOption('V')) {
        Package p = DcmSnd.class.getPackage();
        System.out.println("dcmsnd v" + p.getImplementationVersion());
        // System.exit(0);
    }
    if (cl.hasOption('h') || cl.getArgList().size() < 2) {
        HelpFormatter formatter = new HelpFormatter();
        formatter.printHelp(USAGE, DESCRIPTION, opts, EXAMPLE);
        // System.exit(0);
    }
    return cl;
}

From source file:mod.org.dcm4che2.tool.DcmSnd.java

private static CommandLine parse(String[] args) {
    Options opts = new Options();

    OptionBuilder.withArgName("name");
    OptionBuilder.hasArg();// w  w w  .j  ava2s .  com
    OptionBuilder.withDescription("set device name, use DCMSND by default");
    opts.addOption(OptionBuilder.create("device"));

    OptionBuilder.withArgName("aet[@host][:port]");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription("set AET, local address and listening port of local "
            + "Application Entity, use device name and pick up any valid "
            + "local address to bind the socket by default");
    opts.addOption(OptionBuilder.create("L"));

    opts.addOption("ts1", false,
            "offer Default Transfer Syntax in " + "separate Presentation Context. By default offered with "
                    + "Explicit VR Little Endian TS in one PC.");

    opts.addOption("fileref", false,
            "send objects without pixel data, but with a reference to "
                    + "the DICOM file using DCM4CHE URI Referenced Transfer Syntax "
                    + "to import DICOM objects on a given file system to a DCM4CHEE " + "archive.");

    OptionBuilder.withArgName("username");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription(
            "enable User Identity Negotiation with specified username and " + " optional passcode");
    opts.addOption(OptionBuilder.create("username"));

    OptionBuilder.withArgName("passcode");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription(
            "optional passcode for User Identity Negotiation, " + "only effective with option -username");
    opts.addOption(OptionBuilder.create("passcode"));

    opts.addOption("uidnegrsp", false,
            "request positive User Identity Negotation response, " + "only effective with option -username");

    OptionBuilder.withArgName("NULL|3DES|AES");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription("enable TLS connection without, 3DES or AES encryption");
    opts.addOption(OptionBuilder.create("tls"));

    OptionGroup tlsProtocol = new OptionGroup();
    tlsProtocol.addOption(new Option("tls1", "disable the use of SSLv3 and SSLv2 for TLS connections"));
    tlsProtocol.addOption(new Option("ssl3", "disable the use of TLSv1 and SSLv2 for TLS connections"));
    tlsProtocol.addOption(new Option("no_tls1", "disable the use of TLSv1 for TLS connections"));
    tlsProtocol.addOption(new Option("no_ssl3", "disable the use of SSLv3 for TLS connections"));
    tlsProtocol.addOption(new Option("no_ssl2", "disable the use of SSLv2 for TLS connections"));
    opts.addOptionGroup(tlsProtocol);

    opts.addOption("noclientauth", false, "disable client authentification for TLS");

    OptionBuilder.withArgName("file|url");
    OptionBuilder.hasArg();
    OptionBuilder
            .withDescription("file path or URL of P12 or JKS keystore, resource:tls/test_sys_2.p12 by default");
    opts.addOption(OptionBuilder.create("keystore"));

    OptionBuilder.withArgName("password");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription("password for keystore file, 'secret' by default");
    opts.addOption(OptionBuilder.create("keystorepw"));

    OptionBuilder.withArgName("password");
    OptionBuilder.hasArg();
    OptionBuilder
            .withDescription("password for accessing the key in the keystore, keystore password by default");
    opts.addOption(OptionBuilder.create("keypw"));

    OptionBuilder.withArgName("file|url");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription("file path or URL of JKS truststore, resource:tls/mesa_certs.jks by default");
    opts.addOption(OptionBuilder.create("truststore"));

    OptionBuilder.withArgName("password");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription("password for truststore file, 'secret' by default");
    opts.addOption(OptionBuilder.create("truststorepw"));

    OptionBuilder.withArgName("aet@host:port");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription("request storage commitment of (successfully) sent objects "
            + "afterwards in new association to specified remote " + "Application Entity");
    opts.addOption(OptionBuilder.create("stgcmtae"));

    opts.addOption("stgcmt", false,
            "request storage commitment of (successfully) sent objects " + "afterwards in same association");

    OptionBuilder.withArgName("attr=value");
    OptionBuilder.hasArgs();
    OptionBuilder.withValueSeparator('=');
    OptionBuilder.withDescription("Replace value of specified attribute "
            + "with specified value in transmitted objects. attr can be "
            + "specified by name or tag value (in hex), e.g. PatientName " + "or 00100010.");
    opts.addOption(OptionBuilder.create("set"));

    OptionBuilder.withArgName("salt");
    OptionBuilder.hasArgs();
    OptionBuilder.withDescription(
            "Anonymize the files.  Set to 0 for a random anonymization (not repeatable) or 1 for a daily anonymization or another"
                    + " value for a specific salt for reproducible anonymization (useful for allowing studies to be sent at a later date and still correctly named/associated)");
    OptionBuilder.withLongOpt("anonymize");
    opts.addOption(OptionBuilder.create("a"));

    OptionBuilder.withArgName("sx1[:sx2[:sx3]");
    OptionBuilder.hasArgs();
    OptionBuilder.withValueSeparator(':');
    OptionBuilder.withDescription(
            "Suffix SOP [,Series [,Study]] " + "Instance UID with specified value[s] in transmitted objects.");
    opts.addOption(OptionBuilder.create("setuid"));

    OptionBuilder.withArgName("maxops");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription("maximum number of outstanding operations it may invoke "
            + "asynchronously, unlimited by default.");
    opts.addOption(OptionBuilder.create("async"));

    opts.addOption("pdv1", false, "send only one PDV in one P-Data-TF PDU, "
            + "pack command and data PDV in one P-DATA-TF PDU by default.");
    opts.addOption("tcpdelay", false, "set TCP_NODELAY socket option to false, true by default");

    OptionBuilder.withArgName("ms");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription("timeout in ms for TCP connect, no timeout by default");
    opts.addOption(OptionBuilder.create("connectTO"));

    OptionBuilder.withArgName("ms");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription("delay in ms for Socket close after sending A-ABORT, " + "50ms by default");
    opts.addOption(OptionBuilder.create("soclosedelay"));

    OptionBuilder.withArgName("ms");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription("delay in ms for closing the listening socket, " + "1000ms by default");
    opts.addOption(OptionBuilder.create("shutdowndelay"));

    OptionBuilder.withArgName("ms");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription("period in ms to check for outstanding DIMSE-RSP, " + "10s by default");
    opts.addOption(OptionBuilder.create("reaper"));

    OptionBuilder.withArgName("ms");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription("timeout in ms for receiving DIMSE-RSP, 10s by default");
    opts.addOption(OptionBuilder.create("rspTO"));

    OptionBuilder.withArgName("ms");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription("timeout in ms for receiving A-ASSOCIATE-AC, 5s by default");
    opts.addOption(OptionBuilder.create("acceptTO"));

    OptionBuilder.withArgName("ms");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription("timeout in ms for receiving A-RELEASE-RP, 5s by default");
    opts.addOption(OptionBuilder.create("releaseTO"));

    OptionBuilder.withArgName("KB");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription("maximal length in KB of received P-DATA-TF PDUs, 16KB by default");
    opts.addOption(OptionBuilder.create("rcvpdulen"));

    OptionBuilder.withArgName("KB");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription("maximal length in KB of sent P-DATA-TF PDUs, 16KB by default");
    opts.addOption(OptionBuilder.create("sndpdulen"));

    OptionBuilder.withArgName("KB");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription("set SO_RCVBUF socket option to specified value in KB");
    opts.addOption(OptionBuilder.create("sorcvbuf"));

    OptionBuilder.withArgName("KB");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription("set SO_SNDBUF socket option to specified value in KB");
    opts.addOption(OptionBuilder.create("sosndbuf"));

    OptionBuilder.withArgName("KB");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription("transcoder buffer size in KB, 1KB by default");
    opts.addOption(OptionBuilder.create("bufsize"));

    OptionBuilder.withArgName("count");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription("Batch size - Number of files to be sent in each batch, "
            + "where a storage commit is done between batches ");
    opts.addOption(OptionBuilder.create("batchsize"));

    opts.addOption("lowprior", false, "LOW priority of the C-STORE operation, MEDIUM by default");
    opts.addOption("highprior", false, "HIGH priority of the C-STORE operation, MEDIUM by default");
    opts.addOption("h", "help", false, "print this message");
    opts.addOption("V", "version", false, "print the version information and exit");
    CommandLine cl = null;
    try {
        cl = new GnuParser().parse(opts, args);
    } catch (ParseException e) {
        exit("dcmsnd: " + e.getMessage());
        throw new RuntimeException("unreachable");
    }
    if (cl.hasOption('V')) {
        Package p = DcmSnd.class.getPackage();
        System.out.println("dcmsnd v" + p.getImplementationVersion());
        System.exit(0);
    }
    if (cl.hasOption('h') || cl.getArgList().size() < 2) {
        HelpFormatter formatter = new HelpFormatter();
        formatter.printHelp(USAGE, DESCRIPTION, opts, EXAMPLE);
        System.exit(0);
    }
    return cl;
}

From source file:daemon.dicomnode.DcmRcv.java

private static CommandLine parse(String[] args) {
    Options opts = new Options();

    OptionBuilder.withArgName("name");
    OptionBuilder.hasArg();//from   w  w  w . j a  v  a2s  .  c  o  m
    OptionBuilder.withDescription("set device name, use DCMRCV by default");
    opts.addOption(OptionBuilder.create("device"));

    OptionBuilder.withArgName("NULL|3DES|AES");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription("enable TLS connection without, 3DES or AES encryption");
    opts.addOption(OptionBuilder.create("tls"));

    OptionGroup tlsProtocol = new OptionGroup();
    tlsProtocol.addOption(new Option("tls1", "disable the use of SSLv3 and SSLv2 for TLS connections"));
    tlsProtocol.addOption(new Option("ssl3", "disable the use of TLSv1 and SSLv2 for TLS connections"));
    tlsProtocol.addOption(new Option("no_tls1", "disable the use of TLSv1 for TLS connections"));
    tlsProtocol.addOption(new Option("no_ssl3", "disable the use of SSLv3 for TLS connections"));
    tlsProtocol.addOption(new Option("no_ssl2", "disable the use of SSLv2 for TLS connections"));
    opts.addOptionGroup(tlsProtocol);

    opts.addOption("noclientauth", false, "disable client authentification for TLS");

    OptionBuilder.withArgName("file|url");
    OptionBuilder.hasArg();
    OptionBuilder
            .withDescription("file path or URL of P12 or JKS keystore, resource:tls/test_sys_2.p12 by default");
    opts.addOption(OptionBuilder.create("keystore"));

    OptionBuilder.withArgName("password");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription("password for keystore file, 'secret' by default");
    opts.addOption(OptionBuilder.create("keystorepw"));

    OptionBuilder.withArgName("password");
    OptionBuilder.hasArg();
    OptionBuilder
            .withDescription("password for accessing the key in the keystore, keystore password by default");
    opts.addOption(OptionBuilder.create("keypw"));

    OptionBuilder.withArgName("file|url");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription("file path or URL of JKS truststore, resource:tls/mesa_certs.jks by default");
    opts.addOption(OptionBuilder.create("truststore"));

    OptionBuilder.withArgName("password");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription("password for truststore file, 'secret' by default");
    opts.addOption(OptionBuilder.create("truststorepw"));

    OptionBuilder.withArgName("dir");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription("store received objects into files in specified directory <dir>."
            + " Do not store received objects by default.");
    opts.addOption(OptionBuilder.create("dest"));

    OptionBuilder.withArgName("file|url");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription("file path or URL of properties for mapping Calling AETs to "
            + "sub-directories of the storage directory specified by "
            + "-dest, to separate the storage location dependend on " + "Calling AETs.");
    opts.addOption(OptionBuilder.create("calling2dir"));

    OptionBuilder.withArgName("file|url");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription("file path or URL of properties for mapping Called AETs to "
            + "sub-directories of the storage directory specified by "
            + "-dest, to separate the storage location dependend on " + "Called AETs.");
    opts.addOption(OptionBuilder.create("called2dir"));

    OptionBuilder.withArgName("sub-dir");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription("storage sub-directory used for Calling AETs for which no "
            + " mapping is defined by properties specified by " + "-calling2dir, 'OTHER' by default.");
    opts.addOption(OptionBuilder.create("callingdefdir"));

    OptionBuilder.withArgName("sub-dir");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription("storage sub-directory used for Called AETs for which no "
            + " mapping is defined by properties specified by " + "-called2dir, 'OTHER' by default.");
    opts.addOption(OptionBuilder.create("calleddefdir"));

    OptionBuilder.withArgName("dir");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription("register stored objects in cache journal files in specified directory <dir>."
            + " Do not register stored objects by default.");
    opts.addOption(OptionBuilder.create("journal"));

    OptionBuilder.withArgName("pattern");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription("cache journal file path, with "
            + "'yyyy' will be replaced by the current year, "
            + "'MM' by the current month, 'dd' by the current date, "
            + "'HH' by the current hour and 'mm' by the current minute. " + "'yyyy/MM/dd/HH/mm' by default.");
    opts.addOption(OptionBuilder.create("journalfilepath"));

    opts.addOption("defts", false, "accept only default transfer syntax.");
    opts.addOption("bigendian", false, "accept also Explict VR Big Endian transfer syntax.");
    opts.addOption("native", false, "accept only transfer syntax with uncompressed pixel data.");

    OptionGroup scRetrieveAET = new OptionGroup();
    OptionBuilder.withArgName("aet");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription("Retrieve AE Title included in Storage Commitment "
            + "N-EVENT-REPORT in items of the Referenced SOP Sequence.");
    scRetrieveAET.addOption(OptionBuilder.create("scretraets"));
    OptionBuilder.withArgName("aet");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription("Retrieve AE Title included in Storage Commitment "
            + "N-EVENT-REPORT outside of the Referenced SOP Sequence.");
    scRetrieveAET.addOption(OptionBuilder.create("scretraet"));
    opts.addOptionGroup(scRetrieveAET);

    opts.addOption("screusefrom", false,
            "attempt to issue the Storage Commitment N-EVENT-REPORT on "
                    + "the same Association on which the N-ACTION operation was "
                    + "performed; use different Association for N-EVENT-REPORT by " + "default.");

    opts.addOption("screuseto", false,
            "attempt to issue the Storage Commitment N-EVENT-REPORT on "
                    + "previous initiated Association to the Storage Commitment SCU; "
                    + "initiate new Association for N-EVENT-REPORT by default.");

    OptionBuilder.withArgName("port");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription("port of Storage Commitment SCU to connect to issue "
            + "N-EVENT-REPORT on different Association; 104 by default.");
    opts.addOption(OptionBuilder.create("scport"));

    OptionBuilder.withArgName("ms");
    OptionBuilder.hasArg();
    OptionBuilder
            .withDescription("delay in ms for N-EVENT-REPORT-RQ to Storage Commitment SCU, " + "1s by default");
    opts.addOption(OptionBuilder.create("scdelay"));

    OptionBuilder.withArgName("retry");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription(
            "number of retries to issue N-EVENT-REPORT-RQ to Storage " + "Commitment SCU, 0 by default");
    opts.addOption(OptionBuilder.create("scretry"));

    OptionBuilder.withArgName("ms");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription("interval im ms between retries to issue N-EVENT-REPORT-RQ to"
            + "Storage Commitment SCU, 60s by default");
    opts.addOption(OptionBuilder.create("scretryperiod"));

    OptionBuilder.withArgName("maxops");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription(
            "maximum number of outstanding operations performed " + "asynchronously, unlimited by default.");
    opts.addOption(OptionBuilder.create("async"));

    opts.addOption("pdv1", false, "send only one PDV in one P-Data-TF PDU, "
            + "pack command and data PDV in one P-DATA-TF PDU by default.");
    opts.addOption("tcpdelay", false, "set TCP_NODELAY socket option to false, true by default");

    OptionBuilder.withArgName("ms");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription("timeout in ms for TCP connect, no timeout by default");
    opts.addOption(OptionBuilder.create("connectTO"));

    OptionBuilder.withArgName("ms");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription("timeout in ms for receiving DIMSE-RSP, 10s by default");
    opts.addOption(OptionBuilder.create("rspTO"));

    OptionBuilder.withArgName("ms");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription("timeout in ms for receiving A-ASSOCIATE-AC, 5s by default");
    opts.addOption(OptionBuilder.create("acceptTO"));

    OptionBuilder.withArgName("ms");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription("delay in ms for Socket close after sending A-ABORT, 50ms by default");
    opts.addOption(OptionBuilder.create("soclosedelay"));

    OptionBuilder.withArgName("ms");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription("delay in ms for DIMSE-RSP; useful for testing asynchronous mode");
    opts.addOption(OptionBuilder.create("rspdelay"));

    OptionBuilder.withArgName("ms");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription("timeout in ms for receiving -ASSOCIATE-RQ, 5s by default");
    opts.addOption(OptionBuilder.create("requestTO"));

    OptionBuilder.withArgName("ms");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription("timeout in ms for receiving A-RELEASE-RP, 5s by default");
    opts.addOption(OptionBuilder.create("releaseTO"));

    OptionBuilder.withArgName("ms");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription("period in ms to check for outstanding DIMSE-RSP, 10s by default");
    opts.addOption(OptionBuilder.create("reaper"));

    OptionBuilder.withArgName("ms");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription("timeout in ms for receiving DIMSE-RQ, 60s by default");
    opts.addOption(OptionBuilder.create("idleTO"));

    OptionBuilder.withArgName("KB");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription("maximal length in KB of received P-DATA-TF PDUs, 16KB by default");
    opts.addOption(OptionBuilder.create("rcvpdulen"));

    OptionBuilder.withArgName("KB");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription("maximal length in KB of sent P-DATA-TF PDUs, 16KB by default");
    opts.addOption(OptionBuilder.create("sndpdulen"));

    OptionBuilder.withArgName("KB");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription("set SO_RCVBUF socket option to specified value in KB");
    opts.addOption(OptionBuilder.create("sorcvbuf"));

    OptionBuilder.withArgName("KB");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription("set SO_SNDBUF socket option to specified value in KB");
    opts.addOption(OptionBuilder.create("sosndbuf"));

    OptionBuilder.withArgName("KB");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription("minimal buffer size to write received object to file, 1KB by default");
    opts.addOption(OptionBuilder.create("bufsize"));

    opts.addOption("h", "help", false, "print this message");
    opts.addOption("V", "version", false, "print the version information and exit");
    CommandLine cl = null;
    try {
        cl = new GnuParser().parse(opts, args);
    } catch (ParseException e) {
        exit("dcmrcv: " + e.getMessage());
        throw new RuntimeException("unreachable");
    }
    if (cl.hasOption("V")) {
        Package p = DcmRcv.class.getPackage();
        System.out.println("dcmrcv v" + p.getImplementationVersion());
        System.exit(0);
    }
    if (cl.hasOption("h") || cl.getArgList().size() == 0) {
        HelpFormatter formatter = new HelpFormatter();
        formatter.printHelp(USAGE, DESCRIPTION, opts, EXAMPLE);
        System.exit(0);
    }
    return cl;
}

From source file:net.kyllercg.acms.ACMgen.java

/**
 * Creates the valid command line options
 *///  w w  w  . j  ava2 s. com
private void createOptions() {

    Option op_help = new Option("h", "help", false, ACMgen.msg.getMessage("help_desc"));

    Option op_rrbb = new Option("r", "rrbb", true, ACMgen.msg.getMessage("rrbb_desc"));
    op_rrbb.setArgs(1);
    op_rrbb.setArgName("size");
    Option op_owbb = new Option("o", "owbb", true, ACMgen.msg.getMessage("owbb_desc"));
    op_owbb.setArgs(1);
    op_owbb.setArgName("size");
    Option op_owrrbb = new Option("b", "owrrbb", true, ACMgen.msg.getMessage("owrrbb_desc"));
    op_owrrbb.setArgs(1);
    op_owrrbb.setArgName("size");

    Option op_cpp = new Option("C", "cpp", false, ACMgen.msg.getMessage("cpp_desc"));
    Option op_verilog = new Option("v", "verilog", false, ACMgen.msg.getMessage("verilog_desc"));
    Option op_pep = new Option("p", "pep", false, ACMgen.msg.getMessage("pep_desc"));
    Option op_petrify = new Option("P", "petrify", false, ACMgen.msg.getMessage("petrify_desc"));
    Option op_smv = new Option("s", "smv", false, ACMgen.msg.getMessage("smv_desc"));
    Option op_smv_pn = new Option("S", "smvpn", false, ACMgen.msg.getMessage("smvpn_desc"));

    OptionGroup op_acm_group = new OptionGroup();
    op_acm_group.setRequired(true);
    op_acm_group.addOption(op_help);
    op_acm_group.addOption(op_rrbb);
    op_acm_group.addOption(op_owbb);
    op_acm_group.addOption(op_owrrbb);

    this.options = new Options();
    this.options.addOptionGroup(op_acm_group);
    this.options.addOption(op_cpp);
    this.options.addOption(op_verilog);
    this.options.addOption(op_pep);
    this.options.addOption(op_petrify);
    this.options.addOption(op_smv);
    this.options.addOption(op_smv_pn);
}

From source file:com.emc.vipr.sync.ViPRSync.java

protected static Options mainOptions() {
    Options options = new Options();
    options.addOption(new OptionBuilder().withLongOpt(HELP_OPTION).withDescription(HELP_DESC).create());
    options.addOption(new OptionBuilder().withLongOpt(SPRING_CONFIG_OPTION).withDescription(SPRING_CONFIG_DESC)
            .hasArg().withArgName(SPRING_CONFIG_ARG_NAME).create());
    options.addOption(new OptionBuilder().withLongOpt(QUERY_THREADS_OPTION).withDescription(QUERY_THREADS_DESC)
            .hasArg().withArgName(QUERY_THREADS_ARG_NAME).create());
    options.addOption(new OptionBuilder().withLongOpt(SYNC_THREADS_OPTION).withDescription(SYNC_THREADS_DESC)
            .hasArg().withArgName(SYNC_THREADS_ARG_NAME).create());
    options.addOption(new OptionBuilder().withLongOpt(SOURCE_OPTION).withDescription(SOURCE_DESC).hasArg()
            .withArgName(SOURCE_ARG_NAME).create());
    options.addOption(new OptionBuilder().withLongOpt(TARGET_OPTION).withDescription(TARGET_DESC).hasArg()
            .withArgName(TARGET_ARG_NAME).create());
    options.addOption(new OptionBuilder().withLongOpt(FILTERS_OPTION).withDescription(FILTERS_DESC).hasArg()
            .withArgName(FILTERS_ARG_NAME).create());
    options.addOption(/*  w w  w .j  av  a 2  s . c om*/
            new OptionBuilder().withLongOpt(NON_RECURSIVE_OPTION).withDescription(NON_RECURSIVE_DESC).create());
    options.addOption(new OptionBuilder().withLongOpt(TIMINGS_OPTION).withDescription(TIMINGS_DESC).create());
    options.addOption(new OptionBuilder().withLongOpt(TIMING_WINDOW_OPTION).withDescription(TIMING_WINDOW_DESC)
            .hasArg().withArgName(TIMING_WINDOW_ARG_NAME).create());
    options.addOption(
            new OptionBuilder().withLongOpt(FORGET_FAILED_OPTION).withDescription(FORGET_FAILED_DESC).create());
    options.addOption(
            new OptionBuilder().withLongOpt(DELETE_SOURCE_OPTION).withDescription(DELETE_SOURCE_DESC).create());

    OptionGroup loggingOpts = new OptionGroup();
    loggingOpts.addOption(new OptionBuilder().withLongOpt(DEBUG_OPTION).withDescription(DEBUG_DESC).create());
    loggingOpts
            .addOption(new OptionBuilder().withLongOpt(VERBOSE_OPTION).withDescription(VERBOSE_DESC).create());
    loggingOpts.addOption(new OptionBuilder().withLongOpt(SILENT_OPTION).withDescription(SILENT_DESC).create());
    loggingOpts.addOption(new OptionBuilder().withLongOpt(QUIET_OPTION).withDescription(QUIET_DESC).create());
    options.addOptionGroup(loggingOpts);

    return options;
}

From source file:br.edu.ufcg.lsd.oursim.ui.CLI.java

public static Options prepareOptions() {

    // Para adicionar uma evento:
    // 1. Defina uma constante com a identificao da opo
    // 2. Cria a Option referente
    // 3. Opcionalmente defina o tipo do argumento, quantidade de parmetros
    // ou restries
    // 4. Adicione a Options
    Options options = new Options();

    Option availability = new Option(AVAILABILITY, "availability", true,
            "Arquivo com a caracterizao da disponibilidade para todos os recursos.");
    Option dedicatedResources = new Option(DEDICATED_RESOURCES, "dedicated", false,
            "Indica que os recursos so todos dedicados.");
    Option syntAvail = new Option(SYNTHETIC_AVAILABILITY, "synthetic_availability", true,
            "Disponibilidade dos recursos deve ser gerada sinteticamente.");
    Option syntAvailDur = new Option(SYNTHETIC_AVAILABILITY_DURATION, "synthetic_availability_duration", true,
            "At que momento gerar eventos de disponibilidade dos recursos.");
    Option workload = new Option(WORKLOAD, "workload", true,
            "Arquivo com o workload no format GWA (Grid Workload Archive).");
    Option utilization = new Option(UTILIZATION, "utilization", true,
            "Arquivo em que ser registrada a utilizao da grade.");
    Option workerEvents = new Option(WORKER_EVENTS, "worker_events", true,
            "Arquivo em que sero registrados os eventos de disponibilidade.");
    Option taskEvents = new Option(TASK_EVENTS, "task_events", true,
            "Arquivo em que ser registrados os eventos de envolvendo tasks.");
    Option workloadType = new Option(WORKLOAD_TYPE, "workload_type", true,
            "The type of workload to read the workload file.");
    Option machinesDescription = new Option(MACHINES_DESCRIPTION, "machinesdescription", true,
            "Descrio das mquinas presentes em cada peer.");
    Option speedOption = new Option(NODE_MIPS_RATING, "speed", true, "A velocidade de cada mquina.");
    Option scheduler = new Option(SCHEDULER, "scheduler", true, "Indica qual scheduler dever ser usado.");
    Option peersDescription = new Option(PEERS_DESCRIPTION, "peers_description", true,
            "Arquivo descrevendo os peers.");
    Option numResByPeer = new Option(NUM_RESOURCES_BY_PEER, "nresources", true,
            "O nmero de rplicas para cada task.");
    Option numPeers = new Option(NUM_PEERS, "npeers", true, "O nmero de peers do grid.");
    Option nofOption = new Option(NOF, "nof", false, "Utiliza a Rede de Favores (NoF).");
    Option erwOption = new Option(EXTRACT_REMOTE_WORKLOAD, "extract_remote_workload", true,
            "Extrai, para cada job, o subconjunto das tasks que rodaram em recursos remotos.");
    Option output = new Option(OUTPUT, "output", true,
            "O nome do arquivo em que o output da simulao ser gravado.");
    Option halt = new Option(HALT_SIMULATION, "halt", true,
            "O tempo em que a simulao deve parar incondicionalmente.");

    workload.setRequired(true);// w  w  w  .ja  v  a2s.  c o  m
    peersDescription.setRequired(true);
    output.setRequired(true);

    workload.setType(File.class);
    peersDescription.setType(File.class);
    machinesDescription.setType(File.class);
    availability.setType(File.class);
    utilization.setType(File.class);
    workerEvents.setType(File.class);
    taskEvents.setType(File.class);
    output.setType(File.class);
    erwOption.setType(File.class);
    numResByPeer.setType(Number.class);
    numPeers.setType(Number.class);
    speedOption.setType(Number.class);
    //      syntAvail.setType(Number.class);
    syntAvailDur.setType(Number.class);
    syntAvail.setType(String.class);
    halt.setType(Number.class);

    scheduler.setArgs(2);
    availability.setArgs(2);
    // syntAvail.setArgs(2);

    OptionGroup availGroup = new OptionGroup();
    availGroup.addOption(availability);
    availGroup.addOption(dedicatedResources);
    availGroup.addOption(syntAvail);

    options.addOptionGroup(availGroup);

    options.addOption(workload);
    options.addOption(workloadType);
    options.addOption(machinesDescription);
    options.addOption(scheduler);
    options.addOption(syntAvailDur);
    options.addOption(output);
    options.addOption(erwOption);
    options.addOption(numResByPeer);
    options.addOption(numPeers);
    options.addOption(peersDescription);
    options.addOption(speedOption);
    options.addOption(nofOption);
    options.addOption(utilization);
    options.addOption(workerEvents);
    options.addOption(taskEvents);
    options.addOption(halt);

    options.addOption(VERBOSE, "verbose", false, "Informa todos os eventos importantes.");
    options.addOption(HELP, false, "Comando de ajuda.");
    options.addOption(USAGE, false, "Instrues de uso.");

    return options;
}

From source file:edu.internet2.middleware.psp.PspOptions.java

/**
 * Construct the <code>Options</code>.
 *//*from   w ww  .  java 2s . co  m*/
private void initOptions() {

    options = new Options();

    OptionGroup requestOp = new OptionGroup();
    requestOp.setRequired(true);
    requestOp.addOption(Mode.calc.getOption());
    requestOp.addOption(Mode.diff.getOption());
    requestOp.addOption(Mode.sync.getOption());
    requestOp.addOption(Mode.bulkCalc.getOption());
    requestOp.addOption(Mode.bulkDiff.getOption());
    requestOp.addOption(Mode.bulkSync.getOption());
    options.addOptionGroup(requestOp);

    OptionGroup returnData = new OptionGroup();
    returnData.addOption(Opts.returnData.getOption());
    returnData.addOption(Opts.returnEverything.getOption());
    returnData.addOption(Opts.returnIdentifier.getOption());
    returnData.setRequired(false);
    options.addOptionGroup(returnData);

    options.addOption(Opts.conf.getOption());
    options.addOption(Opts.entityName.getOption());
    options.addOption(Opts.interval.getOption());
    options.addOption(Opts.iterations.getOption());
    options.addOption(Opts.logSpml.getOption());
    options.addOption(Opts.output.getOption());
    options.addOption(Opts.requestID.getOption());
    options.addOption(Opts.printRequests.getOption());
    options.addOption(Opts.targetID.getOption());
    options.addOption(Opts.omitDiffResponses.getOption());
    options.addOption(Opts.omitSyncResponses.getOption());
}

From source file:de.bmw.yamaica.common.console.CommandExecuter.java

private OptionGroup createOptionGroup(IConfigurationElement optionGroupConfiguration,
        Map<String, IConfigurationElement> referenceableOptionConfigurations) {
    String required = optionGroupConfiguration.getAttribute(OPTION_GROUP_REQUIRED_ATTRIBUTE_NAME);

    OptionGroup optionGroup = new OptionGroup();
    optionGroup.setRequired(Boolean.parseBoolean(required));

    for (IConfigurationElement optionConfiguration : optionGroupConfiguration.getChildren()) {
        Option option = getOptionByConfiguration(optionConfiguration, referenceableOptionConfigurations);

        if (null != option) {
            optionGroup.addOption(option);
        }//from w ww .  j ava  2s  . c  o  m
    }

    return optionGroup;
}