Search in sources :

Example 1 with GetFeatureTypeRequest

use of org.polymap.core.data.feature.GetFeatureTypeRequest in project polymap4-core by Polymap4.

the class PipelineFeatureSource method buildFeatureType.

@Override
protected SimpleFeatureType buildFeatureType() throws IOException {
    // FIXME caching schema is not allowed since the pipeline and/or processors
    // may change; maybe we could add a listener API to the pipeline
    // avoid synchronize; doing this in parallel is ok
    GetFeatureTypeRequest request = new GetFeatureTypeRequest();
    try {
        final FeatureType[] type = new FeatureType[1];
        newExecutor().execute(pipeline, request, (ProcessorResponse r) -> {
            GetFeatureTypeResponse response = (GetFeatureTypeResponse) r;
            type[0] = response.getFeatureType();
        });
        return (SimpleFeatureType) type[0];
    } catch (Exception e) {
        Throwables.propagateIfInstanceOf(e, IOException.class);
        throw Throwables.propagate(e);
    }
}
Also used : SimpleFeatureType(org.opengis.feature.simple.SimpleFeatureType) FeatureType(org.opengis.feature.type.FeatureType) ProcessorResponse(org.polymap.core.data.pipeline.ProcessorResponse) SimpleFeatureType(org.opengis.feature.simple.SimpleFeatureType) GetFeatureTypeRequest(org.polymap.core.data.feature.GetFeatureTypeRequest) GetFeatureTypeResponse(org.polymap.core.data.feature.GetFeatureTypeResponse) IOException(java.io.IOException) IOException(java.io.IOException)

Aggregations

IOException (java.io.IOException)1 SimpleFeatureType (org.opengis.feature.simple.SimpleFeatureType)1 FeatureType (org.opengis.feature.type.FeatureType)1 GetFeatureTypeRequest (org.polymap.core.data.feature.GetFeatureTypeRequest)1 GetFeatureTypeResponse (org.polymap.core.data.feature.GetFeatureTypeResponse)1 ProcessorResponse (org.polymap.core.data.pipeline.ProcessorResponse)1