| java.lang.Object org.geotools.data.postgis.VersionedPostgisDataStore
VersionedPostgisDataStore | public class VersionedPostgisDataStore implements VersioningDataStore(Code) | | Postgis datastore with versioning support. On the implementation level, this subclass basically
acts as a mapper between the base class, that sees the data structures as how they really are,
and the outside view, that hides versioning columns and extra versioning tables from feature
types.
Assumptions made by the data store:
- There is a primary key in tables that need to be turned into versioned ones
- Primary key columns are mapped in the FID mapper.
author: aaime since: 2.4 |
Method Summary | |
Filter | buildFidFilter(FilterFactory ff, Set ids) | Filter | buildVersionedFilter(String featureTypeName, Filter filter, RevisionInfo ri) | DefaultQuery | buildVersionedQuery(Query query) | protected synchronized void | checkVersioningDataStructures() | public void | createSchema(FeatureType featureType) | void | createVersionedFeatureCollectionView(String typeName) | public void | dispose() | protected void | execute(Statement st, String sql) | protected ResultSet | executeQuery(Statement st, String sql) | protected JDBCDataStoreConfig | getConfig() | public FIDMapper | getFIDMapper(String tableName) | public FeatureReader | getFeatureReader(Query query, Transaction trans) | public FeatureSource | getFeatureSource(String typeName) | public FeatureWriter | getFeatureWriter(String typeName, Transaction transaction) | public FeatureWriter | getFeatureWriter(String typeName, Filter filter, Transaction transaction) | public FeatureWriter | getFeatureWriterAppend(String typeName, Transaction transaction) | protected FeatureWriter | getFeatureWriterInternal(String typeName, Filter filter, Transaction transaction, boolean append) | public long | getLastRevision() | public LockingManager | getLockingManager() | public ModifiedFeatureIds | getModifiedFeatureFIDs(String typeName, String version1, String version2, Filter filter, String[] users, Transaction transaction) Returns a set of feature ids for features that where modified, created or deleted between
version1 and version2 and that matched the specified filter at least in one revision between
version1 and version2. | public String[] | getModifiedFeatureTypes(String version1, String version2) Returns a list of type names modified between version1 and
version2 , with the first version excluded. | Set | getRevisionsCreatedBy(String typeName, RevisionInfo r1, RevisionInfo r2, String[] users, Transaction transaction) | public FeatureType | getSchema(String typeName) | public String[] | getTypeNames() | public static String | getVFCTableName(String vfcTypeName) | public static String | getVFCViewName(String typeName) | public FeatureSource | getView(Query query) | public boolean | isVersioned(String typeName) | protected boolean | isVersioned(String typeName, Transaction transaction) Checks wheter a type name is versioned or not. | public boolean | isVersionedFeatureCollection(String typeName) | void | resetTypeInfo() | public void | setLooseBbox(boolean enabled) | public synchronized void | setVersioned(String typeName, boolean versioned, String author, String message) Alters the versioned state of a feature type
Parameters: typeName - the type name that must be changed Parameters: versioned - if true, the type gets version enabled, if false versioning is disabled Parameters: t - the transaction used to performe version enabling. | public void | setWKBEnabled(boolean enabled) | protected Filter | transformFidFilter(String featureTypeName, Filter filter) | public void | updateSchema(String typeName, FeatureType featureType) |
AUTHOR | final public static String AUTHOR(Code) | | Key used in transaction properties to hold the commit author
|
DIRTYTYPES | final public static String DIRTYTYPES(Code) | | Key used to store the feature types touched by the current transaction
|
LOGGER | final protected static Logger LOGGER(Code) | | The logger for the postgis module.
|
MESSAGE | final public static String MESSAGE(Code) | | Key used in transaction properties to hold the commit message
|
SUPPORTED_FID_MAPPERS | final static Class[] SUPPORTED_FID_MAPPERS(Code) | | |
TBL_CHANGESETS | final public static String TBL_CHANGESETS(Code) | | |
TBL_TABLESCHANGED | final public static String TBL_TABLESCHANGED(Code) | | |
TBL_VERSIONEDTABLES | final public static String TBL_VERSIONEDTABLES(Code) | | |
versionedMap | protected Map versionedMap(Code) | | Holds boolean markers used to determine wheter a table is versioned or not (caching to
increase speed since isVersioned() check is required in every other public API)
|
buildFidFilter | Filter buildFidFilter(FilterFactory ff, Set ids)(Code) | | Builds a filter from a set of feature ids, since there is no convenient way to build it using
the factory
Parameters: ff - Parameters: ids - |
buildVersionedFilter | Filter buildVersionedFilter(String featureTypeName, Filter filter, RevisionInfo ri) throws IOException(Code) | | Takes a filter and merges in the extra conditions needed to extract the specified revision
Parameters: filter - The original filter Parameters: ri - The revision information a new filter throws: FactoryConfigurationError - throws: IOException - |
checkVersioningDataStructures | protected synchronized void checkVersioningDataStructures() throws IOException(Code) | | Makes sure the required versioning data structures are available in the database
throws: IOException - |
createVersionedFeatureCollectionView | void createVersionedFeatureCollectionView(String typeName) throws IOException(Code) | | |
dispose | public void dispose()(Code) | | |
getLastRevision | public long getLastRevision() throws IOException(Code) | | Returns the last revision of the repository
|
getModifiedFeatureFIDs | public ModifiedFeatureIds getModifiedFeatureFIDs(String typeName, String version1, String version2, Filter filter, String[] users, Transaction transaction) throws IOException(Code) | | Returns a set of feature ids for features that where modified, created or deleted between
version1 and version2 and that matched the specified filter at least in one revision between
version1 and version2.
If called on an unversioned feature type, will return empty Sets.
The semantics is a little complex, so here is a more detailed explaination:
- A feature is said to have been modified between version1 and version2 if a new state of
it has been created after version1 and before or at version2 (included), or if it has been
deleted between version1 and version2 (included).
- Filter is used to match every state between version1 and version2, so all new states
after version1, but also the states existent at version1 provided they existed also at
version1 + 1.
- If at least one state matches the filter, the feature id is returned.
The result is composed of three sets of feature ids:
- A matched feature created after version1 is included in the created set
- A matched feature deleted before or at version2 is included in the deleted set
- A matched feature not included in the created/deleted sets is included in the modified
set
The following graph illustrates feature matching and set destination. Each line represents a
feature lifeline, with different symbols for filter matched states, unmatched states, state
creation, expiration, and lack of feature existance.
v1 v2
| |
f1 ======]..........................|........... Not returned
f2 ======][-------------------------|----------- Not returned
f3 ======|==].......................|........... Returned (deleted)
f4 ======|==][----------------------|---]....... Returned (modified)
f5 ......|.[=======]................|........... Returned (created/deleted)
f5 ......[=========]................|........... Returned (deleted)
f5 ......[-------------------][=====|====]...... Returned (modified)
f6 [-----|----][=============][-----|----------- Returned (modified)
Legend:
- -: unmatched state
- =: matched state
- .: no state (feature has ben deleted)
- [: creation of a state
- ]: expiration of a state
Parameters: version1 - -the first revision Parameters: version2 - -the second revision, or null if you want the diff between version1 and current Parameters: filter - a filter to limit the features that must be taken into consideration Parameters: users - an eventual list of user ids that can be used to further filter the features,only features touched by any of these users will be Parameters: transaction - throws: IOException - throws: IllegalAttributeException - throws: NoSuchElementException - |
getModifiedFeatureTypes | public String[] getModifiedFeatureTypes(String version1, String version2) throws IOException(Code) | | Returns a list of type names modified between version1 and
version2 , with the first version excluded.
Parameters: version1 - the first version Parameters: version2 - the second version, which may be null, if you need to refer the latest version an array or type names, eventually empty, never null |
getRevisionsCreatedBy | Set getRevisionsCreatedBy(String typeName, RevisionInfo r1, RevisionInfo r2, String[] users, Transaction transaction) throws IOException(Code) | | Gathers the revisions created by a certain group of users between two specified revisions
Parameters: r1 - the first revision Parameters: r2 - the second revision Parameters: users - an array of user |
getVFCTableName | public static String getVFCTableName(String vfcTypeName) throws IOException(Code) | | Given a versioned feature collection view name returns the base table name
Parameters: vfcTypeName - throws: IOException - |
getVFCViewName | public static String getVFCViewName(String typeName)(Code) | | Given a type name returns the name of the versioned feature collection view
associated to it
Parameters: typeName - |
isVersioned | public boolean isVersioned(String typeName) throws IOException(Code) | | Returns true if the specified feature type is versioned, false otherwise
Parameters: typeName - |
isVersioned | protected boolean isVersioned(String typeName, Transaction transaction) throws IOException(Code) | | Checks wheter a type name is versioned or not.
Parameters: typeName - the feature type to check Parameters: transaction - a transaction, or null if you don't have one (use null to avoid a new revisionbeing created for this operation) true if the type is versioned, false otherwise throws: IOException - |
resetTypeInfo | void resetTypeInfo() throws IOException(Code) | | Makes sure type infos and fid mappers are recomputed when table structures do change
throws: IOException - |
setVersioned | public synchronized void setVersioned(String typeName, boolean versioned, String author, String message) throws IOException(Code) | | Alters the versioned state of a feature type
Parameters: typeName - the type name that must be changed Parameters: versioned - if true, the type gets version enabled, if false versioning is disabled Parameters: t - the transaction used to performe version enabling. It shall contain user andcommit message as properties. throws: IOException - |
transformFidFilter | protected Filter transformFidFilter(String featureTypeName, Filter filter) throws IOException, FactoryConfigurationError(Code) | | Takes a fid filter with external fids and turns it into a set of filters against internal
feature type attributes, that is, an equivalent filter that can run against the internal,
versioned feature type
Parameters: featureTypeName - Parameters: filter - throws: IOException - throws: FactoryConfigurationError - |
|
|