org.geotools.jdbc
Class JDBCJNDIDataStoreFactory

Object
  extended by AbstractDataStoreFactory
      extended by JDBCDataStoreFactory
          extended by JDBCJNDIDataStoreFactory
All Implemented Interfaces:
DataAccessFactory, DataStoreFactorySpi, Factory
Direct Known Subclasses:
DB2NGJNDIDataStoreFactory, H2JNDIDataStoreFactory, MySQLJNDIDataStoreFactory, OracleNGJNDIDataStoreFactory, PostgisNGJNDIDataStoreFactory, SpatiaLiteJNDIDataStoreFactory, SQLServerJNDIDataStoreFactory, TeradataJNDIDataStoreFactory

public abstract class JDBCJNDIDataStoreFactory
extends JDBCDataStoreFactory

Abstract implementation of DataStoreFactory for jdbc datastores which obtain a JNDI connection.

Subclasses should not need to override any methods, only just call the parent constructor passing in the non JNDI datastore factory to delegate to.

Author:
Christian Mueller

Nested Class Summary
 
Nested classes/interfaces inherited from interface DataAccessFactory
DataAccessFactory.Param
 
Field Summary
protected  JDBCDataStoreFactory delegate
          regular datastore factory to delegate to.
static String J2EERootContext
           
static DataAccessFactory.Param JNDI_REFNAME
          JNDI data source name
 
Fields inherited from class JDBCDataStoreFactory
DATABASE, DATASOURCE, DBTYPE, EXPOSE_PK, FETCHSIZE, HOST, MAX_OPEN_PREPARED_STATEMENTS, MAXCONN, MAXWAIT, MINCONN, NAMESPACE, PASSWD, PK_METADATA_TABLE, PORT, SCHEMA, SQL_ON_BORROW, SQL_ON_RELEASE, USER, VALIDATECONN
 
Constructor Summary
protected JDBCJNDIDataStoreFactory(JDBCDataStoreFactory delegate)
           
 
Method Summary
protected  boolean checkDBType(Map params)
           
protected  DataSource createDataSource(Map params, SQLDialect dialect)
          Override to create the datasource from the external JNDI conection.
protected  JDBCDataStore createDataStoreInternal(JDBCDataStore dataStore, Map params)
          Subclass hook to do additional initialization of a newly created datastore.
 DataStore createNewDataStore(Map params)
           
protected  SQLDialect createSQLDialect(JDBCDataStore dataStore)
          Creates the dialect that the datastore uses for communication with the underlying database.
protected  String getDatabaseID()
          Returns a string to identify the type of the database.
 String getDescription()
          Describe the nature of the datasource constructed by this factory.
 String getDisplayName()
          Default Implementation abuses the naming convention.
protected  String getDriverClassName()
          Override which explicitly returns null because with a JNDI connection the driver is not known ahead of time.
 Map getImplementationHints()
          Returns the implementation hints for the datastore.
protected  String getJDBCUrl(Map params)
          Override which explicitly returns null since there is no jdbc url, the connection is identified by the JNDI name.
protected  String getValidationQuery()
          Override which explicitly returns null, validation queries are not supported, my be part of the external data source configuration
 boolean isAvailable()
          Determines if the datastore is available.
protected  void setupParameters(Map parameters)
          Override to omit all those parameters which define the creation of the connection.
 
Methods inherited from class JDBCDataStoreFactory
canProcess, checkDBType, createDataSource, createDataStore, getParametersInfo
 
Methods inherited from class AbstractDataStoreFactory
getParameters
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

J2EERootContext

public static final String J2EERootContext
See Also:
Constant Field Values

JNDI_REFNAME

public static final DataAccessFactory.Param JNDI_REFNAME
JNDI data source name


delegate

protected JDBCDataStoreFactory delegate
regular datastore factory to delegate to.

Constructor Detail

JDBCJNDIDataStoreFactory

protected JDBCJNDIDataStoreFactory(JDBCDataStoreFactory delegate)
Method Detail

getDriverClassName

protected String getDriverClassName()
Override which explicitly returns null because with a JNDI connection the driver is not known ahead of time.

Specified by:
getDriverClassName in class JDBCDataStoreFactory

getValidationQuery

protected String getValidationQuery()
Override which explicitly returns null, validation queries are not supported, my be part of the external data source configuration

Specified by:
getValidationQuery in class JDBCDataStoreFactory
Returns:

getJDBCUrl

protected String getJDBCUrl(Map params)
                     throws IOException
Override which explicitly returns null since there is no jdbc url, the connection is identified by the JNDI name.

Overrides:
getJDBCUrl in class JDBCDataStoreFactory
Returns:
Throws:
IOException

createDataSource

protected DataSource createDataSource(Map params,
                                      SQLDialect dialect)
                               throws IOException
Override to create the datasource from the external JNDI conection.

Overrides:
createDataSource in class JDBCDataStoreFactory
Throws:
IOException

isAvailable

public boolean isAvailable()
Determines if the datastore is available.

Check in an Initial Context is available, that is all what can be done Checking for the right jdbc jars in the classpath is not possible here

Specified by:
isAvailable in interface DataAccessFactory
Overrides:
isAvailable in class JDBCDataStoreFactory
Returns:
true, override to check for drivers etc...

setupParameters

protected void setupParameters(Map parameters)
Override to omit all those parameters which define the creation of the connection.

Overrides:
setupParameters in class JDBCDataStoreFactory
Parameters:
parameters - Map of Param objects.

getDatabaseID

protected String getDatabaseID()
Description copied from class: JDBCDataStoreFactory
Returns a string to identify the type of the database.

Example: 'postgis'.

Specified by:
getDatabaseID in class JDBCDataStoreFactory

getDisplayName

public String getDisplayName()
Description copied from class: AbstractDataStoreFactory
Default Implementation abuses the naming convention.

Will return Foo for org.geotools.data.foo.FooFactory.

Specified by:
getDisplayName in interface DataAccessFactory
Overrides:
getDisplayName in class JDBCDataStoreFactory
Returns:
return display name based on class name

getDescription

public String getDescription()
Description copied from interface: DataAccessFactory
Describe the nature of the datasource constructed by this factory.

A non localized description of this data store type.

Returns:
A human readable description that is suitable for inclusion in a list of available datasources.

createDataStoreInternal

protected JDBCDataStore createDataStoreInternal(JDBCDataStore dataStore,
                                                Map params)
                                         throws IOException
Description copied from class: JDBCDataStoreFactory
Subclass hook to do additional initialization of a newly created datastore.

Typically subclasses will want to override this method in the case where they provide additional datastore parameters, those should be processed here.

This method is provided with an instance of the datastore. In some cases subclasses may wish to create a new instance of the datastore, for instance in order to wrap the original instance. This is supported but the new datastore must be returned from this method. If not is such the case this method should still return the original passed in.

Overrides:
createDataStoreInternal in class JDBCDataStoreFactory
Parameters:
dataStore - The newly created datastore.
params - THe datastore parameters.
Throws:
IOException

createNewDataStore

public DataStore createNewDataStore(Map params)
                             throws IOException
Specified by:
createNewDataStore in interface DataStoreFactorySpi
Overrides:
createNewDataStore in class JDBCDataStoreFactory
Throws:
IOException

getImplementationHints

public Map getImplementationHints()
Description copied from class: JDBCDataStoreFactory
Returns the implementation hints for the datastore.

Subclasses may override, this implementation returns null.

Specified by:
getImplementationHints in interface Factory
Overrides:
getImplementationHints in class JDBCDataStoreFactory
Returns:
The map of hints, or an empty map if none.

createSQLDialect

protected SQLDialect createSQLDialect(JDBCDataStore dataStore)
Description copied from class: JDBCDataStoreFactory
Creates the dialect that the datastore uses for communication with the underlying database.

Specified by:
createSQLDialect in class JDBCDataStoreFactory
Parameters:
dataStore - The datastore.

checkDBType

protected boolean checkDBType(Map params)
Overrides:
checkDBType in class JDBCDataStoreFactory


Copyright © 1996-2014 Geotools. All Rights Reserved.