java.lang.Object
org.apache.torque.dsfactory.AbstractDataSourceFactory
org.apache.torque.dsfactory.JndiDataSourceFactory
- All Implemented Interfaces:
- DataSourceFactory
- public class JndiDataSourceFactory
- extends AbstractDataSourceFactory
- implements 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,v 1.6.2.3 2004/10/20 14:13:58 henning Exp $
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
log
private static org.apache.commons.logging.Log log
- The log.
path
private java.lang.String path
- The path to get the resource from.
ctx
private javax.naming.Context ctx
- The context to get the resource from.
ds
private javax.sql.DataSource ds
- A locally cached copy of the DataSource
lastLookup
private long lastLookup
- Time of last actual lookup action
ttl
private long ttl
- Time between two lookups
JndiDataSourceFactory
public JndiDataSourceFactory()
getDataSource
public javax.sql.DataSource getDataSource()
throws org.apache.torque.TorqueException
- Specified by:
getDataSource in interface DataSourceFactory
initialize
public void initialize(org.apache.commons.configuration.Configuration configuration)
throws org.apache.torque.TorqueException
- Description copied from interface:
DataSourceFactory
- Initialize the factory.
- Specified by:
initialize in interface DataSourceFactory
initJNDI
private void initJNDI(org.apache.commons.configuration.Configuration configuration)
throws org.apache.torque.TorqueException
- Initializes JNDI.
initDataSource
private void initDataSource(org.apache.commons.configuration.Configuration configuration)
throws org.apache.torque.TorqueException
- Initializes the DataSource.
debugCtx
private void debugCtx(javax.naming.Context ctx)
throws javax.naming.NamingException
bindDStoJndi
private void bindDStoJndi(javax.naming.Context ctx,
java.lang.String path,
java.lang.Object ds)
throws java.lang.Exception