Search in sources :

Example 1 with DataSourceProcessor

use of org.polymap.core.data.feature.DataSourceProcessor 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);
}
Also used : DataSourceProcessor(org.polymap.core.data.feature.DataSourceProcessor) PipelineProcessorSite(org.polymap.core.data.pipeline.PipelineProcessorSite) DataSourceDescriptor(org.polymap.core.data.pipeline.DataSourceDescriptor)

Aggregations

DataSourceProcessor (org.polymap.core.data.feature.DataSourceProcessor)1 DataSourceDescriptor (org.polymap.core.data.pipeline.DataSourceDescriptor)1 PipelineProcessorSite (org.polymap.core.data.pipeline.PipelineProcessorSite)1