Search in sources :

Example 6 with OptionGroup

use of org.apache.commons.cli.OptionGroup in project hbase by apache.

the class HFilePrettyPrinter method init.

private void init() {
    options.addOption("v", "verbose", false, "Verbose output; emits file and meta data delimiters");
    options.addOption("p", "printkv", false, "Print key/value pairs");
    options.addOption("e", "printkey", false, "Print keys");
    options.addOption("m", "printmeta", false, "Print meta data of file");
    options.addOption("b", "printblocks", false, "Print block index meta data");
    options.addOption("h", "printblockheaders", false, "Print block headers for each block.");
    options.addOption("k", "checkrow", false, "Enable row order check; looks for out-of-order keys");
    options.addOption("a", "checkfamily", false, "Enable family check");
    options.addOption("w", "seekToRow", true, "Seek to this row and print all the kvs for this row only");
    options.addOption("s", "stats", false, "Print statistics");
    options.addOption("i", "checkMobIntegrity", false, "Print all cells whose mob files are missing");
    OptionGroup files = new OptionGroup();
    files.addOption(new Option("f", "file", true, "File to scan. Pass full-path; e.g. hdfs://a:9000/hbase/hbase:meta/12/34"));
    files.addOption(new Option("r", "region", true, "Region to scan. Pass region name; e.g. 'hbase:meta,,1'"));
    options.addOptionGroup(files);
}
Also used : OptionGroup(org.apache.commons.cli.OptionGroup) Option(org.apache.commons.cli.Option)

Example 7 with OptionGroup

use of org.apache.commons.cli.OptionGroup in project hbase by apache.

the class ThriftServer method getOptions.

private static Options getOptions() {
    Options options = new Options();
    options.addOption("b", "bind", true, "Address to bind the Thrift server to. [default: 0.0.0.0]");
    options.addOption("p", "port", true, "Port to bind to [default: " + DEFAULT_LISTEN_PORT + "]");
    options.addOption("f", "framed", false, "Use framed transport");
    options.addOption("c", "compact", false, "Use the compact protocol");
    options.addOption("w", "workers", true, "How many worker threads to use.");
    options.addOption("s", "selectors", true, "How many selector threads to use.");
    options.addOption("q", "callQueueSize", true, "Max size of request queue (unbounded by default)");
    options.addOption("h", "help", false, "Print help information");
    options.addOption(null, "infoport", true, "Port for web UI");
    options.addOption("t", READ_TIMEOUT_OPTION, true, "Amount of time in milliseconds before a server thread will timeout " + "waiting for client to send data on a connected socket. Currently, " + "only applies to TBoundedThreadPoolServer");
    OptionGroup servers = new OptionGroup();
    servers.addOption(new Option("nonblocking", false, "Use the TNonblockingServer. This implies the framed transport."));
    servers.addOption(new Option("hsha", false, "Use the THsHaServer. This implies the framed transport."));
    servers.addOption(new Option("selector", false, "Use the TThreadedSelectorServer. This implies the framed transport."));
    servers.addOption(new Option("threadpool", false, "Use the TThreadPoolServer. This is the default."));
    options.addOptionGroup(servers);
    return options;
}
Also used : Options(org.apache.commons.cli.Options) OptionGroup(org.apache.commons.cli.OptionGroup) Option(org.apache.commons.cli.Option)

Example 8 with OptionGroup

use of org.apache.commons.cli.OptionGroup in project hive by apache.

the class HiveSchemaTool method initOptions.

// Create the required command line options
@SuppressWarnings("static-access")
private static void initOptions(Options cmdLineOptions) {
    Option help = new Option("help", "print this message");
    Option upgradeOpt = new Option("upgradeSchema", "Schema upgrade");
    Option upgradeFromOpt = OptionBuilder.withArgName("upgradeFrom").hasArg().withDescription("Schema upgrade from a version").create("upgradeSchemaFrom");
    Option initOpt = new Option("initSchema", "Schema initialization");
    Option initToOpt = OptionBuilder.withArgName("initTo").hasArg().withDescription("Schema initialization to a version").create("initSchemaTo");
    Option infoOpt = new Option("info", "Show config and schema details");
    Option validateOpt = new Option("validate", "Validate the database");
    OptionGroup optGroup = new OptionGroup();
    optGroup.addOption(upgradeOpt).addOption(initOpt).addOption(help).addOption(upgradeFromOpt).addOption(initToOpt).addOption(infoOpt).addOption(validateOpt);
    optGroup.setRequired(true);
    Option userNameOpt = OptionBuilder.withArgName("user").hasArgs().withDescription("Override config file user name").create("userName");
    Option passwdOpt = OptionBuilder.withArgName("password").hasArgs().withDescription("Override config file password").create("passWord");
    Option dbTypeOpt = OptionBuilder.withArgName("databaseType").hasArgs().withDescription("Metastore database type").create("dbType");
    Option dbOpts = OptionBuilder.withArgName("databaseOpts").hasArgs().withDescription("Backend DB specific options").create("dbOpts");
    Option dryRunOpt = new Option("dryRun", "list SQL scripts (no execute)");
    Option verboseOpt = new Option("verbose", "only print SQL statements");
    Option serversOpt = OptionBuilder.withArgName("serverList").hasArgs().withDescription("a comma-separated list of servers used in location validation").create("servers");
    cmdLineOptions.addOption(help);
    cmdLineOptions.addOption(dryRunOpt);
    cmdLineOptions.addOption(userNameOpt);
    cmdLineOptions.addOption(passwdOpt);
    cmdLineOptions.addOption(dbTypeOpt);
    cmdLineOptions.addOption(verboseOpt);
    cmdLineOptions.addOption(dbOpts);
    cmdLineOptions.addOption(serversOpt);
    cmdLineOptions.addOptionGroup(optGroup);
}
Also used : OptionGroup(org.apache.commons.cli.OptionGroup) Option(org.apache.commons.cli.Option)

Example 9 with OptionGroup

use of org.apache.commons.cli.OptionGroup in project perun by CESNET.

the class ExporterStarter method main.

public static void main(String[] args) {
    // create Options object
    Options options = new Options();
    options.addOption("id", true, "exporter ID");
    OptionGroup outputOptions = new OptionGroup();
    outputOptions.addOption(new Option("stdout", "Print audit log messages to the stdout"));
    outputOptions.addOption(new Option("tcp", "sends audit log messages to the host:port over TCP"));
    outputOptions.addOption(new Option("udp", "sends audit log messages to the host:port over UDP"));
    options.addOptionGroup(outputOptions);
    CommandLineParser parser = new BasicParser();
    CommandLine cmd;
    try {
        cmd = parser.parse(options, args);
        String exporterId = cmd.getOptionValue("id");
        if (exporterId == null) {
            System.err.println("Exporter ID must be specified.");
            System.exit(1);
        }
        OutputType outputType = cmd.hasOption("stdout") ? OutputType.STDOUT : cmd.hasOption("tcp") ? OutputType.TCP : cmd.hasOption("udp") ? OutputType.UDP : OutputType.STDOUT;
        ExporterStarter exporter = new ExporterStarter(outputType);
        exporter.run(exporterId);
    } catch (ParseException e) {
        help(options);
        System.exit(1);
    }
}
Also used : Options(org.apache.commons.cli.Options) BasicParser(org.apache.commons.cli.BasicParser) CommandLine(org.apache.commons.cli.CommandLine) OptionGroup(org.apache.commons.cli.OptionGroup) Option(org.apache.commons.cli.Option) CommandLineParser(org.apache.commons.cli.CommandLineParser) ParseException(org.apache.commons.cli.ParseException)

Example 10 with OptionGroup

use of org.apache.commons.cli.OptionGroup in project wildfly by wildfly.

the class VaultTool method initOptions.

/**
     * Build options for non-interactive VaultTool usage scenario.
     *
     * @return
     */
private void initOptions() {
    options = new Options();
    options.addOption("k", KEYSTORE_PARAM, true, SecurityLogger.ROOT_LOGGER.cmdLineKeyStoreURL());
    options.addOption("p", KEYSTORE_PASSWORD_PARAM, true, SecurityLogger.ROOT_LOGGER.cmdLineKeyStorePassword());
    options.addOption("e", ENC_DIR_PARAM, true, SecurityLogger.ROOT_LOGGER.cmdLineEncryptionDirectory());
    options.addOption("s", SALT_PARAM, true, SecurityLogger.ROOT_LOGGER.cmdLineSalt());
    options.addOption("i", ITERATION_PARAM, true, SecurityLogger.ROOT_LOGGER.cmdLineIterationCount());
    options.addOption("v", ALIAS_PARAM, true, SecurityLogger.ROOT_LOGGER.cmdLineVaultKeyStoreAlias());
    options.addOption("b", VAULT_BLOCK_PARAM, true, SecurityLogger.ROOT_LOGGER.cmdLineVaultBlock());
    options.addOption("a", ATTRIBUTE_PARAM, true, SecurityLogger.ROOT_LOGGER.cmdLineAttributeName());
    options.addOption("t", CREATE_KEYSTORE_PARAM, false, SecurityLogger.ROOT_LOGGER.cmdLineAutomaticallyCreateKeystore());
    OptionGroup og = new OptionGroup();
    Option x = new Option("x", SEC_ATTR_VALUE_PARAM, true, SecurityLogger.ROOT_LOGGER.cmdLineSecuredAttribute());
    Option c = new Option("c", CHECK_SEC_ATTR_EXISTS_PARAM, false, SecurityLogger.ROOT_LOGGER.cmdLineCheckAttribute());
    Option r = new Option("r", REMOVE_SEC_ATTR_PARAM, false, SecurityLogger.ROOT_LOGGER.cmdLineRemoveSecuredAttribute());
    Option h = new Option("h", HELP_PARAM, false, SecurityLogger.ROOT_LOGGER.cmdLineHelp());
    og.addOption(x);
    og.addOption(c);
    og.addOption(r);
    og.addOption(h);
    og.setRequired(true);
    options.addOptionGroup(og);
}
Also used : Options(org.apache.commons.cli.Options) OptionGroup(org.apache.commons.cli.OptionGroup) Option(org.apache.commons.cli.Option)

Aggregations

OptionGroup (org.apache.commons.cli.OptionGroup)14 Option (org.apache.commons.cli.Option)13 Options (org.apache.commons.cli.Options)11 Collection (java.util.Collection)1 HashSet (java.util.HashSet)1 BasicParser (org.apache.commons.cli.BasicParser)1 CommandLine (org.apache.commons.cli.CommandLine)1 CommandLineParser (org.apache.commons.cli.CommandLineParser)1 ParseException (org.apache.commons.cli.ParseException)1