Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.torque.dsfactory
Class JndiDataSourceFactory

    java.lang.Object
      org.apache.torque.dsfactory.AbstractDataSourceFactory
          org.apache.torque.dsfactory.JndiDataSourceFactory

All Implemented Interfaces:
  DataSourceFactory

    public class JndiDataSourceFactory

extends AbstractDataSourceFactory

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 1336091 2012-05-09 11:09:40Z tfischer $
Author:
  John McNally, Thomas Vandahl

Field Summary
`static String` | `CLASSNAME_KEY` Key for the configuration property which contains the class name of the datasource to be bound into jndi.
`static String` | `DATASOURCE_KEY` Key for the configuration which contains properties for a DataSource which should be bound into jndi.
`static String` | `JNDI_KEY` Key for the configuration which contains jndi properties.
`static String` | `PATH_KEY` Key for the configuration property which contains the jndi path.
`static String` | `TIME_BETWEEN_LOOKUPS_KEY` Key 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`

Fields inherited from interface org.apache.torque.dsfactory.DataSourceFactory
`DSFACTORY_KEY, FACTORY_KEY`

Constructor Summary
`JndiDataSourceFactory()`

Method Summary
`void` | `close()` Does nothing.
`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`

Field Detail

### JNDI_KEY

    public static final String JNDI_KEY

  Key for the configuration which contains jndi properties.

  See Also:
    Constant Field Values

### PATH_KEY

    public static final String PATH_KEY

  Key for the configuration property which contains the jndi path.

  See Also:
    Constant Field Values

### TIME_BETWEEN_LOOKUPS_KEY

    public static final String TIME_BETWEEN_LOOKUPS_KEY

  Key for the configuration property which contains the time between two jndi lookups.

  See Also:
    Constant Field Values

### DATASOURCE_KEY

    public static final String DATASOURCE_KEY

  Key for the configuration which contains properties for a DataSource which should be bound into jndi.

  See Also:
    Constant Field Values

### CLASSNAME_KEY

    public static final String CLASSNAME_KEY

  Key for the configuration property which contains the class name of the datasource to be bound into jndi.

  See Also:
    Constant Field Values

Constructor Detail

### JndiDataSourceFactory

    public JndiDataSourceFactory()

Method Detail

### getDataSource

    public DataSource getDataSource()
                             throws TorqueException

  Specified by:
    `getDataSource` in interface `DataSourceFactory`
  Specified by:
    `getDataSource` in class `AbstractDataSourceFactory`
  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 class: `AbstractDataSourceFactory`
  Initialize the factory.

  Specified by:
    `initialize` in interface `DataSourceFactory`
  Specified by:
    `initialize` in class `AbstractDataSourceFactory`
  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)`

### 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.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2000-2013 The Apache Software Foundation. All Rights Reserved.