public WorkspaceInfo getWorkspaceByName(String name) { if (name == null || Catalog.DEFAULT.equals(name)) { WorkspaceInfo ws = getDefaultWorkspace(); if (ws != null) { name = ws.getName(); } } return facade.getWorkspaceByName(name); }
public StyleInfo getStyleByName(String name) { StyleInfo result = null; int colon = name.indexOf(':'); if (colon != -1) { // search by resource name String prefix = name.substring(0, colon); String resource = name.substring(colon + 1); result = getStyleByName(prefix, resource); } else { // search in default workspace first WorkspaceInfo ws = getDefaultWorkspace(); if (ws != null) { result = getStyleByName(ws, name); } } if (result == null) { result = facade.getStyleByName(name); } return result; }
public <T extends StoreInfo> T getStoreByName( WorkspaceInfo workspace, String name, Class<T> clazz) { WorkspaceInfo ws = workspace; if (ws == null) { ws = getDefaultWorkspace(); } if (clazz != null && clazz.isAssignableFrom(DataStoreInfo.class) && (name == null || name.equals(Catalog.DEFAULT))) { return (T) getDefaultDataStore(workspace); } T store = facade.getStoreByName(ws, name, clazz); if (store == null && workspace == null) { store = facade.getStoreByName(CatalogFacade.ANY_WORKSPACE, name, clazz); } return store; }
@Override public LayerGroupInfo getLayerGroupByName(String name) { final LayerGroupInfo layerGroup = getLayerGroupByName((String) null, name); if (layerGroup != null) return layerGroup; // last chance: checking handle prefixed name case String workspaceName = null; String layerGroupName = null; int colon = name.indexOf(':'); if (colon == -1) { // if there is no prefix, try the default workspace WorkspaceInfo defaultWs = getDefaultWorkspace(); workspaceName = defaultWs == null ? null : defaultWs.getName(); layerGroupName = name; } if (colon != -1) { workspaceName = name.substring(0, colon); layerGroupName = name.substring(colon + 1); } return getLayerGroupByName(workspaceName, layerGroupName); }
public LayerInfo getLayerByName(String name) { LayerInfo result = null; int colon = name.indexOf(':'); if (colon != -1) { // search by resource name String prefix = name.substring(0, colon); String resource = name.substring(colon + 1); result = getLayerByName(prefix, resource); } else { // search in default workspace first WorkspaceInfo ws = getDefaultWorkspace(); if (ws != null) { result = getLayerByName(ws.getName(), name); } } if (result == null) { result = facade.getLayerByName(name); } return result; }
facade.remove(workspace); WorkspaceInfo defaultWorkspace = getDefaultWorkspace(); if (workspace.equals(defaultWorkspace) || defaultWorkspace == null) { List<WorkspaceInfo> workspaces = facade.getWorkspaces();
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(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); }
defaultWorkspace = catalog.getDefaultWorkspace(); if (defaultWorkspace != null) { try {