Search in sources :

Example 1 with ConfigOptions

use of org.locationtech.geowave.core.cli.operations.config.options.ConfigOptions 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 2 with ConfigOptions

use of org.locationtech.geowave.core.cli.operations.config.options.ConfigOptions 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 3 with ConfigOptions

use of org.locationtech.geowave.core.cli.operations.config.options.ConfigOptions in project geowave by locationtech.

the class ListStoresCommand method computeResults.

@Override
public Map<String, String> computeResults(OperationParams params) throws Exception {
    final File configFile = getGeoWaveConfigFile(params);
    // ConfigOptions checks/will never return null Properties
    Properties configProps = ConfigOptions.loadProperties(configFile);
    LOGGER.debug(configProps.size() + " entries in the config file");
    // The name that the user gave the store is in a property named
    // as "store." <[optional namespace.] the name the user gave > ".type"
    Map<String, String> storeMap = configProps.entrySet().stream().filter(// Omit defaults
    entry -> !entry.getKey().toString().startsWith("store.default-")).filter(entry -> entry.getKey().toString().startsWith("store.")).filter(entry -> entry.getKey().toString().endsWith(".type")).collect(Collectors.toMap(entry -> (String) entry.getKey(), entry -> (String) entry.getValue()));
    return storeMap;
}
Also used : OperationParams(org.locationtech.geowave.core.cli.api.OperationParams) Arrays(java.util.Arrays) Parameters(com.beust.jcommander.Parameters) Properties(java.util.Properties) FirstElementListComparator(org.locationtech.geowave.core.cli.utils.FirstElementListComparator) Logger(org.slf4j.Logger) LoggerFactory(org.slf4j.LoggerFactory) Collectors(java.util.stream.Collectors) File(java.io.File) ArrayList(java.util.ArrayList) GeowaveOperation(org.locationtech.geowave.core.cli.annotations.GeowaveOperation) ConfigOptions(org.locationtech.geowave.core.cli.operations.config.options.ConfigOptions) List(java.util.List) ServiceEnabledCommand(org.locationtech.geowave.core.cli.api.ServiceEnabledCommand) Map(java.util.Map) Collections(java.util.Collections) ConsoleTablePrinter(org.locationtech.geowave.core.cli.utils.ConsoleTablePrinter) Properties(java.util.Properties) File(java.io.File)

Example 4 with ConfigOptions

use of org.locationtech.geowave.core.cli.operations.config.options.ConfigOptions 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)

Example 5 with ConfigOptions

use of org.locationtech.geowave.core.cli.operations.config.options.ConfigOptions in project geowave by locationtech.

the class ComparisonStatsJobRunner method main.

public static void main(final String[] args) throws Exception {
    final ConfigOptions opts = new ConfigOptions();
    final ComparisonCommandLineOptions comparisonOptions = new ComparisonCommandLineOptions();
    final OperationParser parser = new OperationParser();
    parser.addAdditionalObject(opts);
    parser.addAdditionalObject(comparisonOptions);
    final KdeCommand kdeCommand = new KdeCommand();
    final CommandLineOperationParams params = parser.parse(kdeCommand, args);
    // Load the params for config file.
    opts.prepare(params);
    final File configFile = (File) params.getContext().get(ConfigOptions.PROPERTIES_FILE_CONTEXT);
    // Don't care about output, but this will set the datastore options.
    kdeCommand.createRunner(params);
    final ComparisonStatsJobRunner runner = new ComparisonStatsJobRunner(comparisonOptions, kdeCommand.getKdeOptions(), kdeCommand.getInputStoreOptions(), kdeCommand.getOutputStoreOptions(), configFile, null);
    final int res = ToolRunner.run(new Configuration(), runner, 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) File(java.io.File) ConfigOptions(org.locationtech.geowave.core.cli.operations.config.options.ConfigOptions)

Aggregations

ConfigOptions (org.locationtech.geowave.core.cli.operations.config.options.ConfigOptions)7 Configuration (org.apache.hadoop.conf.Configuration)6 CommandLineOperationParams (org.locationtech.geowave.core.cli.parser.CommandLineOperationParams)6 OperationParser (org.locationtech.geowave.core.cli.parser.OperationParser)6 File (java.io.File)2 KdeCommand (org.locationtech.geowave.analytic.mapreduce.operations.KdeCommand)2 ParameterException (com.beust.jcommander.ParameterException)1 Parameters (com.beust.jcommander.Parameters)1 ArrayList (java.util.ArrayList)1 Arrays (java.util.Arrays)1 Collections (java.util.Collections)1 List (java.util.List)1 Map (java.util.Map)1 Properties (java.util.Properties)1 Collectors (java.util.stream.Collectors)1 ResizeMRCommand (org.locationtech.geowave.adapter.raster.operations.ResizeMRCommand)1 GeowaveOperation (org.locationtech.geowave.core.cli.annotations.GeowaveOperation)1 OperationParams (org.locationtech.geowave.core.cli.api.OperationParams)1 ServiceEnabledCommand (org.locationtech.geowave.core.cli.api.ServiceEnabledCommand)1 ConsoleTablePrinter (org.locationtech.geowave.core.cli.utils.ConsoleTablePrinter)1