org.apache.cayenne.conf
Class JNDIDataSourceFactory

java.lang.Object
  extended by org.apache.cayenne.conf.JNDIDataSourceFactory
All Implemented Interfaces:
DataSourceFactory

public class JNDIDataSourceFactory
extends java.lang.Object
implements DataSourceFactory

Looks up DataSource objects via JNDI.

Author:
Andrei Adamchik

Field Summary
protected  Configuration parentConfig
           
 
Constructor Summary
JNDIDataSourceFactory()
           
 
Method Summary
 javax.sql.DataSource getDataSource(java.lang.String location)
          Attempts to load DataSource using JNDI.
 javax.sql.DataSource getDataSource(java.lang.String location, org.apache.log4j.Level logLevel)
          Deprecated. since 1.2
 void initializeWithParentConfiguration(Configuration conf)
          Initializes factory with the parent configuration object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

parentConfig

protected Configuration parentConfig
Constructor Detail

JNDIDataSourceFactory

public JNDIDataSourceFactory()
Method Detail

initializeWithParentConfiguration

public void initializeWithParentConfiguration(Configuration conf)
Description copied from interface: DataSourceFactory
Initializes factory with the parent configuration object.

Specified by:
initializeWithParentConfiguration in interface DataSourceFactory

getDataSource

public javax.sql.DataSource getDataSource(java.lang.String location,
                                          org.apache.log4j.Level logLevel)
                                   throws java.lang.Exception
Deprecated. since 1.2

Returns DataSource object corresponding to location. Location is expected to be a path mapped in JNDI InitialContext.

Specified by:
getDataSource in interface DataSourceFactory
Throws:
java.lang.Exception

getDataSource

public javax.sql.DataSource getDataSource(java.lang.String location)
                                   throws java.lang.Exception
Attempts to load DataSource using JNDI. In case of failure tries to get the DataSource with the same name from CayenneModeler preferences.

Specified by:
getDataSource in interface DataSourceFactory
Throws:
java.lang.Exception


Copyright © 2001-2006 Apache.org All Rights Reserved.