org.geotools.data.wfs.v1_0_0
Class WFSFeatureStore

Object
  extended by AbstractFeatureSource
      extended by WFSFeatureSource
          extended by WFSFeatureStore
All Implemented Interfaces:
FeatureSource<SimpleFeatureType,SimpleFeature>, FeatureStore<SimpleFeatureType,SimpleFeature>, SimpleFeatureSource, SimpleFeatureStore

public class WFSFeatureStore
extends WFSFeatureSource
implements SimpleFeatureStore

FeatureStore used to assemble a Transaction Request (issued during commit).

Please note this FeatureStore does not support working on Transaction.AUTO_COMMIT. Instead it builds up the Transaction request in a WFSTransactionState; each call to addFeatures, removeFeatures etc results in a series of "Actions" being recorded. These actions are used to both modify the contents you are looking at prior to commit being called; and to construct the Transaction Request when commit() is called.

Author:
dzwiers

Nested Class Summary
 
Nested classes/interfaces inherited from class WFSFeatureSource
WFSFeatureSource.WFSFeatureResults
 
Field Summary
protected  Transaction trans
           
 
Fields inherited from class WFSFeatureSource
ds, fname
 
Fields inherited from class AbstractFeatureSource
hints, queryCapabilities
 
Constructor Summary
WFSFeatureStore(WFS_1_0_0_DataStore ds, String typeName)
           
 
Method Summary
 List<FeatureId> addFeatures(FeatureCollection<SimpleFeatureType,SimpleFeature> collection)
          Adds all features from the feature collection.
 List<FeatureId> addFeatures(FeatureReader<SimpleFeatureType,SimpleFeature> reader)
           
 Set getSupportedHints()
          By default, no Hints are supported
 Transaction getTransaction()
          Retrieve the Transaction this SimpleFeatureSource is operating against.
 void modifyFeatures(AttributeDescriptor[] type, Object[] value, Filter filter)
          For backwards compatibility; please be careful that your descriptor is actually compatible with the one declared.
 void modifyFeatures(AttributeDescriptor type, Object value, Filter filter)
          For backwards compatibility; please be careful that your descriptor is actually compatible with the one declared.
 void modifyFeatures(Name[] names, Object[] value, Filter filter2)
          Modifies the attributes with the supplied values in all features selected by the given filter.
 void modifyFeatures(Name type, Object value, Filter filter)
          Modifies an attribute with the supplied value in all features selected by the given filter.
 void modifyFeatures(String[] names, Object[] values, Filter filter)
           
 void modifyFeatures(String name, Object attributeValue, Filter filter)
           
 void removeFeatures(Filter filter2)
          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 this FeatureStore.
 
Methods inherited from class WFSFeatureSource
addFeatureListener, getBounds, getBounds, getDataStore, getFeatures, getFeatures, getFeatures, getInfo, getName, getSchema, removeFeatureListener
 
Methods inherited from class AbstractFeatureSource
getCount, getQueryCapabilities, namedQuery
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface SimpleFeatureStore
getFeatures, getFeatures, getFeatures
 
Methods inherited from interface FeatureSource
addFeatureListener, getBounds, getBounds, getCount, getDataStore, getInfo, getName, getQueryCapabilities, getSchema, removeFeatureListener
 

Field Detail

trans

protected Transaction trans
Constructor Detail

WFSFeatureStore

public WFSFeatureStore(WFS_1_0_0_DataStore ds,
                       String typeName)
Parameters:
ds -
typeName -
Method Detail

getSupportedHints

public Set getSupportedHints()
Description copied from class: AbstractFeatureSource
By default, no Hints are supported

Specified by:
getSupportedHints in interface FeatureSource<SimpleFeatureType,SimpleFeature>
Overrides:
getSupportedHints in class WFSFeatureSource
Returns:
a set of RenderingHints#Key objects; may be empty but never null
See Also:
Hints.FEATURE_DETACHED, Hints.JTS_GEOMETRY_FACTORY, Hints.JTS_COORDINATE_SEQUENCE_FACTORY, Hints.JTS_PRECISION_MODEL, Hints.JTS_SRID, Hints.GEOMETRY_DISTANCE, Hints.FEATURE_2D

getTransaction

public Transaction getTransaction()
Description copied from class: AbstractFeatureSource
Retrieve the Transaction this SimpleFeatureSource is operating against.

For a plain SimpleFeatureSource that cannot modify this will always be Transaction.AUTO_COMMIT.

Specified by:
getTransaction in interface FeatureStore<SimpleFeatureType,SimpleFeature>
Overrides:
getTransaction in class WFSFeatureSource
Returns:
Transacstion SimpleFeatureSource is operating against
See Also:
AbstractFeatureSource.getTransaction()

addFeatures

public List<FeatureId> addFeatures(FeatureReader<SimpleFeatureType,SimpleFeature> reader)
                            throws IOException
Throws:
IOException

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 interface FeatureStore<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

removeFeatures

public void removeFeatures(Filter filter2)
                    throws IOException
Description copied from interface: FeatureStore
Removes features selected by the given filter.

Specified by:
removeFeatures in interface FeatureStore<SimpleFeatureType,SimpleFeature>
Parameters:
filter2 - an OpenGIS filter
Throws:
IOException - if an error occurs modifying the data source
See Also:
org.geotools.data.FeatureStore#removeFeatures(org.geotools.filter.Filter)

modifyFeatures

public void modifyFeatures(Name[] names,
                           Object[] value,
                           Filter filter2)
                    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 interface FeatureStore<SimpleFeatureType,SimpleFeature>
Parameters:
names - the attributes to modify
value - the new values for the attributes
filter2 - 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
See Also:
org.geotools.data.FeatureStore#modifyFeatures(org.geotools.feature.AttributeType[], java.lang.Object[], org.geotools.filter.Filter)

modifyFeatures

public final void modifyFeatures(AttributeDescriptor type,
                                 Object value,
                                 Filter filter)
                          throws IOException
Description copied from interface: FeatureStore
For backwards compatibility; please be careful that your descriptor is actually compatible with the one declared.

Specified by:
modifyFeatures in interface FeatureStore<SimpleFeatureType,SimpleFeature>
Parameters:
type - the attribute to modify
value - the new value for the attribute
filter - an OpenGIS filter
Throws:
IOException

modifyFeatures

public void modifyFeatures(Name type,
                           Object value,
                           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 interface FeatureStore<SimpleFeatureType,SimpleFeature>
Parameters:
type - the attribute to modify
value - 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
See Also:
org.geotools.data.FeatureStore#modifyFeatures(org.geotools.feature.AttributeType, java.lang.Object, org.geotools.filter.Filter)

modifyFeatures

public final void modifyFeatures(AttributeDescriptor[] type,
                                 Object[] value,
                                 Filter filter)
                          throws IOException
Description copied from interface: FeatureStore
For backwards compatibility; please be careful that your descriptor is actually compatible with the one declared.

Specified by:
modifyFeatures in interface FeatureStore<SimpleFeatureType,SimpleFeature>
Parameters:
type - the attributes to modify
value - the new values for the attributes
filter - an OpenGIS filter
Throws:
IOException

modifyFeatures

public void modifyFeatures(String name,
                           Object attributeValue,
                           Filter filter)
                    throws IOException
Specified by:
modifyFeatures in interface SimpleFeatureStore
Throws:
IOException

modifyFeatures

public void modifyFeatures(String[] names,
                           Object[] values,
                           Filter filter)
                    throws IOException
Specified by:
modifyFeatures in interface SimpleFeatureStore
Throws:
IOException

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 interface FeatureStore<SimpleFeatureType,SimpleFeature>
Parameters:
reader - - the collection to be written
Throws:
IOException - if there are any datasource errors.
See Also:
FeatureStore.setFeatures(org.geotools.data.FeatureReader)

setTransaction

public void setTransaction(Transaction transaction)
Description copied from interface: FeatureStore
Provide a transaction for commit/rollback control of a modifying operation on this FeatureStore.

 Transation t = new DefaultTransaction();
 featureStore.setTransaction(t);
 try {
     featureStore.addFeatures( someFeatures );
     t.commit();
 } catch ( IOException ex ) {
     // something went wrong;
     ex.printStackTrace();
     t.rollback();
 } finally {
     t.close();
 }
 

Specified by:
setTransaction in interface FeatureStore<SimpleFeatureType,SimpleFeature>
Parameters:
transaction - the transaction
See Also:
FeatureStore.setTransaction(org.geotools.data.Transaction)


Copyright © 1996-2014 Geotools. All Rights Reserved.