use of org.locationtech.geowave.core.store.metadata.AdapterStoreImpl in project geowave by locationtech.
the class AccumuloUtils method getIterator.
private static CloseableIterator<Entry<Key, Value>> getIterator(final Connector connector, final String namespace, final Index index) throws AccumuloException, AccumuloSecurityException, IOException, TableNotFoundException {
CloseableIterator<Entry<Key, Value>> iterator = null;
final AccumuloOptions options = new AccumuloOptions();
final AccumuloOperations operations = new AccumuloOperations(connector, namespace, new AccumuloOptions());
final IndexStore indexStore = new IndexStoreImpl(operations, options);
final PersistentAdapterStore adapterStore = new AdapterStoreImpl(operations, options);
final AdapterIndexMappingStore mappingStore = new AdapterIndexMappingStoreImpl(operations, options);
if (indexStore.indexExists(index.getName())) {
final ScannerBase scanner = operations.createBatchScanner(index.getName());
((BatchScanner) scanner).setRanges(AccumuloUtils.byteArrayRangesToAccumuloRanges(null));
final IteratorSetting iteratorSettings = new IteratorSetting(10, "GEOWAVE_WHOLE_ROW_ITERATOR", WholeRowIterator.class);
scanner.addScanIterator(iteratorSettings);
final Iterator<Entry<Key, Value>> it = new IteratorWrapper(adapterStore, mappingStore, index, scanner.iterator(), new QueryFilter[] { new DedupeFilter() });
iterator = new CloseableIteratorWrapper<>(new ScannerClosableWrapper(scanner), it);
}
return iterator;
}
use of org.locationtech.geowave.core.store.metadata.AdapterStoreImpl in project geowave by locationtech.
the class OSMConversionRunner method run.
@Override
public int run(final String[] args) throws Exception {
final Configuration conf = getConf();
final AccumuloRequiredOptions accumuloOptions = (AccumuloRequiredOptions) inputStoreOptions.getFactoryOptions();
// job settings
final Job job = Job.getInstance(conf, ingestOptions.getJobName() + "NodeConversion");
job.setJarByClass(OSMConversionRunner.class);
job.getConfiguration().set("osm_mapping", ingestOptions.getMappingContents());
job.getConfiguration().set("arguments", ingestOptions.serializeToString());
if (ingestOptions.getVisibilityOptions().getGlobalVisibility() != null) {
job.getConfiguration().set(AbstractMapReduceIngest.GLOBAL_VISIBILITY_KEY, ingestOptions.getVisibilityOptions().getGlobalVisibility());
}
// input format
AbstractInputFormat.setConnectorInfo(job, accumuloOptions.getUser(), new PasswordToken(accumuloOptions.getPassword()));
InputFormatBase.setInputTableName(job, ingestOptions.getQualifiedTableName());
AbstractInputFormat.setZooKeeperInstance(job, ClientConfiguration.create().withInstance(accumuloOptions.getInstance()).withZkHosts(accumuloOptions.getZookeeper()));
AbstractInputFormat.setScanAuthorizations(job, new Authorizations(ingestOptions.getVisibilityOptions().getGlobalVisibility()));
final IteratorSetting is = new IteratorSetting(50, "WholeRow", WholeRowIterator.class);
InputFormatBase.addIterator(job, is);
job.setInputFormatClass(AccumuloInputFormat.class);
final Range r = new Range();
// final ArrayList<Pair<Text, Text>> columns = new ArrayList<>();
InputFormatBase.setRanges(job, Arrays.asList(r));
// output format
GeoWaveOutputFormat.setStoreOptions(job.getConfiguration(), inputStoreOptions);
final AccumuloOptions options = new AccumuloOptions();
final AdapterStore as = new AdapterStoreImpl(new AccumuloOperations(accumuloOptions.getZookeeper(), accumuloOptions.getInstance(), accumuloOptions.getUser(), accumuloOptions.getPasswordOrKeytab(), accumuloOptions.isUseSasl(), accumuloOptions.getGeoWaveNamespace(), options), options);
for (final FeatureDataAdapter fda : FeatureDefinitionSet.featureAdapters.values()) {
as.addAdapter(fda);
GeoWaveOutputFormat.addDataAdapter(job.getConfiguration(), fda);
}
final Index primaryIndex = SpatialDimensionalityTypeProvider.createIndexFromOptions(new SpatialOptions());
GeoWaveOutputFormat.addIndex(job.getConfiguration(), primaryIndex);
job.getConfiguration().set(AbstractMapReduceIngest.INDEX_NAMES_KEY, primaryIndex.getName());
job.setOutputFormatClass(GeoWaveOutputFormat.class);
job.setMapOutputKeyClass(GeoWaveOutputKey.class);
job.setMapOutputValueClass(SimpleFeature.class);
// mappper
job.setMapperClass(OSMConversionMapper.class);
// reducer
job.setNumReduceTasks(0);
return job.waitForCompletion(true) ? 0 : -1;
}
use of org.locationtech.geowave.core.store.metadata.AdapterStoreImpl in project geowave by locationtech.
the class BaseDataStoreFactory method createStore.
@Override
public DataStore createStore(final StoreFactoryOptions factoryOptions) {
final DataStoreOperations operations = helper.createOperations(factoryOptions);
final DataStoreOptions options = factoryOptions.getStoreOptions();
return new BaseDataStore(new IndexStoreImpl(operations, options), new AdapterStoreImpl(operations, options), new DataStatisticsStoreImpl(operations, options), new AdapterIndexMappingStoreImpl(operations, options), operations, options, new InternalAdapterStoreImpl(operations), new PropertyStoreImpl(operations, options));
}
use of org.locationtech.geowave.core.store.metadata.AdapterStoreImpl in project geowave by locationtech.
the class BigTableDataStoreFactory method createStore.
@Override
public DataStore createStore(final StoreFactoryOptions options) {
if (!(options instanceof BigTableOptions)) {
throw new AssertionError("Expected " + BigTableOptions.class.getSimpleName());
}
final BigTableOperations bigtableOperations = (BigTableOperations) helper.createOperations(options);
final HBaseOptions hbaseOptions = ((BigTableOptions) options).getHBaseOptions();
// BigTableDataStatisticsStore
return new HBaseDataStore(new IndexStoreImpl(bigtableOperations, hbaseOptions), new AdapterStoreImpl(bigtableOperations, hbaseOptions), new DataStatisticsStoreImpl(bigtableOperations, hbaseOptions), new AdapterIndexMappingStoreImpl(bigtableOperations, hbaseOptions), bigtableOperations, hbaseOptions, new InternalAdapterStoreImpl(bigtableOperations), new PropertyStoreImpl(bigtableOperations, hbaseOptions));
}
Aggregations