use of org.polymap.core.runtime.CachedLazyInit in project polymap4-core by Polymap4.
the class FeatureRenderProcessor2 method init.
@Override
public void init(@SuppressWarnings("hiding") PipelineProcessorSite site) throws Exception {
this.site = site;
// styleSupplier
style = STYLE_SUPPLIER.rawopt(site).orElseGet(() -> {
log.warn("No style for resource: " + site.dsd.get().resourceName.get());
return () -> DefaultStyles.findStyle(fs.get());
});
// pipeline
this.pipeline = new CachedLazyInit(() -> {
try {
PipelineBuilder builder = site.builder.get();
DataSourceDescriptor dsd = new DataSourceDescriptor(site.dsd.get());
return builder.createPipeline(site.layerId.get(), FeaturesProducer.class, dsd).get();
} catch (Exception e) {
throw new RuntimeException(e);
}
});
// fs
this.fs = new CachedLazyInit(() -> {
try {
return new PipelineDataStore(pipeline.get()).getFeatureSource();
} catch (IOException e) {
throw new RuntimeException(e);
}
});
}
Aggregations