|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
ObjectAbstractFeatureSource
AbstractFeatureStore
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 AbstractFeatureStore |
|---|
transaction |
| Fields inherited from class AbstractFeatureSource |
|---|
hints, queryCapabilities |
| Constructor Summary | |
|---|---|
VersionedPostgisFeatureStore(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. |
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 |
FeatureDiffReader |
getDifferences(String fromVersion,
String toVersion,
Filter filter,
String[] userIds)
Returns a feature difference reader providing the changes occurred on filtered features between the two specified versions |
FeatureCollection<SimpleFeatureType,SimpleFeature> |
getFeatures()
Retrieve all Features. |
FeatureCollection<SimpleFeatureType,SimpleFeature> |
getFeatures(Filter filter)
Retrieve all Feature matching the Filter. |
FeatureCollection<SimpleFeatureType,SimpleFeature> |
getFeatures(Query query)
Provides an interface to for the Results of a Query. |
FeatureCollection<SimpleFeatureType,SimpleFeature> |
getLog(String fromVersion,
String toVersion,
Filter filter,
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. |
SimpleFeatureType |
getSchema()
Retrieves the featureType that features extracted from this datasource will be created with. |
Set |
getSupportedHints()
By default, no Hints are supported |
Transaction |
getTransaction()
Retrieve the Transaction this FeatureSource |
FeatureCollection<SimpleFeatureType,SimpleFeature> |
getVersionedFeatures()
Returns the same features as FeatureSource.getFeatures() but providing more
attributes, namely, revision, author and date of the version. |
FeatureCollection<SimpleFeatureType,SimpleFeature> |
getVersionedFeatures(Filter filter)
Returns the same features as FeatureSource.getFeatures(Filter) but providing more
attributes, namely, revision, author and date of the version. |
FeatureCollection<SimpleFeatureType,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(AttributeDescriptor[] type,
Object[] value,
Filter filter)
Modifies features matching filter. |
void |
modifyFeatures(AttributeDescriptor type,
Object value,
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(Filter filter)
Removes features indicated by provided filter. |
void |
rollback(String toVersion,
Filter filter,
String[] userIds)
Rolls back features matching the filter to the state they had on the specified version. |
void |
setFeatures(FeatureReader<SimpleFeatureType,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 AbstractFeatureStore |
|---|
addFeatures, addFeatures |
| Methods inherited from class AbstractFeatureSource |
|---|
getInfo, getName, namedQuery |
| Methods inherited from class Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface FeatureStore |
|---|
addFeatures |
| Methods inherited from interface FeatureSource |
|---|
getInfo, getName |
| Constructor Detail |
|---|
public VersionedPostgisFeatureStore(SimpleFeatureType schema,
VersionedPostgisDataStore store)
throws IOException
IOException| Method Detail |
|---|
public Transaction getTransaction()
AbstractFeatureStore
getTransaction in interface FeatureStore<SimpleFeatureType,SimpleFeature>getTransaction in class AbstractFeatureStorepublic void setTransaction(Transaction transaction)
FeatureStoreThis 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<SimpleFeatureType,SimpleFeature>setTransaction in class AbstractFeatureStoretransaction - DOCUMENT ME!
public ReferencedEnvelope getBounds()
throws IOException
AbstractFeatureSourceCurrently returns null, consider getFeatures().getBounds() instead.
Subclasses may override this method to perform the appropriate optimization for this result.
getBounds in interface FeatureSource<SimpleFeatureType,SimpleFeature>getBounds in class AbstractFeatureSourceIOException - DOCUMENT ME!
public ReferencedEnvelope getBounds(Query query)
throws IOException
AbstractFeatureSourceCurrently returns null, consider getFeatures( query ).getBounds() instead.
Subclasses may override this method to perform the appropriate optimization for this result.
getBounds in interface FeatureSource<SimpleFeatureType,SimpleFeature>getBounds in class AbstractFeatureSourcequery - Query we are requesting the bounds of
IOException - DOCUMENT ME!
public int getCount(Query query)
throws IOException
AbstractFeatureSourceCurrently returns -1, consider getFeatures( query ).getCount() instead.
Subclasses may override this method to perform the appropriate optimization for this result.
getCount in interface FeatureSource<SimpleFeatureType,SimpleFeature>getCount in class AbstractFeatureSourcequery - Query we are requesting the count of
IOException - if there are errors getting the countpublic DataStore getDataStore()
AbstractFeatureSourceDataStore
getDataStore in interface FeatureSource<SimpleFeatureType,SimpleFeature>getDataStore in class AbstractFeatureSourcepublic void addFeatureListener(FeatureListener listener)
FeatureSource
addFeatureListener in interface FeatureSource<SimpleFeatureType,SimpleFeature>listener - FeatureListenerpublic SimpleFeatureType getSchema()
FeatureSourceThe 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<SimpleFeatureType,SimpleFeature>public void removeFeatureListener(FeatureListener listener)
FeatureSource
removeFeatureListener in interface FeatureSource<SimpleFeatureType,SimpleFeature>listener - FeatureListener
public void modifyFeatures(AttributeDescriptor type,
Object value,
Filter filter)
throws IOException
AbstractFeatureStorefilter.
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<SimpleFeatureType,SimpleFeature>modifyFeatures in class AbstractFeatureStoretype - Attribute to modifyvalue - Modification being made to typefilter - Identifies features to modify
IOException - If modification could not be made
public void modifyFeatures(AttributeDescriptor[] type,
Object[] value,
Filter filter)
throws IOException
AbstractFeatureStorefilter.
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<SimpleFeatureType,SimpleFeature>modifyFeatures in class AbstractFeatureStoretype - Attributes to modifyvalue - Modifications being made to typefilter - Identifies features to modify
IOException - If we could not modify Feature
DataSourceException - See IOException
public void removeFeatures(Filter filter)
throws IOException
AbstractFeatureStoreEquivelent 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<SimpleFeatureType,SimpleFeature>removeFeatures in class AbstractFeatureStorefilter - Identifies features to remove
IOException - If anything goes wrong.
public void setFeatures(FeatureReader<SimpleFeatureType,SimpleFeature> reader)
throws IOException
AbstractFeatureStoreEquivelent 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<SimpleFeatureType,SimpleFeature>setFeatures in class AbstractFeatureStorereader - Contents to replace with
IOException - if anything goes wrong during replacement
DataSourceException - See IOException
public FeatureCollection<SimpleFeatureType,SimpleFeature> getFeatures(Query query)
throws IOException
AbstractFeatureSourceVarious queries can be made against the results, the most basic being to retrieve Features.
getFeatures in interface FeatureSource<SimpleFeatureType,SimpleFeature>getFeatures in class AbstractFeatureSourcequery - a datasource query object. It encapsulates requested
information, such as typeName, maxFeatures and filter.
IOException - For all data source errors.FeatureSource.getFeatures(org.geotools.data.Query)
public FeatureCollection<SimpleFeatureType,SimpleFeature> getFeatures(Filter filter)
throws IOException
AbstractFeatureSource
getFeatures in interface FeatureSource<SimpleFeatureType,SimpleFeature>getFeatures in class AbstractFeatureSourcefilter - Indicates features to retrieve
IOException - If results could not be obtained
public FeatureCollection<SimpleFeatureType,SimpleFeature> getFeatures()
throws IOException
AbstractFeatureSource
getFeatures in interface FeatureSource<SimpleFeatureType,SimpleFeature>getFeatures in class AbstractFeatureSourceIOException - If features could not be obtained
public FeatureCollection<SimpleFeatureType,SimpleFeature> getVersionedFeatures(Query query)
throws IOException
VersioningFeatureSourceFeatureSource.getFeatures(Query) but providing more
attributes, namely, revision, author and date of the version.
getVersionedFeatures in interface VersioningFeatureSourceIOException
public FeatureCollection<SimpleFeatureType,SimpleFeature> getVersionedFeatures(Filter filter)
throws IOException
VersioningFeatureSourceFeatureSource.getFeatures(Filter) but providing more
attributes, namely, revision, author and date of the version.
getVersionedFeatures in interface VersioningFeatureSourceIOException
public FeatureCollection<SimpleFeatureType,SimpleFeature> getVersionedFeatures()
throws IOException
VersioningFeatureSourceFeatureSource.getFeatures() but providing more
attributes, namely, revision, author and date of the version.
getVersionedFeatures in interface VersioningFeatureSourceIOException
public void rollback(String toVersion,
Filter filter,
String[] userIds)
throws 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 VersioningFeatureStoretoVersion - 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.
IOException
public FeatureCollection<SimpleFeatureType,SimpleFeature> getLog(String fromVersion,
String toVersion,
Filter filter,
String[] userIds,
int maxRows)
throws 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 VersioningFeatureSourcefromVersion - 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
IOException
public FeatureDiffReader getDifferences(String fromVersion,
String toVersion,
Filter filter,
String[] userIds)
throws IOException
VersioningFeatureSource
getDifferences in interface VersioningFeatureSourcefromVersion - the start versiontoVersion - the end version, may be null to imply the latest onefilter - matches features whose differences will be reported *
IOExceptionpublic Set getSupportedHints()
AbstractFeatureSource
getSupportedHints in interface FeatureSource<SimpleFeatureType,SimpleFeature>getSupportedHints in class AbstractFeatureSourceRenderingHints#Key objects (eventually empty, never null).public QueryCapabilities getQueryCapabilities()
FeatureSource
getQueryCapabilities in interface FeatureSource<SimpleFeatureType,SimpleFeature>getQueryCapabilities in class AbstractFeatureSource
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||