Search in sources :

Example 1 with Option

use of org.apache.hbase.thirdparty.org.apache.commons.cli.Option in project hbase by apache.

the class TestJoinedScanners method main.

/**
 * Command line interface:
 * @param args
 * @throws IOException if there is a bug while reading from disk
 */
public static void main(final String[] args) throws Exception {
    Option encodingOption = new Option("e", "blockEncoding", true, "Data block encoding; Default: FAST_DIFF");
    encodingOption.setRequired(false);
    options.addOption(encodingOption);
    Option ratioOption = new Option("r", "selectionRatio", true, "Ratio of selected rows using essential column family");
    ratioOption.setRequired(false);
    options.addOption(ratioOption);
    Option widthOption = new Option("w", "valueWidth", true, "Width of value for non-essential column family");
    widthOption.setRequired(false);
    options.addOption(widthOption);
    CommandLineParser parser = new GnuParser();
    CommandLine cmd = parser.parse(options, args);
    if (args.length < 1) {
        HelpFormatter formatter = new HelpFormatter();
        formatter.printHelp("TestJoinedScanners", options, true);
    }
    if (cmd.hasOption("e")) {
        blockEncoding = DataBlockEncoding.valueOf(cmd.getOptionValue("e"));
    }
    if (cmd.hasOption("r")) {
        selectionRatio = Integer.parseInt(cmd.getOptionValue("r"));
    }
    if (cmd.hasOption("w")) {
        valueWidth = Integer.parseInt(cmd.getOptionValue("w"));
    }
    // run the test
    TestJoinedScanners test = new TestJoinedScanners();
    test.testJoinedScanners();
}
Also used : HelpFormatter(org.apache.hbase.thirdparty.org.apache.commons.cli.HelpFormatter) CommandLine(org.apache.hbase.thirdparty.org.apache.commons.cli.CommandLine) GnuParser(org.apache.hbase.thirdparty.org.apache.commons.cli.GnuParser) Option(org.apache.hbase.thirdparty.org.apache.commons.cli.Option) StartTestingClusterOption(org.apache.hadoop.hbase.StartTestingClusterOption) CommandLineParser(org.apache.hbase.thirdparty.org.apache.commons.cli.CommandLineParser)

Example 2 with Option

use of org.apache.hbase.thirdparty.org.apache.commons.cli.Option in project hbase by apache.

the class AbstractHBaseTool method addRequiredOptWithArg.

protected void addRequiredOptWithArg(String shortOpt, String longOpt, String description) {
    Option option = new Option(shortOpt, longOpt, true, description);
    option.setRequired(true);
    addOption(option);
}
Also used : Option(org.apache.hbase.thirdparty.org.apache.commons.cli.Option)

Example 3 with Option

use of org.apache.hbase.thirdparty.org.apache.commons.cli.Option in project hbase by apache.

the class RowCounter method addOptions.

@Override
protected void addOptions() {
    Option startTimeOption = Option.builder(null).valueSeparator('=').hasArg(true).desc("starting time filter to start counting rows from.").longOpt(OPT_START_TIME).build();
    Option endTimeOption = Option.builder(null).valueSeparator('=').hasArg(true).desc("end time filter limit, to only count rows up to this timestamp.").longOpt(OPT_END_TIME).build();
    Option rangeOption = Option.builder(null).valueSeparator('=').hasArg(true).desc("[startKey],[endKey][;[startKey],[endKey]...]]").longOpt(OPT_RANGE).build();
    Option expectedOption = Option.builder(null).valueSeparator('=').hasArg(true).desc("expected number of rows to be count.").longOpt(OPT_EXPECTED_COUNT).build();
    addOption(startTimeOption);
    addOption(endTimeOption);
    addOption(rangeOption);
    addOption(expectedOption);
}
Also used : Option(org.apache.hbase.thirdparty.org.apache.commons.cli.Option)

Example 4 with Option

use of org.apache.hbase.thirdparty.org.apache.commons.cli.Option 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.hbase.thirdparty.org.apache.commons.cli.OptionGroup) Option(org.apache.hbase.thirdparty.org.apache.commons.cli.Option)

Example 5 with Option

use of org.apache.hbase.thirdparty.org.apache.commons.cli.Option in project hbase by apache.

the class ChaosService method getOptions.

private static Options getOptions() {
    Options options = new Options();
    options.addOption(new Option("c", ChaosServiceName.CHAOSAGENT.toString().toLowerCase(), true, "expecting a start/stop argument"));
    options.addOption(new Option("D", ChaosServiceName.GENERIC.toString(), true, "generic D param"));
    LOG.info(Arrays.toString(new Collection[] { options.getOptions() }));
    return options;
}
Also used : Options(org.apache.hbase.thirdparty.org.apache.commons.cli.Options) Collection(java.util.Collection) Option(org.apache.hbase.thirdparty.org.apache.commons.cli.Option)

Aggregations

Option (org.apache.hbase.thirdparty.org.apache.commons.cli.Option)7 OptionGroup (org.apache.hbase.thirdparty.org.apache.commons.cli.OptionGroup)2 Collection (java.util.Collection)1 StartTestingClusterOption (org.apache.hadoop.hbase.StartTestingClusterOption)1 CommandLine (org.apache.hbase.thirdparty.org.apache.commons.cli.CommandLine)1 CommandLineParser (org.apache.hbase.thirdparty.org.apache.commons.cli.CommandLineParser)1 GnuParser (org.apache.hbase.thirdparty.org.apache.commons.cli.GnuParser)1 HelpFormatter (org.apache.hbase.thirdparty.org.apache.commons.cli.HelpFormatter)1 Options (org.apache.hbase.thirdparty.org.apache.commons.cli.Options)1