Class JDBCJNDIDataStoreFactory
- Object
-
- JDBCDataStoreFactory
-
- JDBCJNDIDataStoreFactory
-
- All Implemented Interfaces:
DataAccessFactory,DataStoreFactorySpi,Factory
- Direct Known Subclasses:
DB2NGJNDIDataStoreFactory,H2GISJNDIDataStoreFactory,H2JNDIDataStoreFactory,HanaJNDIDataStoreFactory,InformixJNDIDataStoreFactory,MySQLJNDIDataStoreFactory,OracleNGJNDIDataStoreFactory,PostgisNGJNDIDataStoreFactory,SingleStoreJNDIDataStoreFactory,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
Fields Modifier and Type Field Description protected JDBCDataStoreFactorydelegateregular datastore factory to delegate to.static StringJ2EERootContextstatic DataAccessFactory.ParamJNDI_REFNAMEJNDI data source name-
Fields inherited from class JDBCDataStoreFactory
BATCH_INSERT_SIZE, CALLBACK_FACTORY, DATABASE, DATASOURCE, DBTYPE, EVICTOR_TESTS_PER_RUN, EXPOSE_PK, FETCHSIZE, HOST, MAX_OPEN_PREPARED_STATEMENTS, MAXCONN, MAXWAIT, MIN_EVICTABLE_TIME, MINCONN, NAMESPACE, PASSWD, PK_METADATA_TABLE, PORT, SCHEMA, SQL_ON_BORROW, SQL_ON_RELEASE, TEST_WHILE_IDLE, TIME_BETWEEN_EVICTOR_RUNS, USER, VALIDATECONN
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedJDBCJNDIDataStoreFactory(JDBCDataStoreFactory delegate)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected booleancheckDBType(Map<String,?> params)protected DataSourcecreateDataSource(Map<String,?> params, SQLDialect dialect)Override to create the datasource from the external JNDI conection.protected JDBCDataStorecreateDataStoreInternal(JDBCDataStore dataStore, Map<String,?> params)Subclass hook to do additional initialization of a newly created datastore.DataStorecreateNewDataStore(Map<String,?> params)protected SQLDialectcreateSQLDialect(JDBCDataStore dataStore)Creates the dialect that the datastore uses for communication with the underlying database.protected StringgetDatabaseID()Returns a string to identify the type of the database.StringgetDescription()Describe the nature of the datasource constructed by this factory.StringgetDisplayName()Name suitable for display to end user.protected StringgetDriverClassName()Override which explicitly returns null because with a JNDI connection the driver is not known ahead of time.Map<RenderingHints.Key,?>getImplementationHints()Returns the implementation hints for the datastore.protected StringgetJDBCUrl(Map<String,?> params)Override which explicitly returns null since there is no jdbc url, the connection is identified by the JNDI name.protected StringgetValidationQuery()Override which explicitly returns null, validation queries are not supported, my be part of the external data source configurationbooleanisAvailable()Determines if the datastore is available.protected voidsetupParameters(Map<String,Object> parameters)Override to omit all those parameters which define the creation of the connection.-
Methods inherited from class JDBCDataStoreFactory
canProcess, checkDBType, createDataSource, createDataStore, createSQLDialect, getParametersInfo
-
-
-
-
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:
getDriverClassNamein classJDBCDataStoreFactory
-
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:
getValidationQueryin classJDBCDataStoreFactory
-
getJDBCUrl
protected String getJDBCUrl(Map<String,?> params) throws IOException
Override which explicitly returns null since there is no jdbc url, the connection is identified by the JNDI name.- Overrides:
getJDBCUrlin classJDBCDataStoreFactory- Throws:
IOException
-
createDataSource
protected DataSource createDataSource(Map<String,?> params, SQLDialect dialect) throws IOException
Override to create the datasource from the external JNDI conection.- Overrides:
createDataSourcein classJDBCDataStoreFactory- 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:
isAvailablein interfaceDataAccessFactory- Overrides:
isAvailablein classJDBCDataStoreFactory- Returns:
- true if and only if this factory has all the appropriate jars on the classpath to create DataStores.
-
setupParameters
protected void setupParameters(Map<String,Object> parameters)
Override to omit all those parameters which define the creation of the connection.- Overrides:
setupParametersin classJDBCDataStoreFactory- Parameters:
parameters- Map ofDataAccessFactory.Paramobjects.
-
getDatabaseID
protected String getDatabaseID()
Description copied from class:JDBCDataStoreFactoryReturns a string to identify the type of the database.Example: 'postgis'.
- Specified by:
getDatabaseIDin classJDBCDataStoreFactory
-
getDisplayName
public String getDisplayName()
Description copied from interface:DataAccessFactoryName suitable for display to end user.A non localized display name for this data store type.
- Specified by:
getDisplayNamein interfaceDataAccessFactory- Overrides:
getDisplayNamein classJDBCDataStoreFactory- Returns:
- A short name suitable for display in a user interface.
-
getDescription
public String getDescription()
Description copied from interface:DataAccessFactoryDescribe 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<String,?> params) throws IOException
Description copied from class:JDBCDataStoreFactorySubclass 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:
createDataStoreInternalin classJDBCDataStoreFactory- Parameters:
dataStore- The newly created datastore.params- THe datastore parameters.- Throws:
IOException
-
createNewDataStore
public DataStore createNewDataStore(Map<String,?> params) throws IOException
- Specified by:
createNewDataStorein interfaceDataStoreFactorySpi- Overrides:
createNewDataStorein classJDBCDataStoreFactory- Throws:
IOException
-
getImplementationHints
public Map<RenderingHints.Key,?> getImplementationHints()
Description copied from class:JDBCDataStoreFactoryReturns the implementation hints for the datastore.Subclasses may override, this implementation returns
null.- Specified by:
getImplementationHintsin interfaceFactory- Overrides:
getImplementationHintsin classJDBCDataStoreFactory- Returns:
- The map of hints, or an {@linkplain java.util.Collections.emptyMap() empty map} if none.
-
createSQLDialect
protected SQLDialect createSQLDialect(JDBCDataStore dataStore)
Description copied from class:JDBCDataStoreFactoryCreates the dialect that the datastore uses for communication with the underlying database.- Specified by:
createSQLDialectin classJDBCDataStoreFactory- Parameters:
dataStore- The datastore.
-
checkDBType
protected boolean checkDBType(Map<String,?> params)
- Overrides:
checkDBTypein classJDBCDataStoreFactory
-
-