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

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

Introduction

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

Prototype

public OptionGroup addOption(Option option) 

Source Link

Document

Add the specified Option to this group.

Usage

From source file:org.apache.hive.beeline.schematool.HiveSchemaTool.java

public static void main(String[] args) {
    MetastoreSchemaTool tool = new HiveSchemaTool();
    OptionGroup additionalGroup = new OptionGroup();
    Option metaDbTypeOpt = OptionBuilder.withArgName("metaDatabaseType").hasArgs()
            .withDescription("Used only if upgrading the system catalog for hive").create("metaDbType");
    additionalGroup.addOption(metaDbTypeOpt);
    System.setProperty(MetastoreConf.ConfVars.SCHEMA_VERIFICATION.getVarname(), "true");
    System.exit(/*from   w w w . j a  va 2  s .  c  om*/
            tool.run(System.getenv("HIVE_HOME"), args, additionalGroup, new HiveConf(HiveSchemaTool.class)));
}

From source file:org.apache.ignite.startup.GridRandomCommandLineLoader.java

/**
 * Creates cli options./*from  w  ww .  j a  v  a2s  . co m*/
 *
 * @return Command line options
 */
private static Options createOptions() {
    Options options = new Options();

    Option help = new Option(OPTION_HELP, "print this message");

    Option cfg = new Option(null, OPTION_CFG, true, "path to Spring XML configuration file.");

    cfg.setValueSeparator('=');
    cfg.setType(String.class);

    Option minTtl = new Option(null, OPTION_MIN_TTL, true, "node minimum time to live.");

    minTtl.setValueSeparator('=');
    minTtl.setType(Long.class);

    Option maxTtl = new Option(null, OPTION_MAX_TTL, true, "node maximum time to live.");

    maxTtl.setValueSeparator('=');
    maxTtl.setType(Long.class);

    Option duration = new Option(null, OPTION_DURATION, true, "run timeout.");

    duration.setValueSeparator('=');
    duration.setType(Long.class);

    Option log = new Option(null, OPTION_LOG_CFG, true, "path to log4j configuration file.");

    log.setValueSeparator('=');
    log.setType(String.class);

    options.addOption(help);

    OptionGroup grp = new OptionGroup();

    grp.setRequired(true);

    grp.addOption(cfg);
    grp.addOption(minTtl);
    grp.addOption(maxTtl);
    grp.addOption(duration);
    grp.addOption(log);

    options.addOptionGroup(grp);

    return options;
}

From source file:org.apache.ignite.startup.GridVmNodesStarter.java

/**
 * Creates cli options./*from www  . j av a 2  s.co m*/
 *
 * @return Command line options
 */
private static Options createOptions() {
    Options options = new Options();

    OptionGroup grp = new OptionGroup();

    grp.setRequired(true);

    Option cfg = new Option(OPTION_CFG, null, true, "path to Spring XML configuration file.");

    cfg.setArgName("file");

    Option n = new Option(null, OPTION_N, true, "nodes count.");

    n.setValueSeparator('=');
    n.setType(Integer.class);

    grp.addOption(cfg);
    grp.addOption(n);

    options.addOptionGroup(grp);

    return options;
}

From source file:org.apache.ivory.cli.IvoryCLI.java

private Options createAdminOptions() {
    Options adminOptions = new Options();
    Option url = new Option(URL_OPTION, true, "Ivory URL");
    adminOptions.addOption(url);/*w  w  w  . j av a2s . c om*/

    OptionGroup group = new OptionGroup();
    // Option status = new Option(STATUS_OPTION, false,
    // "show the current system status");
    Option version = new Option(VERSION_OPTION, false, "show Ivory server build version");
    Option help = new Option("help", false, "show Ivory help");
    group.addOption(version);
    group.addOption(help);

    adminOptions.addOptionGroup(group);
    return adminOptions;
}

From source file:org.apache.ivory.cli.IvoryCLI.java

private Options entityOptions() {

    Options entityOptions = new Options();

    Option submit = new Option(SUBMIT_OPT, false, "Submits an entity xml to Ivory");
    Option update = new Option(UPDATE_OPT, false, "Updates an existing entity xml");
    Option schedule = new Option(SCHEDULE_OPT, false, "Schedules a submited entity in Ivory");
    Option suspend = new Option(SUSPEND_OPT, false, "Suspends a running entity in Ivory");
    Option resume = new Option(RESUME_OPT, false, "Resumes a suspended entity in Ivory");
    Option delete = new Option(DELETE_OPT, false,
            "Deletes an entity in Ivory, and kills its instance from workflow engine");
    Option submitAndSchedule = new Option(SUBMIT_AND_SCHEDULE_OPT, false,
            "Submits and entity to Ivory and schedules it immediately");
    Option validate = new Option(VALIDATE_OPT, false, "Validates an entity based on the entity type");
    Option status = new Option(STATUS_OPT, false, "Gets the status of entity");
    Option definition = new Option(DEFINITION_OPT, false, "Gets the Definition of entity");
    Option dependency = new Option(DEPENDENCY_OPT, false, "Gets the dependencies of entity");
    Option list = new Option(LIST_OPT, false, "List entities registerd for a type");

    OptionGroup group = new OptionGroup();
    group.addOption(submit);
    group.addOption(update);//www  .j a  v a 2s  . c om
    group.addOption(schedule);
    group.addOption(suspend);
    group.addOption(resume);
    group.addOption(delete);
    group.addOption(submitAndSchedule);
    group.addOption(validate);
    group.addOption(status);
    group.addOption(definition);
    group.addOption(dependency);
    group.addOption(list);

    Option url = new Option(URL_OPTION, true, "Ivory URL");
    Option entityType = new Option(ENTITY_TYPE_OPT, true, "Entity type, can be cluster, feed or process xml");
    Option filePath = new Option(FILE_PATH_OPT, true, "Path to entity xml file");
    Option entityName = new Option(ENTITY_NAME_OPT, true, "Entity type, can be cluster, feed or process xml");

    entityOptions.addOption(url);
    entityOptions.addOptionGroup(group);
    entityOptions.addOption(entityType);
    entityOptions.addOption(entityName);
    entityOptions.addOption(filePath);

    return entityOptions;

}

From source file:org.apache.ivory.cli.IvoryCLI.java

private Options instanceOptions() {

    Options instanceOptions = new Options();

    Option running = new Option(RUNNING_OPT, false, "Gets running process instances for a given process");
    Option status = new Option(STATUS_OPT, false,
            "Gets status of process instances for a given process in the range start time and optional end time");
    Option kill = new Option(KILL_OPT, false,
            "Kills active process instances for a given process in the range start time and optional end time");
    Option suspend = new Option(SUSPEND_OPT, false,
            "Suspends active process instances for a given process in the range start time and optional end time");
    Option resume = new Option(RESUME_OPT, false,
            "Resumes suspended process instances for a given process in the range start time and optional end time");
    Option rerun = new Option(RERUN_OPT, false,
            "Reruns process instances for a given process in the range start time and optional end time and overrides properties present in job.properties file");

    OptionGroup group = new OptionGroup();
    group.addOption(running);
    group.addOption(status);/*from   www .jav  a  2  s .  c o m*/
    group.addOption(kill);
    group.addOption(resume);
    group.addOption(suspend);
    group.addOption(resume);
    group.addOption(rerun);

    Option url = new Option(URL_OPTION, true, "Ivory URL");
    Option start = new Option(START_OPT, true,
            "Start time is required for commands, status, kill, suspend, resume and re-run");
    Option end = new Option(END_OPT, true,
            "End time is optional for commands, status, kill, suspend, resume and re-run; if not specified then current time is considered as end time");
    Option runid = new Option(RUNID_OPT, true,
            "Instance runid  is optional and user can specify the runid, defaults to 0");
    Option filePath = new Option(FILE_PATH_OPT, true,
            "Path to job.properties file is required for rerun command, it should contain name=value pair for properties to override for rerun");
    Option entityType = new Option(ENTITY_TYPE_OPT, true, "Entity type, can be feed or process xml");
    Option entityName = new Option(ENTITY_NAME_OPT, true, "Entity type, can be feed or process xml");

    instanceOptions.addOption(url);
    instanceOptions.addOptionGroup(group);
    instanceOptions.addOption(start);
    instanceOptions.addOption(end);
    instanceOptions.addOption(filePath);
    instanceOptions.addOption(entityType);
    instanceOptions.addOption(entityName);
    instanceOptions.addOption(runid);

    return instanceOptions;

}

From source file:org.apache.kylin.job.CubeMetaExtractor.java

public CubeMetaExtractor() {
    options = new Options();

    OptionGroup realizationOrProject = new OptionGroup();
    realizationOrProject.addOption(OPTION_CUBE);
    realizationOrProject.addOption(OPTION_PROJECT);
    realizationOrProject.addOption(OPTION_HYBRID);
    realizationOrProject.setRequired(true);

    options.addOptionGroup(realizationOrProject);
    options.addOption(OPTION_INCLUDE_SEGMENTS);
    options.addOption(OPTION_INCLUDE_JOB);
    options.addOption(OPTION_DEST);/*ww  w . j  a v  a 2 s .  c o  m*/

}

From source file:org.apache.kylin.tool.CubeMetaExtractor.java

public CubeMetaExtractor() {
    super();/*from www  .  j a va2s .  c o m*/

    packageType = "cubemeta";

    OptionGroup realizationOrProject = new OptionGroup();
    realizationOrProject.addOption(OPTION_CUBE);
    realizationOrProject.addOption(OPTION_PROJECT);
    realizationOrProject.addOption(OPTION_HYBRID);
    realizationOrProject.addOption(OPTION_All_PROJECT);
    realizationOrProject.setRequired(true);

    options.addOptionGroup(realizationOrProject);
    options.addOption(OPTION_INCLUDE_SEGMENTS);
    options.addOption(OPTION_INCLUDE_JOB);
    options.addOption(OPTION_INCLUDE_SEGMENT_DETAILS);
    options.addOption(OPTION_INCLUDE_ONLY_JOB_OUTPUT);
    options.addOption(OPTION_STORAGE_TYPE);
    options.addOption(OPTION_ENGINE_TYPE);
}

From source file:org.apache.kylin.tool.HBaseUsageExtractor.java

public HBaseUsageExtractor() {
    super();/* w  w  w  .  ja v  a  2s . c om*/
    packageType = "hbase";

    OptionGroup realizationOrProject = new OptionGroup();
    realizationOrProject.addOption(OPTION_CUBE);
    realizationOrProject.addOption(OPTION_PROJECT);
    realizationOrProject.setRequired(true);

    options.addOptionGroup(realizationOrProject);
    conf = HBaseConfiguration.create();
}

From source file:org.apache.marmotta.ldpath.backend.file.FileQuery.java

@SuppressWarnings("static-access")
private static Options buildOptions() {
    Options result = new Options();

    OptionGroup input = new OptionGroup();
    Option file = OptionBuilder.withArgName("file").hasArg().withDescription("query the contents of a file")
            .create("file");
    Option url = OptionBuilder.withArgName("url").hasArg().withDescription("query the contents of a remote URL")
            .create("url");

    input.addOption(file);
    input.addOption(url);//from w w w . j ava 2s. c  o  m
    input.setRequired(true);

    result.addOptionGroup(input);

    Option format = OptionBuilder.withArgName("mimetype").hasArg()
            .withDescription("MIME type of the input document").create("format");
    result.addOption(format);

    OptionGroup query = new OptionGroup();
    Option path = OptionBuilder.withArgName("path").hasArg()
            .withDescription("LD Path to evaluate on the file starting from the context").create("path");
    Option program = OptionBuilder.withArgName("file").hasArg()
            .withDescription("LD Path program to evaluate on the file starting from the context")
            .create("program");
    query.addOption(path);
    query.addOption(program);
    query.setRequired(true);
    result.addOptionGroup(query);

    Option context = OptionBuilder.withArgName("uri").hasArg()
            .withDescription("URI of the context node to start from").create("context");
    context.setRequired(true);
    result.addOption(context);

    Option loglevel = OptionBuilder.withArgName("level").hasArg()
            .withDescription("set the log level; default is 'warn'").create("loglevel");
    result.addOption(loglevel);

    return result;
}