|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
ObjectContentFeatureSource
ContentFeatureStore
public abstract class ContentFeatureStore
Abstract implementation of FeatureStore.
List its base class ContentFeatureSource
, this feature store works off
of operations provided by FeatureCollection
.
The #addFeatures(FeatureCollection
method is used to add features to
the feature store. The method should return the "persistent" feature id's
which are generated after the feature has been added to persistent storage.
Often the persistent fid is different from the fid specified by the actual
feature being inserted. For this reason Property.getUserData()
is
used to report back persistent fids. It is up to the implementor of the
feature collection to report this value back after a feature has been inserted.
As an example, consider an implementation of FeatureCollection#add(Object)
.
boolean add( Object o ) { SimpleFeature feature = (SimpleFeature) o; //1.add the feature to storage ... //2. derive the persistent fid String fid = ...; //3. set the user data feature.getUserData().put( "fid", fid ); }
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface FeatureLocking |
---|
FeatureLocking.Response |
Field Summary | |
---|---|
protected FeatureLock |
lock
current feature lock |
protected int |
WRITER_ADD
writer flags |
protected int |
WRITER_UPDATE
|
Fields inherited from class ContentFeatureSource |
---|
entry, hints, query, queryCapabilities, schema, transaction |
Constructor Summary | |
---|---|
ContentFeatureStore(ContentEntry entry,
Query query)
Creates the content feature store. |
Method Summary | |
---|---|
List<FeatureId> |
addFeatures(Collection collection)
Adds a collection of features to the store. |
List<FeatureId> |
addFeatures(FeatureCollection<SimpleFeatureType,SimpleFeature> collection)
Adds a collection of features to the store. |
FeatureWriter<SimpleFeatureType,SimpleFeature> |
getWriter(Filter filter)
Returns a writer over features specified by a filter. |
FeatureWriter<SimpleFeatureType,SimpleFeature> |
getWriter(Filter filter,
int flags)
Returns a writer over features specified by a filter. |
FeatureWriter<SimpleFeatureType,SimpleFeature> |
getWriter(Query query)
Returns a writer over features specified by a query. |
FeatureWriter<SimpleFeatureType,SimpleFeature> |
getWriter(Query query,
int flags)
Returns a writer over features specified by a query. |
protected abstract FeatureWriter<SimpleFeatureType,SimpleFeature> |
getWriterInternal(Query query,
int flags)
Subclass method for returning a native writer from the datastore. |
int |
lockFeatures()
Locks all features. |
int |
lockFeatures(Filter filter)
Locks features specified by a filter. |
int |
lockFeatures(Query query)
Locks features specified by a query. |
void |
modifyFeatures(AttributeDescriptor[] type,
Object[] value,
Filter filter)
Modifies/updates the features of the store which match the specified filter. |
void |
modifyFeatures(AttributeDescriptor type,
Object value,
Filter filter)
Calls through to modifyFeatures(AttributeDescriptor[], Object[], Filter) . |
void |
removeFeatures(Filter filter)
Removes the features from the store which match the specified filter. |
void |
setFeatureLock(FeatureLock lock)
Sets the feature lock of the feature store. |
void |
setFeatures(FeatureReader<SimpleFeatureType,SimpleFeature> reader)
Sets the feature of the source. |
void |
unLockFeatures()
Unlocks all features. |
void |
unLockFeatures(Filter filter)
Unlocks features specified by a filter. |
void |
unLockFeatures(Query query)
Unlocks features specified by a query. |
Methods inherited from class Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected final int WRITER_ADD
protected final int WRITER_UPDATE
protected FeatureLock lock
Constructor Detail |
---|
public ContentFeatureStore(ContentEntry entry, Query query)
entry
- The entry for the feature store.query
- The defining query.Method Detail |
---|
public final FeatureWriter<SimpleFeatureType,SimpleFeature> getWriter(Filter filter) throws IOException
filter
- The filter
IOException
public final FeatureWriter<SimpleFeatureType,SimpleFeature> getWriter(Filter filter, int flags) throws IOException
filter
- The filterflags
- flags specifying writing mode
IOException
public final FeatureWriter<SimpleFeatureType,SimpleFeature> getWriter(Query query) throws IOException
query
- The query
IOException
public final FeatureWriter<SimpleFeatureType,SimpleFeature> getWriter(Query query, int flags) throws IOException
query
- The queryflags
- flags specifying writing mode
IOException
protected abstract FeatureWriter<SimpleFeatureType,SimpleFeature> getWriterInternal(Query query, int flags) throws IOException
It is important to note that if the native writer intends to handle any of the following natively:
true
:
ContentFeatureSource.canReproject()
ContentFeatureSource.canFilter()
ContentFeatureSource.canLimit()
ContentFeatureSource.canSort()
IOException
public final List<FeatureId> addFeatures(Collection collection) throws IOException
This method operates by getting an appending feature writer and writing all the features in collection to it. Directly after a feature is written its id is obtained and added to the returned set.
IOException
public List<FeatureId> addFeatures(FeatureCollection<SimpleFeatureType,SimpleFeature> collection) throws IOException
This method calls through to addFeatures(Collection)
.
addFeatures
in interface FeatureStore<SimpleFeatureType,SimpleFeature>
collection
- The collection of features to add.
IOException
- if anything goes wrong.public final void setFeatures(FeatureReader<SimpleFeatureType,SimpleFeature> reader) throws IOException
This method operates by first clearing the contents of the feature
store (removeFeatures(Filter)
), and then obtaining an appending
feature writer and writing all features from reader to it.
setFeatures
in interface FeatureStore<SimpleFeatureType,SimpleFeature>
reader
- - the collection to be written
IOException
- if there are any datasource errors.public void modifyFeatures(AttributeDescriptor[] type, Object[] value, Filter filter) throws IOException
This method operates by obtaining an updating feature writer based on the specified filter and writing the updated values to it.
The filter must not be null
, in this case this method
will throw an IllegalArgumentException
.
modifyFeatures
in interface FeatureStore<SimpleFeatureType,SimpleFeature>
type
- The attributes to modify.value
- The values to put in the attribute types.filter
- An OGC filter to note which attributes to modify.
IOException
- if the attribute and object arrays are not eqaul
length, if the object types do not match the attribute types,
or if there are backend errors.public final void modifyFeatures(AttributeDescriptor type, Object value, Filter filter) throws IOException
modifyFeatures(AttributeDescriptor[], Object[], Filter)
.
modifyFeatures
in interface FeatureStore<SimpleFeatureType,SimpleFeature>
type
- The attributes to modify.value
- The values to put in the attribute types.filter
- An OGC filter to note which attributes to modify.
IOException
- If modificaton is not supported, if the object type
do not match the attribute type.public void removeFeatures(Filter filter) throws IOException
This method operates by obtaining an updating feature writer based on the specified filter and removing every feature from it.
The filter must not be null
, in this case this method
will throw an IllegalArgumentException
.
removeFeatures
in interface FeatureStore<SimpleFeatureType,SimpleFeature>
filter
- An OpenGIS filter; specifies which features to remove.
IOException
- If anything goes wrong.public final void setFeatureLock(FeatureLock lock)
setFeatureLock
in interface FeatureLocking<SimpleFeatureType,SimpleFeature>
lock
- DOCUMENT ME!public final int lockFeatures() throws IOException
This method calls through to lockFeatures(Filter)
.
lockFeatures
in interface FeatureLocking<SimpleFeatureType,SimpleFeature>
IOException
public final int lockFeatures(Query query) throws IOException
This method calls through to lockFeatures(Filter)
.
lockFeatures
in interface FeatureLocking<SimpleFeatureType,SimpleFeature>
query
- Query describing the features to lock
IOException
- Thrown if anything goes wrongpublic final int lockFeatures(Filter filter) throws IOException
lockFeatures
in interface FeatureLocking<SimpleFeatureType,SimpleFeature>
filter
- Filter describing the features to lock
IOException
- Thrown if anything goes wrongpublic final void unLockFeatures() throws IOException
This method calls through to unLockFeatures(Filter)
.
unLockFeatures
in interface FeatureLocking<SimpleFeatureType,SimpleFeature>
IOException
public final void unLockFeatures(Query query) throws IOException
This method calls through to unLockFeatures(Filter)
.
unLockFeatures
in interface FeatureLocking<SimpleFeatureType,SimpleFeature>
query
- Specifies fatures to unlock
IOException
public final void unLockFeatures(Filter filter) throws IOException
unLockFeatures
in interface FeatureLocking<SimpleFeatureType,SimpleFeature>
IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |