public void resolve(CatalogInfo info) { if (info instanceof LayerGroupInfo) { resolve((LayerGroupInfo) info); } else if (info instanceof LayerInfo) { resolve((LayerInfo) info); } else if (info instanceof MapInfo) { resolve((MapInfo) info); } else if (info instanceof NamespaceInfo) { resolve((NamespaceInfo) info); } else if (info instanceof ResourceInfo) { resolve((ResourceInfo) info); } else if (info instanceof StoreInfo) { resolve((StoreInfo) info); } else if (info instanceof StyleInfo) { resolve((StyleInfo) info); } else if (info instanceof WorkspaceInfo) { resolve((WorkspaceInfo) info); } else { throw new IllegalArgumentException("Unknown resource type: " + info); } }
protected ResourceInfo resolve(ResourceInfo resource) { ResourceInfoImpl r = (ResourceInfoImpl) resource; r.setCatalog(this); if (resource instanceof FeatureTypeInfo) { resolve((FeatureTypeInfo) resource); } if (r instanceof CoverageInfo) { resolve((CoverageInfo) resource); } if (r instanceof WMSLayerInfo) { resolve((WMSLayerInfo) resource); } if (r instanceof WMTSLayerInfo) { resolve((WMTSLayerInfo) resource); } return resource; }
/** * Loads an object from peristence. * * @param in The input stream to read the object from. * @param clazz The class of the expected object. * @throws IOException */ public <T> T load(InputStream in, Class<T> clazz) throws IOException { T obj = clazz.cast(xs.fromXML(in)); // call resolve() to ensure that any references created during loading // get resolved to actual objects, for instance for links from datastores // to workspaces if (obj instanceof CatalogImpl) { ((CatalogImpl) obj).resolve(); } return obj; }
public void add(MapInfo map) { MapInfo added = facade.add(resolve(map)); added(added); }
public void add(StyleInfo style) { style = resolve(style); validate(style, true); StyleInfo added = facade.add(style); added(added); }
@SuppressWarnings("PMD.UnusedLocalVariable") public void add(LayerGroupInfo layerGroup) { layerGroup = resolve(layerGroup); validate(layerGroup, true); if (layerGroup.getStyles().isEmpty()) { for (PublishedInfo l : layerGroup.getLayers()) { // default style layerGroup.getStyles().add(null); } } LayerGroupInfo added = facade.add(layerGroup); added(added); }
public void add(NamespaceInfo namespace) { validate(namespace, true); NamespaceInfo added; synchronized (facade) { final NamespaceInfo resolved = resolve(namespace); added = facade.add(resolved); if (getDefaultNamespace() == null) { setDefaultNamespace(resolved); } } added(added); }
public void add(WorkspaceInfo workspace) { workspace = resolve(workspace); validate(workspace, true); if (getWorkspaceByName(workspace.getName()) != null) { throw new IllegalArgumentException( "Workspace with name '" + workspace.getName() + "' already exists."); } WorkspaceInfo added; synchronized (facade) { added = facade.add(workspace); // if there is no default workspace use this one as the default if (getDefaultWorkspace() == null) { setDefaultWorkspace(workspace); } } added(added); }
public void add(ResourceInfo resource) { if (resource.getNamespace() == null) { // default to default namespace resource.setNamespace(getDefaultNamespace()); } if (resource.getNativeName() == null) { resource.setNativeName(resource.getName()); } ResourceInfo resolved = resolve(resource); validate(resolved, true); ResourceInfo added = facade.add(resolved); added(added); }
public void add(LayerInfo layer) { layer = resolve(layer); validate(layer, true); if (layer.getType() == null) { if (layer.getResource() instanceof FeatureTypeInfo) { layer.setType(PublishedType.VECTOR); } else if (layer.getResource() instanceof CoverageInfo) { layer.setType(PublishedType.RASTER); } else if (layer.getResource() instanceof WMTSLayerInfo) { layer.setType(PublishedType.WMTS); } else if (layer.getResource() instanceof WMSLayerInfo) { layer.setType(PublishedType.WMS); } else { String msg = "Layer type not set and can't be derived from resource"; throw new IllegalArgumentException(msg); } } LayerInfo added = facade.add(layer); added(added); }
public void add(StoreInfo store) { if (store.getWorkspace() == null) { store.setWorkspace(getDefaultWorkspace()); } validate(store, true); // TODO: remove synchronized block, need transactions StoreInfo added; synchronized (facade) { added = facade.add(resolve(store)); // if there is no default store use this one as the default if (getDefaultDataStore(store.getWorkspace()) == null && store instanceof DataStoreInfo) { setDefaultDataStore(store.getWorkspace(), (DataStoreInfo) store); } } added(added); }
((CatalogImpl) catalog).resolve(); } else { loader.reload();
catalog.resolve();