@Override public FeatureType answer() throws Throwable { return ((DataStore) ds.getDataStore(null)).getSchema(name); } })
/** * Make sure the FeatureTypeMap is fully loaded * * @param map * @throws IOException */ void updateMap(FeatureTypeMap map, boolean forceUpdate) throws IOException { try { if (map.getFeatureType() == null || forceUpdate) { SimpleFeatureType original = wrapped.getSchema(map.getOriginalName()); SimpleFeatureType transformed = transformFeatureType(original); map.setFeatureTypes(original, transformed); } } catch (IOException e) { LOGGER.log( Level.INFO, "Failure to remap feature type " + map.getOriginalName() + ". The type will be ignored", e); // if the feature type cannot be found in the original data store, // remove it from the map backwardsMap.remove(map.getName()); forwardMap.remove(map.getOriginalName()); } }
@Override public SimpleFeatureType getSchema(Name name) throws IOException { return delegate.getSchema(name); }
@Override public SimpleFeatureType getSchema(String typeName) throws IOException { return delegate.getSchema(typeName); }
public SimpleFeatureType getSchema(Name name) throws IOException { return delegate.getSchema(name); }
public SimpleFeatureType getSchema(String typeName) throws IOException { return delegate.getSchema(typeName); }
expect(ds.getSchema("trees")).andReturn(type).anyTimes(); expect(ds.getFeatureSource("trees")).andReturn(fs); replay(ds);
expect(ds.getSchema("trees")).andReturn(type).anyTimes(); expect(ds.getFeatureSource("trees")).andReturn(fs); replay(ds);
public SimpleFeatureType getSchema(final String typeName) throws IOException { final Lock lock = rwLock.readLock(); try { lock.lock(); checkStore(); if (typeName == null) { return null; } return slicesIndexStore.getSchema(typeName); } finally { lock.unlock(); } }
public SimpleFeatureType getSchema(String typeName) throws IOException { return getDataStore(typeName).getSchema(typeName); }
/** * Create a minimal style to render features of type {@code typeName} read from the given data * store * * @param store the data store containing the features * @param typeName the feature type to create the style for * @param color single color to use for all components of the Style * @return a new Style instance * @throws java.io.IOException if the data store cannot be accessed */ public static Style createSimpleStyle(DataStore store, String typeName, Color color) throws IOException { SimpleFeatureType type = store.getSchema(typeName); return createSimpleStyle(type, color); }
final SimpleFeatureType nativeFeatureType = dataStore.getSchema(typeName); final SimpleFeatureType renamedFeatureType = (SimpleFeatureType) getFeatureType(info, false);
/** * Checks the provided schema, and throws an exception if not valid * * @param schema * @throws IOException */ private void checkMosaicSchema(String typeName) throws IOException { SimpleFeatureType schema = getTileIndexStore().getSchema(typeName); if (schema == null) { throw new IllegalArgumentException("Could not find typename " + schema); } else { checkMosaicSchema(schema); } }
/** * Static convenience method: displays a {@code JSimpleStyleDialog} to prompt the user for style * preferences to use with the first feature type in the {@code dataStore}. * * @param parent parent JFrame (may be null) * @param dataStore data store with the features to be rendered * @param initialStyle an optional Style object to initialize the dialog (may be {@code null}) * @return a new Style instance or null if the user cancels the dialog */ public static Style showDialog(Component parent, DataStore dataStore, Style initialStyle) { SimpleFeatureType type = null; try { String typeName = dataStore.getTypeNames()[0]; type = dataStore.getSchema(typeName); } catch (Exception ex) { throw new IllegalStateException(ex); } return showDialog(parent, type, initialStyle); }
@Test public void testSimpleRename() throws IOException { SimpleFeatureSource fs = store.getFeatureSource(BUILDINGS.getLocalPart()); SimpleFeatureTypeBuilder tb = new SimpleFeatureTypeBuilder(); tb.init(fs.getSchema()); tb.setName("houses"); SimpleFeatureType target = tb.buildFeatureType(); SimpleFeatureSource retyped = RetypingFeatureSource.getRetypingSource(fs, target); assertTrue(retyped instanceof SimpleFeatureLocking); assertEquals(target, retyped.getSchema()); assertEquals(target, ((DataStore) retyped.getDataStore()).getSchema("houses")); assertEquals(target, retyped.getFeatures().getSchema()); SimpleFeatureIterator it = retyped.getFeatures().features(); SimpleFeature f = it.next(); it.close(); assertEquals(target, f.getType()); }
@Override public SimpleFeatureType getType(String typeName) throws IOException { checkStore(); if (this.getValidTypeNames().isEmpty() || !this.getValidTypeNames().contains(typeName)) { return null; } return getTileIndexStore().getSchema(typeName); }
/** * Returns true if the type is usable as a mosaic index, that is, it has a geometry and the * expected location property */ private boolean isValidMosaicSchema(String typeName) throws IOException { SimpleFeatureType schema = getTileIndexStore().getSchema(typeName); return Utils.isValidMosaicSchema(schema, getLocationAttributeName()); }
private void assertStoreHasFeatureType(DataStore store, String featureType) throws IOException { assertNotNull(store); assertNotNull(featureType); SimpleFeatureType schema = store.getSchema(featureType); assertNotNull(schema); }
@Override public void addGranules( final String typeName, final Collection<SimpleFeature> granules, final Transaction transaction) throws IOException { Utilities.ensureNonNull("granuleMetadata", granules); // check if the index has been cleared checkStore(); SimpleFeatureStore store = (SimpleFeatureStore) getTileIndexStore().getFeatureSource(typeName); store.setTransaction(transaction); ListFeatureCollection featureCollection = new ListFeatureCollection(getTileIndexStore().getSchema(typeName)); // add them all Set<FeatureId> fids = new HashSet<FeatureId>(); for (SimpleFeature f : granules) { // Add the feature to the feature collection featureCollection.add(f); fids.add(ff.featureId(f.getID())); } store.addFeatures(featureCollection); store.setTransaction(null); }
public void testDataStore() throws IOException { SimpleFeatureSource features = DataUtilities.source(roadFeatures); Name name = features.getName(); String typeName = name.getLocalPart(); DataStore store = DataUtilities.dataStore(features); assertSame(features.getSchema(), store.getSchema(name)); assertSame(features.getSchema(), store.getSchema(typeName)); assertSame(features, store.getFeatureSource(name)); assertSame(features, store.getFeatureSource(typeName)); assertEquals(name, store.getNames().get(0)); assertEquals(typeName, store.getTypeNames()[0]); }