public DataStoreInfo getStore() { return delegate.getStore(); }
@Override public DataStoreInfo getStore() { return (DataStoreInfo) SecuredObjects.secure(delegate.getStore(), policy); }
FeatureType getCacheableFeatureType(FeatureTypeInfo info, boolean handleProjectionPolicy) throws IOException { String key = getFeatureTypeInfoKey(info, handleProjectionPolicy); FeatureType ft = featureTypeCache.get(key); if (ft == null) { synchronized (featureTypeCache) { ft = featureTypeCache.get(key); if (ft == null) { // grab the underlying feature type DataAccess<? extends FeatureType, ? extends Feature> dataAccess = getDataStore(info.getStore()); FeatureTypeCallback initializer = getFeatureTypeInitializer(info, dataAccess); if (initializer != null) { initializer.initialize(info, dataAccess, null); } // ft = jstore.getSchema(vt.getName()); ft = dataAccess.getSchema(info.getQualifiedNativeName()); ft = buildFeatureType(info, handleProjectionPolicy, ft); featureTypeCache.put(key, ft); } } } return ft; }
private FeatureType getNonCacheableFeatureType( FeatureTypeInfo info, boolean handleProjectionPolicy) throws IOException { FeatureType ft = null; // grab the underlying feature type DataAccess<? extends FeatureType, ? extends Feature> dataAccess = getDataStore(info.getStore()); FeatureTypeCallback initializer = getFeatureTypeInitializer(info, dataAccess); Name temporaryName = null; if (initializer != null) { temporaryName = getTemporaryName(info, dataAccess, initializer); } ft = dataAccess.getSchema( temporaryName != null ? temporaryName : info.getQualifiedNativeName()); ft = buildFeatureType(info, handleProjectionPolicy, ft); // Remove layer configuration from datastore if (initializer != null && temporaryName != null) { initializer.dispose(info, dataAccess, temporaryName); } return ft; }
DataStoreInfo ds = ft.getStore(); if (ds == null) { return;
@Test public void testGlobal() throws IOException { GeoServerDataDirectory dd = createDataDirectoryMock(); DataStoreInfo s = createNiceMock(DataStoreInfo.class); FeatureTypeInfo ft = createNiceMock(FeatureTypeInfo.class); WorkspaceInfo ws = createNiceMock(WorkspaceInfo.class); expect(ft.getStore()).andReturn(s).anyTimes(); expect(s.getWorkspace()).andReturn(ws).anyTimes(); replay(ft, s, ws, dd); GeoServerTemplateLoader tl = new GeoServerTemplateLoader(getClass(), dd); tl.setResource(ft); assertNull(tl.findTemplateSource("dummy.ftl")); reset(dd); expect(dd.findSuppWorkspacesFile(ws, "dummy.ftl")).andReturn(new File("foo")).once(); replay(dd); assertNotNull(tl.findTemplateSource("dummy.ftl")); verify(dd); }
@Test public void testRelativeToWorkspace() throws IOException { GeoServerDataDirectory dd = createDataDirectoryMock(); DataStoreInfo s = createNiceMock(DataStoreInfo.class); FeatureTypeInfo ft = createNiceMock(FeatureTypeInfo.class); WorkspaceInfo ws = createNiceMock(WorkspaceInfo.class); expect(ft.getStore()).andReturn(s).anyTimes(); expect(s.getWorkspace()).andReturn(ws).anyTimes(); replay(ft, s, ws, dd); GeoServerTemplateLoader tl = new GeoServerTemplateLoader(getClass(), dd); tl.setFeatureType(ft); Object source = tl.findTemplateSource("dummy.ftl"); assertNull(source); reset(dd); expect(dd.findSuppWorkspaceFile(ws, "dummy.ftl")).andReturn(new File("foo")).once(); replay(dd); assertNotNull(tl.findTemplateSource("dummy.ftl")); verify(dd); }
@Test public void testRelativeToStore() throws IOException { GeoServerDataDirectory dd = createDataDirectoryMock(); replay(dd); GeoServerTemplateLoader tl = new GeoServerTemplateLoader(getClass(), dd); Object source = tl.findTemplateSource("dummy.ftl"); assertNull(source); reset(dd); DataStoreInfo s = createNiceMock(DataStoreInfo.class); FeatureTypeInfo ft = createNiceMock(FeatureTypeInfo.class); expect(ft.getStore()).andReturn(s).anyTimes(); tl.setFeatureType(ft); replay(ft, s, dd); assertNull(tl.findTemplateSource("dummy.ftl")); reset(dd); expect(dd.findSuppStoreFile(s, "dummy.ftl")).andReturn(new File("foo")).once(); replay(dd); assertNotNull(tl.findTemplateSource("dummy.ftl")); verify(dd); }
DataStoreInfo originalStoreInfo = originalFeatureTypeInfo.getStore();
FeatureTypeInfo info, Hints hints) throws IOException { DataAccess<? extends FeatureType, ? extends Feature> dataAccess = getDataStore(info.getStore());
assertEquals(ds, ft.getStore()); assertEquals(ns, ft.getNamespace()); assertEquals("EPSG:4326", ft.getSRS());
void clear(FeatureTypeInfo info) { catalog.getResourcePool().clear(info); catalog.getResourcePool().clear(info.getStore()); }
public SQLViewEditPage(FeatureTypeInfo type, ResourceConfigurationPage previousPage) throws IOException { super(type.getStore().getWorkspace().getName(), type.getStore().getName(), type.getName(), type.getMetadata().get(FeatureTypeInfo.JDBC_VIRTUAL_TABLE, VirtualTable.class)); VirtualTable vt = type.getMetadata().get(FeatureTypeInfo.JDBC_VIRTUAL_TABLE, VirtualTable.class); tinfo = type; originalName = vt.getName(); this.previusPage = previousPage; }
public CascadedWFSStoredQueryEditPage( FeatureTypeInfo type, ResourceConfigurationPage previousPage) throws IOException { super(type.getStore().getWorkspace().getName(), type.getStore().getName(), type.getName()); this.editableType = type; this.configuration = (StoredQueryConfiguration) type.getMetadata().get(FeatureTypeInfo.STORED_QUERY_CONFIGURATION); this.storedQueryId = this.configuration.getStoredQueryId(); this.previousPage = previousPage; parameterProvider.refreshItems(configuration.getStoredQueryId()); }
public SQLViewEditPage(FeatureTypeInfo type, ResourceConfigurationPage previousPage) throws IOException { super( type.getStore().getWorkspace().getName(), type.getStore().getName(), type.getName(), type.getMetadata().get(FeatureTypeInfo.JDBC_VIRTUAL_TABLE, VirtualTable.class)); VirtualTable vt = type.getMetadata().get(FeatureTypeInfo.JDBC_VIRTUAL_TABLE, VirtualTable.class); tinfo = type; originalName = vt.getName(); this.previusPage = previousPage; }
@Test public void testCollectionsWorkspaceSpecificJson() throws Exception { DocumentContext json = getAsJSONPath("cdf/wfs3/collections", 200); long expected = getCatalog() .getFeatureTypes() .stream() .filter(ft -> "cdf".equals(ft.getStore().getWorkspace().getName())) .count(); assertEquals(expected, (int) json.read("collections.length()", Integer.class)); }
@Override public void marshal(Object source, HierarchicalStreamWriter writer, MarshallingContext context) { FeatureTypeInfo ft = (FeatureTypeInfo) source; writer.startNode("name"); writer.setValue(ft.prefixedName()); writer.endNode(); StoreInfo store = ft.getStore(); WorkspaceInfo ws = store.getWorkspace(); encodeLink( "/workspaces/" + encode(ws.getName()) + "/datastores/" + encode(store.getName()) + "/featuretypes/" + encode(ft.getName()), writer, getFormatGet()); }
@Override protected void onClick(AjaxRequestTarget target, Form form) { GeoServerApplication app = (GeoServerApplication) getApplication(); FeatureTypeInfo ft = (FeatureTypeInfo) getResourceInfo(); app.getCatalog().getResourcePool().clear(ft); app.getCatalog().getResourcePool().clear(ft.getStore()); target.add(attributePanel); } };
@Override protected void onClick(AjaxRequestTarget target, Form form) { GeoServerApplication app = (GeoServerApplication) getApplication(); FeatureTypeInfo ft = (FeatureTypeInfo)getResourceInfo(); app.getCatalog().getResourcePool().clear(ft); app.getCatalog().getResourcePool().clear(ft.getStore()); target.addComponent(attributePanel); } };