Package org.geotools.data.directory
Class DirectoryFeatureStore
- Object
-
- DirectoryFeatureSource
-
- DirectoryFeatureStore
-
- All Implemented Interfaces:
FeatureSource<SimpleFeatureType,SimpleFeature>
,FeatureStore<SimpleFeatureType,SimpleFeature>
,SimpleFeatureSource
,SimpleFeatureStore
- Direct Known Subclasses:
DirectoryFeatureLocking
public class DirectoryFeatureStore extends DirectoryFeatureSource implements SimpleFeatureStore
-
-
Constructor Summary
Constructors Constructor Description DirectoryFeatureStore(SimpleFeatureStore store)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description List<FeatureId>
addFeatures(FeatureCollection<SimpleFeatureType,SimpleFeature> collection)
Adds all features from the feature collection.Transaction
getTransaction()
Gets theTransaction
that thisFeatureStore
is currently operating against.void
modifyFeatures(String[] names, Object[] values, Filter filter)
void
modifyFeatures(String name, Object value, Filter filter)
void
modifyFeatures(Name[] name, Object[] value, Filter filter)
Modifies the attributes with the supplied values in all features selected by the given filter.void
modifyFeatures(Name attributeName, Object attributeValue, Filter filter)
Modifies an attribute with the supplied value in all features selected by the given filter.void
removeFeatureListener(FeatureListener listener)
Removes an object from thisFeatureSource's
listeners.void
removeFeatures(Filter filter)
Removes features selected by the given filter.void
setFeatures(FeatureReader<SimpleFeatureType,SimpleFeature> reader)
Deletes any existing features in the data source and then inserts new features provided by the given reader.void
setTransaction(Transaction transaction)
Provide a transaction for commit/rollback control of a modifying operation on thisFeatureStore
.SimpleFeatureStore
unwrap()
-
Methods inherited from class DirectoryFeatureSource
addFeatureListener, getBounds, getBounds, getCount, getDataStore, getFeatures, getFeatures, getFeatures, getInfo, getName, getQueryCapabilities, getSchema, getSupportedHints
-
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface FeatureSource
addFeatureListener, getBounds, getBounds, getCount, getDataStore, getInfo, getName, getQueryCapabilities, getSchema, getSupportedHints
-
Methods inherited from interface SimpleFeatureStore
getFeatures, getFeatures, getFeatures
-
-
-
-
Constructor Detail
-
DirectoryFeatureStore
public DirectoryFeatureStore(SimpleFeatureStore store)
-
-
Method Detail
-
getTransaction
public Transaction getTransaction()
Description copied from interface:FeatureStore
Gets theTransaction
that thisFeatureStore
is currently operating against.Transaction t = featureStore.getTransaction(); try { featureStore.addFeatures( features ); t.commit(); } catch( IOException erp ){ // something went wrong; java.util.logging.Logger.getGlobal().log(java.util.logging.Level.INFO, "", ex); t.rollback(); }
- Specified by:
getTransaction
in interfaceFeatureStore<SimpleFeatureType,SimpleFeature>
- Returns:
- Transaction in use, or Transaction.AUTO_COMMIT
-
modifyFeatures
public void modifyFeatures(Name attributeName, Object attributeValue, Filter filter) throws IOException
Description copied from interface:FeatureStore
Modifies an attribute with the supplied value in all features selected by the given filter.- Specified by:
modifyFeatures
in interfaceFeatureStore<SimpleFeatureType,SimpleFeature>
- Parameters:
attributeName
- the attribute to modifyattributeValue
- the new value for the attributefilter
- an OpenGIS filter- Throws:
IOException
- if modification is not supported; if the value type does not match the attribute type; or if there errors accessing the data source
-
modifyFeatures
public void modifyFeatures(Name[] name, Object[] value, Filter filter) throws IOException
Description copied from interface:FeatureStore
Modifies the attributes with the supplied values in all features selected by the given filter.- Specified by:
modifyFeatures
in interfaceFeatureStore<SimpleFeatureType,SimpleFeature>
- Parameters:
name
- the attributes to modifyvalue
- the new values for the attributesfilter
- an OpenGIS filter- Throws:
IOException
- if the attribute and object arrays are not equal in length; if the value types do not match the attribute types; if modification is not supported; or if there errors accessing the data source
-
modifyFeatures
public void modifyFeatures(String name, Object value, Filter filter) throws IOException
- Specified by:
modifyFeatures
in interfaceSimpleFeatureStore
- Throws:
IOException
-
modifyFeatures
public void modifyFeatures(String[] names, Object[] values, Filter filter) throws IOException
- Specified by:
modifyFeatures
in interfaceSimpleFeatureStore
- Throws:
IOException
-
removeFeatureListener
public void removeFeatureListener(FeatureListener listener)
Description copied from interface:FeatureSource
Removes an object from thisFeatureSource's
listeners.- Specified by:
removeFeatureListener
in interfaceFeatureSource<SimpleFeatureType,SimpleFeature>
- Overrides:
removeFeatureListener
in classDirectoryFeatureSource
- Parameters:
listener
- the listener to remove
-
removeFeatures
public void removeFeatures(Filter filter) throws IOException
Description copied from interface:FeatureStore
Removes features selected by the given filter.- Specified by:
removeFeatures
in interfaceFeatureStore<SimpleFeatureType,SimpleFeature>
- Parameters:
filter
- an OpenGIS filter- Throws:
IOException
- if an error occurs modifying the data source
-
setFeatures
public void setFeatures(FeatureReader<SimpleFeatureType,SimpleFeature> reader) throws IOException
Description copied from interface:FeatureStore
Deletes any existing features in the data source and then inserts new features provided by the given reader. This is primarily used as a convenience method for file-based data sources.- Specified by:
setFeatures
in interfaceFeatureStore<SimpleFeatureType,SimpleFeature>
- Parameters:
reader
- - the collection to be written- Throws:
IOException
- if there are any datasource errors.
-
setTransaction
public void setTransaction(Transaction transaction)
Description copied from interface:FeatureStore
Provide a transaction for commit/rollback control of a modifying operation on thisFeatureStore
.Transaction t = new DefaultTransaction(); featureStore.setTransaction(t); try { featureStore.addFeatures( someFeatures ); t.commit(); } catch ( IOException ex ) { // something went wrong; java.util.logging.Logger.getGlobal().log(java.util.logging.Level.INFO, "", ex); t.rollback(); } finally { t.close(); }
- Specified by:
setTransaction
in interfaceFeatureStore<SimpleFeatureType,SimpleFeature>
- Parameters:
transaction
- the transaction
-
addFeatures
public List<FeatureId> addFeatures(FeatureCollection<SimpleFeatureType,SimpleFeature> collection) throws IOException
Description copied from interface:FeatureStore
Adds all features from the feature collection.A list of
FeatureIds
is returned, one for each feature in the order created. However, these might not be assigned until after a commit has been performed.- Specified by:
addFeatures
in interfaceFeatureStore<SimpleFeatureType,SimpleFeature>
- Parameters:
collection
- the collection of features to add- Returns:
- the
FeatureIds
of the newly added features - Throws:
IOException
- if an error occurs modifying the data source
-
unwrap
public SimpleFeatureStore unwrap()
- Overrides:
unwrap
in classDirectoryFeatureSource
-
-