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 TypeMethodDescriptionvoid
close()
Does nothing.getName()
void
initialize
(JDBCDiskCacheAttributes config) Initialize the factory.
-
Constructor Details
-
JndiDataSourceFactory
public JndiDataSourceFactory()
-
-
Method Details
-
getName
- Specified by:
getName
in interfaceDataSourceFactory
- Returns:
- the name of the factory.
-
getDataSource
- Specified by:
getDataSource
in interfaceDataSourceFactory
- Returns:
- the
DataSource
configured by the factory. - Throws:
SQLException
- if the source can't be returned- See Also:
-
initialize
Description copied from interface:DataSourceFactory
Initialize the factory.- Specified by:
initialize
in 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:
close
in interfaceDataSourceFactory
-