Package org.apache.torque.dsfactory
Class JndiDataSourceFactory
java.lang.Object
org.apache.torque.dsfactory.AbstractDataSourceFactory
org.apache.torque.dsfactory.JndiDataSourceFactory
- All Implemented Interfaces:
DataSourceFactory
A factory that looks up the DataSource from JNDI. It is also able
to deploy the DataSource based on properties found in the
configuration.
This factory tries to avoid excessive context lookups to improve speed.
The time between two lookups can be configured. The default is 0 (no cache).
- Version:
- $Id: JndiDataSourceFactory.java 1912328 2023-09-15 14:14:19Z gk $
- Author:
- John McNally, Thomas Vandahl
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringKey for the configuration property which contains the class name of the datasource to be bound into jndi.static final StringKey for the configuration which contains properties for a DataSource which should be bound into jndi.static final StringKey for the configuration which contains jndi properties.static final StringKey for the configuration property which contains the jndi path.static final StringKey for the configuration property which contains the time between two jndi lookups.Fields inherited from class org.apache.torque.dsfactory.AbstractDataSourceFactory
CONNECTION_KEY, DEFAULT_CONNECTION_KEY, DEFAULT_POOL_KEY, DEFAULTS_KEY, POOL_KEY, USE_DURATION_TEXT_FORMATFields inherited from interface org.apache.torque.dsfactory.DataSourceFactory
DSFACTORY_KEY, FACTORY_KEY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Does nothing.voidinitialize(org.apache.commons.configuration2.Configuration configuration) Initialize the factory.Methods inherited from class org.apache.torque.dsfactory.AbstractDataSourceFactory
applyAndRemoveGlobal, applyConfiguration, initCPDS, initJdbc2Pool, setProperty
-
Field Details
-
JNDI_KEY
Key for the configuration which contains jndi properties.- See Also:
-
PATH_KEY
Key for the configuration property which contains the jndi path.- See Also:
-
TIME_BETWEEN_LOOKUPS_KEY
Key for the configuration property which contains the time between two jndi lookups.- See Also:
-
DATASOURCE_KEY
Key for the configuration which contains properties for a DataSource which should be bound into jndi.- See Also:
-
CLASSNAME_KEY
Key for the configuration property which contains the class name of the datasource to be bound into jndi.- See Also:
-
-
Constructor Details
-
JndiDataSourceFactory
public JndiDataSourceFactory()
-
-
Method Details
-
getDataSource
- Specified by:
getDataSourcein interfaceDataSourceFactory- Specified by:
getDataSourcein classAbstractDataSourceFactory- Returns:
- the
DataSourceconfigured by the factory. - Throws:
TorqueException- if the source can't be returned- See Also:
-
initialize
public void initialize(org.apache.commons.configuration2.Configuration configuration) throws TorqueException Description copied from class:AbstractDataSourceFactoryInitialize the factory.- Specified by:
initializein interfaceDataSourceFactory- Specified by:
initializein classAbstractDataSourceFactory- Parameters:
configuration- where to load the factory settings from- Throws:
TorqueException- Any exceptions caught during processing will be rethrown wrapped into a TorqueException.- See Also:
-
close
public void close()Does nothing. We do not want to close a dataSource retrieved from Jndi, because other applications might use it as well.
-