|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.geotools.data.jdbc.JDBC1DataStore org.geotools.data.jdbc.JDBC2DataStore org.geotools.data.jdbc.JDBCDataStore org.geotools.data.postgis.PostgisDataStore
Postgis DataStore implementation.
This datastore by default will read/write geometries in WKT format.
Optionally use of WKB can be turned on, in which case you may want to turn
on also the use of the bytea function, that fasten the data trasfer, but
that it's available only from version 0.7.2 onwards.
Field Summary | |
protected boolean |
byteaEnabled
If true, the bytea function will be used to optimize even further data loading when using WKB format |
protected boolean |
byteaWKB
postgis 1.0 changed the way WKB is handled, this needs to be set if version >1. |
protected static com.vividsolutions.jts.geom.GeometryFactory |
geometryFactory
Factory for producing geometries (from JTS). |
protected static com.vividsolutions.jts.io.WKTReader |
geometryReader
Well Known Text reader (from JTS). |
protected static java.util.logging.Logger |
LOGGER
The logger for the postgis module. |
protected boolean |
looseBbox
If true then the bounding box filters will use the && postgis operator, which uses the spatial index and performs against the envelope of the geom, leading to greater speed and slightly less accuracy. |
int |
OPTIMIZE_MODE
Current optimize mode |
static int |
OPTIMIZE_SAFE
OPTIMIZE constants |
static int |
OPTIMIZE_SQL
|
protected boolean |
useGeos
Enables the use of geos operators |
protected boolean |
WKBEnabled
If true, WKB format is used instead of WKT |
Fields inherited from class org.geotools.data.jdbc.JDBC2DataStore |
connectionPool |
Fields inherited from class org.geotools.data.jdbc.JDBC1DataStore |
allowWriteOnVolatileFIDs, config, listenerManager, sqlNameEscape, TYPE_MAPPINGS, typeHandler |
Constructor Summary | |
protected |
PostgisDataStore(ConnectionPool connPool)
|
|
PostgisDataStore(ConnectionPool connectionPool,
JDBCDataStoreConfig config,
int optimizeMode)
|
protected |
PostgisDataStore(ConnectionPool connPool,
java.lang.String namespace)
|
protected |
PostgisDataStore(ConnectionPool connPool,
java.lang.String schema,
java.lang.String namespace)
|
protected |
PostgisDataStore(ConnectionPool connPool,
java.lang.String schema,
java.lang.String namespace,
int optimizeMode)
|
Method Summary | |
protected boolean |
allowTable(java.lang.String tablename)
Provides a hook for sub classes to filter out specific tables in the data store that are not to be used as geospatial tables. |
protected java.lang.String[] |
attributeNames(FeatureType featureType,
Filter filter)
Gets the list of attribute names required for both featureType and filter |
protected AttributeType |
buildAttributeType(java.sql.ResultSet metadataRs)
Constructs an AttributeType from a row in a ResultSet. |
protected FIDMapperFactory |
buildFIDMapperFactory(JDBCDataStoreConfig config)
|
protected FeatureType |
buildSchema(java.lang.String typeName,
FIDMapper mapper)
Override this method to perform a few permission checks before the super class has a chance to do its thing. |
PostgisFeatureLocking |
createFeatureLockingInternal(PostgisDataStore ds,
FeatureType type)
|
protected JDBCFeatureWriter |
createFeatureWriter(FeatureReader fReader,
QueryData queryData)
DOCUMENT ME! |
protected LockingManager |
createLockingManager()
Allows subclass to create LockingManager to support their needs. |
void |
createSchema(FeatureType featureType)
Creates storage for a new featureType .
|
protected int |
determineSRID(java.lang.String tableName,
java.lang.String geometryColumnName)
DOCUMENT ME! |
protected int |
getConcurrency(boolean forWrite)
|
com.vividsolutions.jts.geom.Envelope |
getEnvelope(java.lang.String typeName)
Retrieve approx bounds of all Features. |
FeatureReader |
getFeatureReader(FeatureType requestType,
Filter filter,
Transaction transaction)
This is a public entry point to the DataStore. |
FeatureSource |
getFeatureSource(java.lang.String typeName)
Default implementation based on getFeatureReader and getFeatureWriter. |
FeatureWriter |
getFeatureWriter(java.lang.String typeName,
Transaction transaction)
Retrieve a FeatureWriter over entire dataset. |
FeatureWriter |
getFeatureWriterAppend(java.lang.String typeName,
Transaction transaction)
Retrieve a FeatureWriter for creating new content. |
protected AttributeIO |
getGeometryAttributeIO(AttributeType type,
QueryData queryData)
Hook to create the geometry attribute IO for a vendor specific data source. |
protected int |
getResultSetType(boolean forWrite)
|
SQLBuilder |
getSqlBuilder(java.lang.String typeName)
DOCUMENT ME! |
java.lang.String[] |
getTypeNames()
Retrieves a list of of the available FeatureTypes. |
protected void |
guessDataStoreOptions()
Attempts to figure out some optimization options, based on some postgis metadata. |
boolean |
isByteaEnabled()
Returns true if the data store is using the bytea function to fasten WKB data transfer, false otherwise |
boolean |
isByteaWKB()
|
boolean |
isLooseBbox()
Whether the bounding boxes issued against this postgis datastore are on the envelope of the geometry or the actual geometry. |
boolean |
isWKBEnabled()
Returns true if the WKB format is used to transfer geometries, false otherwise |
protected static java.lang.String |
schema(java.lang.String schema)
Simple helper method to ensure that a schema is always set. |
void |
setByteaEnabled(boolean byteaEnabled)
Enables the use of bytea function for WKB data transfer (will improve performance). |
void |
setByteaWKB(boolean byteaWKB)
|
void |
setLooseBbox(boolean isLooseBbox)
Sets this postgis instance to use a less strict but faster bounding box query. |
void |
setWKBEnabled(boolean enabled)
If turned on, WKB will be used to transfer geometry data instead of WKT |
void |
updateSchema(java.lang.String typeName,
FeatureType featureType)
Used to force namespace and CS info into a persistent change. |
Methods inherited from class org.geotools.data.jdbc.JDBC2DataStore |
createConnection |
Methods inherited from class org.geotools.data.jdbc.JDBC1DataStore |
allSameOrder, createFeatureReader, determineFidColumnName, executeQuery, getAttributeIO, getAttributeTypes, getConnection, getFeatureReader, getFeatureTypeHandler, getFeatureWriter, getFIDMapper, getFIDMapperFactory, getJDBCFeatureReader, getLockingManager, getNameSpace, getSchema, getSqlNameEscape, getView, setAutoCommit, setFIDMapper, setFIDMapperFactory, setSqlNameEscape |
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.DataStore |
getFeatureReader, getFeatureWriter, getLockingManager, getSchema, getView |
Field Detail |
protected static final java.util.logging.Logger LOGGER
protected static com.vividsolutions.jts.geom.GeometryFactory geometryFactory
protected static com.vividsolutions.jts.io.WKTReader geometryReader
public static final int OPTIMIZE_SAFE
public static final int OPTIMIZE_SQL
protected boolean useGeos
public final int OPTIMIZE_MODE
protected boolean WKBEnabled
protected boolean byteaEnabled
protected boolean byteaWKB
protected boolean looseBbox
Constructor Detail |
protected PostgisDataStore(ConnectionPool connPool) throws java.io.IOException
protected PostgisDataStore(ConnectionPool connPool, java.lang.String namespace) throws java.io.IOException
protected PostgisDataStore(ConnectionPool connPool, java.lang.String schema, java.lang.String namespace) throws java.io.IOException
protected PostgisDataStore(ConnectionPool connPool, java.lang.String schema, java.lang.String namespace, int optimizeMode) throws java.io.IOException
public PostgisDataStore(ConnectionPool connectionPool, JDBCDataStoreConfig config, int optimizeMode) throws java.io.IOException
Method Detail |
protected static java.lang.String schema(java.lang.String schema)
protected LockingManager createLockingManager()
createLockingManager
in class JDBC1DataStore
protected void guessDataStoreOptions() throws java.io.IOException
java.io.IOException
- DOCUMENT ME!
DataSourceException
- DOCUMENT ME!public java.lang.String[] getTypeNames() throws java.io.IOException
DataStore
This is simply a list of the FeatureType names as aquiring the actual FeatureType schemas may be expensive.
Warning: this list may not be unique - the types may be in separate namespaces.
If you need to worry about such things please consider the use of the Catalog and CatalogEntry interface - many DataStores support this. getTypeNames is really a convience method for a Catalog.iterator() where the name of each entry is returned.
getTypeNames
in interface DataStore
getTypeNames
in class JDBC1DataStore
java.io.IOException
org.geotools.data.DataStore#getFeatureTypes()
public com.vividsolutions.jts.geom.Envelope getEnvelope(java.lang.String typeName)
This result is suitable for a quick map display, illustrating the data. This value is often stored as metadata in databases such as oraclespatial.
getEnvelope
in class JDBC1DataStore
protected boolean allowTable(java.lang.String tablename)
JDBC1DataStore
allowTable
in class JDBC1DataStore
tablename
- A table name to check.
protected FeatureType buildSchema(java.lang.String typeName, FIDMapper mapper) throws java.io.IOException
buildSchema
in class JDBC1DataStore
typeName
- The name of the table to construct a feature type for.mapper
- The name of the column holding the fid.
java.io.IOException
JDBC1DataStore.buildAttributeType(ResultSet)
public FeatureReader getFeatureReader(FeatureType requestType, Filter filter, Transaction transaction) throws java.io.IOException
We have given some though to changing this api to be based on query.
Currently the is is the only way to retype your features to different name spaces.
(non-Javadoc)
getFeatureReader
in class JDBC1DataStore
java.io.IOException
org.geotools.data.DataStore#getFeatureReader(org.geotools.feature.FeatureType,
org.geotools.filter.Filter, org.geotools.data.Transaction)
protected java.lang.String[] attributeNames(FeatureType featureType, Filter filter) throws java.io.IOException
attributeNames
in class JDBC1DataStore
featureType
- The FeatureType to get attribute names for.filter
- The filter which needs attributes to filter.
java.io.IOException
- If we can't get the schema.public SQLBuilder getSqlBuilder(java.lang.String typeName) throws java.io.IOException
getSqlBuilder
in class JDBC1DataStore
typeName
-
java.io.IOException
- DOCUMENT ME!protected int determineSRID(java.lang.String tableName, java.lang.String geometryColumnName) throws java.io.IOException
determineSRID
in class JDBC1DataStore
tableName
- geometryColumnName
-
java.io.IOException
- DOCUMENT ME!
DataSourceException
- DOCUMENT ME!protected AttributeType buildAttributeType(java.sql.ResultSet metadataRs) throws java.io.IOException
This implementation construct an AttributeType using the default JDBC type mappings defined in JDBCDataStore. These type mappings only handle native Java classes and SQL standard column types. If a geometry type is found then getGeometryAttribute is called.
Note: Overriding methods must never move the current row pointer in the result set.
buildAttributeType
in class JDBC1DataStore
metadataRs
- The ResultSet containing the result of a
DatabaseMetaData.getColumns call.
java.io.IOException
- If an error occurs processing the ResultSet.protected FIDMapperFactory buildFIDMapperFactory(JDBCDataStoreConfig config)
buildFIDMapperFactory
in class JDBC1DataStore
JDBC1DataStore.buildFIDMapperFactory(org.geotools.data.jdbc.JDBCDataStoreConfig)
public void createSchema(FeatureType featureType) throws java.io.IOException
DataStore
featureType
.
The provided featureType
we be accessable by the typeName
provided by featureType.getTypeName().
createSchema
in interface DataStore
createSchema
in class JDBC1DataStore
featureType
-
java.io.IOException
DataStore.createSchema(org.geotools.feature.FeatureType)
public void updateSchema(java.lang.String typeName, FeatureType 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
updateSchema
in class JDBC1DataStore
java.io.IOException
DataStore.updateSchema(java.lang.String,
org.geotools.feature.FeatureType)
public FeatureSource getFeatureSource(java.lang.String typeName) throws java.io.IOException
We should be able to optimize this to only get the RowSet once
getFeatureSource
in interface DataStore
getFeatureSource
in class JDBC1DataStore
java.io.IOException
DataStore.getFeatureSource(java.lang.String)
public PostgisFeatureLocking createFeatureLockingInternal(PostgisDataStore ds, FeatureType type) throws java.io.IOException
java.io.IOException
protected JDBCFeatureWriter createFeatureWriter(FeatureReader fReader, QueryData queryData) throws java.io.IOException
createFeatureWriter
in class JDBC1DataStore
fReader
- queryData
-
java.io.IOException
- DOCUMENT ME!public FeatureWriter getFeatureWriter(java.lang.String typeName, Transaction transaction) throws java.io.IOException
Quick notes: This FeatureWriter is often used to add new content, or perform summary calculations over the entire dataset.
Subclass may wish to implement an optimized featureWriter for these operations.
It should provide Feature for next() even when hasNext() is
false
.
Subclasses are responsible for checking with the lockingManger unless they are providing their own locking support.
getFeatureWriter
in interface DataStore
getFeatureWriter
in class JDBC1DataStore
typeName
- transaction
-
java.io.IOException
org.geotools.data.DataStore#getFeatureWriter(java.lang.String,
boolean, org.geotools.data.Transaction)
public FeatureWriter getFeatureWriterAppend(java.lang.String typeName, Transaction transaction) throws java.io.IOException
Subclass may wish to implement an optimized featureWriter for this operation. One based on prepared statements is a possibility, as we do not require a ResultSet.
To allow new content the FeatureWriter should provide Feature for next()
even when hasNext() is false
.
Subclasses are responsible for checking with the lockingManger unless they are providing their own locking support.
getFeatureWriterAppend
in interface DataStore
getFeatureWriterAppend
in class JDBC1DataStore
typeName
- transaction
-
java.io.IOException
org.geotools.data.DataStore#getFeatureWriter(java.lang.String,
boolean, org.geotools.data.Transaction)
protected AttributeIO getGeometryAttributeIO(AttributeType type, QueryData queryData)
JDBC1DataStore
getGeometryAttributeIO
in class JDBC1DataStore
type
- The AttributeType to read.queryData
- The connection holder
org.geotools.data.jdbc.JDBCDataStore#getGeometryAttributeIO(org.geotools.feature.AttributeType)
protected int getResultSetType(boolean forWrite)
getResultSetType
in class JDBC1DataStore
protected int getConcurrency(boolean forWrite)
getConcurrency
in class JDBC1DataStore
public boolean isWKBEnabled()
public void setWKBEnabled(boolean enabled)
enabled
- public void setLooseBbox(boolean isLooseBbox)
isLooseBbox
- true if this should have a loose Bbox.public boolean isLooseBbox()
public boolean isByteaEnabled()
public void setByteaWKB(boolean byteaWKB)
public boolean isByteaWKB()
public void setByteaEnabled(boolean byteaEnabled)
byteaEnabled
-
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |