|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.geotools.data.directory.DirectoryFeatureStore
public class DirectoryFeatureStore
Constructor Summary | |
---|---|
DirectoryFeatureStore(FeatureStore<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature> store,
DirectoryDataStore dataStore)
|
Method Summary | |
---|---|
void |
addFeatureListener(FeatureListener listener)
Adds a listener to the list that's notified each time a change to the FeatureStore occurs. |
java.util.List<org.opengis.filter.identity.FeatureId> |
addFeatures(FeatureCollection<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature> collection)
Adds all features from the passed feature collection to the datasource. |
ReferencedEnvelope |
getBounds()
Gets the bounding box of this datasource. |
ReferencedEnvelope |
getBounds(Query query)
Gets the bounding box of the features that would be returned by this query. |
int |
getCount(Query query)
Gets the number of the features that would be returned by this query. |
DataAccess<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature> |
getDataStore()
Access to the DataStore implementing this FeatureStore. |
FeatureCollection<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature> |
getFeatures()
Loads all features from the datasource into the return FeatureResults. |
FeatureCollection<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature> |
getFeatures(org.opengis.filter.Filter filter)
Loads features from the datasource into the returned FeatureResults, based on the passed filter. |
FeatureCollection<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature> |
getFeatures(Query query)
Loads features from the datasource into the returned FeatureResults, based on the passed query. |
ResourceInfo |
getInfo()
Information describing the contents of this resoruce. |
org.opengis.feature.type.Name |
getName()
Returns the qualified name for the Features this FeatureSource serves. |
QueryCapabilities |
getQueryCapabilities()
Returns and indication of what query capabilities this FeatureSource supports natively. |
org.opengis.feature.simple.SimpleFeatureType |
getSchema()
Retrieves the featureType that features extracted from this datasource will be created with. |
java.util.Set<java.awt.RenderingHints.Key> |
getSupportedHints()
Returns the set of hints this FeatureSource is able to support. |
Transaction |
getTransaction()
Used to access the Transaction this DataSource is currently opperating against. |
void |
modifyFeatures(org.opengis.feature.type.AttributeDescriptor[] type,
java.lang.Object[] value,
org.opengis.filter.Filter filter)
Modifies the passed attribute types with the passed objects in all features that correspond to the passed OGS filter. |
void |
modifyFeatures(org.opengis.feature.type.AttributeDescriptor type,
java.lang.Object value,
org.opengis.filter.Filter filter)
Modifies the passed attribute types with the passed objects in all features that correspond to the passed OGS filter. |
void |
removeFeatureListener(FeatureListener listener)
Removes a listener from the list that's notified each time a change to the FeatureStore occurs. |
void |
removeFeatures(org.opengis.filter.Filter filter)
Removes all of the features specificed by the passed filter from the collection. |
void |
setFeatures(FeatureReader<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature> reader)
Deletes the all the current Features of this datasource and adds the new collection. |
void |
setTransaction(Transaction transaction)
Provides a transaction for commit/rollback control of this FeatureStore. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.geotools.data.FeatureSource |
---|
addFeatureListener, getBounds, getBounds, getCount, getDataStore, getFeatures, getFeatures, getFeatures, getInfo, getName, getQueryCapabilities, getSchema, getSupportedHints |
Constructor Detail |
---|
public DirectoryFeatureStore(FeatureStore<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature> store, DirectoryDataStore dataStore)
Method Detail |
---|
public Transaction getTransaction()
FeatureStore
Example Use: adding features to a road DataSource
Transaction t = roads.getTransaction();
try{
roads.addFeatures( features );
roads.getTransaction().commit();
}
catch( IOException erp ){
//something went wrong;
roads.getTransaction().rollback();
}
getTransaction
in interface FeatureStore<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature>
Transaction.AUTO_COMMIT
public void modifyFeatures(org.opengis.feature.type.AttributeDescriptor type, java.lang.Object value, org.opengis.filter.Filter filter) throws java.io.IOException
FeatureStore
modifyFeatures
in interface FeatureStore<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.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.
java.io.IOException
- If modificaton is not supported, if the object type
do not match the attribute type.public void modifyFeatures(org.opengis.feature.type.AttributeDescriptor[] type, java.lang.Object[] value, org.opengis.filter.Filter filter) throws java.io.IOException
FeatureStore
modifyFeatures
in interface FeatureStore<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.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.
java.io.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 void removeFeatureListener(FeatureListener listener)
FeatureSource
removeFeatureListener
in interface FeatureSource<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature>
listener
- FeatureListenerpublic void removeFeatures(org.opengis.filter.Filter filter) throws java.io.IOException
FeatureStore
removeFeatures
in interface FeatureStore<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature>
filter
- An OpenGIS filter; specifies which features to remove.
java.io.IOException
- If anything goes wrong.public void setFeatures(FeatureReader<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature> reader) throws java.io.IOException
FeatureStore
setFeatures
in interface FeatureStore<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature>
reader
- - the collection to be written
java.io.IOException
- if there are any datasource errors.public void setTransaction(Transaction transaction)
FeatureStore
This method operates as a replacement for setAutoCommitMode. When a transaction is provided you are no longer automatically committing.
In order to return to AutoCommit mode supply the Transaction.AUTO_COMMIT to this method. Since this represents a return to AutoCommit mode the previous Transaction will be commited.
setTransaction
in interface FeatureStore<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature>
transaction
- DOCUMENT ME!public java.util.List<org.opengis.filter.identity.FeatureId> addFeatures(FeatureCollection<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature> collection) throws java.io.IOException
FeatureStore
A list of FeatureIds is returned; one for each Feature in the order created. Please note that these FeatureIds may not be assigned until after a commit has been performed.
addFeatures
in interface FeatureStore<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature>
collection
- The collection of features to add.
java.io.IOException
- if anything goes wrong.public void addFeatureListener(FeatureListener listener)
FeatureSource
addFeatureListener
in interface FeatureSource<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature>
listener
- FeatureListenerpublic ReferencedEnvelope getBounds() throws java.io.IOException
FeatureSource
With getBounds(Query) this becomes a convenience method for getBounds(Query.ALL), that is the bounds for all features contained here.
If getBounds() returns null
due to expense consider using
getFeatures().getBounds()
as a an alternative.
getBounds
in interface FeatureSource<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature>
java.io.IOException
- if there are errors getting the bounding box.public ReferencedEnvelope getBounds(Query query) throws java.io.IOException
FeatureSource
To retrieve the bounds of the DataSource please use getBounds(
Query.ALL )
.
This method is needed if we are to stream features to a gml out, since a
FeatureCollection
If getBounds(Query) returns null
due to expense consider
using getFeatures(Query).getBounds()
as a an alternative.
getBounds
in interface FeatureSource<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature>
query
- Contains the Filter, and optionally MaxFeatures and StartIndex to
find the bounds for.
java.io.IOException
- DOCUMENT ME!public int getCount(Query query) throws java.io.IOException
FeatureSource
If getBounds(Query) returns -1
due to expense consider
using getFeatures(Query).getCount()
as a an alternative.
This method should take into account the Query's maxFeatures
and startIndex
, if present, in order to
consistently return the number of features the query would return.
getCount
in interface FeatureSource<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature>
query
- Contains the Filter, and optionally MaxFeatures and StartIndex to
find the count for.
-1
if count is too expensive to calculate or any errors or occur.
java.io.IOException
- if there are errors getting the countpublic DataAccess<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature> getDataStore()
FeatureSource
getDataStore
in interface FeatureSource<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature>
public FeatureCollection<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature> getFeatures() throws java.io.IOException
FeatureSource
Filter.INCLUDE can also be used to get all features. Calling this function
is equivalent to using Query.ALL
getFeatures
in interface FeatureSource<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature>
java.io.IOException
- For all data source errors.public FeatureCollection<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature> getFeatures(org.opengis.filter.Filter filter) throws java.io.IOException
FeatureSource
getFeatures
in interface FeatureSource<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature>
filter
- An OpenGIS filter; specifies which features to retrieve.
null is not allowed, use Filter.INCLUDE instead.
java.io.IOException
- For all data source errors.public FeatureCollection<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature> getFeatures(Query query) throws java.io.IOException
FeatureSource
getFeatures
in interface FeatureSource<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature>
query
- a datasource query object. It encapsulates requested
information, such as typeName, maxFeatures and filter.
java.io.IOException
- For all data source errors.Query
public ResourceInfo getInfo()
FeatureSource
Please note that for FeatureContent:
getInfo
in interface FeatureSource<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature>
public org.opengis.feature.type.Name getName()
FeatureSource
Note this is different from getSchema().getType().getName()
(that
is, the feature type name), this name specifies the
AttributeDescriptor name
for the
Features served by this source. So,
FeatureSoruce.getName() == FeatureSource.getFeatures().next().getAttributeDescriptor().getName()
.
Though it's a common practice when dealing with SimpleFeatureType
and SimpleFeature
to assume they're equal. There's no conflict
(as per the dynamic typing system the org.opengis.feature
package
defines) in a Feature and its type sharing the same name, as well as in a
GML schema an element declaration and a type definition may be named the
same. Yet, the distinction becomes important as we get rid of that
assumption and thus allow to reuse a type definition for different
FeatureSoruces, decoupling the descriptor (homologous to the Feature
element declaration in a GML schema) from its type definition.
So, even if implementors are allowed to delegate to
getSchema().getName()
if they want to call the fatures and their
type the same, client code asking a
DataAccess.getFeatureSource(Name)
shall use this name to request
for a FeatureSource, rather than the type name, as used in pre 2.5
versions of GeoTools. For example, if we have a FeatureSource named
Roads
and its type is named Roads_Type
, the
DataAccess
shall be queried through Roads
, not
Roads_Type
.
getName
in interface FeatureSource<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature>
public QueryCapabilities getQueryCapabilities()
FeatureSource
getQueryCapabilities
in interface FeatureSource<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature>
public org.opengis.feature.simple.SimpleFeatureType getSchema()
FeatureSource
The schema returned is the LCD supported by all available Features. In the common case of shapfiles and database table this schema will match that of every feature available. In the degenerate GML case this will simply reflect the gml:AbstractFeatureType.
getSchema
in interface FeatureSource<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature>
public java.util.Set<java.awt.RenderingHints.Key> getSupportedHints()
FeatureSource
FeatureSource
is able to support.
Hints are to be specified in the Query
, for each data access where they
may be required.
Depending on the actual value provide by the user, the FeatureSource
may decide not to honor the hint.
getSupportedHints
in interface FeatureSource<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature>
RenderingHints#Key
objects (eventually empty, never null).
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |