public WMSStoreInfo createWebMapServer() { return new WMSStoreInfoImpl(catalog); }
public WebMapServer getWebMapServer(ProgressListener listener) throws IOException { return getCatalog().getResourcePool().getWebMapServer(this); }
@Override public void setUseConnectionPooling(boolean useHttpConnectionPooling) { getMetadata().put("useConnectionPooling", Boolean.valueOf(useHttpConnectionPooling)); } }
@Test public void testWMSStoreReferencedByName() throws Exception { Catalog catalog = new CatalogImpl(); CatalogFactory cFactory = catalog.getFactory(); WorkspaceInfo ws = cFactory.createWorkspace(); ws.setName("foo"); WMSStoreInfo wms1 = cFactory.createWebMapServer(); wms1.setName("bar"); wms1.setWorkspace(ws); wms1.setCapabilitiesURL("http://fake.host/wms?request=GetCapabilities&service=wms"); catalog.detach(wms1); ((WMSStoreInfoImpl) wms1).setId(null); ByteArrayOutputStream out = out(); XStreamPersister persister = new XStreamPersisterFactory().createXMLPersister(); persister.setReferenceByName(true); persister.save(wms1, out); WMSStoreInfo wms2 = persister.load(in(out), WMSStoreInfo.class); assertEquals("bar", wms2.getName()); assertEquals(WMSStoreInfoImpl.DEFAULT_MAX_CONNECTIONS, wms2.getMaxConnections()); assertEquals(WMSStoreInfoImpl.DEFAULT_CONNECT_TIMEOUT, wms2.getConnectTimeout()); assertEquals(WMSStoreInfoImpl.DEFAULT_READ_TIMEOUT, wms2.getReadTimeout()); assertNotNull(wms2.getWorkspace()); assertEquals("foo", wms2.getWorkspace().getId()); Document dom = dom(in(out)); assertEquals("wmsStore", dom.getDocumentElement().getNodeName()); }
@Override WMSLayerInfo createDelegate() { WMSLayerInfo info = new WMSLayerInfoImpl(getCatalog()); info.setStore(new WMSStoreInfoImpl(getCatalog())); return info; }
@Override public boolean isUseConnectionPooling() { Boolean useConnectionPooling = getMetadata().get("useConnectionPooling", Boolean.class); return useConnectionPooling == null ? Boolean.TRUE : useConnectionPooling; }
private CatalogInfo prototype(CatalogInfo original, Catalog catalog) { CatalogInfo prototype; if (original instanceof WorkspaceInfo) { prototype = new WorkspaceInfoImpl(); } else if (original instanceof DataStoreInfo) { prototype = new DataStoreInfoImpl(catalog); } else if (original instanceof CoverageStoreInfo) { prototype = new CoverageStoreInfoImpl(catalog); } else if (original instanceof WMSStoreInfo) { prototype = new WMSStoreInfoImpl((CatalogImpl) SecureCatalogImpl.unwrap(catalog)); } else if (original instanceof FeatureTypeInfo) { prototype = new FeatureTypeInfoImpl(catalog); } else if (original instanceof CoverageInfo) { prototype = new CoverageInfoImpl(catalog); } else if (original instanceof WMSLayerInfo) { prototype = new WMSLayerInfoImpl((CatalogImpl) SecureCatalogImpl.unwrap(catalog)); } else { throw new IllegalArgumentException(original.toString()); } return prototype; } }
catalog.add(coverageStore); WMSStoreInfo wmsStore = new WMSStoreInfoImpl(catalog); wmsStore.setEnabled(false); wmsStore.setName("wmsStore-Name");