use of org.geotools.data.FeatureStore in project incubator-rya by apache.
the class GeoMesaGeoIndexer method initInternal.
private void initInternal() throws IOException {
validPredicates = ConfigUtils.getGeoPredicates(conf);
final DataStore dataStore = createDataStore(conf);
try {
featureType = getStatementFeatureType(dataStore);
} catch (final IOException | SchemaException e) {
throw new IOException(e);
}
featureSource = dataStore.getFeatureSource(featureType.getName());
if (!(featureSource instanceof FeatureStore)) {
throw new IllegalStateException("Could not retrieve feature store");
}
featureStore = (FeatureStore<SimpleFeatureType, SimpleFeature>) featureSource;
}
use of org.geotools.data.FeatureStore in project polymap4-core by Polymap4.
the class DataSourceProcessor method addFeaturesRequest.
@Override
public void addFeaturesRequest(AddFeaturesRequest request, ProcessorContext context) throws Exception {
Collection<Feature> features = request.getFeatures();
log.debug("addFeatures(): Features: " + features.size());
FeatureCollection fc = new AdaptorFeatureCollection("features", (SimpleFeatureType) fs.getSchema()) {
@Override
protected void closeIterator(Iterator it) {
}
@Override
protected Iterator openIterator() {
return features.iterator();
}
@Override
public int size() {
return features.size();
}
};
List<FeatureId> result = ((FeatureStore) fs).addFeatures(fc);
context.sendResponse(new ModifyFeaturesResponse(new FidSet(result)));
context.sendResponse(ProcessorResponse.EOP);
}
use of org.geotools.data.FeatureStore in project incubator-rya by apache.
the class GeoWaveGeoIndexer method initInternal.
private void initInternal() throws IOException {
validPredicates = ConfigUtils.getGeoPredicates(conf);
try {
geoToolsDataStore = createDataStore(conf);
geoWaveDataStore = ((GeoWaveGTDataStore) geoToolsDataStore).getDataStore();
} catch (final GeoWavePluginException e) {
logger.error("Failed to create GeoWave data store", e);
}
try {
featureType = getStatementFeatureType(geoToolsDataStore);
} catch (final IOException | SchemaException e) {
throw new IOException(e);
}
featureDataAdapter = new FeatureDataAdapter(featureType);
featureSource = geoToolsDataStore.getFeatureSource(featureType.getName());
if (!(featureSource instanceof FeatureStore)) {
throw new IllegalStateException("Could not retrieve feature store");
}
featureStore = (FeatureStore<SimpleFeatureType, SimpleFeature>) featureSource;
}
use of org.geotools.data.FeatureStore in project polymap4-core by Polymap4.
the class FullDataStoreSyncStrategy method checkUpdateSchema.
protected void checkUpdateSchema() throws IOException {
FeatureStore cacheFs = (FeatureStore) cacheDs.getFeatureSource(resName);
FeatureType cacheSchema = cacheFs.getSchema();
FeatureType schema = fs.getSchema();
// simple check as equals() does not work for us here
boolean needsUpdate = false;
if (!schema.getName().equals(cacheSchema.getName())) {
needsUpdate = true;
}
if (schema.getDescriptors().equals(cacheSchema.getDescriptors())) {
needsUpdate = true;
}
if (needsUpdate) {
// XXX
log.warn("Not implemented: schema update");
}
}
Aggregations