use of org.polymap.core.data.feature.GetFeaturesResponse in project polymap4-core by Polymap4.
the class PipelineFeatureSource method fetchFeatures.
/**
* Called by {@link SyncPipelineFeatureCollection} to fetch feature chunks.
*/
@SuppressWarnings("hiding")
protected void fetchFeatures(Query query, final FeatureResponseHandler handler) throws Exception {
try {
log.debug("fetchFeatures(): maxFeatures= " + query.getMaxFeatures());
GetFeaturesRequest request = new GetFeaturesRequest(query);
newExecutor().execute(pipeline, request, new ResponseHandler() {
public void handle(ProcessorResponse r) throws Exception {
GetFeaturesResponse response = (GetFeaturesResponse) r;
handler.handle(response.getFeatures());
}
});
} finally {
handler.endOfResponse();
}
}
use of org.polymap.core.data.feature.GetFeaturesResponse in project polymap4-core by Polymap4.
the class FeatureRenameProcessor method featuresResponse.
@Produces(GetFeaturesResponse.class)
public void featuresResponse(GetFeaturesResponse response, ProcessorContext context) throws Exception {
assert schema != null : "Target schema is not yet initialized. Call getSchema() first.";
SimpleFeatureBuilder builder = new SimpleFeatureBuilder((SimpleFeatureType) schema);
// log.debug( " received features: " + chunk.count() );
List<Feature> result = new ArrayList(response.count());
for (Feature feature : response) {
for (PropertyDescriptor prop : schema.getDescriptors()) {
Property featureProp = feature.getProperty(prop.getName());
// the feature may not contain the property if it was not requested
if (featureProp != null) {
builder.set(prop.getName(), featureProp.getValue());
}
}
result.add(builder.buildFeature(feature.getIdentifier().getID()));
}
// log.debug( " sending features: " + result.size() );
context.sendResponse(new GetFeaturesResponse(result));
}
Aggregations