private boolean forceServiceRootLayerHaveGeogigAuthURL() { LOGGER.fine("Checking for root layer geogig auth URL"); WMSInfo serviceInfo = geoserver.getService(WMSInfo.class); if (serviceInfo == null) { LOGGER.info("No WMSInfo available in GeoServer. This is strange but can happen"); return false; } List<AuthorityURLInfo> authorityURLs = serviceInfo.getAuthorityURLs(); for (AuthorityURLInfo urlInfo : authorityURLs) { if (AUTHORITY_URL_NAME.equals(urlInfo.getName())) { LOGGER.fine("geogig root layer auth URL already exists"); return true; } } AuthorityURL geogigAuthURL = new AuthorityURL(); geogigAuthURL.setName(AUTHORITY_URL_NAME); geogigAuthURL.setHref(AUTHORITY_URL); serviceInfo.getAuthorityURLs().add(geogigAuthURL); LOGGER.fine("Saving geogig root layer auth URL"); geoserver.save(serviceInfo); LOGGER.info("geogig root layer auth URL saved"); return true; }
properties.put("schemaBaseURL", wmsInfo.getSchemaBaseURL()); properties.put("verbose", wmsInfo.isVerbose() ? "true" : "false"); properties.put("authorityURLs", wmsInfo.getAuthorityURLs() != null ? new CollectionModel(wmsInfo.getAuthorityURLs(), new ObjectToMapWrapper(AuthorityURL.class)) : "NO_AUTHORITY_URL"); properties.put("identifiers", wmsInfo.getIdentifiers() != null ? new CollectionModel(wmsInfo.getIdentifiers(), new ObjectToMapWrapper(LayerIdentifierInfo.class)) : "NO_IDENTIFIER"); properties.put("srsList", wmsInfo.getSRS().size() > 0 ? wmsInfo.getSRS() : "NO_SRSList");
handleAuthorityURL(serviceInfo.getAuthorityURLs());
handleAuthorityURL(serviceInfo.getAuthorityURLs());
@SuppressWarnings("unchecked") public LayerAuthoritiesAndIdentifiersPanel(final String id, final boolean isRootLayer, final IModel<? extends CatalogInfo> layerModel) { super(id); // authority URLs for the this layer IModel<List<AuthorityURLInfo>> authURLsModel; authURLsModel = LiveCollectionModel.list(new PropertyModel<List<AuthorityURLInfo>>( layerModel, "authorityURLs")); AuthorityURLListEditor authUrlEditor = new AuthorityURLListEditor("authorityurls", authURLsModel); add(authUrlEditor); // Layer Identifiers for this layer IModel<List<LayerIdentifierInfo>> identifiersModel; identifiersModel = LiveCollectionModel.list(new PropertyModel<List<LayerIdentifierInfo>>( layerModel, "identifiers")); LayerIdentifierListEditor identifiersEditor = new LayerIdentifierListEditor( "layerIdentifiers", identifiersModel, authUrlEditor); if (!isRootLayer) { WMSInfo serviceInfo = WMS.get().getServiceInfo(); List<AuthorityURLInfo> rootLayerAuthorities = serviceInfo.getAuthorityURLs(); identifiersEditor.setBaseAuthorities(rootLayerAuthorities); } add(identifiersEditor); }
List<AuthorityURLInfo> rootLayerAuthorities = serviceInfo.getAuthorityURLs(); identifiersEditor.setBaseAuthorities(rootLayerAuthorities);
@Test public void testRootLayer() throws Exception { WMSInfo serviceInfo = getWMS().getServiceInfo(); addAuthUrl("rootAuth1", "http://geoserver/wms/auth1", serviceInfo.getAuthorityURLs()); addAuthUrl("rootAuth2", "http://geoserver/wms/auth2", serviceInfo.getAuthorityURLs()); addIdentifier("rootAuth1", "rootId1", serviceInfo.getIdentifiers()); addIdentifier("rootAuth2", "rootId2", serviceInfo.getIdentifiers());
@Test public void testRootLayer() throws Exception { WMSInfo serviceInfo = getWMS().getServiceInfo(); addAuthUrl("rootAuth1", "http://geoserver/wms/auth1", serviceInfo.getAuthorityURLs()); addAuthUrl("rootAuth2", "http://geoserver/wms/auth2", serviceInfo.getAuthorityURLs()); addIdentifier("rootAuth1", "rootId1", serviceInfo.getIdentifiers()); addIdentifier("rootAuth2", "rootId2", serviceInfo.getIdentifiers());