@Override protected void map(final LongWritable key, final Text value, final Context context) throws IOException, InterruptedException { simpleFeature = parseGeonamesValue(value); ((InitializeWithIndicesDataAdapter) adapter).init(index); // build Geowave-formatted Accumulo [Key,Value] pairs keyValuePairs = generator.constructKeyValuePairs(simpleFeature); // output each [Key,Value] pair to shuffle-and-sort phase where we rely // on MapReduce to sort by Key for (final KeyValue accumuloKeyValuePair : keyValuePairs) { context.write(accumuloKeyValuePair.getKey(), accumuloKeyValuePair.getValue()); } }
public void initForWrite() { // this is ensuring the adapter is properly initialized with the // indicies and writing it to the adapterStore, in cases where the // featuredataadapter was created from geotools datastore's createSchema if (adapter instanceof InitializeWithIndicesDataAdapter) { ((InitializeWithIndicesDataAdapter) adapter).init(adapterIndices); } final short internalAdapterId = gtStore.getInternalAdapterStore().getAdapterId(adapter.getTypeName()); final InternalDataAdapter<?> internalDataAdapter = new InternalDataAdapterWrapper(adapter, internalAdapterId); gtStore.adapterStore.addAdapter(internalDataAdapter); }
private void internalAddIndices( final InternalDataAdapter<?> adapter, final Index[] indices, final boolean updateAdapter) { if (adapter.getAdapter() instanceof InitializeWithIndicesDataAdapter) { if (((InitializeWithIndicesDataAdapter) adapter.getAdapter()).init(indices) && updateAdapter) { adapterStore.removeAdapter(adapter.getAdapterId()); adapterStore.addAdapter(adapter); } } indexMappingStore.addAdapterIndexMapping( new AdapterToIndexMapping( internalAdapterStore.addTypeName(adapter.getTypeName()), indices)); for (final Index index : indices) { store(index); initOnIndexWriterCreate(adapter, index); } }