Package org.geotools.data.transform
Class TransformFeatureStore
- Object
- 
- TransformFeatureSource
- 
- TransformFeatureStore
 
 
- 
- All Implemented Interfaces:
- FeatureSource<SimpleFeatureType,SimpleFeature>,- FeatureStore<SimpleFeatureType,SimpleFeature>,- SimpleFeatureSource,- SimpleFeatureStore
 - Direct Known Subclasses:
- OracleTransformFeatureStore,- PostgisTransformFeatureStore,- SQLServerTransformFeatureStore,- TransformFeatureLocking
 
 public class TransformFeatureStore extends TransformFeatureSource implements SimpleFeatureStore A transforming feature store, will transform on the fly all attempts to write so that the underlying features are getting modified while exposing a different feature type to its callers.- Author:
- Andrea Aime - GeoSolutions
 
- 
- 
Field SummaryFields Modifier and Type Field Description protected TransformerinvertedTransformerprotected SimpleFeatureStorestore- 
Fields inherited from class TransformFeatureSourceFF, LOGGER, source, transformer
 
- 
 - 
Constructor SummaryConstructors Constructor Description TransformFeatureStore(SimpleFeatureStore store, Name name, List<Definition> definitions)
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description List<FeatureId>addFeatures(FeatureCollection<SimpleFeatureType,SimpleFeature> collection)Adds all features from the feature collection.TransactiongetTransaction()Gets theTransactionthat thisFeatureStoreis currently operating against.voidmodifyFeatures(String[] nameArray, Object[] attributeValues, Filter filter)voidmodifyFeatures(String name, Object attributeValue, Filter filter)voidmodifyFeatures(Name[] attributeNames, Object[] attributeValues, Filter filter)Modifies the attributes with the supplied values in all features selected by the given filter.voidmodifyFeatures(Name attributeName, Object attributeValue, Filter filter)Modifies an attribute with the supplied value in all features selected by the given filter.voidremoveFeatures(Filter filter)Removes features selected by the given filter.voidsetFeatures(FeatureReader<SimpleFeatureType,SimpleFeature> reader)Deletes any existing features in the data source and then inserts new features provided by the given reader.voidsetTransaction(Transaction transaction)Provide a transaction for commit/rollback control of a modifying operation on thisFeatureStore.- 
Methods inherited from class TransformFeatureSourceaddFeatureListener, getBounds, getBounds, getCount, getDataStore, getFeatures, getFeatures, getFeatures, getInfo, getName, getQueryCapabilities, getSchema, getSupportedHints, removeFeatureListener
 - 
Methods inherited from class Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 - 
Methods inherited from interface FeatureSourceaddFeatureListener, getBounds, getBounds, getCount, getDataStore, getInfo, getName, getQueryCapabilities, getSchema, getSupportedHints, removeFeatureListener
 - 
Methods inherited from interface SimpleFeatureStoregetFeatures, getFeatures, getFeatures
 
- 
 
- 
- 
- 
Field Detail- 
storeprotected SimpleFeatureStore store 
 - 
invertedTransformerprotected Transformer invertedTransformer 
 
- 
 - 
Constructor Detail- 
TransformFeatureStorepublic TransformFeatureStore(SimpleFeatureStore store, Name name, List<Definition> definitions) throws IOException - Throws:
- IOException
 
 
- 
 - 
Method Detail- 
setTransactionpublic void setTransaction(Transaction transaction) Description copied from interface:FeatureStoreProvide 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:
- setTransactionin interface- FeatureStore<SimpleFeatureType,SimpleFeature>
- Parameters:
- transaction- the transaction
 
 - 
getTransactionpublic Transaction getTransaction() Description copied from interface:FeatureStoreGets theTransactionthat thisFeatureStoreis 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:
- getTransactionin interface- FeatureStore<SimpleFeatureType,SimpleFeature>
- Returns:
- Transaction in use, or Transaction.AUTO_COMMIT
 
 - 
removeFeaturespublic void removeFeatures(Filter filter) throws IOException Description copied from interface:FeatureStoreRemoves features selected by the given filter.- Specified by:
- removeFeaturesin interface- FeatureStore<SimpleFeatureType,SimpleFeature>
- Parameters:
- filter- an OpenGIS filter
- Throws:
- IOException- if an error occurs modifying the data source
 
 - 
addFeaturespublic List<FeatureId> addFeatures(FeatureCollection<SimpleFeatureType,SimpleFeature> collection) throws IOException Description copied from interface:FeatureStoreAdds all features from the feature collection.A list of FeatureIdsis returned, one for each feature in the order created. However, these might not be assigned until after a commit has been performed.- Specified by:
- addFeaturesin interface- FeatureStore<SimpleFeatureType,SimpleFeature>
- Parameters:
- collection- the collection of features to add
- Returns:
- the FeatureIdsof the newly added features
- Throws:
- IOException- if an error occurs modifying the data source
 
 - 
setFeaturespublic void setFeatures(FeatureReader<SimpleFeatureType,SimpleFeature> reader) throws IOException Description copied from interface:FeatureStoreDeletes 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:
- setFeaturesin interface- FeatureStore<SimpleFeatureType,SimpleFeature>
- Parameters:
- reader- - the collection to be written
- Throws:
- IOException- if there are any datasource errors.
 
 - 
modifyFeaturespublic void modifyFeatures(Name[] attributeNames, Object[] attributeValues, Filter filter) throws IOException Description copied from interface:FeatureStoreModifies the attributes with the supplied values in all features selected by the given filter.- Specified by:
- modifyFeaturesin interface- FeatureStore<SimpleFeatureType,SimpleFeature>
- Parameters:
- attributeNames- the attributes to modify
- attributeValues- the new values for the attributes
- filter- 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
 
 - 
modifyFeaturespublic void modifyFeatures(Name attributeName, Object attributeValue, Filter filter) throws IOException Description copied from interface:FeatureStoreModifies an attribute with the supplied value in all features selected by the given filter.- Specified by:
- modifyFeaturesin interface- FeatureStore<SimpleFeatureType,SimpleFeature>
- Parameters:
- attributeName- the attribute to modify
- attributeValue- the new value for the attribute
- filter- 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
 
 - 
modifyFeaturespublic void modifyFeatures(String name, Object attributeValue, Filter filter) throws IOException - Specified by:
- modifyFeaturesin interface- SimpleFeatureStore
- Throws:
- IOException
 
 - 
modifyFeaturespublic void modifyFeatures(String[] nameArray, Object[] attributeValues, Filter filter) throws IOException - Specified by:
- modifyFeaturesin interface- SimpleFeatureStore
- Throws:
- IOException
 
 
- 
 
-