/** Helper method that checks that the provided namespace has the expected content. */ protected void checkNamespace( NamespaceInfo namespace, String expectedPrefix, String expectedNamespaceUri, boolean expectedIsolation) { assertThat(namespace, notNullValue()); assertThat(namespace.getPrefix(), is(expectedPrefix)); assertThat(namespace.getName(), is(expectedPrefix)); assertThat(namespace.getURI(), is(expectedNamespaceUri)); assertThat(namespace.isIsolated(), is(expectedIsolation)); }
expect(ns.getName()).andReturn(name).anyTimes(); expect(ns.getPrefix()).andReturn(name).anyTimes(); expect(ns.getMetadata()).andReturn(new MetadataMap()).anyTimes();
private String unmapLocalPrefixes(String typeName, Element element, Catalog catalog) { String[] split = typeName.trim().split(":"); if (split.length != 2) { return typeName; } String prefix = split[0]; String localName = split[1]; NamedNodeMap attributes = element.getAttributes(); for (int i = 0; i < attributes.getLength(); i++) { Node attribute = attributes.item(i); String nodeName = attribute.getNodeName(); String xmlnsPrefix = null; if (nodeName.startsWith("xmlns:")) { xmlnsPrefix = nodeName.substring(6); } else if (nodeName.equalsIgnoreCase("xmlns")) { xmlnsPrefix = ""; } if (prefix.equalsIgnoreCase(xmlnsPrefix)) { String uri = attribute.getNodeValue(); NamespaceInfo ns = catalog.getNamespaceByURI(uri); prefix = ns.getName(); } } return prefix + ":" + localName; }
@GetMapping( value = "/{namespaceName}", produces = { MediaType.APPLICATION_JSON_VALUE, MediaType.TEXT_HTML_VALUE, MediaType.APPLICATION_XML_VALUE } ) public RestWrapper<NamespaceInfo> namespaceGet(@PathVariable String namespaceName) { NamespaceInfo namespace = catalog.getNamespaceByPrefix(namespaceName); if (namespace == null) { throw new ResourceNotFoundException("No such namespace: '" + namespaceName + "' found"); } LOGGER.info("GET " + namespaceName); LOGGER.info("got " + namespace.getName()); return wrapObject(namespace, NamespaceInfo.class); }
String infoName = namespace.getName(); if (infoName != null && !prefix.equals(infoName)) { throw new RestException("Can't change name of namespace", HttpStatus.FORBIDDEN);
baseURL.replace("${nameSpace}", coverageInfo.getNamespace().getName()) .replace("${layerName}", coverageInfo.getName());
@PostMapping( consumes = { MediaType.TEXT_XML_VALUE, MediaType.APPLICATION_XML_VALUE, MediaTypeExtensions.TEXT_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE } ) @ResponseStatus(HttpStatus.CREATED) public ResponseEntity<String> namespacePost( @RequestBody NamespaceInfo namespace, UriComponentsBuilder builder) { catalog.add(namespace); String name = namespace.getName(); LOGGER.info("Added namespace " + name); // JD: we need to keep namespace and workspace in sync, so create a worksapce // if one does not already exists, we can remove this once we get to a point // where namespace is just an attribute on a layer, and not a containing element if (catalog.getWorkspaceByName(namespace.getPrefix()) == null) { WorkspaceInfo ws = catalog.getFactory().createWorkspace(); ws.setName(namespace.getPrefix()); ws.setIsolated(namespace.isIsolated()); catalog.add(ws); } // build the new path UriComponents uriComponents = getUriComponents(name, builder); HttpHeaders headers = new HttpHeaders(); headers.setLocation(uriComponents.toUri()); return new ResponseEntity<>(name, headers, HttpStatus.CREATED); }
layer.getFeature().getNamespace().getName(), layer.getFeature().getName()); collection = new FeatureCollectionDecorator(name, collection);
public ResourceConfigurationPage(String workspaceName, String layerName) { super(false); this.returnPageClass = LayerPage.class; LayerInfo layer; if (workspaceName != null) { NamespaceInfo ns = getCatalog().getNamespaceByPrefix(workspaceName); if (ns == null) { // unlikely to happen, requires someone making modifications on the workspaces // with a layer page open in another tab/window throw new RuntimeException("Could not find workspace " + workspaceName); } layer = getCatalog().getLayerByName(ns.getName() + ":" + layerName); } else { layer = getCatalog().getLayerByName(layerName); } if (layer == null) { error( new ParamResourceModel("ResourceConfigurationPage.notFound", this, layerName) .getString()); setResponsePage(returnPage); return; } setupPublished(layer); setupResource(layer.getResource()); }
expect(ns.getName()).andReturn(ws.getName()).anyTimes(); expect(ns.getPrefix()).andReturn(ws.getName()).anyTimes(); expect(ns.getURI()).andReturn("http://www.geoserver.org/test/" + ws.getName()).anyTimes();
jw.value(nsInfo.getURI()); jw.key("targetPrefix"); jw.value(nsInfo.getName()); jw.key("featureTypes");
while (it1.hasNext()) { LayerInfo next = it1.next(); String wsName = next.getResource().getNamespace().getName(); assertTrue(wsName.equalsIgnoreCase("nurc")); while (it1.hasNext()) { LayerInfo next = it1.next(); String wsName = next.getResource().getNamespace().getName(); assertTrue(wsName.equalsIgnoreCase("nurc")); while (it4.hasNext()) { FeatureTypeInfo next = it4.next(); String name = next.getNamespace().getName(); assertTrue(name.equalsIgnoreCase("nurc")); while (it4.hasNext()) { FeatureTypeInfo next = it4.next(); String name = next.getNamespace().getName(); assertTrue(name.equalsIgnoreCase("nurc")); while (it5.hasNext()) { CoverageInfo next = it5.next(); String name = next.getNamespace().getName(); assertTrue(name.equalsIgnoreCase("nurc")); while (it5.hasNext()) { CoverageInfo next = it5.next(); String name = next.getNamespace().getName(); assertTrue(name.equalsIgnoreCase("nurc"));
source.setId(obj.getId()); source.setType("NamespaceInfo"); source.setName(obj.getName()); source.setNamespaceURI(obj.getURI()); message.setSource(source);