public void remove(NamespaceInfo namespace) { if (namespace.equals(defaultNamespace)) { defaultNamespace = null; } namespaces.remove(namespace); }
public <T extends ResourceInfo> List<T> getResourcesByNamespace( NamespaceInfo namespace, Class<T> clazz) { // TODO: support ANY_NAMESPACE? NamespaceInfo ns; if (namespace == null) { ns = getDefaultNamespace(); } else { ns = namespace; } List<T> matches = resources.list(clazz, r -> ns.equals(r.getNamespace())); return ModificationProxy.createList(matches, clazz); }
public void remove(NamespaceInfo namespace) { if (!getResourcesByNamespace(namespace, ResourceInfo.class).isEmpty()) { throw new IllegalArgumentException("Unable to delete non-empty namespace."); } // TODO: remove synchronized block, need transactions synchronized (facade) { facade.remove(namespace); NamespaceInfo defaultNamespace = getDefaultNamespace(); if (namespace.equals(defaultNamespace) || defaultNamespace == null) { List<NamespaceInfo> namespaces = facade.getNamespaces(); defaultNamespace = null; if (!namespaces.isEmpty()) { defaultNamespace = namespaces.get(0); } setDefaultNamespace(defaultNamespace); if (defaultNamespace != null) { WorkspaceInfo defaultWorkspace = getWorkspaceByName(defaultNamespace.getPrefix()); if (defaultWorkspace != null) { setDefaultWorkspace(defaultWorkspace); } } } } removed(namespace); }
if (newDefault != null) { NamespaceInfo ns = catalog.getNamespaceByPrefix(newDefault.getName()); if (ns != null && !catalog.getDefaultNamespace().equals(ns)) { try { editing = true;
if (namespace == null) { if (other.getNamespace() != null) return false; } else if (!namespace.equals(other.getNamespace())) return false; if (nativeBoundingBox == null) { if (other.getNativeBoundingBox() != null) return false;
|| !layer.getResource() .getNamespace() .equals(catalog.getNamespaceByPrefix(prefix))) { layer = catalog.getFactory().createLayer();
/** * Checks that the collection of featureTypeNames all have the same prefix. Used to determine if * their schemas are all in the same namespace or if imports need to be done. * * @param infos list of feature type info objects.. * @return true if all the types in the collection have the same prefix. */ public boolean allSameType(FeatureTypeInfo[] infos) { boolean sameType = true; if (infos.length == 0) { return false; } FeatureTypeInfo first = infos[0]; for (int i = 0; i < infos.length; i++) { FeatureTypeInfo ftInfo = infos[i]; if (!first.getNamespace().equals(ftInfo.getNamespace())) { return false; } } return sameType; } }
@Override protected void wrapInternal(Map properties, SimpleHash model, NamespaceInfo namespace) { if (properties == null) { try { properties = model.toMap(); } catch (TemplateModelException e) { // TODO Auto-generated catch block e.printStackTrace(); } } NamespaceInfo def = catalog.getDefaultNamespace(); if (def.equals(namespace)) { properties.put("isDefault", Boolean.TRUE); } else { properties.put("isDefault", Boolean.FALSE); } List<Map<String, Map<String, String>>> resources = new ArrayList<>(); List<ResourceInfo> res = catalog.getResourcesByNamespace(namespace, ResourceInfo.class); for (ResourceInfo r : res) { HashMap<String, String> props = new HashMap<>(); props.put("name", r.getName()); props.put("description", r.getDescription()); resources.add(Collections.singletonMap("properties", props)); } properties.put("resources", resources); }
while (i.hasNext()) { FeatureTypeInfo type = i.next(); if (!namespace.equals(type.getNamespace())) { namespace = null; break;
@Override public boolean apply(GeoServerTileLayer tileLayer) { String layerName = tileLayer.getName(); if (-1 == layerName.indexOf(':')) { return false; } LayerInfo layerInfo = catalog.getLayerByName(layerName); if (layerInfo != null) { NamespaceInfo layerNamespace = layerInfo.getResource().getNamespace(); if (namespaceFilter.equals(layerNamespace)) { return true; } } return false; } });
final NamespaceInfo ns = catalog .getNamespaceByPrefix(newDefault.getName()); if (ns != null && !catalog.getDefaultNamespace().equals(ns)) { catalog.setDefaultNamespace(ns);