public WMTSStoreInfo clone(final WMTSStoreInfo source, boolean allowEnvParametrization) { WMTSStoreInfo target; try { target = (WMTSStoreInfo) SerializationUtils.clone(source); if (target instanceof StoreInfoImpl && target.getCatalog() == null) { ((StoreInfoImpl) target).setCatalog(catalog); } } catch (Exception e) { target = catalog.getFactory().createWebMapTileServer(); target.setDescription(source.getDescription()); target.setEnabled(source.isEnabled()); target.setName(source.getName()); target.setType(source.getType()); target.setWorkspace(source.getWorkspace()); } setConnectionParameters(source, target); if (allowEnvParametrization) { // Resolve GeoServer Environment placeholders final GeoServerEnvironment gsEnvironment = GeoServerExtensions.bean(GeoServerEnvironment.class); if (gsEnvironment != null && GeoServerEnvironment.ALLOW_ENV_PARAMETRIZATION) { target.setCapabilitiesURL( (String) gsEnvironment.resolveValue(source.getCapabilitiesURL())); target.setUsername((String) gsEnvironment.resolveValue(source.getUsername())); target.setPassword((String) gsEnvironment.resolveValue(source.getPassword())); } } return target; }
@Override public WebMapTileServer getWebMapTileServer(ProgressListener listener) throws IOException { return delegate.getWebMapTileServer(listener); }
EntityResolver entityResolver = getEntityResolver(); String id = info.getId(); WebMapTileServer wmts = wmtsCache.get(id); if (wmts == null) { HTTPClient client = getHTTPClient(expandedStore); String capabilitiesURL = expandedStore.getCapabilitiesURL(); URL serverURL = new URL(capabilitiesURL); wmts = new WebMapTileServer(serverURL, client, null); if (StringUtils.isNotEmpty(info.getHeaderName()) && StringUtils.isNotEmpty(info.getHeaderValue())) { wmts.getHeaders().put(info.getHeaderName(), info.getHeaderValue());
/** * @param source * @param target */ private void setConnectionParameters(final WMTSStoreInfo source, WMTSStoreInfo target) { target.setCapabilitiesURL(source.getCapabilitiesURL()); target.setUsername(source.getUsername()); target.setPassword(source.getPassword()); target.setUseConnectionPooling(source.isUseConnectionPooling()); target.setMaxConnections(source.getMaxConnections()); target.setConnectTimeout(source.getConnectTimeout()); target.setReadTimeout(source.getReadTimeout()); }
wmtss.setName("wmtsName"); wmtss.setType("WMTS"); wmtss.setCapabilitiesURL("http://fake.wmts.url"); wmtss.setWorkspace(ws);
UriComponentsBuilder builder) { if (store.getWorkspace() != null) { WorkspaceInfo ws = store.getWorkspace(); if (!workspaceName.equals(ws.getName())) { throw new RestException( store.setWorkspace(catalog.getWorkspaceByName(workspaceName)); store.setEnabled(true); String storeName = store.getName(); LOGGER.info("POST wmts store " + storeName); UriComponents uriComponents =
@Test public void testPutNonDestructive() throws Exception { WMTSStoreInfo wsi = catalog.getStoreByName("sf", "demo", WMTSStoreInfo.class); wsi.setEnabled(true); catalog.save(wsi); assertTrue(wsi.isEnabled()); int maxConnections = wsi.getMaxConnections(); int readTimeout = wsi.getReadTimeout(); int connectTimeout = wsi.getConnectTimeout(); boolean useConnectionPooling = wsi.isUseConnectionPooling(); String xml = "<wmtsStore>" + "<name>demo</name>" + "</wmtsStore>"; MockHttpServletResponse response = putAsServletResponse( RestBaseController.ROOT_PATH + "/workspaces/sf/wmtsstores/demo", xml, "text/xml"); assertEquals(200, response.getStatus()); wsi = catalog.getStoreByName("sf", "demo", WMTSStoreInfo.class); assertTrue(wsi.isEnabled()); assertEquals(maxConnections, wsi.getMaxConnections()); assertEquals(readTimeout, wsi.getReadTimeout()); assertEquals(connectTimeout, wsi.getConnectTimeout()); assertEquals(useConnectionPooling, wsi.isUseConnectionPooling()); }
if (info.getWorkspace() != null && !original.getWorkspace().equals(info.getWorkspace())) { throw new RestException( "Attempting to move " + storeName + " from " + original.getWorkspace().getName() + " to " + info.getWorkspace().getName() + " via PUT", HttpStatus.FORBIDDEN); if (!original.getName().equals(info.getName())) { throw new RestException( "Attempting to rename " + storeName + " to " + info.getName() + " via PUT", HttpStatus.FORBIDDEN);
public String getName() { return delegate.getName(); }
public String getCapabilitiesURL() { return delegate.getCapabilitiesURL(); }
wmts.setWorkspace(ws); wmts.setName("foo"); wmts.setCapabilitiesURL("http://fake.host/wmts?request=getCapabilities"); catalog.add(wmts);
@Test public void testAddWMTSStore() { assertTrue(catalog.getStores(WMTSStoreInfo.class).isEmpty()); addWMTSStore(); assertEquals(1, catalog.getStores(WMTSStoreInfo.class).size()); WMTSStoreInfo retrieved = catalog.getStore(wmtss.getId(), WMTSStoreInfo.class); assertNotNull(retrieved); WMTSStoreInfo wmts2 = catalog.getFactory().createWebMapTileServer(); wmts2.setName("wmts2Name"); wmts2.setWorkspace(ws); catalog.add(wmts2); assertEquals(2, catalog.getStores(WMTSStoreInfo.class).size()); }
@Test public void testModifyWMTSStore() throws Exception { testAddWMTSStore(); WMTSStoreInfo wmts = catalog.getStoreByName("acme", "demowmts", WMTSStoreInfo.class); assertNull(wmts.getCapabilitiesURL()); String capsURL = "http://demo.opengeo.org:8080/geoserver/gwc?request=GetCapabilites&service=WMTS"; wmts.setCapabilitiesURL(capsURL); catalog.save(wmts); File f = new File(testData.getDataDirectoryRoot(), "workspaces/acme/demowmts/wmtsstore.xml"); Document dom = dom(f); assertXpathEvaluatesTo(capsURL, "/wmtsStore/capabilitiesURL/text()", dom); }
public void setCapabilitiesURL(String url) { delegate.setCapabilitiesURL(url); }
LOGGER.log(Level.INFO, "Adding the store for " + info.getCapabilitiesURL(), e); throw new IllegalArgumentException( "The WMTS store could not be saved. Failure message: " + e.getMessage()); try { layerChooserPage = new NewLayerPage(savedStore.getId()); } catch (RuntimeException e) { LOGGER.log( Level.INFO, "Getting list of layers for the WMTS store " + info.getCapabilitiesURL(), e);
@Test public void testAddWMTSStore() throws Exception { testAddWorkspace(); File dir = new File(testData.getDataDirectoryRoot(), "workspaces/acme/demowmts"); assertFalse(dir.exists()); WMTSStoreInfo wmts = catalog.getFactory().createWebMapTileServer(); wmts.setName("demowmts"); wmts.setWorkspace(catalog.getWorkspaceByName("acme")); catalog.add(wmts); assertTrue(dir.exists()); assertTrue(new File(dir, "wmtsstore.xml").exists()); }
public void setEnabled(boolean enabled) { delegate.setEnabled(enabled); }
public void setWorkspace(WorkspaceInfo workspace) { delegate.setWorkspace(workspace); }
public String getId() { return delegate.getId(); }
public boolean isEnabled() { return delegate.isEnabled(); }