org.geotools.data.jdbc
Class JDBC1DataStore

Object
  extended by JDBC1DataStore
All Implemented Interfaces:
DataAccess<SimpleFeatureType,SimpleFeature>, DataStore
Direct Known Subclasses:
JDBC2DataStore

Deprecated. scheduled for removal in 2.7, use classes in org.geotools.jdbc

public abstract class JDBC1DataStore
extends Object
implements DataStore

Abstract class for JDBC based DataStore implementations.

This class provides a default implementation of a JDBC data store. Support for vendor specific JDBC data stores can be easily added to Geotools by subclassing this class and overriding the hooks provided.

At a minimum subclasses should implement the following methods:

Additionally subclasses can optionally override the following:

Additionally subclasses may want to set the value of:

Author:
Amr Alam, Refractions Research, Sean Geoghegan, Defence Science and Technology Organisation, Chris Holmes, TOPP, Andrea Aime
Module:
modules/library/jdbc (gt-jdbc.jar)

Field Summary
protected  boolean allowWriteOnVolatileFIDs
          Deprecated. When true, writes are allowed also on tables with volatile FID mappers.
protected  JDBCDataStoreConfig config
          Deprecated.  
 FeatureListenerManager listenerManager
          Deprecated. Manages listener lists for FeatureSource implementations
protected static Logger LOGGER
          Deprecated. The logger for the filter module.
protected  String sqlNameEscape
          Deprecated. The character(s) to surround schema, table and column names an SQL query to support mixed-case and non-English names
protected  int transactionIsolation
          Deprecated. The transaction isolation level to use in a transaction.
static Map TYPE_MAPPINGS
          Deprecated. Maps SQL types to Java classes.
protected  FeatureTypeHandler typeHandler
          Deprecated.  
 
Constructor Summary
JDBC1DataStore(JDBCDataStoreConfig config)
          Deprecated. Construct a JDBCDataStore with ConnectionPool and associated configuration.
 
Method Summary
protected  boolean allowTable(String tablename)
          Deprecated. Provides a hook for sub classes to filter out specific tables in the data store that are not to be used as geospatial tables.
 boolean allSameOrder(String[] requestedNames, SimpleFeatureType ft)
          Deprecated. returns true if the requested names list all the attributes in the correct order.
protected  String[] attributeNames(SimpleFeatureType featureType, Filter filter)
          Deprecated. Gets the list of attribute names required for both featureType and filter
protected  AttributeDescriptor buildAttributeType(ResultSet rs)
          Deprecated. Constructs an AttributeDescriptor from a row in a ResultSet.
protected  FIDMapper buildFIDMapper(String typeName, FIDMapperFactory factory)
          Deprecated. Builds the appropriate FID mapper given a table name and a FID mapper factory
protected  FIDMapperFactory buildFIDMapperFactory(JDBCDataStoreConfig config)
          Deprecated.  
protected  SimpleFeatureType buildSchema(String typeName, FIDMapper mapper)
          Deprecated. Builds the schema for a table in the database.
protected abstract  Connection createConnection()
          Deprecated. Create a connection for your JDBC1 database
protected  FeatureReader<SimpleFeatureType,SimpleFeature> createFeatureReader(SimpleFeatureType schema, Filter postFilter, QueryData queryData)
          Deprecated. Create a new FeatureReader based on attributeReaders.
protected  JDBCFeatureWriter createFeatureWriter(FeatureReader<SimpleFeatureType,SimpleFeature> reader, QueryData queryData)
          Deprecated.  
protected  LockingManager createLockingManager()
          Deprecated. Allows subclass to create LockingManager to support their needs.
 void createSchema(SimpleFeatureType featureType)
          Deprecated. Create a new featureType.
protected  String determineFidColumnName(String typeName)
          Deprecated. Provides the default implementation of determining the FID column.
protected  int determineSRID(String tableName, String geometryColumnName)
          Deprecated. Provides a hook for subclasses to determine the SRID of a geometry column.
protected  QueryData executeQuery(FeatureTypeInfo featureTypeInfo, String tableName, String sqlQuery, Transaction transaction, boolean forWrite)
          Deprecated. See the full version with hints support
protected  QueryData executeQuery(FeatureTypeInfo featureTypeInfo, String tableName, String sqlQuery, Transaction transaction, boolean forWrite, Hints hints)
          Deprecated. Executes the SQL Query.
protected  AttributeIO getAttributeIO(AttributeDescriptor type)
          Deprecated. Returns the basic AttributeIO that can read and write all of the simple data types
protected  AttributeDescriptor[] getAttributeTypes(String typeName, String[] propertyNames, Hints hints)
          Deprecated. Gets the attribute types from from a given type.
protected  int getConcurrency(boolean forWrite)
          Deprecated.  
 Connection getConnection(Transaction transaction)
          Deprecated. Gets a connection for the provided transaction.
 String getDatabaseSchemaName()
          Deprecated. Returns the database schema used by this JDBC datastore
 Envelope getEnvelope(String typeName)
          Deprecated. Retrieve approx bounds of all Features.
 FeatureReader<SimpleFeatureType,SimpleFeature> getFeatureReader(Query query, Transaction trans)
          Deprecated. The top level method for getting a FeatureReader.
 FeatureReader<SimpleFeatureType,SimpleFeature> getFeatureReader(SimpleFeatureType requestType, Filter filter, Transaction transaction)
          Deprecated. This is a public entry point to the DataStore.
 FeatureSource<SimpleFeatureType,SimpleFeature> getFeatureSource(Name typeName)
          Deprecated. Delegates to getFeatureSource(String) with name.getLocalPart()
 FeatureSource<SimpleFeatureType,SimpleFeature> getFeatureSource(String typeName)
          Deprecated. Default implementation based on getFeatureReader and getFeatureWriter.
protected  FeatureTypeHandler getFeatureTypeHandler(JDBCDataStoreConfig config)
          Deprecated. DOCUMENT ME!
 FeatureWriter<SimpleFeatureType,SimpleFeature> getFeatureWriter(String typeName, Filter filter, Transaction transaction)
          Deprecated. Acquire FeatureWriter for modification of contents specifed by filter.
 FeatureWriter<SimpleFeatureType,SimpleFeature> getFeatureWriter(String typeName, Transaction transaction)
          Deprecated. Retrieve a FeatureWriter over entire dataset.
 FeatureWriter<SimpleFeatureType,SimpleFeature> getFeatureWriterAppend(String typeName, Transaction transaction)
          Deprecated. Retrieve a FeatureWriter for creating new content.
 FIDMapper getFIDMapper(String tableName)
          Deprecated.  
 FIDMapperFactory getFIDMapperFactory()
          Deprecated. Returns the FIDMapperFactory used for this data store
protected abstract  AttributeIO getGeometryAttributeIO(AttributeDescriptor type, QueryData queryData)
          Deprecated. Hook to create the geometry attribute IO for a vendor specific data source.
 ServiceInfo getInfo()
          Deprecated. Information about this service.
protected  JDBCFeatureReader getJDBCFeatureReader(QueryData queryData)
          Deprecated.  
 LockingManager getLockingManager()
          Deprecated. Locking manager used for this DataStore.
 List<Name> getNames()
          Deprecated. Returns the same list of names than getTypeNames() meaning the returned Names have no namespace set.
 URI getNameSpace()
          Deprecated. Gets the namespace of the data store.
protected  int getResultSetType(boolean forWrite)
          Deprecated.  
 SimpleFeatureType getSchema(Name name)
          Deprecated. Delegates to getSchema(String) with name.getLocalPart()
 SimpleFeatureType getSchema(String typeName)
          Deprecated. Retrieve FeatureType metadata by typeName.
 SQLBuilder getSqlBuilder(String typeName)
          Deprecated. Hook for subclass to return a different sql builder.
 String getSqlNameEscape()
          Deprecated. Gets the SQL name escape string.
 Set getSupportedHints()
          Deprecated.  
 int getTransactionIsolation()
          Deprecated. Obtain the transaction isolation level for connections.
 String[] getTypeNames()
          Deprecated. Retrieves a list of of the available FeatureTypes.
 FeatureSource<SimpleFeatureType,SimpleFeature> getView(Query query)
          Deprecated. Access a FeatureSource for Query providing a high-level API.
protected  String[] propertyNames(Query query)
          Deprecated. Get propertyNames in a safe manner.
protected  boolean requireAutoCommit()
          Deprecated. Return true if transaction is handled on client.
protected  void setAutoCommit(boolean forWrite, Connection conn)
          Deprecated. This method should be overridden to do nothing by DataStores where setting autoCommit causes funky behaviour (ie. anytime autoCommit is changed, every thing up to that point is committed...this isn't good at this stage)
 void setFIDMapper(String featureTypeName, FIDMapper fidMapper)
          Deprecated. Sets the FIDMapper for a specific type name
 void setFIDMapperFactory(FIDMapperFactory fmFactory)
          Deprecated. Allows to override the default FIDMapperFactory.
protected  void setSqlNameEscape(String sqlNameEscape)
          Deprecated. Sets the SQL name escape string.
 void setTransactionIsolation(int value)
          Deprecated. Sets the transaction isolation level for connections.
 void updateSchema(Name typeName, SimpleFeatureType featureType)
          Deprecated. Delegates to updateSchema(String, SimpleFeatureType) with name.getLocalPart()
 void updateSchema(String typeName, SimpleFeatureType featureType)
          Deprecated. Used to provide support for changing the DataStore Schema.
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface DataAccess
dispose
 

Field Detail

LOGGER

protected static final Logger LOGGER
Deprecated. 
The logger for the filter module.


TYPE_MAPPINGS

public static final Map TYPE_MAPPINGS
Deprecated. 
Maps SQL types to Java classes. This might need to be fleshed out more later, Ive ignored complex types such as ARRAY, BLOB and CLOB. It is protected so subclasses can override it I guess.

These mappings were taken from http://java.sun.com/j2se/1.3/docs/guide/jdbc/getstart/mapping.html#997737


listenerManager

public FeatureListenerManager listenerManager
Deprecated. 
Manages listener lists for FeatureSource implementations


config

protected final JDBCDataStoreConfig config
Deprecated. 

typeHandler

protected FeatureTypeHandler typeHandler
Deprecated. 

sqlNameEscape

protected String sqlNameEscape
Deprecated. 
The character(s) to surround schema, table and column names an SQL query to support mixed-case and non-English names


allowWriteOnVolatileFIDs

protected boolean allowWriteOnVolatileFIDs
Deprecated. 
When true, writes are allowed also on tables with volatile FID mappers. False by default

See Also:
FIDMapper.isVolatile()

transactionIsolation

protected int transactionIsolation
Deprecated. 
The transaction isolation level to use in a transaction. One of Connection.TRANSACTION_READ_UNCOMMITTED, TRANSACTION_READ_COMMITTED, TRANSACTION_REPEATABLE_READ, or SERIALIZABLE. Connection.TRANSACTION_NONE may also be used to indicate "use default".

Constructor Detail

JDBC1DataStore

public JDBC1DataStore(JDBCDataStoreConfig config)
               throws IOException
Deprecated. 
Construct a JDBCDataStore with ConnectionPool and associated configuration.

Parameters:
config -
Throws:
IOException
Method Detail

getSqlNameEscape

public String getSqlNameEscape()
Deprecated. 
Gets the SQL name escape string.

The value of this string is prefixed and appended to table schema names, table names and column names in an SQL statement to support mixed-case and non-English names.

Returns:
the value of the SQL name escape string.

setSqlNameEscape

protected void setSqlNameEscape(String sqlNameEscape)
Deprecated. 
Sets the SQL name escape string.

The value of this string is prefixed and appended to table schema names, table names and column names in an SQL statement to support mixed-case and non-English names.

This value is typically only set once when the DataStore implementation class is constructed.

Parameters:
sqlNameEscape - the name escape character

getFeatureTypeHandler

protected FeatureTypeHandler getFeatureTypeHandler(JDBCDataStoreConfig config)
                                            throws IOException
Deprecated. 
DOCUMENT ME!

Parameters:
config -
Returns:
DOCUMENT ME!
Throws:
IOException - DOCUMENT ME!

buildFIDMapperFactory

protected FIDMapperFactory buildFIDMapperFactory(JDBCDataStoreConfig config)
Deprecated. 

getFIDMapper

public FIDMapper getFIDMapper(String tableName)
                       throws IOException
Deprecated. 
Throws:
IOException

createLockingManager

protected LockingManager createLockingManager()
Deprecated. 
Allows subclass to create LockingManager to support their needs.


getInfo

public ServiceInfo getInfo()
Deprecated. 
Description copied from interface: DataAccess
Information about this service.

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).

Specified by:
getInfo in interface DataAccess<SimpleFeatureType,SimpleFeature>
Returns:
SeviceInfo

getTypeNames

public String[] getTypeNames()
                      throws IOException
Deprecated. 
Description copied from interface: DataStore
Retrieves a list of of the available FeatureTypes.

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.

Specified by:
getTypeNames in interface DataStore
Returns:
typeNames for available FeatureTypes.
Throws:
IOException
See Also:
org.geotools.data.DataStore#getFeatureTypes()

getSchema

public SimpleFeatureType getSchema(String typeName)
                            throws IOException
Deprecated. 
Description copied from interface: DataStore
Retrieve FeatureType metadata by typeName.

Retrieves the Schema information as a FeatureType object.

Specified by:
getSchema in interface DataStore
Parameters:
typeName - typeName of requested FeatureType
Returns:
FeatureType for the provided typeName
Throws:
IOException - If typeName cannot be found
See Also:
DataStore.getSchema(java.lang.String)

createSchema

public void createSchema(SimpleFeatureType featureType)
                  throws IOException
Deprecated. 
Create a new featureType.

Not currently supported - subclass may implement.

Specified by:
createSchema in interface DataAccess<SimpleFeatureType,SimpleFeature>
Parameters:
featureType -
Throws:
IOException
UnsupportedOperationException - Creating new schemas is not supported.
See Also:
org.geotools.data.DataStore#createSchema(org.geotools.feature.FeatureType)

updateSchema

public void updateSchema(String typeName,
                         SimpleFeatureType featureType)
                  throws IOException
Deprecated. 
Used to provide support for changing the DataStore Schema.

Specifically this is intended to address updating the metadata Coordinate System information.

If we can figure out the Catalog API for metadata we will not have to use such a heavy handed approach.

Subclasses are free to implement various levels of support:

Specified by:
updateSchema in interface DataStore
Throws:
IOException
See Also:
org.geotools.data.DataStore#updateSchema(java.lang.String, org.geotools.feature.FeatureType)

getView

public FeatureSource<SimpleFeatureType,SimpleFeature> getView(Query query)
                                                       throws IOException,
                                                              SchemaException
Deprecated. 
Description copied from interface: DataStore
Access a FeatureSource for Query providing a high-level API.

The provided Query does not need to completely cover the existing schema for Query.getTypeName(). The result will mostly likely only be a FeatureSource and probably wont' allow write access by the FeatureStore method.

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.

Specified by:
getView in interface DataStore
Parameters:
query - Query.getTypeName() locates FeatureType being viewed
Returns:
FeatureSource providing operations for featureType
Throws:
IOException - If FeatureSource is not available
SchemaException - If fetureType is not covered by existing schema

getFeatureSource

public FeatureSource<SimpleFeatureType,SimpleFeature> getFeatureSource(String typeName)
                                                                throws IOException
Deprecated. 
Default implementation based on getFeatureReader and getFeatureWriter.

We should be able to optimize this to only get the RowSet once

Specified by:
getFeatureSource in interface DataStore
Returns:
FeatureSource (or subclass) providing operations for typeName
Throws:
IOException
See Also:
DataStore.getFeatureSource(java.lang.String)

getFeatureReader

public FeatureReader<SimpleFeatureType,SimpleFeature> getFeatureReader(SimpleFeatureType requestType,
                                                                       Filter filter,
                                                                       Transaction transaction)
                                                                throws IOException
Deprecated. 
This is a public entry point to the DataStore.

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)

Throws:
IOException

attributeNames

protected String[] attributeNames(SimpleFeatureType featureType,
                                  Filter filter)
                           throws IOException
Deprecated. 
Gets the list of attribute names required for both featureType and filter

Parameters:
featureType - The FeatureType to get attribute names for.
filter - The filter which needs attributes to filter.
Returns:
The list of attribute names required by a filter.
Throws:
IOException - If we can't get the schema.

getFeatureReader

public FeatureReader<SimpleFeatureType,SimpleFeature> getFeatureReader(Query query,
                                                                       Transaction trans)
                                                                throws IOException
Deprecated. 
The top level method for getting a FeatureReader.

Chris- I've gone with the Query object aswell. It just seems to make more sense. This is pretty well split up across methods. The hooks for DB specific AttributeReaders are createResultSetReader and createGeometryReader.

JG- I have implemented getFeatureReader( FeatureType, Filter, Transasction) ontop of this method, it will Retype as required

Specified by:
getFeatureReader in interface DataStore
Parameters:
query - The Query to get a FeatureReader for.
trans - The transaction this read operation is being performed in.
Returns:
A FeatureReader that contains features defined by the query.
Throws:
IOException - If an error occurs executing the query.
DataSourceException

createFeatureReader

protected FeatureReader<SimpleFeatureType,SimpleFeature> createFeatureReader(SimpleFeatureType schema,
                                                                             Filter postFilter,
                                                                             QueryData queryData)
                                                                      throws IOException
Deprecated. 
Create a new FeatureReader based on attributeReaders.

The provided schema describes the attributes in the queryData ResultSet. This schema should cover the requirements of filter.

Retyping to the users requested Schema will not happen in this method.

Parameters:
schema -
postFilter - Filter for post processing, or null if not required.
queryData - Holds a ResultSet for attribute Readers
Throws:
IOException

getJDBCFeatureReader

protected JDBCFeatureReader getJDBCFeatureReader(QueryData queryData)
                                          throws IOException
Deprecated. 
Throws:
IOException

getAttributeIO

protected AttributeIO getAttributeIO(AttributeDescriptor type)
Deprecated. 
Returns the basic AttributeIO that can read and write all of the simple data types

Parameters:
type -

getGeometryAttributeIO

protected abstract AttributeIO getGeometryAttributeIO(AttributeDescriptor type,
                                                      QueryData queryData)
                                               throws IOException
Deprecated. 
Hook to create the geometry attribute IO for a vendor specific data source.

Parameters:
type - The AttributeDescriptor to read.
queryData - The connection holder
Returns:
The AttributeIO that will read and write the geometry from the results.
Throws:
IOException - DOCUMENT ME!

executeQuery

protected QueryData executeQuery(FeatureTypeInfo featureTypeInfo,
                                 String tableName,
                                 String sqlQuery,
                                 Transaction transaction,
                                 boolean forWrite)
                          throws IOException
Deprecated. 
See the full version with hints support

Parameters:
featureTypeInfo -
tableName -
sqlQuery -
transaction -
forWrite -
Returns:
Throws:
IOException

executeQuery

protected QueryData executeQuery(FeatureTypeInfo featureTypeInfo,
                                 String tableName,
                                 String sqlQuery,
                                 Transaction transaction,
                                 boolean forWrite,
                                 Hints hints)
                          throws IOException
Deprecated. 
Executes the SQL Query.

This is private in the expectation that subclasses should not need to change this behaviour.

Jody with a question here - I have stopped this method from closing connection shared by a Transaction. It sill seems like we are leaving connections open by using this method. I have also stopped QueryData from doing the same thing.

Answer from Sean: Resources for successful queries are closed when close is called on the AttributeReaders constructed with the QueryData. We can't close them here since they need to be open to read from the ResultSet.

Jody AttributeReader question: I looked at the code and Attribute Readers do not close with respect to Transactions (they need to as we can issue a Reader against a Transaction. I have changed the JDBCDataStore.close method to force us to keep track of these things.

SG: I've marked this as final since I don't think it shoudl be overriden, but Im not sure

Parameters:
featureTypeInfo -
tableName -
sqlQuery - The SQL query to execute.
transaction - The Transaction is included here for handling transaction connections at a later stage. It is not currently used.
forWrite -
hints - the Query hints
Returns:
The QueryData object that contains the resources for the query.
Throws:
IOException
DataSourceException - If an error occurs performing the query.
TODO:
HACK: This is just protected for postgis FeatureWriter purposes. Should move back to private when that stuff moves more abstract here.

setAutoCommit

protected void setAutoCommit(boolean forWrite,
                             Connection conn)
                      throws SQLException
Deprecated. 
This method should be overridden to do nothing by DataStores where setting autoCommit causes funky behaviour (ie. anytime autoCommit is changed, every thing up to that point is committed...this isn't good at this stage)

Parameters:
forWrite -
conn -
Throws:
SQLException

getResultSetType

protected int getResultSetType(boolean forWrite)
Deprecated. 

getConcurrency

protected int getConcurrency(boolean forWrite)
Deprecated. 

getSqlBuilder

public SQLBuilder getSqlBuilder(String typeName)
                         throws IOException
Deprecated. 
Hook for subclass to return a different sql builder.

Subclasses requiring a ClientTransactionAccessor should override and instantiate an SQLBuilder with one in the constructor.

Parameters:
typeName - The typename for the sql builder.
Returns:
A new sql builder.
Throws:
IOException - if anything goes wrong.

getConnection

public Connection getConnection(Transaction transaction)
                         throws IOException
Deprecated. 
Gets a connection for the provided transaction.

Parameters:
transaction -
Returns:
A single use connection.
Throws:
IOException
DataSourceException - If the connection can not be obtained.

getTransactionIsolation

public int getTransactionIsolation()
Deprecated. 
Obtain the transaction isolation level for connections.

Returns:
Connection.TRANSACTION_* value
Since:
2.2.0
See Also:
setTransactionIsolation, This web page

setTransactionIsolation

public void setTransactionIsolation(int value)
Deprecated. 
Sets the transaction isolation level for connections.

Parameters:
value - Connection.TRANSACTION_READ_UNCOMMITTED, Connection.TRANSACTION_READ_COMMITTED, Connection.TRANSACTION_REPEATABLE_READ, Connection.SERIALIZABLE, or Connection.TRANSACTION_NONE (for use default/do not set)
Since:
2.2.0
See Also:
This web page

requireAutoCommit

protected boolean requireAutoCommit()
Deprecated. 
Return true if transaction is handled on client. Usually this will not have to be overridden.

Returns:
true if transaction is handled on client. Usually this will not have to be overridden.

createConnection

protected abstract Connection createConnection()
                                        throws SQLException
Deprecated. 
Create a connection for your JDBC1 database

Throws:
SQLException

allowTable

protected boolean allowTable(String tablename)
Deprecated. 
Provides a hook for sub classes to filter out specific tables in the data store that are not to be used as geospatial tables. The default implementation of this method is to allow all tables.

Parameters:
tablename - A table name to check.
Returns:
True if the table should be exposed as a FeaturSimpleFeatureTypee if it should be ignored.

buildFIDMapper

protected FIDMapper buildFIDMapper(String typeName,
                                   FIDMapperFactory factory)
                            throws IOException
Deprecated. 
Builds the appropriate FID mapper given a table name and a FID mapper factory

Parameters:
typeName -
factory -
Throws:
IOException

buildSchema

protected SimpleFeatureType buildSchema(String typeName,
                                        FIDMapper mapper)
                                 throws IOException
Deprecated. 
Builds the schema for a table in the database.

This works by retrieving the column information for the table from the DatabaseMetaData object. It then iterates over the information for each column, calling buildAttributeType(ResultSet) to construct an AttributeDescriptor for each column. The list of attribute types is then turned into a FeatureType that defines the schema.

It is not intended that this method is overriden. It should provide the required functionality for most sub-classes. To add AttributeDescriptor construction for vendor specific SQL types, such as geometries, override the buildAttributeType(ResultSet) method.

This may become final later. In fact Ill make it private because I don't think It will need to be overriden.

Parameters:
typeName - The name of the table to construct a feature type for.
mapper - The name of the column holding the fid.
Returns:
The FeatureType for the table.
Throws:
IOException
DataSourceException - This can occur if there is an SQL error or an error constructing the FeatureType.
See Also:
buildAttributeType(ResultSet)

buildAttributeType

protected AttributeDescriptor buildAttributeType(ResultSet rs)
                                          throws IOException
Deprecated. 
Constructs an AttributeDescriptor from a row in a ResultSet. The ResultSet contains the information retrieved by a call to getColumns() on the DatabaseMetaData object. This information can be used to construct an Attribute Type.

The default implementation constructs an AttributeDescriptor using the default JDBC type mappings defined in JDBCDataStore. These type mappings only handle native Java classes and SQL standard column types, so to handle Geometry columns, sub classes should override this to check if a column is a geometry column, if it is a geometry column the appropriate determination of the geometry type can be performed. Otherwise, overriding methods should call super.buildAttributeType.

Note: Overriding methods must never move the current row pointer in the result set.

Parameters:
rs - The ResultSet containing the result of a DatabaseMetaData.getColumns call.
Returns:
The AttributeDescriptor built from the ResultSet or null if the column should be excluded from the schema.
Throws:
IOException - If an error occurs processing the ResultSet.

determineSRID

protected int determineSRID(String tableName,
                            String geometryColumnName)
                     throws IOException
Deprecated. 
Provides a hook for subclasses to determine the SRID of a geometry column.

This allows SRIDs to be determined in a Vendor specific way and to be cached by the default implementation. To retreive these srids, get the FeatureTypeInfo object for the table and call getSRID(geometryColumnName). This will allow storage of SRIDs for multiple geometry columns in each table.

If no SRID can be found, subclasses should return -1. The default implementation always returns -1.

Parameters:
tableName - The name of the table to get the SRID for.
geometryColumnName - The name of the geometry column within the table to get SRID for.
Returns:
The SRID for the geometry column in the table or -1.
Throws:
IOException

determineFidColumnName

protected String determineFidColumnName(String typeName)
                                 throws IOException
Deprecated. 
Provides the default implementation of determining the FID column.

The default implementation of determining the FID column name is to use the primary key as the FID column. If no primary key is present, null will be returned. Sub classes can override this behaviour to define primary keys for vendor specific cases.

There is an unresolved issue as to what to do when there are multiple primary keys. Maybe a restriction that table much have a single column primary key is appropriate.

This should not be called by subclasses to retreive the FID column name. Instead, subclasses should call getFeatureTypeInfo(String) to get the FeatureTypeInfo for a feature type and get the fidColumn name from the fidColumn name memeber.

Parameters:
typeName - The name of the table to get a primary key for.
Returns:
The name of the primay key column or null if one does not exist.
Throws:
IOException - This will only occur if there is an error getting a connection to the Database.

getNameSpace

public URI getNameSpace()
Deprecated. 
Gets the namespace of the data store. TODO: change config over to use URI

Returns:
The namespace.

getDatabaseSchemaName

public String getDatabaseSchemaName()
Deprecated. 
Returns the database schema used by this JDBC datastore

Returns:

getFeatureWriter

public FeatureWriter<SimpleFeatureType,SimpleFeature> getFeatureWriter(String typeName,
                                                                       Transaction transaction)
                                                                throws IOException
Deprecated. 
Retrieve a FeatureWriter over entire dataset.

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.

Specified by:
getFeatureWriter in interface DataStore
Parameters:
typeName -
transaction -
Returns:
FeatureReader Allows Sequential Processing of featureType
Throws:
IOException
See Also:
org.geotools.data.DataStore#getFeatureWriter(java.lang.String, boolean, org.geotools.data.Transaction)

getFeatureWriterAppend

public FeatureWriter<SimpleFeatureType,SimpleFeature> getFeatureWriterAppend(String typeName,
                                                                             Transaction transaction)
                                                                      throws IOException
Deprecated. 
Retrieve a FeatureWriter for creating new content.

Subclass may wish to implement an optimized featureWriter for this operation. One based on prepaired statemnts 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.

Specified by:
getFeatureWriterAppend in interface DataStore
Parameters:
typeName -
transaction -
Returns:
FeatureWriter that may only be used to append new content
Throws:
IOException
See Also:
org.geotools.data.DataStore#getFeatureWriter(java.lang.String, boolean, org.geotools.data.Transaction)

getFeatureWriter

public FeatureWriter<SimpleFeatureType,SimpleFeature> getFeatureWriter(String typeName,
                                                                       Filter filter,
                                                                       Transaction transaction)
                                                                throws IOException
Deprecated. 
Acquire FeatureWriter for modification of contents specifed by filter.

Quick notes: This FeatureWriter is often used to remove contents specified by the provided filter, or perform summary calculations.

Subclasses are responsible for checking with the lockingManager unless they are providing their own locking support.

Specified by:
getFeatureWriter in interface DataStore
Parameters:
typeName -
filter -
transaction -
Returns:
FeatureWriter Allows Sequential Modification of featureType
Throws:
IOException - If typeName could not be located
NullPointerException - If the provided filter is null
DataSourceException

createFeatureWriter

protected JDBCFeatureWriter createFeatureWriter(FeatureReader<SimpleFeatureType,SimpleFeature> reader,
                                                QueryData queryData)
                                         throws IOException
Deprecated. 
Throws:
IOException

propertyNames

protected String[] propertyNames(Query query)
                          throws IOException
Deprecated. 
Get propertyNames in a safe manner.

Method will figure out names from the schema for query.getTypeName(), if query getPropertyNames() is null, or query.retrieveAllProperties is true.

Parameters:
query -
Throws:
IOException

getAttributeTypes

protected final AttributeDescriptor[] getAttributeTypes(String typeName,
                                                        String[] propertyNames,
                                                        Hints hints)
                                                 throws IOException,
                                                        SchemaException
Deprecated. 
Gets the attribute types from from a given type.

Parameters:
typeName - The name of the feature type to get the AttributeTypes for.
propertyNames - The list of propertyNames to get AttributeTypes for.
Returns:
the array of attribute types from the schema which match propertyNames.
Throws:
IOException - If we can't get the schema.
SchemaException - if query contains a propertyName that is not a part of this type's schema.

getLockingManager

public LockingManager getLockingManager()
Deprecated. 
Locking manager used for this DataStore.

By default AbstractDataStore makes use of InProcessLockingManager.

Specified by:
getLockingManager in interface DataStore
Returns:
DataStores may return null, if the handling locking in another fashion.
See Also:
DataStore.getLockingManager()

setFIDMapper

public void setFIDMapper(String featureTypeName,
                         FIDMapper fidMapper)
Deprecated. 
Sets the FIDMapper for a specific type name

Parameters:
featureTypeName -
fidMapper -

getFIDMapperFactory

public FIDMapperFactory getFIDMapperFactory()
Deprecated. 
Returns the FIDMapperFactory used for this data store


setFIDMapperFactory

public void setFIDMapperFactory(FIDMapperFactory fmFactory)
                         throws UnsupportedOperationException
Deprecated. 
Allows to override the default FIDMapperFactory.

Warning: the ovveride may not be supported by all data stores, in this case an exception will be thrown

Parameters:
fmFactory -
Throws:
UnsupportedOperationException - - if the datastore does not allow the factory override

allSameOrder

public boolean allSameOrder(String[] requestedNames,
                            SimpleFeatureType ft)
Deprecated. 
returns true if the requested names list all the attributes in the correct order.

Parameters:
requestedNames -
ft -

getEnvelope

public Envelope getEnvelope(String typeName)
Deprecated. 
Retrieve approx bounds of all Features.

This result is suitable for a quick map display, illustrating the data. This value is often stored as metadata in databases such as oraclespatial.

Returns:
null as a generic implementation is not provided.

getSupportedHints

public Set getSupportedHints()
Deprecated. 

getFeatureSource

public FeatureSource<SimpleFeatureType,SimpleFeature> getFeatureSource(Name typeName)
                                                                throws IOException
Deprecated. 
Delegates to getFeatureSource(String) with name.getLocalPart()

Specified by:
getFeatureSource in interface DataAccess<SimpleFeatureType,SimpleFeature>
Returns:
Access to the named resource being made available
Throws:
IOException
Since:
2.5
See Also:
DataAccess.getFeatureSource(Name)

getNames

public List<Name> getNames()
                    throws IOException
Deprecated. 
Returns the same list of names than getTypeNames() meaning the returned Names have no namespace set.

Specified by:
getNames in interface DataAccess<SimpleFeatureType,SimpleFeature>
Returns:
Names of the available contents.
Throws:
IOException
Since:
2.5
See Also:
DataAccess.getNames()

getSchema

public SimpleFeatureType getSchema(Name name)
                            throws IOException
Deprecated. 
Delegates to getSchema(String) with name.getLocalPart()

Specified by:
getSchema in interface DataAccess<SimpleFeatureType,SimpleFeature>
Parameters:
name - Type name a the resource from getNames()
Returns:
Description of the FeatureType being made avaialble
Throws:
IOException
Since:
2.5
See Also:
DataAccess.getSchema(Name)

updateSchema

public void updateSchema(Name typeName,
                         SimpleFeatureType featureType)
                  throws IOException
Deprecated. 
Delegates to updateSchema(String, SimpleFeatureType) with name.getLocalPart()

Specified by:
updateSchema in interface DataAccess<SimpleFeatureType,SimpleFeature>
Throws:
IOException - if the operation failed
Since:
2.5
See Also:
DataAccess.getFeatureSource(Name)


Copyright © 1996-2010 Geotools. All Rights Reserved.