Search in sources :

Example 1 with GeoServerServlet

use of org.polymap.service.geoserver.GeoServerServlet in project polymap4-core by Polymap4.

the class GeoServerLoader method loadGeoServer.

protected void loadGeoServer(GeoServerServlet service) {
    IMap map = service.map;
    log.info("Loading GeoServer...");
    GeoServerInfoImpl gsInfo = new GeoServerInfoImpl(geoserver);
    gsInfo.setTitle("GeoServer powered by mapzone.io");
    gsInfo.setId(simpleName(map.id()) + "-gs");
    // XXX alias is added by ArenaConfig when running in mapzone (see comment there)
    String proxyBaseUrl = GeoServerPlugin.instance().baseUrl.map(s -> !s.contains(service.alias) ? s + service.alias : s).get();
    gsInfo.setProxyBaseUrl(proxyBaseUrl);
    log.info("Proxy base URL: " + gsInfo.getProxyBaseUrl());
    gsInfo.setVerbose(true);
    gsInfo.setVerboseExceptions(true);
    geoserver.setGlobal(gsInfo);
    log.info("GeoServer: " + gsInfo);
    createWMSInfo(map);
    createWFSInfo(map);
}
Also used : ILayer(org.polymap.core.project.ILayer) GMLInfo(org.geoserver.wfs.GMLInfo) WorkspaceInfoImpl(org.geoserver.catalog.impl.WorkspaceInfoImpl) Supplier(java.util.function.Supplier) GeoServerExtensions(org.geoserver.platform.GeoServerExtensions) ArrayList(java.util.ArrayList) WMSInfoImpl(org.geoserver.wms.WMSInfoImpl) Version(org.geotools.util.Version) Lists(com.google.common.collect.Lists) GeoServerServlet(org.polymap.service.geoserver.GeoServerServlet) ServiceLevel(org.geoserver.wfs.WFSInfo.ServiceLevel) GeoServerUtils.simpleName(org.polymap.service.geoserver.GeoServerUtils.simpleName) WFSInfoImpl(org.geoserver.wfs.WFSInfoImpl) GeoServerInitializer(org.geoserver.config.GeoServerInitializer) Catalog(org.geoserver.catalog.Catalog) ServiceInfo(org.geoserver.config.ServiceInfo) WFSInfo(org.geoserver.wfs.WFSInfo) GeoServerReinitializer(org.geoserver.config.GeoServerReinitializer) GeoServerPlugin(org.polymap.service.geoserver.GeoServerPlugin) Keyword(org.geoserver.catalog.Keyword) GeoServerInfoImpl(org.geoserver.config.impl.GeoServerInfoImpl) GeoServer(org.geoserver.config.GeoServer) BeansException(org.springframework.beans.BeansException) Wrapper(org.geoserver.catalog.Wrapper) GeoServerResourceLoader(org.geoserver.platform.GeoServerResourceLoader) GMLInfoImpl(org.geoserver.wfs.GMLInfoImpl) ApplicationContext(org.springframework.context.ApplicationContext) Consumer(java.util.function.Consumer) BeanPostProcessor(org.springframework.beans.factory.config.BeanPostProcessor) List(java.util.List) GeoServerUtils(org.polymap.service.geoserver.GeoServerUtils) SrsNameStyle(org.geoserver.wfs.GMLInfo.SrsNameStyle) PublishedType(org.geoserver.catalog.PublishedType) DisposableBean(org.springframework.beans.factory.DisposableBean) Log(org.apache.commons.logging.Log) LogFactory(org.apache.commons.logging.LogFactory) IMap(org.polymap.core.project.IMap) ApplicationContextAware(org.springframework.context.ApplicationContextAware) IMap(org.polymap.core.project.IMap) GeoServerInfoImpl(org.geoserver.config.impl.GeoServerInfoImpl)

Example 2 with GeoServerServlet

use of org.polymap.service.geoserver.GeoServerServlet in project polymap4-core by Polymap4.

the class P4ImageStoreInfo method canHandle.

/**
 * Returns a newly created {@link P4DataStoreInfo}, or null if the layer is not
 * connected to a {@link FeatureStore}.
 *
 * @throws Exception
 */
public static P4ImageStoreInfo canHandle(Catalog catalog, ILayer layer) throws Exception {
    GeoServerServlet server = GeoServerServlet.instance.get();
    Optional<Pipeline> pipeline = server.getOrCreatePipeline(layer, ImageProducer.class);
    if (pipeline.isPresent()) {
        if (!(pipeline.get().getLast().processor() instanceof WmsRenderProcessor)) {
            return null;
        }
        return new P4ImageStoreInfo(catalog, layer, pipeline.get());
    } else {
        return null;
    }
}
Also used : GeoServerServlet(org.polymap.service.geoserver.GeoServerServlet) WmsRenderProcessor(org.polymap.core.data.wms.WmsRenderProcessor) Pipeline(org.polymap.core.data.pipeline.Pipeline)

Example 3 with GeoServerServlet

use of org.polymap.service.geoserver.GeoServerServlet in project polymap4-core by Polymap4.

the class P4DataStoreInfo method canHandle.

/**
 * Returns a newly created {@link P4DataStoreInfo}, or null if the layer is not
 * connected to a {@link FeatureStore}.
 *
 * @throws Exception
 */
public static P4DataStoreInfo canHandle(Catalog catalog, ILayer layer) throws Exception {
    GeoServerServlet server = GeoServerServlet.instance.get();
    Optional<Pipeline> pipeline = server.getOrCreatePipeline(layer, FeaturesProducer.class);
    if (pipeline.isPresent()) {
        PipelineFeatureSource fs = new PipelineDataStore(pipeline.get()).getFeatureSource();
        // check with P4FeatureTypeInfo
        Name name = new NameImpl(GeoServerUtils.defaultNsInfo.get().getName(), GeoServerUtils.simpleName(layer.label.get()));
        Params params = new Params();
        FeatureRenameProcessor.NAME.rawput(params, name);
        PipelineProcessorSite procSite = new PipelineProcessorSite(params);
        ProcessorDescriptor proc = new ProcessorDescriptor(FeatureRenameProcessor.class, params);
        proc.processor().init(procSite);
        fs.pipeline().addFirst(proc);
        return new P4DataStoreInfo(catalog, layer, fs);
    } else {
        return null;
    }
}
Also used : NameImpl(org.geotools.feature.NameImpl) PipelineProcessorSite(org.polymap.core.data.pipeline.PipelineProcessorSite) PipelineFeatureSource(org.polymap.core.data.PipelineFeatureSource) GeoServerServlet(org.polymap.service.geoserver.GeoServerServlet) Params(org.polymap.core.data.pipeline.PipelineProcessorSite.Params) ProcessorDescriptor(org.polymap.core.data.pipeline.ProcessorDescriptor) Pipeline(org.polymap.core.data.pipeline.Pipeline) PipelineDataStore(org.polymap.core.data.PipelineDataStore) Name(org.opengis.feature.type.Name)

Aggregations

GeoServerServlet (org.polymap.service.geoserver.GeoServerServlet)3 Pipeline (org.polymap.core.data.pipeline.Pipeline)2 Lists (com.google.common.collect.Lists)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 Consumer (java.util.function.Consumer)1 Supplier (java.util.function.Supplier)1 Log (org.apache.commons.logging.Log)1 LogFactory (org.apache.commons.logging.LogFactory)1 Catalog (org.geoserver.catalog.Catalog)1 Keyword (org.geoserver.catalog.Keyword)1 PublishedType (org.geoserver.catalog.PublishedType)1 Wrapper (org.geoserver.catalog.Wrapper)1 WorkspaceInfoImpl (org.geoserver.catalog.impl.WorkspaceInfoImpl)1 GeoServer (org.geoserver.config.GeoServer)1 GeoServerInitializer (org.geoserver.config.GeoServerInitializer)1 GeoServerReinitializer (org.geoserver.config.GeoServerReinitializer)1 ServiceInfo (org.geoserver.config.ServiceInfo)1 GeoServerInfoImpl (org.geoserver.config.impl.GeoServerInfoImpl)1 GeoServerExtensions (org.geoserver.platform.GeoServerExtensions)1