|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface FeatureStore<T extends FeatureType,F extends Feature>
This interface extends FeatureSource, adding methods to add and remove
features and to modify existing features.
DataStore myDataStore = ...
FeatureSource featureSource = myDataStore.getFeatureSource("aname");
if (featureSource instanceof FeatureStore) {
// we have write access to the feature data
FeatureStore featureStore = (FeatureStore) featureSource;
// add some new features
Transaction t = new DefaultTransaction("add");
featureStore.setTransaction(t);
try {
featureStore.addFeatures( someFeatures );
t.commit();
} catch (Exception ex) {
ex.printStackTrace();
t.rollback();
} finally {
t.close();
}
}
| Method Summary | |
|---|---|
List<FeatureId> |
addFeatures(FeatureCollection<T,F> featureCollection)
Adds all features from the feature collection. |
Transaction |
getTransaction()
Gets the Transaction that this FeatureStore is
currently operating against. |
void |
modifyFeatures(AttributeDescriptor[] type,
Object[] value,
Filter filter)
Deprecated. Please use the safer method modifyFeatures(Name[], Object[], Filter) |
void |
modifyFeatures(AttributeDescriptor type,
Object value,
Filter filter)
Deprecated. Please use the safer method modifyFeatures(Name, Object, Filter) |
void |
modifyFeatures(Name[] attributeNames,
Object[] attributeValues,
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 |
removeFeatures(Filter filter)
Removes features selected by the given filter. |
void |
setFeatures(FeatureReader<T,F> 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 interface FeatureSource |
|---|
addFeatureListener, getBounds, getBounds, getCount, getDataStore, getFeatures, getFeatures, getFeatures, getInfo, getName, getQueryCapabilities, getSchema, getSupportedHints, removeFeatureListener |
| Method Detail |
|---|
List<FeatureId> addFeatures(FeatureCollection<T,F> featureCollection)
throws IOException
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.
featureCollection - the collection of features to add
FeatureIds of the newly added features
IOException - if an error occurs modifying the data source
void removeFeatures(Filter filter)
throws IOException
filter - an OpenGIS filter
IOException - if an error occurs modifying the data source
void modifyFeatures(Name[] attributeNames,
Object[] attributeValues,
Filter filter)
throws IOException
attributeNames - the attributes to modifyattributeValues - the new values for the attributesfilter - an OpenGIS filter
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
void modifyFeatures(AttributeDescriptor[] type,
Object[] value,
Filter filter)
throws IOException
modifyFeatures(Name[], Object[], Filter)
type - the attributes to modifyvalue - the new values for the attributesfilter - an OpenGIS filter
IOException
void modifyFeatures(Name attributeName,
Object attributeValue,
Filter filter)
throws IOException
attributeName - the attribute to modifyattributeValue - the new value for the attributefilter - an OpenGIS filter
IOException - if modification is not supported; if the value type does
not match the attribute type; or if there errors accessing the data source
void modifyFeatures(AttributeDescriptor type,
Object value,
Filter filter)
throws IOException
modifyFeatures(Name, Object, Filter)
type - the attribute to modifyvalue - the new value for the attributefilter - an OpenGIS filter
IOException
void setFeatures(FeatureReader<T,F> reader)
throws IOException
reader - - the collection to be written
IOException - if there are any datasource errors.void setTransaction(Transaction transaction)
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();
}
transaction - the transactionTransaction getTransaction()
Transaction that this FeatureStore is
currently operating against.
Transaction t = featureStore.getTransaction();
try {
featureStore.addFeatures( features );
t.commit();
} catch( IOException erp ){
// something went wrong;
ex.printStackTrace();
t.rollback();
}
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||