/** * Returns all groups containing directly or indirectly containing the resource * * @param resource * @return */ public Collection<LayerGroupSummary> getContainerGroupsFor(ResourceInfo resource) { String id = resource.getId(); Set<LayerGroupSummary> groups = resourceContainmentCache.get(id); if (groups == null) { return Collections.emptyList(); } Set<LayerGroupSummary> result = new HashSet<>(); for (LayerGroupSummary lg : groups) { collectContainers(lg, result); } return result; }
private void addGroupInfo(LayerGroupInfo lg) { LayerGroupSummary groupData = new LayerGroupSummary(lg); groupCache.put(lg.getId(), groupData); lg.getLayers() .stream() .filter(IS_LAYER) .forEach( p -> { String id = ((LayerInfo) p).getResource().getId(); Set<LayerGroupSummary> containers = resourceContainmentCache.computeIfAbsent( id, CONCURRENT_SET_BUILDER); containers.add(groupData); }); }
private void clearGroupInfo(LayerGroupInfo lg) { LayerGroupSummary data = groupCache.remove(lg.getId()); // clear the resource containment cache lg.getLayers() .stream() .filter(IS_LAYER) .forEach( p -> { String rid = ((LayerInfo) p).getResource().getId(); synchronized (rid) { Set<LayerGroupSummary> containers = resourceContainmentCache.get(rid); if (containers != null) { containers.remove(data); } } }); // this group does not contain anything anymore, remove from containment for (LayerGroupSummary d : groupCache.values()) { d.containerGroups.remove(lg); } }
public List<LayerInfo> getLayers(ResourceInfo resource) { return filterLayers(Predicates.equal("resource.id", resource.getId())); }
for (PublishedInfo removed : removedLayers) { if (removed instanceof LayerInfo) { String resourceId = ((LayerInfo) removed).getResource().getId(); Set<LayerGroupSummary> containers = resourceContainmentCache.get(resourceId); if (containers != null) { for (PublishedInfo added : addedLayers) { if (added instanceof LayerInfo) { String resourceId = ((LayerInfo) added).getResource().getId(); synchronized (resourceId) { Set<LayerGroupSummary> containers =
public DataAccessLimits getAccessLimits(Authentication user, ResourceInfo resource) { if (user == null) { return null; } final String name = user.getName(); return (DataAccessLimits) getUserMap(name).get(resource.getId()); }
ReferencedEnvelope latLonEnvelope) { expect(r.getId()).andReturn(rId).anyTimes(); expect(r.getName()).andReturn(name).anyTimes(); expect(r.getQualifiedName()).andReturn(new NameImpl(ns.getURI(), name)).anyTimes();
private Map<String, Object> getDefaultValues( ResourceInfo resource, GetMapRequest getMap, DefaultValueConfigurations configurations) throws IOException { Map<String, Map<String, Object>> defaults = DYNAMIC_DEFAULTS.get(); String resourceKey = resource.getId(); Map<String, Object> result = defaults.get(resourceKey); if (result == null) { result = buildDynamicDefaults(resource, getMap, configurations); if (LOGGER.isLoggable(Level.FINE)) { LOGGER.fine( "Computed the following dynamic dimension default values for layer " + resource.prefixedName() + ":\n" + result + "\nbased on configuration:\n" + configurations); } defaults.put(resourceKey, result); } return result; }
public ResourceConfigurationPage(LayerInfo info, boolean isNew) { super(info, isNew); this.returnPageClass = LayerPage.class; setupResource( isNew ? info.getResource() : getCatalog().getResource(info.getResource().getId(), ResourceInfo.class)); }
ResourceInfo oldState = catalog.getResource(resourceInfo.getId(), ResourceInfo.class);
expect(resource.getId()).andReturn(name + "-id").anyTimes(); replay(resource);
public ResourceConfigurationPage(String workspaceName, String layerName) { 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); } String nsURI = ns.getURI(); layer = getCatalog().getLayerByName(new NameImpl(nsURI, layerName)); } else { layer = getCatalog().getLayerByName(layerName); } if (layer == null) { error(new ParamResourceModel("ResourceConfigurationPage.notFound", this, layerName) .getString()); setResponsePage(returnPage); return; } setup(getCatalog().getResource(layer.getResource().getId(), ResourceInfo.class), layer); this.isNew = false; initComponents(); }
ResourceInfo oldState = catalog.getResource(resourceInfo.getId(), ResourceInfo.class);
@Test public void test() throws Exception { String forestId = getCatalog().getLayerByName("Forests").getResource().getId(); String request = "csw?service=CSW&version=2.0.2&request=GetRecordById&typeNames=csw:Record&id=" + forestId; Document d = getAsDOM(request); print(d); checkValidationErrors(d); // check we have the expected results // we have the right kind of document assertXpathEvaluatesTo("1", "count(/csw:GetRecordByIdResponse)", d); // check contents Forests record assertXpathEvaluatesTo("abstract about Forests", "//csw:SummaryRecord[dc:title='Forests']/dct:abstract", d); assertXpathEvaluatesTo("Forests", "//csw:SummaryRecord[dc:title='Forests']/dc:subject", d); assertXpathEvaluatesTo("http://purl.org/dc/dcmitype/Dataset", "//csw:SummaryRecord[dc:title='Forests']/dc:type", d); assertXpathEvaluatesTo("urn:x-ogc:def:crs:EPSG:6.11:4326", "//csw:SummaryRecord[dc:title='Forests']/ows:BoundingBox/@crs", d); assertXpathEvaluatesTo("-90.0 -180.0", "//csw:SummaryRecord[dc:title='Forests']/ows:BoundingBox/ows:LowerCorner", d); assertXpathEvaluatesTo("90.0 180.0", "//csw:SummaryRecord[dc:title='Forests']/ows:BoundingBox/ows:UpperCorner", d); // scheme attribute assertXpathEvaluatesTo("http://www.digest.org/2.1", "//csw:SummaryRecord[dc:title='Forests']/dc:subject/@scheme", d); }
@Test public void test() throws Exception { String forestId = getCatalog().getLayerByName("Forests").getResource().getId();
source.setId(obj.getId()); source.setName(obj.getName()); source.setWorkspace(