Class JndiDataSourceFactory
java.lang.Object
org.apache.commons.jcs3.auxiliary.disk.jdbc.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).
Borrowed and adapted from Apache DB Torque
-
Field Summary
Fields inherited from interface org.apache.commons.jcs3.auxiliary.disk.jdbc.dsfactory.DataSourceFactory
DSFACTORY_KEY, FACTORY_KEY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Does nothing.getName()voidinitialize(JDBCDiskCacheAttributes config) Initialize the factory.
-
Constructor Details
-
JndiDataSourceFactory
public JndiDataSourceFactory()
-
-
Method Details
-
getName
- Specified by:
getNamein interfaceDataSourceFactory- Returns:
- the name of the factory.
-
getDataSource
- Specified by:
getDataSourcein interfaceDataSourceFactory- Returns:
- the
DataSourceconfigured by the factory. - Throws:
SQLException- if the source can't be returned- See Also:
-
initialize
Description copied from interface:DataSourceFactoryInitialize the factory.- Specified by:
initializein interfaceDataSourceFactory- Parameters:
config- the factory settings- Throws:
SQLException- Any exceptions caught during processing will be rethrown wrapped into a SQLException.- See Also:
-
close
Does nothing. We do not want to close a dataSource retrieved from Jndi, because other applications might use it as well.- Specified by:
closein interfaceDataSourceFactory
-