@Override public void dispose( FeatureTypeInfo info, DataAccess<? extends FeatureType, ? extends Feature> dataAccess, Name temporaryName) throws IOException { JDBCDataStore ds = (JDBCDataStore) dataAccess; if (temporaryName != null) { ds.dropVirtualTable(temporaryName.getLocalPart()); } else { ds.dropVirtualTable(info.getNativeName()); } } }
/** * Removes and returns the specified virtual table * * @param name * @return * @deprecated Use dropVirtualTable instead */ public VirtualTable removeVirtualTable(String name) { return dropVirtualTable(name); }
dataStore.dropVirtualTable("invalid_attribute");
protected SimpleFeatureType getFeatureType(VirtualTable vt) throws IOException { // check out if the view can be used JDBCDataStore ds = (JDBCDataStore) getCatalog().getDataStore(storeId).getDataStore(null); String vtName = null; try { // use a highly random name do { vtName = UUID.randomUUID().toString(); } while (Arrays.asList(ds.getTypeNames()).contains(vtName)); // try adding the vt and see if that works ds.createVirtualTable(new VirtualTable(vtName, vt)); return ds.getSchema(vtName); } finally { if (vtName != null) { ds.dropVirtualTable(vtName); } } }
/** * Checks the view definition works as expected and returns the feature type guessed solely by * looking at the sql and the first row of its output * * @param newSchema * @throws IOException */ protected SimpleFeatureType testViewDefinition(boolean guessGeometrySrid) throws IOException { // check out if the view can be used JDBCDataStore ds = (JDBCDataStore) getCatalog().getDataStore(storeId).getDataStore(null); String vtName = null; try { // use a highly random name do { vtName = UUID.randomUUID().toString(); } while (Arrays.asList(ds.getTypeNames()).contains(vtName)); // try adding the vt and see if that works VirtualTable vt = new VirtualTable(vtName, sql); paramProvider.updateVirtualTable(vt); ds.createVirtualTable(vt); return guessFeatureType(ds, vt.getName(), guessGeometrySrid); } finally { if (vtName != null) { ds.dropVirtualTable(vtName); } } }
/** * Checks the view definition works as expected and returns the feature type guessed solely by * looking at the sql and the first row of its output * * @param newSchema * @throws IOException */ protected SimpleFeatureType testViewDefinition( VirtualTable virtualTable, boolean guessGeometrySrid) throws IOException { // check out if the view can be used JDBCDataStore ds = (JDBCDataStore) getCatalog().getDataStore(storeId).getDataStore(null); String vtName = null; try { // use a highly random name do { vtName = UUID.randomUUID().toString(); } while (Arrays.asList(ds.getTypeNames()).contains(vtName)); // try adding the vt and see if that works VirtualTable vt = new VirtualTable(vtName, virtualTable); // hide the primary key definitions or we'll loose some columns vt.setPrimaryKeyColumns(Collections.emptyList()); vt.setEscapeSql(escapeSql); ds.createVirtualTable(vt); return guessFeatureType(ds, vt.getName(), guessGeometrySrid); } finally { if (vtName != null) { ds.dropVirtualTable(name); } } }
delegate.dropVirtualTable(collectionTableName); existing = null;