|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.geotools.data.AbstractFeatureSource
org.geotools.data.AbstractFeatureStore
org.geotools.data.postgis.VersionedPostgisFeatureStore
public class VersionedPostgisFeatureStore
A cheap implementation of a feature locking.
Implementation wise, for all locking needs, tries to leverage the wrapped datastore feature locking. If an optimization is possible (mass updates come to mind), we try to use the feature locking, otherwiser we fall back on the implementation inherited from AbstractFeatureSource.
modifyFeatures(AttributeDescriptor[], Object[], Filter)
is an example of things that cannot be
optimized. Theoretically, one could mass expire current feature, but he should have first read
into memory all of them to rewrite them as new (which may not be possible).
Field Summary |
---|
Fields inherited from class org.geotools.data.AbstractFeatureStore |
---|
transaction |
Fields inherited from class org.geotools.data.AbstractFeatureSource |
---|
hints, queryCapabilities |
Constructor Summary | |
---|---|
VersionedPostgisFeatureStore(org.opengis.feature.simple.SimpleFeatureType schema,
VersionedPostgisDataStore store)
|
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()
Retrieve Bounds of all Features. |
ReferencedEnvelope |
getBounds(Query query)
Retrieve Bounds of Query results. |
int |
getCount(Query query)
Retrieve total number of Query results. |
DataStore |
getDataStore()
Overrides to explicitly type narrow the return type to DataStore |
FeatureDiffReaderImpl |
getDifferences(java.lang.String fromVersion,
java.lang.String toVersion,
org.opengis.filter.Filter filter,
java.lang.String[] userIds)
Returns a feature difference reader providing the changes occurred on filtered features between the two specified versions |
FeatureCollection<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature> |
getFeatures()
Retrieve all Features. |
FeatureCollection<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature> |
getFeatures(org.opengis.filter.Filter filter)
Retrieve all Feature matching the Filter. |
FeatureCollection<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature> |
getFeatures(Query query)
Provides an interface to for the Results of a Query. |
FeatureCollection<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature> |
getLog(java.lang.String fromVersion,
java.lang.String toVersion,
org.opengis.filter.Filter filter,
java.lang.String[] userIds,
int maxRows)
Returns a log of changes performed between fromVersion and toVersion against the features matched by the specified filter. |
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 |
getSupportedHints()
By default, no Hints are supported |
Transaction |
getTransaction()
Retrieve the Transaction this FeatureSource |
java.lang.String |
getVersion()
Returns the revision for the current transaction, or null if no transaction is set. |
FeatureCollection<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature> |
getVersionedFeatures()
Returns the same features as FeatureSource.getFeatures() but providing more
attributes, namely, revision, author and date of the version. |
FeatureCollection<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature> |
getVersionedFeatures(org.opengis.filter.Filter filter)
Returns the same features as FeatureSource.getFeatures(Filter) but providing more
attributes, namely, revision, author and date of the version. |
FeatureCollection<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature> |
getVersionedFeatures(Query query)
Returns the same features as FeatureSource.getFeatures(Query) but providing more
attributes, namely, revision, author and date of the version. |
void |
modifyFeatures(org.opengis.feature.type.AttributeDescriptor[] type,
java.lang.Object[] value,
org.opengis.filter.Filter filter)
Modifies features matching filter . |
void |
modifyFeatures(org.opengis.feature.type.AttributeDescriptor type,
java.lang.Object value,
org.opengis.filter.Filter filter)
Modifies features matching 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 features indicated by provided filter. |
void |
rollback(java.lang.String toVersion,
org.opengis.filter.Filter filter,
java.lang.String[] userIds)
Rolls back features matching the filter to the state they had on the specified version. |
void |
setFeatures(FeatureReader<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature> reader)
Replace with contents of reader. |
void |
setTransaction(Transaction transaction)
Provides a transaction for commit/rollback control of this FeatureStore. |
Methods inherited from class org.geotools.data.AbstractFeatureStore |
---|
addFeatures |
Methods inherited from class org.geotools.data.AbstractFeatureSource |
---|
getInfo, getName, namedQuery |
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 |
---|
getInfo, getName |
Constructor Detail |
---|
public VersionedPostgisFeatureStore(org.opengis.feature.simple.SimpleFeatureType schema, VersionedPostgisDataStore store) throws java.io.IOException
java.io.IOException
Method Detail |
---|
public Transaction getTransaction()
AbstractFeatureStore
getTransaction
in interface FeatureStore<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature>
getTransaction
in class AbstractFeatureStore
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>
setTransaction
in class AbstractFeatureStore
transaction
- DOCUMENT ME!public ReferencedEnvelope getBounds() throws java.io.IOException
AbstractFeatureSource
Currently returns null, consider getFeatures().getBounds() instead.
Subclasses may override this method to perform the appropriate optimization for this result.
getBounds
in interface FeatureSource<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature>
getBounds
in class AbstractFeatureSource
java.io.IOException
- DOCUMENT ME!public ReferencedEnvelope getBounds(Query query) throws java.io.IOException
AbstractFeatureSource
Currently returns null, consider getFeatures( query ).getBounds() instead.
Subclasses may override this method to perform the appropriate optimization for this result.
getBounds
in interface FeatureSource<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature>
getBounds
in class AbstractFeatureSource
query
- Query we are requesting the bounds of
java.io.IOException
- DOCUMENT ME!public int getCount(Query query) throws java.io.IOException
AbstractFeatureSource
Currently returns -1, consider getFeatures( query ).getCount() instead.
Subclasses may override this method to perform the appropriate optimization for this result.
getCount
in interface FeatureSource<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature>
getCount
in class AbstractFeatureSource
query
- Query we are requesting the count of
java.io.IOException
- if there are errors getting the countpublic DataStore getDataStore()
AbstractFeatureSource
DataStore
getDataStore
in interface FeatureSource<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature>
getDataStore
in class AbstractFeatureSource
public void addFeatureListener(FeatureListener listener)
FeatureSource
addFeatureListener
in interface FeatureSource<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature>
listener
- FeatureListenerpublic 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 void removeFeatureListener(FeatureListener listener)
FeatureSource
removeFeatureListener
in interface FeatureSource<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature>
listener
- FeatureListenerpublic void modifyFeatures(org.opengis.feature.type.AttributeDescriptor type, java.lang.Object value, org.opengis.filter.Filter filter) throws java.io.IOException
AbstractFeatureStore
filter
.
Equivelent to:
FeatureWriter writer = dataStore.getFeatureWriter( typeName, filter, transaction );
while( writer.hasNext() ){
feature = writer.next();
feature.setAttribute( type.getName(), value );
writer.write();
}
writer.close();
Subclasses may override this method to perform the appropriate optimization for this result.
modifyFeatures
in interface FeatureStore<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature>
modifyFeatures
in class AbstractFeatureStore
type
- Attribute to modifyvalue
- Modification being made to typefilter
- Identifies features to modify
java.io.IOException
- If modification could not be madepublic void modifyFeatures(org.opengis.feature.type.AttributeDescriptor[] type, java.lang.Object[] value, org.opengis.filter.Filter filter) throws java.io.IOException
AbstractFeatureStore
filter
.
Equivelent to:
FeatureWriter writer = dataStore.getFeatureWriter( typeName, filter, transaction );
Feature feature;
while( writer.hasNext() ){
feature = writer.next();
feature.setAttribute( type[0].getName(), value[0] );
feature.setAttribute( type[1].getName(), value[1] );
...
feature.setAttribute( type[N].getName(), value[N] );
writer.write();
}
writer.close();
Subclasses may override this method to perform the appropriate optimization for this result.
modifyFeatures
in interface FeatureStore<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature>
modifyFeatures
in class AbstractFeatureStore
type
- Attributes to modifyvalue
- Modifications being made to typefilter
- Identifies features to modify
java.io.IOException
- If we could not modify Feature
DataSourceException
- See IOExceptionpublic void removeFeatures(org.opengis.filter.Filter filter) throws java.io.IOException
AbstractFeatureStore
Equivelent to:
FeatureWriter writer = dataStore.getFeatureWriter( typeName, filter, transaction );
Feature feature;
while( writer.hasNext() ){
feature = writer.next();
writer.remove();
}
writer.close();
Subclasses may override this method to perform the appropriate optimization for this result.
removeFeatures
in interface FeatureStore<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature>
removeFeatures
in class AbstractFeatureStore
filter
- Identifies 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
AbstractFeatureStore
Equivelent to:
FeatureWriter writer = dataStore.getFeatureWriter( typeName, false, transaction );
Feature feature, newFeature;
while( writer.hasNext() ){
feature = writer.next();
writer.remove();
}
while( reader.hasNext() ){
newFeature = reader.next();
feature = writer.next();
newFeature.setAttributes( feature.getAttributes( null ) );
writer.write();
}
reader.close();
writer.close();
Subclasses may override this method to perform the appropriate optimization for this result.
setFeatures
in interface FeatureStore<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature>
setFeatures
in class AbstractFeatureStore
reader
- Contents to replace with
java.io.IOException
- if anything goes wrong during replacement
DataSourceException
- See IOExceptionpublic FeatureCollection<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature> getFeatures(Query query) throws java.io.IOException
AbstractFeatureSource
Various queries can be made against the results, the most basic being to retrieve Features.
getFeatures
in interface FeatureSource<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature>
getFeatures
in class AbstractFeatureSource
query
- a datasource query object. It encapsulates requested
information, such as typeName, maxFeatures and filter.
java.io.IOException
- For all data source errors.FeatureSource.getFeatures(org.geotools.data.Query)
public FeatureCollection<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature> getFeatures(org.opengis.filter.Filter filter) throws java.io.IOException
AbstractFeatureSource
getFeatures
in interface FeatureSource<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature>
getFeatures
in class AbstractFeatureSource
filter
- Indicates features to retrieve
java.io.IOException
- If results could not be obtainedpublic FeatureCollection<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature> getFeatures() throws java.io.IOException
AbstractFeatureSource
getFeatures
in interface FeatureSource<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature>
getFeatures
in class AbstractFeatureSource
java.io.IOException
- If features could not be obtainedpublic FeatureCollection<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature> getVersionedFeatures(Query query) throws java.io.IOException
VersioningFeatureSource
FeatureSource.getFeatures(Query)
but providing more
attributes, namely, revision, author and date of the version.
getVersionedFeatures
in interface VersioningFeatureSource
java.io.IOException
public FeatureCollection<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature> getVersionedFeatures(org.opengis.filter.Filter filter) throws java.io.IOException
VersioningFeatureSource
FeatureSource.getFeatures(Filter)
but providing more
attributes, namely, revision, author and date of the version.
getVersionedFeatures
in interface VersioningFeatureSource
java.io.IOException
public FeatureCollection<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature> getVersionedFeatures() throws java.io.IOException
VersioningFeatureSource
FeatureSource.getFeatures()
but providing more
attributes, namely, revision, author and date of the version.
getVersionedFeatures
in interface VersioningFeatureSource
java.io.IOException
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>
addFeatures
in class AbstractFeatureStore
collection
- The collection of features to add.
java.io.IOException
- if anything goes wrong.public java.lang.String getVersion() throws java.io.IOException
VersioningFeatureStore
UnsupportedOperationException
will be thrown
getVersion
in interface VersioningFeatureStore
java.io.IOException
public void rollback(java.lang.String toVersion, org.opengis.filter.Filter filter, java.lang.String[] userIds) throws java.io.IOException
VersioningFeatureStore
For a feature to be included into the rollback it's sufficient that one
of its states between toVersion
and current matches the
filter.
rollback
in interface VersioningFeatureStore
toVersion
- target of the rollbackfilter
- limits the feature whose history will be rolled back by an OGC
filteruserIds
- limits the feaeature whose history will be rolled back, by
catching only those that have been modified by at least one of
the specified users. May be null to avoi user filtering.
java.io.IOException
public FeatureCollection<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature> getLog(java.lang.String fromVersion, java.lang.String toVersion, org.opengis.filter.Filter filter, java.lang.String[] userIds, int maxRows) throws java.io.IOException
VersioningFeatureSource
This is equivalent to gathering the ids of features changed between the
two versions and matching the filter, getting a list of revision
involving those feaures between fromVersion and toVersion, and then query
VersionedPostgisDataStore.TBL_CHANGESETS
against these revision
numbers.
getLog
in interface VersioningFeatureSource
fromVersion
- the start revisiontoVersion
- the end revision, may be null to imply the latest onefilter
- will match features whose log will be reported *maxRows
- the maximum number of log rows returned from this call
java.io.IOException
public FeatureDiffReaderImpl getDifferences(java.lang.String fromVersion, java.lang.String toVersion, org.opengis.filter.Filter filter, java.lang.String[] userIds) throws java.io.IOException
VersioningFeatureSource
getDifferences
in interface VersioningFeatureSource
fromVersion
- the start versiontoVersion
- the end version, may be null to imply the latest onefilter
- matches features whose differences will be reported *
java.io.IOException
public java.util.Set getSupportedHints()
AbstractFeatureSource
getSupportedHints
in interface FeatureSource<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature>
getSupportedHints
in class AbstractFeatureSource
RenderingHints#Key
objects (eventually empty, never null).public QueryCapabilities getQueryCapabilities()
FeatureSource
getQueryCapabilities
in interface FeatureSource<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature>
getQueryCapabilities
in class AbstractFeatureSource
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |