|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.geotools.data.postgis.synch.SynchronizedPostgisDataStore
public class SynchronizedPostgisDataStore
This DataStore provides a wrapper for the VersionedPostgisDataStore
that hides the existence of the synchronizing metadata tables.
Field Summary |
---|
Fields inherited from interface org.geotools.data.VersioningDataStore |
---|
AUTHOR, MESSAGE |
Constructor Summary | |
---|---|
SynchronizedPostgisDataStore(javax.sql.DataSource dataSource)
|
|
SynchronizedPostgisDataStore(javax.sql.DataSource dataSource,
java.lang.String namespace)
|
|
SynchronizedPostgisDataStore(javax.sql.DataSource dataSource,
java.lang.String schema,
java.lang.String namespace)
|
|
SynchronizedPostgisDataStore(javax.sql.DataSource dataSource,
java.lang.String schema,
java.lang.String namespace,
int optimizeMode)
|
Method Summary | |
---|---|
void |
createSchema(org.opengis.feature.simple.SimpleFeatureType featureType)
Creates storage for a new featureType . |
void |
dispose()
Disposes of this data store and releases any resource that it is using. |
boolean |
equals(java.lang.Object obj)
|
java.sql.Connection |
getConnection(Transaction t)
|
FeatureReader<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature> |
getFeatureReader(Query query,
Transaction trans)
Access a FeatureReader providing access to Feature information. |
FeatureSource<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature> |
getFeatureSource(org.opengis.feature.type.Name typeName)
Access to the named resource. |
FeatureSource<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature> |
getFeatureSource(java.lang.String typeName)
Access a FeatureSource |
FeatureWriter<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature> |
getFeatureWriter(java.lang.String typeName,
org.opengis.filter.Filter filter,
Transaction transaction)
Access FeatureWriter for modification of existing DataStore contents. |
FeatureWriter<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature> |
getFeatureWriter(java.lang.String typeName,
Transaction transaction)
Access FeatureWriter for modification of the DataStore typeName. |
FeatureWriter<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature> |
getFeatureWriterAppend(java.lang.String typeName,
Transaction transaction)
Aquire a FeatureWriter for adding new content to a FeatureType. |
FIDMapper |
getFIDMapper(java.lang.String tableName)
|
ServiceInfo |
getInfo()
Information about this service. |
long |
getLastRevision()
|
LockingManager |
getLockingManager()
Retrieve a per featureID based locking service from this DataStore. |
ModifiedFeatureIds |
getModifiedFeatureFIDs(java.lang.String typeName,
java.lang.String version1,
java.lang.String version2,
org.opengis.filter.Filter originalFilter,
java.lang.String[] users,
Transaction transaction)
|
java.lang.String[] |
getModifiedFeatureTypes(java.lang.String version1,
java.lang.String version2)
|
java.util.List<org.opengis.feature.type.Name> |
getNames()
This is stolen verbatim from VersionedPostgisDataStore |
org.opengis.feature.simple.SimpleFeatureType |
getSchema(org.opengis.feature.type.Name name)
We're intercepting malicious requests for our metadata tables and failing, but delegating all other requests. |
org.opengis.feature.simple.SimpleFeatureType |
getSchema(java.lang.String typeName)
Intercept all requests for our metadata tables and fail. |
java.lang.String[] |
getTypeNames()
Retrieves a list of all available featuretypes. |
FeatureSource<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature> |
getView(Query query)
Access a FeatureSource |
int |
hashCode()
|
boolean |
isVersioned(java.lang.String typeName)
Returns true if the specified feature type is versioned, false otherwise |
boolean |
isVersionedFeatureCollection(java.lang.String typeName)
|
void |
setLooseBbox(boolean enabled)
|
void |
setVersioned(java.lang.String typeName,
boolean versioned,
java.lang.String author,
java.lang.String message)
Alters the versioned state of a feature type |
void |
setWKBEnabled(boolean enabled)
|
java.lang.String |
toString()
|
void |
updateSchema(org.opengis.feature.type.Name typeName,
org.opengis.feature.simple.SimpleFeatureType featureType)
Used to update a schema in place. |
void |
updateSchema(java.lang.String typeName,
org.opengis.feature.simple.SimpleFeatureType featureType)
Used to force namespace and CS info into a persistent change. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public SynchronizedPostgisDataStore(javax.sql.DataSource dataSource, java.lang.String schema, java.lang.String namespace, int optimizeMode) throws java.io.IOException
java.io.IOException
public SynchronizedPostgisDataStore(javax.sql.DataSource dataSource, java.lang.String schema, java.lang.String namespace) throws java.io.IOException
java.io.IOException
public SynchronizedPostgisDataStore(javax.sql.DataSource dataSource, java.lang.String namespace) throws java.io.IOException
java.io.IOException
public SynchronizedPostgisDataStore(javax.sql.DataSource dataSource) throws java.io.IOException
java.io.IOException
Method Detail |
---|
public void createSchema(org.opengis.feature.simple.SimpleFeatureType featureType) throws java.io.IOException
DataAccess
featureType
.
The provided featureType
we be accessable by the typeName
provided by featureType.getTypeName().
createSchema
in interface DataAccess<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature>
featureType
-
java.io.IOException
VersionedPostgisDataStore.createSchema(org.opengis.feature.simple.SimpleFeatureType)
public void dispose()
DataAccess
A DataStore
cannot be used after dispose
has
been called, neither can any data access object it helped create, such
as FeatureReader
, FeatureSource
or FeatureCollection
.
This operation can be called more than once without side effects.
There is no thread safety assurance associated with this method. For example, client code will have to make sure this method is not called while retrieving/saving data from/to the storage, or be prepared for the consequences.
dispose
in interface DataAccess<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature>
VersionedPostgisDataStore.dispose()
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
obj
-
Object.equals(java.lang.Object)
public java.sql.Connection getConnection(Transaction t) throws java.io.IOException
t
-
java.io.IOException
VersionedPostgisDataStore.getConnection(org.geotools.data.Transaction)
public FeatureReader<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature> getFeatureReader(Query query, Transaction trans) throws java.io.IOException
DataStore
Filter is used as a low-level indication of constraints. (Implementations may resort to using a FilteredFeatureReader, or provide their own optimizations)
FeatureType provides a template for the returned FeatureReader
Transaction to externalize DataStore state on a per Transaction basis. The most common example is a JDBC datastore saving a Connection for use across several FeatureReader requests. Similarly a Shapefile reader may wish to redirect FeatureReader requests to a alternate filename over the course of a Transaction.
Notes For Implementing DataStore
Subclasses may need to retrieve additional attributes, beyond those
requested by featureType.getAttributeTypes(), in order to correctly
apply the filter
.
These Additional attribtues should be not be returned by
FeatureReader. Subclasses may use ReTypeFeatureReader to aid in
acomplishing this.
Helper classes for implementing a FeatureReader (in order):
Sample use (not optimized):
if (filter == Filter.EXCLUDE) {
return new EmptyFeatureReader(featureType);
}
String typeName = featureType.getTypeName();
FeatureType schema = getSchema( typeName );
FeatureReader reader = new DefaultFeatureReader( getAttributeReaders(), schema );
if (filter != Filter.INCLUDE) {
reader = new FilteringFeatureReader(reader, filter);
}
if (transaction != Transaction.AUTO_COMMIT) {
Map diff = state(transaction).diff(typeName);
reader = new DiffFeatureReader(reader, diff);
}
if (!featureType.equals(reader.getFeatureType())) {
reader = new ReTypeFeatureReader(reader, featureType);
}
return reader
Locking support does not need to be provided for FeatureReaders.
getFeatureReader
in interface DataStore
query
- trans
-
java.io.IOException
VersionedPostgisDataStore.getFeatureReader(org.geotools.data.Query, org.geotools.data.Transaction)
public FeatureSource<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature> getFeatureSource(org.opengis.feature.type.Name typeName) throws java.io.IOException
DataAccess
The level of access is represented by the instance of the FeatureSource being returned.
Formally:
getFeatureSource
in interface DataAccess<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature>
typeName
-
java.io.IOException
VersionedPostgisDataStore.getFeatureSource(org.opengis.feature.type.Name)
public FeatureSource<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature> getFeatureSource(java.lang.String typeName) throws java.io.IOException
DataStore
The resulting FeatureSource
FeatureSource fsource = dataStore.getFeatureSource( "roads" );
FeatureStore fstore = null;
if( fsource instanceof FeatureLocking ){
fstore = (FeatureStore) fs;
}
else {
System.out.println("We do not have write access to roads");
}
getFeatureSource
in interface DataStore
typeName
-
java.io.IOException
VersionedPostgisDataStore.getFeatureSource(java.lang.String)
public FeatureWriter<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature> getFeatureWriter(java.lang.String typeName, org.opengis.filter.Filter filter, Transaction transaction) throws java.io.IOException
DataStore
To limit FeatureWriter to the FeatureTypes defined by this DataStore, typeName is used to indicate FeatureType. The resulting feature writer will allow modifications against the same FeatureType provided by getSchema( typeName )
The FeatureWriter will provide access to the existing contents of the FeatureType referenced by typeName. The provided filter will be used to skip over Features as required.
Notes For Implementing DataStore
The returned FeatureWriter does not support the addition of new
Features to FeatureType (it would need to police your modifications to
agree with filer
). As such it will return
false
for getNext() when it reaches the end of the Query
and NoSuchElementException when next() is called.
Helper classes for implementing a FeatureWriter (in order):
getFeatureWriter
in interface DataStore
typeName
- filter
- transaction
-
java.io.IOException
VersionedPostgisDataStore.getFeatureWriter(java.lang.String, org.opengis.filter.Filter, org.geotools.data.Transaction)
public FeatureWriter<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature> getFeatureWriter(java.lang.String typeName, Transaction transaction) throws java.io.IOException
DataStore
FeatureWriters will need to be limited to the FeatureTypes defined by the DataStore, the easiest way to express this limitation is to the FeatureType by a provided typeName.
The returned FeatureWriter will return false
for getNext()
when it reaches the end of the Query.
getFeatureWriter
in interface DataStore
typeName
- transaction
-
java.io.IOException
VersionedPostgisDataStore.getFeatureWriter(java.lang.String, org.geotools.data.Transaction)
public FeatureWriter<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature> getFeatureWriterAppend(java.lang.String typeName, Transaction transaction) throws java.io.IOException
DataStore
This FeatureWriter will return false
for hasNext(), however
next() may be used to aquire new Features that may be writen out to add
new content.
getFeatureWriterAppend
in interface DataStore
typeName
- transaction
-
java.io.IOException
VersionedPostgisDataStore.getFeatureWriterAppend(java.lang.String, org.geotools.data.Transaction)
public FIDMapper getFIDMapper(java.lang.String tableName) throws java.io.IOException
tableName
-
java.io.IOException
VersionedPostgisDataStore.getFIDMapper(java.lang.String)
public ServiceInfo getInfo()
DataAccess
This method offers access to a summary of header or metadata information describing the service.
Subclasses may return a specific ServiceInfo instance that has additional information (such as FilterCapabilities).
getInfo
in interface DataAccess<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature>
VersionedPostgisDataStore.getInfo()
public long getLastRevision() throws java.io.IOException
java.io.IOException
VersionedPostgisDataStore.getLastRevision()
public LockingManager getLockingManager()
DataStore
It is common to return an instanceof InProcessLockingManager for DataStores that do not provide native locking.
AbstractFeatureLocking makes use of this service to provide locking
support. You are not limitied by this implementation and may simply
return null
for this value.
getLockingManager
in interface DataStore
VersionedPostgisDataStore.getLockingManager()
public ModifiedFeatureIds getModifiedFeatureFIDs(java.lang.String typeName, java.lang.String version1, java.lang.String version2, org.opengis.filter.Filter originalFilter, java.lang.String[] users, Transaction transaction) throws java.io.IOException
typeName
- version1
- version2
- originalFilter
- users
- transaction
-
java.io.IOException
VersionedPostgisDataStore.getModifiedFeatureFIDs(java.lang.String, java.lang.String, java.lang.String, org.opengis.filter.Filter, java.lang.String[], org.geotools.data.Transaction)
public java.lang.String[] getModifiedFeatureTypes(java.lang.String version1, java.lang.String version2) throws java.io.IOException
version1
- version2
-
java.io.IOException
VersionedPostgisDataStore.getModifiedFeatureTypes(java.lang.String, java.lang.String)
public java.util.List<org.opengis.feature.type.Name> getNames() throws java.io.IOException
VersionedPostgisDataStore
getNames
in interface DataAccess<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature>
java.io.IOException
VersionedPostgisDataStore.getNames()
public org.opengis.feature.simple.SimpleFeatureType getSchema(org.opengis.feature.type.Name name) throws java.io.IOException
getSchema
in interface DataAccess<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature>
name
-
java.io.IOException
VersionedPostgisDataStore.getSchema(org.opengis.feature.type.Name)
public org.opengis.feature.simple.SimpleFeatureType getSchema(java.lang.String typeName) throws java.io.IOException
getSchema
in interface DataStore
typeName
-
java.io.IOException
VersionedPostgisDataStore.getSchema(java.lang.String)
public java.lang.String[] getTypeNames() throws java.io.IOException
getTypeNames
in interface DataStore
java.io.IOException
VersionedPostgisDataStore.getTypeNames()
public FeatureSource<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature> getView(Query query) throws java.io.IOException, SchemaException
DataStore
The provided Query does not need to completely cover the existing
schema for Query.getTypeName(). The result will mostly likely only be
a FeatureSource
By using Query we allow support for reprojection, in addition to overriding the CoordinateSystem used by the native FeatureType.
We may wish to limit this method to only support Queries using Filter.EXCLUDE.
Update - GeoServer has an elegatent implementation of this functionality that we could steal. GeoServerFeatureSource, GeoServerFeatureStore and GeoServerFeatureLocking serve as a working prototype.
getView
in interface DataStore
query
-
java.io.IOException
SchemaException
VersionedPostgisDataStore.getView(org.geotools.data.Query)
public int hashCode()
hashCode
in class java.lang.Object
Object.hashCode()
public boolean isVersioned(java.lang.String typeName) throws java.io.IOException
VersioningDataStore
isVersioned
in interface VersioningDataStore
typeName
-
java.io.IOException
VersionedPostgisDataStore.isVersioned(java.lang.String)
public boolean isVersionedFeatureCollection(java.lang.String typeName) throws java.io.IOException
typeName
-
java.io.IOException
VersionedPostgisDataStore.isVersionedFeatureCollection(java.lang.String)
public void setLooseBbox(boolean enabled)
enabled
- VersionedPostgisDataStore.setLooseBbox(boolean)
public void setVersioned(java.lang.String typeName, boolean versioned, java.lang.String author, java.lang.String message) throws java.io.IOException
VersioningDataStore
setVersioned
in interface VersioningDataStore
typeName
- versioned
- author
- message
-
java.io.IOException
VersionedPostgisDataStore.setVersioned(java.lang.String, boolean, java.lang.String, java.lang.String)
public void setWKBEnabled(boolean enabled)
enabled
- VersionedPostgisDataStore.setWKBEnabled(boolean)
public java.lang.String toString()
toString
in class java.lang.Object
Object.toString()
public void updateSchema(org.opengis.feature.type.Name typeName, org.opengis.feature.simple.SimpleFeatureType featureType) throws java.io.IOException
DataAccess
This functionality is similar to an "alter table" statement in SQL. Implementation is optional; it may not be supported by all servers or files.
updateSchema
in interface DataAccess<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature>
typeName
- featureType
-
java.io.IOException
VersionedPostgisDataStore.updateSchema(org.opengis.feature.type.Name, org.opengis.feature.simple.SimpleFeatureType)
public void updateSchema(java.lang.String typeName, org.opengis.feature.simple.SimpleFeatureType featureType) throws java.io.IOException
DataStore
The provided featureType should completely cover the existing schema. All attributes should be accounted for and the typeName should match.
Suggestions:
updateSchema
in interface DataStore
typeName
- featureType
-
java.io.IOException
VersionedPostgisDataStore.updateSchema(java.lang.String, org.opengis.feature.simple.SimpleFeatureType)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |