org.apache.torque.dsfactory
Class JndiDataSourceFactory

java.lang.Object
  extended byorg.apache.torque.dsfactory.AbstractDataSourceFactory
      extended byorg.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 $
Author:
John McNally, Thomas Vandahl

Field Summary
 
Fields inherited from class org.apache.torque.dsfactory.AbstractDataSourceFactory
CONNECTION_KEY, DEFAULT_CONNECTION_KEY, DEFAULT_POOL_KEY, POOL_KEY
 
Constructor Summary
JndiDataSourceFactory()
           
 
Method Summary
 javax.sql.DataSource getDataSource()
           
 void initialize(org.apache.commons.configuration.Configuration configuration)
          Initialize the factory.
 
Methods inherited from class org.apache.torque.dsfactory.AbstractDataSourceFactory
applyConfiguration, initCPDS, setProperty
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JndiDataSourceFactory

public JndiDataSourceFactory()
Method Detail

getDataSource

public javax.sql.DataSource getDataSource()
                                   throws TorqueException
Specified by:
getDataSource in interface DataSourceFactory
Returns:
the DataSource configured by the factory.
Throws:
TorqueException - if the source can't be returned
See Also:
DataSourceFactory.getDataSource()

initialize

public void initialize(org.apache.commons.configuration.Configuration configuration)
                throws TorqueException
Description copied from interface: DataSourceFactory
Initialize the factory.

Specified by:
initialize in interface DataSourceFactory
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:
DataSourceFactory.initialize(org.apache.commons.configuration.Configuration)


Copyright © 2000-2005 Apache Software Foundation. All Rights Reserved.