com.nec.tdd.tools.dbMapper
Class JNDIDataSource

java.lang.Object
  |
  +--com.nec.tdd.tools.dbMapper.JNDIDataSource
All Implemented Interfaces:
DataSource

public class JNDIDataSource
extends java.lang.Object
implements DataSource

Wrapper class around javax.sql.DataSource class.


Constructor Summary
JNDIDataSource(javax.naming.InitialContext ctx, java.lang.String location)
          Constructs a JNDIDataSource object with given initial JNDI context and JNDI location of data-source.
JNDIDataSource(java.lang.String location)
          Constructs a JNDIDataSource object with given initial JNDI context and JNDI location of data-source.
JNDIDataSource(java.lang.String jndiFile, java.lang.String location)
          Constructs a JNDIDataSource object with given initial JNDI context and JNDI location of data-source.
 
Method Summary
 DBConnection getConnection()
          Get a DBConnection from the pool associated with this data-source.
 void releaseConnection(DBConnection conn)
          Method to release an previously acquired DBConnection.
 java.lang.String toString()
          Returns string representation of JNDIDataSource.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

JNDIDataSource

public JNDIDataSource(javax.naming.InitialContext ctx,
                      java.lang.String location)
               throws java.lang.Exception
Constructs a JNDIDataSource object with given initial JNDI context and JNDI location of data-source.
Parameters:
ctx - initial JNDI context
location - JNDI location of data-source
Throws:
java.lang.Exception - if a naming error occurs.

JNDIDataSource

public JNDIDataSource(java.lang.String location)
               throws java.lang.Exception
Constructs a JNDIDataSource object with given initial JNDI context and JNDI location of data-source.
Parameters:
ctx - initial JNDI context
location - JNDI location of data-source
Throws:
java.lang.Exception - if a naming error occurs.

JNDIDataSource

public JNDIDataSource(java.lang.String jndiFile,
                      java.lang.String location)
               throws java.lang.Exception
Constructs a JNDIDataSource object with given initial JNDI context and JNDI location of data-source.
Parameters:
ctx - initial JNDI context
jndiFile - Absolute file name of JNDI file to create InitialContext
location - JNDI location of data-source
Throws:
java.lang.Exception - if a naming error occurs.
Method Detail

getConnection

public DBConnection getConnection()
Get a DBConnection from the pool associated with this data-source.
Specified by:
getConnection in interface DataSource
Returns:
A DBConnection from the pool if available. Null if all connections are already in use for this connection manager.

releaseConnection

public void releaseConnection(DBConnection conn)
Method to release an previously acquired DBConnection.
Specified by:
releaseConnection in interface DataSource
Parameters:
conn - DBConnection to be released.

toString

public java.lang.String toString()
Returns string representation of JNDIDataSource.
Overrides:
toString in class java.lang.Object