public LockingManager getLockingManager() { if (lm == null) { lm = new DirectoryLockingManager(cache); } return lm; }
public FileEntry(File file, DataStore store) { this.file = file; ref = new DataStoreSoftReference(store); }
public DirectoryDataStore(File directory, FileStoreFactory dialect) throws IOException { cache = new DirectoryTypeCache(directory, dialect); }
public SimpleFeatureSource getFeatureSource(String typeName) throws IOException { SimpleFeatureSource fs = getDataStore(typeName).getFeatureSource(typeName); if (fs instanceof SimpleFeatureLocking) { return new DirectoryFeatureLocking((SimpleFeatureLocking) fs); } else if (fs instanceof FeatureStore) { return new DirectoryFeatureStore((SimpleFeatureStore) fs); } else { return new DirectoryFeatureSource((SimpleFeatureSource) fs); } }
@Override public void removeSchema(String name) throws IOException { getDataStore(name).removeSchema(name); } }
DataStore getStore(boolean force) throws IOException { DataStore store = ref != null ? ref.get() : null; if (store == null && force) { store = factory.getDataStore(file); ref = new DataStoreSoftReference(store); } return store; }
public void dispose() { cache.dispose(); }
/** Disposes of the file cache and all the cached data stores */ void dispose() { // dispose all of the entries, they can be disposed more than // once so just scanning the values is ok (generally speaking we'll // find the same entry more than once among the values, once per // registered feature type in the same data store in general) for (FileEntry entry : ftCache.values()) { entry.dispose(); } }
/** * Returns the native store for a specified type name * * @param typeName * @return * @throws IOException */ public DataStore getDataStore(String typeName) throws IOException { // grab the store for a specific feature type, making sure it's actually there DataStore store = cache.getDataStore(typeName, true); if (store == null) throw new IOException("Feature type " + typeName + " is unknown"); return store; }
public String[] getTypeNames() throws IOException { Set<String> typeNames = cache.getTypeNames(); return typeNames.toArray(new String[typeNames.size()]); }
public void updateSchema(Name typeName, SimpleFeatureType featureType) throws IOException { updateSchema(typeName.getLocalPart(), featureType); }
public SimpleFeatureType getSchema(Name name) throws IOException { return getSchema(name.getLocalPart()); }
public SimpleFeatureSource getFeatureSource(Name typeName) throws IOException { return getFeatureSource(typeName.getLocalPart()); }
@Override public void clear() { DataStore store = get(); if (store != null) store.dispose(); super.clear(); } }
@Override public void removeSchema(Name name) throws IOException { removeSchema(name.getLocalPart()); }
public FeatureWriter<SimpleFeatureType, SimpleFeature> getFeatureWriter( String typeName, Filter filter, Transaction transaction) throws IOException { return getDataStore(typeName).getFeatureWriter(typeName, filter, transaction); }
public FeatureWriter<SimpleFeatureType, SimpleFeature> getFeatureWriter( String typeName, Transaction transaction) throws IOException { return getDataStore(typeName).getFeatureWriter(typeName, transaction); }
public FeatureWriter<SimpleFeatureType, SimpleFeature> getFeatureWriterAppend( String typeName, Transaction transaction) throws IOException { return getDataStore(typeName).getFeatureWriterAppend(typeName, transaction); }
public SimpleFeatureType getSchema(String typeName) throws IOException { return getDataStore(typeName).getSchema(typeName); }
public void updateSchema(String typeName, SimpleFeatureType featureType) throws IOException { getDataStore(typeName).updateSchema(typeName, featureType); }