use of org.geoserver.catalog.impl.WorkspaceInfoImpl in project polymap4-core by Polymap4.
the class GeoServerLoader method loadCatalog.
protected void loadCatalog(Catalog catalog, GeoServerServlet service) throws Exception {
log.info("Loading catalog...");
IMap map = service.map;
// workspace
WorkspaceInfoImpl wsInfo = new WorkspaceInfoImpl();
wsInfo.setId(simpleName(map.id()) + "-ws");
wsInfo.setDefault(true);
// simpleName( GeoServerPlugin.instance().baseName.orElse( map.label.get() ) ) );
wsInfo.setName("the-one-and-only");
// catalog.add( MapInfo );
log.info("Workspace: " + wsInfo);
catalog.add(GeoServerUtils.defaultNsInfo.get());
log.info("Namespace: " + GeoServerUtils.defaultNsInfo.get());
for (ILayer layer : map.layers) {
try {
// Features
P4DataStoreInfo dsInfo = P4DataStoreInfo.canHandle(catalog, layer);
if (dsInfo != null) {
dsInfo.setWorkspace(wsInfo);
if (dsInfo.getFeatureSource().getSchema().getGeometryDescriptor() != null) {
P4FeatureTypeInfo ftInfo = new P4FeatureTypeInfo(catalog, dsInfo);
catalog.add(ftInfo);
P4LayerInfo layerInfo = new P4LayerInfo(catalog, layer, ftInfo, PublishedType.VECTOR);
layerInfo.createFeatureStyleInfo(service.createSLD(layer), resourceLoader);
catalog.add(layerInfo);
}
continue;
}
// WMS
P4ImageStoreInfo imInfo = P4ImageStoreInfo.canHandle(catalog, layer);
if (imInfo != null) {
imInfo.setWorkspace(wsInfo);
P4ImageResourceInfo resInfo = new P4ImageResourceInfo(catalog, imInfo);
catalog.add(resInfo);
P4LayerInfo layerInfo = new P4LayerInfo(catalog, layer, resInfo, PublishedType.WMS);
layerInfo.createFeatureStyleInfo(service.createSLD(layer), resourceLoader);
catalog.add(layerInfo);
continue;
}
// XXX GridCoverage is not handled yet
} catch (Exception e) {
// don't break entire GeoServer if upstream WMS/WFS or else fails
log.warn("Error loading layer: " + layer, e);
}
}
catalog.add(wsInfo);
}
Aggregations