org.locationtech.geowave.core.store.api.DataStore.createWriter()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(8.6k)|赞(0)|评价(0)|浏览(119)

本文整理了Java中org.locationtech.geowave.core.store.api.DataStore.createWriter()方法的一些代码示例,展示了DataStore.createWriter()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。DataStore.createWriter()方法的具体详情如下:
包路径:org.locationtech.geowave.core.store.api.DataStore
类名称:DataStore
方法名:createWriter

DataStore.createWriter介绍

[英]Returns an index writer to perform batched write operations for the given data type name. It assumes the type has already been used previously or added using addType and assumes one or more indices have been provided for this type.
[中]返回索引编写器,以对给定的数据类型名称执行批处理写入操作。它假定以前已经使用过该类型或使用addType添加过该类型,并假定已为此类型提供了一个或多个索引。

代码示例

代码示例来源:origin: locationtech/geowave

@Override
public synchronized Writer<?> create(final TypeNameKeyWithIndices adapterWithIndices)
  throws Exception {
 dataStore.addType(
   adapterStore.getAdapter(adapterWithIndices.typeName),
   adapterWithIndices.indices);
 return dataStore.createWriter(adapterWithIndices.typeName);
}

代码示例来源:origin: locationtech/geowave

private static void ingestCannedData() throws IOException {
 final List<SimpleFeature> points = new ArrayList<>();
 System.out.println("Building SimpleFeatures from canned data set...");
 for (final Entry<String, Coordinate> entry : cannedData.entrySet()) {
  System.out.println("Added point: " + entry.getKey());
  points.add(buildSimpleFeature(entry.getKey(), entry.getValue()));
 }
 System.out.println("Ingesting canned data...");
 dataStore.addType(ADAPTER, index);
 try (Writer<SimpleFeature> indexWriter = dataStore.createWriter(ADAPTER.getTypeName())) {
  for (final SimpleFeature sf : points) {
   //
   indexWriter.write(sf);
  }
 }
 System.out.println("Ingest complete.");
}

代码示例来源:origin: locationtech/geowave

public synchronized Writer getIndexWriter(
  final DataTypeAdapter<?> adapter,
  final Index... requiredIndices) throws MismatchedIndexToAdapterMapping {
 Writer indexWriter = adapterIdToWriterCache.get(adapter.getTypeName());
 if (indexWriter == null) {
  dataStore.addType(adapter, requiredIndices);
  indexWriter = dataStore.createWriter(adapter.getTypeName());
  adapterIdToWriterCache.put(adapter.getTypeName(), indexWriter);
 }
 return indexWriter;
}

代码示例来源:origin: locationtech/geowave

private void ingest(
  final FeatureDataAdapter adapter,
  final Index index,
  final List<SimpleFeature> features) {
 dataStore.addType(adapter, index);
 try (Writer<SimpleFeature> indexWriter = dataStore.createWriter(adapter.getTypeName())) {
  for (final SimpleFeature sf : features) {
   indexWriter.write(sf);
  }
 }
}

代码示例来源:origin: locationtech/geowave

protected void setup(
  final Job job,
  final String namespace,
  final DataTypeAdapter<?> adapter,
  final Index index) throws IOException, MismatchedIndexToAdapterMapping {
 GeoWaveOutputFormat.setStoreOptions(job.getConfiguration(), outputDataStoreOptions);
 GeoWaveOutputFormat.addDataAdapter(job.getConfiguration(), adapter);
 GeoWaveOutputFormat.addIndex(job.getConfiguration(), index);
 final DataStore dataStore = outputDataStoreOptions.createDataStore();
 dataStore.addType(adapter, index);
 final Writer writer = dataStore.createWriter(adapter.getTypeName());
 writer.close();
}

代码示例来源:origin: locationtech/geowave

private synchronized Writer<?> getIndexWriter(
  final DataTypeAdapter<?> adapter,
  final String[] indexNames) throws MismatchedIndexToAdapterMapping {
 Writer<?> writer = adapterTypeNameToIndexWriterCache.get(adapter.getTypeName());
 if (writer == null) {
  final Index[] indices = new Index[indexNames.length];
  int i = 0;
  for (final String indexName : indexNames) {
   final Index index = indexStore.getIndex(indexName);
   if (index != null) {
    indices[i++] = index;
   } else {
    LOGGER.warn("Index '" + indexName + "' does not exist");
   }
  }
  dataStore.addType(adapter, indices);
  writer = dataStore.createWriter(adapter.getTypeName());
  adapterTypeNameToIndexWriterCache.put(adapter.getTypeName(), writer);
 }
 return writer;
}

代码示例来源:origin: locationtech/geowave

@SuppressWarnings("unchecked")
public void write(
  final Iterator<SimpleFeature> featureIt,
  final Set<String> fidList,
  final GeoWaveTransaction transaction) throws IOException {
 final VisibilityWriter<SimpleFeature> visibilityWriter =
   new UniformVisibilityWriter<>(
     new GlobalVisibilityHandler<>(transaction.composeVisibility()));
 dataStore.addType(adapter, adapterIndices);
 try (Writer<SimpleFeature> indexWriter = dataStore.createWriter(adapter.getTypeName())) {
  while (featureIt.hasNext()) {
   final SimpleFeature feature = featureIt.next();
   fidList.add(feature.getID());
   indexWriter.write(feature, visibilityWriter);
  }
 }
}

代码示例来源:origin: locationtech/geowave

public void writeCommit(final SimpleFeature feature, final GeoWaveTransaction transaction)
  throws IOException {
 final VisibilityWriter<SimpleFeature> visibilityWriter =
   new UniformVisibilityWriter<>(
     new GlobalVisibilityHandler<>(transaction.composeVisibility()));
 dataStore.addType(adapter, adapterIndices);
 try (Writer<SimpleFeature> indexWriter = dataStore.createWriter(adapter.getTypeName())) {
  indexWriter.write(feature, visibilityWriter);
 }
}

代码示例来源:origin: locationtech/geowave

new NoDataMergeStrategy());
store.addType(adapter, indices);
writer = store.createWriter(adapter.getTypeName());
writerCache.put(coverageName, writer);

代码示例来源:origin: locationtech/geowave

new NoDataMergeStrategy());
store.addType(adapter, indices);
writer = store.createWriter(adapter.getTypeName());
writerCache.put(coverageName, writer);

代码示例来源:origin: locationtech/geowave

try (Writer<SimpleFeature> indexWriter = dataStore.createWriter(adapter.getTypeName())) {
 for (final SimpleFeature sf : points) {

代码示例来源:origin: locationtech/geowave

final FeatureDataAdapter sceneAdapter = new FeatureDataAdapter(sceneType);
 store.addType(sceneAdapter, indices);
 sceneWriter = store.createWriter(sceneAdapter.getTypeName());
 final SimpleFeatureType bandType = BandFeatureIterator.createFeatureType(sceneType);
 final FeatureDataAdapter bandAdapter = new FeatureDataAdapter(bandType);
 store.addType(bandAdapter, indices);
 bandWriter = store.createWriter(bandAdapter.getTypeName());
 super.runInternal(params);
} finally {

代码示例来源:origin: locationtech/geowave

final FeatureDataAdapter sceneAdapter = new FeatureDataAdapter(sceneType);
vectorStore.addType(sceneAdapter, vectorIndices);
sceneWriter = vectorStore.createWriter(sceneAdapter.getTypeName());
final SimpleFeatureType bandType = BandFeatureIterator.createFeatureType(sceneType);
final FeatureDataAdapter bandAdapter = new FeatureDataAdapter(bandType);
bandWriter = vectorStore.createWriter(bandAdapter.getTypeName());

代码示例来源:origin: locationtech/geowave

new SpatialDimensionalityTypeProvider().createIndex(new SpatialOptions());
featureStore.addType(featureAdapter, featureIndex);
try (Writer writer = featureStore.createWriter(featureAdapter.getTypeName())) {

代码示例来源:origin: locationtech/geowave

final FeatureDataAdapter sceneAdapter = new FeatureDataAdapter(sceneType);
store.addType(sceneAdapter, indices);
sceneWriter = store.createWriter(sceneAdapter.getTypeName());
bandWriter = store.createWriter(bandAdapter.getTypeName());

代码示例来源:origin: locationtech/geowave

final FeatureDataAdapter sceneAdapter = new FeatureDataAdapter(sceneType);
vectorStore.addType(sceneAdapter, vectorIndices);
sceneWriter = vectorStore.createWriter(sceneAdapter.getTypeName());
bandWriter = vectorStore.createWriter(bandAdapter.getTypeName());

代码示例来源:origin: locationtech/geowave

/** * Here we will change the ingest mechanism to use a producer/consumer pattern */
protected void writeExampleData(final DataStore geowaveDataStore) {
 // In order to store data we need to determine the type of data store
 final SimpleFeatureType point = createPointFeatureType();
 // This a factory class that builds simple feature objects based on the
 // type passed
 final SimpleFeatureBuilder pointBuilder = new SimpleFeatureBuilder(point);
 // This is an adapter, that is needed to describe how to persist the
 // data type passed
 final GeotoolsFeatureDataAdapter dataTypeAdapter = createDataAdapter(point);
 // This describes how to index the data
 final Index index = createSpatialIndex();
 geowaveDataStore.addType(dataTypeAdapter, index);
 // make sure to close the index writer (a try-with-resources block such
 // as this automatically closes the resource when exiting the block)
 try (Writer<SimpleFeature> indexWriter =
   geowaveDataStore.createWriter(dataTypeAdapter.getTypeName())) {
  // build a grid of points across the globe at each whole
  // lattitude/longitude intersection
  for (final SimpleFeature sft : getGriddedFeatures(pointBuilder, 1000)) {
   indexWriter.write(sft);
  }
 }
}

代码示例来源:origin: locationtech/geowave

try (Writer writer = featureStore.createWriter(featureAdapter.getTypeName())) {

代码示例来源:origin: locationtech/geowave

new SpatialDimensionalityTypeProvider().createIndex(new SpatialOptions());
featureStore.addType(featureAdapter, featureIndex);
try (Writer writer = featureStore.createWriter(featureAdapter.getTypeName())) {
 for (final Vector center : clusterModel.clusterCenters()) {
  final int index = clusterModel.predict(center);

代码示例来源:origin: locationtech/geowave

try (final Writer writer = other.createWriter(typeName)) {
 while (it.hasNext()) {
  writer.write(it.next());

相关文章