use of org.polymap.core.data.pipeline.DataSourceDescriptor in project polymap4-core by Polymap4.
the class StoreCacheProcessor method init.
@Override
public void init(@SuppressWarnings("hiding") PipelineProcessorSite site) throws Exception {
this.site = site;
// XXX shouldn't the ressource name come from upstream schema?
assert cachestore != null : "cachestore is not yet initialized.";
cacheDs = cachestore.get();
String resName = site.dsd.get().resourceName.get();
lastUpdated.computeIfAbsent(site.layerId.get(), k -> new AtomicLong2());
// init sync strategy
String classname = getClass().getPackage().getName() + "." + SYNC_TYPE.get(site);
sync = (SyncStrategy) getClass().getClassLoader().loadClass(classname).newInstance();
sync.beforeInit(this, site);
DataSourceDescriptor cacheDsd = new DataSourceDescriptor(cacheDs, resName);
PipelineProcessorSite cacheSite = new PipelineProcessorSite(Params.EMPTY);
cacheSite.layerId.set(site.layerId.get());
cacheSite.usecase.set(site.usecase.get());
cacheSite.builder.set(site.builder.get());
cacheSite.dsd.set(cacheDsd);
cache = new DataSourceProcessor();
cache.init(cacheSite);
sync.afterInit(this, site);
}
use of org.polymap.core.data.pipeline.DataSourceDescriptor 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