Search in sources :

Example 1 with CommandLineOperationParams

use of org.locationtech.geowave.core.cli.parser.CommandLineOperationParams in project geowave by locationtech.

the class ExplainCommand method execute.

@Override
public void execute(final OperationParams inputParams) {
    final CommandLineOperationParams params = (CommandLineOperationParams) inputParams;
    final StringBuilder builder = new StringBuilder();
    // Sort first
    String nextCommand = "geowave";
    JCommander commander = params.getCommander();
    while (commander != null) {
        if ((commander.getParameters() != null) && (commander.getParameters().size() > 0)) {
            builder.append("Command: ");
            builder.append(nextCommand);
            builder.append(" [options]");
            if (commander.getParsedCommand() != null) {
                builder.append(" <subcommand> ...");
            }
            builder.append("\n\n");
            builder.append(explainCommander(commander));
            builder.append("\n");
        } else if (commander.getMainParameter() != null) {
            builder.append("Command: ");
            builder.append(nextCommand);
            if (commander.getParsedCommand() != null) {
                builder.append(" <subcommand> ...");
            }
            builder.append("\n\n");
            builder.append(explainMainParameter(commander));
            builder.append("\n");
        }
        nextCommand = commander.getParsedCommand();
        commander = commander.getCommands().get(nextCommand);
    }
    params.getConsole().println(builder.toString().trim());
}
Also used : JCommander(com.beust.jcommander.JCommander) CommandLineOperationParams(org.locationtech.geowave.core.cli.parser.CommandLineOperationParams)

Example 2 with CommandLineOperationParams

use of org.locationtech.geowave.core.cli.parser.CommandLineOperationParams in project geowave by locationtech.

the class HelpCommandTest method testPrepare.

@Test
public void testPrepare() {
    final String[] args = { "help" };
    final OperationRegistry registry = OperationRegistry.getInstance();
    final OperationParser parser = new OperationParser(registry);
    final CommandLineOperationParams params = parser.parse(GeoWaveTopLevelSection.class, args);
    final HelpCommand helpcommand = new HelpCommand();
    helpcommand.prepare(params);
    assertEquals(false, params.isValidate());
    assertEquals(true, params.isAllowUnknown());
}
Also used : CommandLineOperationParams(org.locationtech.geowave.core.cli.parser.CommandLineOperationParams) OperationRegistry(org.locationtech.geowave.core.cli.spi.OperationRegistry) OperationParser(org.locationtech.geowave.core.cli.parser.OperationParser) Test(org.junit.Test)

Example 3 with CommandLineOperationParams

use of org.locationtech.geowave.core.cli.parser.CommandLineOperationParams in project geowave by locationtech.

the class GeoWaveDedupeJobRunner method main.

public static void main(final String[] args) throws Exception {
    final ConfigOptions opts = new ConfigOptions();
    final MainParameterHolder holder = new MainParameterHolder();
    final OperationParser parser = new OperationParser();
    parser.addAdditionalObject(opts);
    parser.addAdditionalObject(holder);
    // Second round to get everything else.
    final CommandLineOperationParams params = parser.parse(args);
    // Set the datastore plugin
    if (holder.getMainParameter().size() == 0) {
        throw new ParameterException("Must specify datastore name as first argument.");
    }
    // Load the params for config file.
    opts.prepare(params);
    final StoreLoader loader = new StoreLoader(holder.getMainParameter().get(0));
    loader.loadFromConfig((File) params.getContext().get(ConfigOptions.PROPERTIES_FILE_CONTEXT), params.getConsole());
    final int res = ToolRunner.run(new Configuration(), new GeoWaveDedupeJobRunner(loader.getDataStorePlugin()), args);
    System.exit(res);
}
Also used : Configuration(org.apache.hadoop.conf.Configuration) CommandLineOperationParams(org.locationtech.geowave.core.cli.parser.CommandLineOperationParams) ParameterException(com.beust.jcommander.ParameterException) StoreLoader(org.locationtech.geowave.core.store.cli.store.StoreLoader) OperationParser(org.locationtech.geowave.core.cli.parser.OperationParser) ConfigOptions(org.locationtech.geowave.core.cli.operations.config.options.ConfigOptions)

Example 4 with CommandLineOperationParams

use of org.locationtech.geowave.core.cli.parser.CommandLineOperationParams in project geowave by locationtech.

the class RasterTileResizeJobRunner method main.

public static void main(final String[] args) throws Exception {
    final ConfigOptions opts = new ConfigOptions();
    final OperationParser parser = new OperationParser();
    parser.addAdditionalObject(opts);
    final ResizeMRCommand command = new ResizeMRCommand();
    final CommandLineOperationParams params = parser.parse(command, args);
    opts.prepare(params);
    final int res = ToolRunner.run(new Configuration(), command.createRunner(params), args);
    System.exit(res);
}
Also used : Configuration(org.apache.hadoop.conf.Configuration) CommandLineOperationParams(org.locationtech.geowave.core.cli.parser.CommandLineOperationParams) OperationParser(org.locationtech.geowave.core.cli.parser.OperationParser) ConfigOptions(org.locationtech.geowave.core.cli.operations.config.options.ConfigOptions) ResizeMRCommand(org.locationtech.geowave.adapter.raster.operations.ResizeMRCommand)

Example 5 with CommandLineOperationParams

use of org.locationtech.geowave.core.cli.parser.CommandLineOperationParams in project geowave by locationtech.

the class KDEJobRunner method main.

public static void main(final String[] args) throws Exception {
    final ConfigOptions opts = new ConfigOptions();
    final OperationParser parser = new OperationParser();
    parser.addAdditionalObject(opts);
    final KdeCommand command = new KdeCommand();
    final CommandLineOperationParams params = parser.parse(command, args);
    opts.prepare(params);
    final int res = ToolRunner.run(new Configuration(), command.createRunner(params), args);
    System.exit(res);
}
Also used : Configuration(org.apache.hadoop.conf.Configuration) CommandLineOperationParams(org.locationtech.geowave.core.cli.parser.CommandLineOperationParams) KdeCommand(org.locationtech.geowave.analytic.mapreduce.operations.KdeCommand) OperationParser(org.locationtech.geowave.core.cli.parser.OperationParser) ConfigOptions(org.locationtech.geowave.core.cli.operations.config.options.ConfigOptions)

Aggregations

CommandLineOperationParams (org.locationtech.geowave.core.cli.parser.CommandLineOperationParams)16 OperationParser (org.locationtech.geowave.core.cli.parser.OperationParser)12 Configuration (org.apache.hadoop.conf.Configuration)8 ConfigOptions (org.locationtech.geowave.core.cli.operations.config.options.ConfigOptions)6 OperationRegistry (org.locationtech.geowave.core.cli.spi.OperationRegistry)4 Test (org.junit.Test)3 JCommander (com.beust.jcommander.JCommander)2 File (java.io.File)2 ClientConfiguration (org.apache.accumulo.core.client.ClientConfiguration)2 KdeCommand (org.locationtech.geowave.analytic.mapreduce.operations.KdeCommand)2 OSMIngestCommandArgs (org.locationtech.geowave.cli.osm.operations.options.OSMIngestCommandArgs)2 DataStorePluginOptions (org.locationtech.geowave.core.store.cli.store.DataStorePluginOptions)2 AccumuloStoreFactoryFamily (org.locationtech.geowave.datastore.accumulo.AccumuloStoreFactoryFamily)2 ParameterException (com.beust.jcommander.ParameterException)1 Parameters (com.beust.jcommander.Parameters)1 ArrayList (java.util.ArrayList)1 Map (java.util.Map)1 Properties (java.util.Properties)1 ResizeMRCommand (org.locationtech.geowave.adapter.raster.operations.ResizeMRCommand)1 GeowaveOperation (org.locationtech.geowave.core.cli.annotations.GeowaveOperation)1