|
|||||||||||
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.hsql.HsqlDataStore
An implementation of the GeoTools Data Store API for the HSQL database platform.
Please see class JDBC1DataStore
and
interface DataStore
for DataStore usage details.
Field Summary |
Fields inherited from class org.geotools.data.jdbc.JDBC1DataStore |
allowWriteOnVolatileFIDs, config, listenerManager, sqlNameEscape, TYPE_MAPPINGS, typeHandler |
Constructor Summary | |
HsqlDataStore(HsqlConnectionFactory connectionFactory)
Basic constructor for HsqlDataStore. |
|
HsqlDataStore(HsqlConnectionFactory connectionFactory,
java.lang.String databaseSchemaName)
Constructor for HSQLDataStore where the database schema name is provided. |
|
HsqlDataStore(HsqlConnectionFactory connectionFactory,
java.lang.String databaseSchemaName,
java.lang.String namespace)
Constructor for HSQLDataStore where the database schema name is provided. |
Method Summary | |
void |
addFeatures(Feature[] features)
Convenience method to add feature to the datastore |
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 AttributeType |
buildAttributeType(java.sql.ResultSet rs)
Constructs an AttributeType from a row in a ResultSet. |
protected FIDMapperFactory |
buildFIDMapperFactory(JDBCDataStoreConfig config)
Override the default FIDMapperFactory since it doesn't work well with HSQL |
protected java.sql.Connection |
createConnection()
Create a connection for your JDBC1 database |
protected JDBCFeatureWriter |
createFeatureWriter(FeatureReader reader,
QueryData queryData)
|
void |
createSchema(FeatureType featureType)
Adds support for a new featureType to HsqlDataStore. |
protected java.sql.Connection |
getConnection(Transaction transaction)
Gets a connection for the provided transaction. |
FeatureReader |
getFeatureReader(Query query,
Transaction transaction)
Provides a featureReader over the query results using the given transaction |
FeatureReader |
getFeatureReader(java.lang.String typeName)
Provides FeatureReader over the entire contents of typeName .
|
FeatureWriter |
getFeatureWriter(java.lang.String typeName)
Utility method for getting a FeatureWriter for modifying existing features, using no feature filtering and auto-committing. |
FeatureWriter |
getFeatureWriter(java.lang.String typeName,
Filter filter,
Transaction transaction)
Aquire FetureWriter for modification of contents specifed by filter. |
FeatureWriter |
getFeatureWriterAppend(java.lang.String typeName)
Utility method for getting a FeatureWriter for adding new features, using auto-committing. |
protected AttributeIO |
getGeometryAttributeIO(AttributeType type,
QueryData queryData)
Hook to create the geometry attribute IO for a vendor specific data source. |
SQLBuilder |
getSqlBuilder(java.lang.String typeName)
Hook for subclass to return a different sql builder. |
void |
removeSchema(FeatureType featureType)
Removes support for the featureType schema to HsqlDataStore. |
protected void |
setAutoCommit(boolean arg0,
java.sql.Connection arg1)
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) |
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 |
getFeatureSource, getFeatureWriter, getFeatureWriterAppend, getLockingManager, getSchema, getTypeNames, getView, updateSchema |
Constructor Detail |
public HsqlDataStore(HsqlConnectionFactory connectionFactory) throws java.io.IOException
HsqlConnectionFactory
, which could
be done similar to the following:HsqlConnectionFactory connectionFactory = new HsqlConnectionFactory("dbFileName", "username", "password");
DataStore dataStore = new HsqlDataStore(connectionFactory);
connectionFactory
- an HSQL HsqlConnectionFactory
java.io.IOException
- if the database cannot be properly accessedHsqlConnectionFactory
public HsqlDataStore(HsqlConnectionFactory connectionFactory, java.lang.String databaseSchemaName) throws java.io.IOException
connectionFactory
- an HSQL HsqlConnectionFactory
databaseSchemaName
- the database schema. Can be null. See the comments for the parameter schemaPattern in DatabaseMetaData.getTables
, because databaseSchemaName behaves in the same way.
java.io.IOException
- if the database cannot be properly accessedpublic HsqlDataStore(HsqlConnectionFactory connectionFactory, java.lang.String databaseSchemaName, java.lang.String namespace) throws java.io.IOException
connectionFactory
- an HSQL HsqlConnectionFactory
databaseSchemaName
- the database schema. Can be null. See the comments for the parameter schemaPattern in DatabaseMetaData.getTables
, because databaseSchemaName behaves in the same way.namespace
- the namespace for this data store. Can be null, in which case the namespace will simply be the schema name.
java.io.IOException
- if the database cannot be properly accessedMethod Detail |
public FeatureReader getFeatureReader(java.lang.String typeName) throws java.io.IOException
typeName
.
Implements getFeatureReader contract for AbstractDataStore.
typeName
-
java.io.IOException
- If typeName could not be foundpublic FeatureReader getFeatureReader(Query query, Transaction transaction) throws java.io.IOException
getFeatureReader
in interface DataStore
getFeatureReader
in class JDBC1DataStore
query
- the Query object we want to narrow the results down bytransaction
- the transaction object to be operated on
java.io.IOException
- If an error occurs executing the query.JDBC1DataStore.getFeatureReader(org.geotools.data.Query, org.geotools.data.Transaction)
protected FIDMapperFactory buildFIDMapperFactory(JDBCDataStoreConfig config)
buildFIDMapperFactory
in class JDBC1DataStore
JDBC1DataStore.buildFIDMapperFactory(org.geotools.data.jdbc.JDBCDataStoreConfig)
public void addFeatures(Feature[] features) throws java.io.IOException
features
- an array of features that should be added to the datastore
java.io.IOException
public FeatureWriter getFeatureWriter(java.lang.String typeName) throws java.io.IOException
typeName
- the feature type name (the table name)
java.io.IOException
- if the database cannot be properly accessedpublic FeatureWriter getFeatureWriter(java.lang.String typeName, Filter filter, Transaction transaction) throws java.io.IOException
Quick notes: This FeatureWriter is often used to remove contents specified by the provided filter, or perform summary calculations.
It is not used to provide new content and should return
null
for next() when hasNext() returns false
.
getFeatureWriter
in interface DataStore
getFeatureWriter
in class JDBC1DataStore
typeName
- filter
- transaction
-
java.io.IOException
- If typeName could not be located
java.lang.NullPointerException
- If the provided filter is nullDataStore.getFeatureWriter(java.lang.String,
org.geotools.filter.Filter, org.geotools.data.Transaction)
public FeatureWriter getFeatureWriterAppend(java.lang.String typeName) throws java.io.IOException
typeName
- the feature type name (the table name)
java.io.IOException
- if the database cannot be properly accessedprotected AttributeType buildAttributeType(java.sql.ResultSet rs) throws java.io.IOException
In addition to standard SQL types, this method identifies MySQL 4.1's geometric datatypes and creates attribute types accordingly. This happens when the datatype, identified by column 5 of the ResultSet parameter, is equal to java.sql.Types.OTHER. If a Types.OTHER ends up not being geometric, this method simply calls the parent class's buildAttributeType method to do something with it.
Note: Overriding methods must never move the current row pointer in the result set.
buildAttributeType
in class JDBC1DataStore
rs
- The ResultSet containing the result of a
DatabaseMetaData.getColumns call.
java.sql.SQLException
- If an error occurs processing the ResultSet.
DataSourceException
- Provided for overriding classes to wrap
exceptions caused by other operations they may perform to
determine additional types. This will only be thrown by the
default implementation if a type is present that is not present
in the TYPE_MAPPINGS.
java.io.IOException
- If an error occurs processing the ResultSet.public SQLBuilder getSqlBuilder(java.lang.String typeName) throws java.io.IOException
JDBC1DataStore
getSqlBuilder
in class JDBC1DataStore
typeName
- The typename for the sql builder.
java.io.IOException
- if anything goes wrong.JDBC1DataStore.getSqlBuilder(java.lang.String)
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.JDBC1DataStore#getGeometryAttributeIO(org.geotools.feature.AttributeType)
protected JDBCFeatureWriter createFeatureWriter(FeatureReader reader, QueryData queryData) throws java.io.IOException
createFeatureWriter
in class JDBC1DataStore
java.io.IOException
JDBC1DataStore.createFeatureWriter(org.geotools.data.FeatureReader, org.geotools.data.jdbc.QueryData)
protected java.sql.Connection createConnection() throws java.sql.SQLException
JDBC1DataStore
createConnection
in class JDBC1DataStore
java.sql.SQLException
JDBC1DataStore.createConnection()
protected java.sql.Connection getConnection(Transaction transaction) throws java.io.IOException
getConnection
in class JDBC1DataStore
transaction
-
java.io.IOException
DataSourceException
- If the connection can not be obtained.public void createSchema(FeatureType featureType) throws java.io.IOException
FeatureTypes are stored by typeName (in this case, table name = typeName), an IOException will be thrown if the requested typeName is already in use.
createSchema
in interface DataStore
createSchema
in class JDBC1DataStore
featureType
- FeatureType to be added
java.io.IOException
- If featureType already existsDataStore.createSchema(org.geotools.feature.FeatureType)
protected boolean allowTable(java.lang.String tablename)
JDBC1DataStore
allowTable
in class JDBC1DataStore
tablename
- A table name to check.
public void removeSchema(FeatureType featureType)
FeatureTypes are stored by typeName (in this case, table name = typeName).
featureType
- FeatureType to be removedprotected void setAutoCommit(boolean arg0, java.sql.Connection arg1) throws java.sql.SQLException
JDBC1DataStore
setAutoCommit
in class JDBC1DataStore
arg0
- arg1
-
java.sql.SQLException
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |