org.geotools.data.oracle
Class OracleDataStore

java.lang.Object
  extended by org.geotools.data.jdbc.JDBC1DataStore
      extended by org.geotools.data.jdbc.JDBC2DataStore
          extended by org.geotools.data.jdbc.JDBCDataStore
              extended by org.geotools.data.oracle.OracleDataStore
All Implemented Interfaces:
DataAccess<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature>, DataStore

public class OracleDataStore
extends JDBCDataStore

Author:
Sean Geoghegan, Defence Science and Technology Organisation.

Field Summary
 
Fields inherited from class org.geotools.data.jdbc.JDBC2DataStore
dataSource
 
Fields inherited from class org.geotools.data.jdbc.JDBC1DataStore
allowWriteOnVolatileFIDs, config, listenerManager, sqlNameEscape, transactionIsolation, TYPE_MAPPINGS, typeHandler
 
Constructor Summary
OracleDataStore(javax.sql.DataSource dataSource, JDBCDataStoreConfig config)
           
OracleDataStore(javax.sql.DataSource dataSource, java.lang.String schemaName, java.util.Map fidGeneration)
           
OracleDataStore(javax.sql.DataSource dataSource, java.lang.String namespace, java.lang.String schemaName, java.util.Map fidGeneration)
           
 
Method Summary
protected  boolean allowTable(java.lang.String tablename)
          Crops non feature type tables.
protected  ReferencedEnvelope bounds(Query query)
          This is (unfortunately) a copy and paste from PostgisFeatureStore, I simply did not know a better place to put this...
protected  org.opengis.feature.type.AttributeDescriptor buildAttributeType(java.sql.ResultSet rs)
          Overrides the buildAttributeType method to check for SDO_GEOMETRY columns.
protected  JDBCFeatureWriter createFeatureWriter(FeatureReader<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature> fReader, QueryData queryData)
          Returns a Oracle text based feature writer that just issues the sql statements directly, as text.
 void createSchema(org.opengis.feature.simple.SimpleFeatureType featureType)
          Create a new featureType.
protected  org.opengis.referencing.crs.CoordinateReferenceSystem determineCRS(int srid)
           
protected  int determineSRID(java.lang.String tableName, java.lang.String geometryColumnName)
          Provides a hook for subclasses to determine the SRID of a geometry column.
protected  com.vividsolutions.jts.geom.Envelope getEnvelope(java.sql.Connection conn, org.opengis.feature.simple.SimpleFeatureType schema, java.lang.String geomName, SQLBuilder sqlBuilder, org.opengis.filter.Filter filter)
           
 com.vividsolutions.jts.geom.Envelope getEnvelope(java.lang.String typeName)
          Retrieve approx bounds of all Features.
 FeatureSource<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature> getFeatureSource(java.lang.String typeName)
          Default implementation based on getFeatureReader and getFeatureWriter.
protected  AttributeIO getGeometryAttributeIO(org.opengis.feature.type.AttributeDescriptor 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.
 boolean sql(Transaction t, java.lang.String sql)
          This is used by helper classes to hammer sql back to the database
 
Methods inherited from class org.geotools.data.jdbc.JDBC2DataStore
createConnection, dispose, finalize
 
Methods inherited from class org.geotools.data.jdbc.JDBC1DataStore
allSameOrder, attributeNames, buildFIDMapper, buildFIDMapperFactory, buildSchema, createFeatureReader, createLockingManager, determineFidColumnName, executeQuery, executeQuery, getAttributeIO, getAttributeTypes, getConcurrency, getConnection, getDatabaseSchemaName, getFeatureReader, getFeatureReader, getFeatureSource, getFeatureTypeHandler, getFeatureWriter, getFeatureWriter, getFeatureWriterAppend, getFIDMapper, getFIDMapperFactory, getInfo, getJDBCFeatureReader, getLockingManager, getNames, getNameSpace, getResultSetType, getSchema, getSchema, getSqlNameEscape, getSupportedHints, getTransactionIsolation, getTypeNames, getView, propertyNames, requireAutoCommit, setAutoCommit, setFIDMapper, setFIDMapperFactory, setSqlNameEscape, setTransactionIsolation, updateSchema, updateSchema
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OracleDataStore

public OracleDataStore(javax.sql.DataSource dataSource,
                       JDBCDataStoreConfig config)
                throws java.io.IOException
Parameters:
connectionPool -
config -
Throws:
java.io.IOException

OracleDataStore

public OracleDataStore(javax.sql.DataSource dataSource,
                       java.lang.String schemaName,
                       java.util.Map fidGeneration)
                throws java.io.IOException
Parameters:
connectionPool -
Throws:
DataSourceException
java.io.IOException

OracleDataStore

public OracleDataStore(javax.sql.DataSource dataSource,
                       java.lang.String namespace,
                       java.lang.String schemaName,
                       java.util.Map fidGeneration)
                throws java.io.IOException
Parameters:
connectionPool -
namespace -
Throws:
DataSourceException
java.io.IOException
Method Detail

allowTable

protected boolean allowTable(java.lang.String tablename)
Crops non feature type tables. There are alot of additional tables in a Oracle tablespace. This tries to remove some of them. If the schemaName is provided in the Constructor then the job of narrowing down tables will be mush easier. Otherwise there are alot of Meta tables and SDO tables to cull. This method tries to remove as many as possible.

Overrides:
allowTable in class JDBC1DataStore
Parameters:
tablename - A table name to check.
Returns:
True if the table should be exposed as a FeaturSimpleFeatureTypee if it should be ignored.
See Also:
JDBC1DataStore.allowTable(java.lang.String)

buildAttributeType

protected org.opengis.feature.type.AttributeDescriptor buildAttributeType(java.sql.ResultSet rs)
                                                                   throws java.io.IOException
Overrides the buildAttributeType method to check for SDO_GEOMETRY columns.

Overrides:
buildAttributeType in class JDBC1DataStore
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:
java.io.IOException - If an error occurs processing the ResultSet.
See Also:
A doc from Oracle. TODO: Determine the specific type of the geometry.

determineCRS

protected org.opengis.referencing.crs.CoordinateReferenceSystem determineCRS(int srid)
                                                                      throws java.io.IOException
Throws:
java.io.IOException

determineSRID

protected int determineSRID(java.lang.String tableName,
                            java.lang.String geometryColumnName)
                     throws java.io.IOException
Description copied from class: JDBC1DataStore
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.

Overrides:
determineSRID in class JDBC1DataStore
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:
java.io.IOException
See Also:
JDBC1DataStore.determineSRID(java.lang.String, java.lang.String)

getSqlBuilder

public SQLBuilder getSqlBuilder(java.lang.String typeName)
                         throws java.io.IOException
Description copied from class: JDBC1DataStore
Hook for subclass to return a different sql builder.

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

Overrides:
getSqlBuilder in class JDBC1DataStore
Parameters:
typeName - The typename for the sql builder.
Returns:
A new sql builder.
Throws:
java.io.IOException - if anything goes wrong.
See Also:
JDBC1DataStore.getSqlBuilder(java.lang.String)

getGeometryAttributeIO

protected AttributeIO getGeometryAttributeIO(org.opengis.feature.type.AttributeDescriptor type,
                                             QueryData queryData)
                                      throws java.io.IOException
Description copied from class: JDBC1DataStore
Hook to create the geometry attribute IO for a vendor specific data source.

Specified by:
getGeometryAttributeIO in class JDBC1DataStore
Parameters:
type - The AttributeDescriptor to read.
queryData - The connection holder
Returns:
The AttributeIO that will read and write the geometry from the results.
Throws:
java.io.IOException - DOCUMENT ME!
See Also:
org.geotools.data.jdbc.JDBCDataStore#getGeometryAttributeIO(org.geotools.feature.AttributeType, org.geotools.data.jdbc.QueryData)

createFeatureWriter

protected JDBCFeatureWriter createFeatureWriter(FeatureReader<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature> fReader,
                                                QueryData queryData)
                                         throws java.io.IOException
Returns a Oracle text based feature writer that just issues the sql statements directly, as text. Jody and Sean say things will go faster if we use updatable resultsets and all that jazz, but I can't get those to work, and this does, so I'm going forth with it.

Overrides:
createFeatureWriter in class JDBC1DataStore
Throws:
java.io.IOException

getEnvelope

public com.vividsolutions.jts.geom.Envelope getEnvelope(java.lang.String typeName)
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.

Overrides:
getEnvelope in class JDBC1DataStore
Returns:
null as a generic implementation is not provided.

sql

public boolean sql(Transaction t,
                   java.lang.String sql)
            throws java.io.IOException,
                   java.sql.SQLException
This is used by helper classes to hammer sql back to the database

Throws:
java.io.IOException
java.sql.SQLException

createSchema

public void createSchema(org.opengis.feature.simple.SimpleFeatureType featureType)
                  throws java.io.IOException
Description copied from class: JDBC1DataStore
Create a new featureType.

Not currently supported - subclass may implement.

Specified by:
createSchema in interface DataAccess<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature>
Overrides:
createSchema in class JDBC1DataStore
Parameters:
featureType - FetureType to add to DataStore
Throws:
java.io.IOException - If featureType cannot be created
See Also:
org.geotools.data.DataStore#createSchema(org.geotools.feature.FeatureType)

getFeatureSource

public FeatureSource<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature> getFeatureSource(java.lang.String typeName)
                                                                                                                      throws java.io.IOException
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
Overrides:
getFeatureSource in class JDBC1DataStore
Returns:
FeatureSource (or subclass) providing operations for typeName
Throws:
java.io.IOException
See Also:
DataStore.getFeatureSource(java.lang.String)

bounds

protected ReferencedEnvelope bounds(Query query)
                             throws java.io.IOException
This is (unfortunately) a copy and paste from PostgisFeatureStore, I simply did not know a better place to put this...

Parameters:
query -
Returns:
Throws:
java.io.IOException

getEnvelope

protected com.vividsolutions.jts.geom.Envelope getEnvelope(java.sql.Connection conn,
                                                           org.opengis.feature.simple.SimpleFeatureType schema,
                                                           java.lang.String geomName,
                                                           SQLBuilder sqlBuilder,
                                                           org.opengis.filter.Filter filter)
                                                    throws java.sql.SQLException,
                                                           SQLEncoderException,
                                                           java.io.IOException,
                                                           com.vividsolutions.jts.io.ParseException
Throws:
java.sql.SQLException
SQLEncoderException
java.io.IOException
com.vividsolutions.jts.io.ParseException


Copyright © 1996-2010 Geotools. All Rights Reserved.