org.osesb.utilities.jdbc
Class DataSourceConnectionManager

java.lang.Object
  extended by org.osesb.utilities.jdbc.DataSourceConnectionManager
All Implemented Interfaces:
IConnectionManager

public class DataSourceConnectionManager
extends java.lang.Object
implements IConnectionManager

DataSourceConnectionManager is an implementation of IConnectionManager that manages database connections obtained from a DataSource that is registered with a JNDI naming service.

Implementation Notes:


Field Summary
protected  JDBCConfiguration jdbcConfiguration
          The JDBCConfiguration properties.
protected  java.lang.String thisClassName
          The full name of this class.
 
Constructor Summary
DataSourceConnectionManager(JDBCConfiguration jdbcConfiguration)
          Creates a new DriverConnectionManager with the given JDBC Configuration.
 
Method Summary
 java.sql.Connection getConnection()
          Returns the database connection, according to the properties in jdbcConfiguration.
static void main(java.lang.String[] args)
          main() For testing and sandboxing
 void releaseConnection(java.sql.Connection dbConn)
          Releases the database connection in the way that makes sense for the implementation.
 void reset()
          Resets the connection manager in the way that makes sense for the implementation.
 void stop()
          Stops the connection manager.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

thisClassName

protected java.lang.String thisClassName
The full name of this class.


jdbcConfiguration

protected JDBCConfiguration jdbcConfiguration
The JDBCConfiguration properties.

Constructor Detail

DataSourceConnectionManager

public DataSourceConnectionManager(JDBCConfiguration jdbcConfiguration)
                            throws java.lang.Exception
Creates a new DriverConnectionManager with the given JDBC Configuration.

Parameters:
jdbcConfiguration - The JDBCConfiguration to use for this DriverConnectionManager.
Throws:
java.lang.Exception - if constructed with a null jdbcConfiguration.
Method Detail

getConnection

public java.sql.Connection getConnection()
                                  throws java.lang.Exception
Returns the database connection, according to the properties in jdbcConfiguration.

Specified by:
getConnection in interface IConnectionManager
Returns:
A connection to the configured database.
Throws:
java.lang.Exception - if an error occurs while loading the JDBC driver or obtaining a connection.

releaseConnection

public void releaseConnection(java.sql.Connection dbConn)
Releases the database connection in the way that makes sense for the implementation.

Specified by:
releaseConnection in interface IConnectionManager
Parameters:
dbConn - A Connection obtained using a previous call to getConnection().

reset

public void reset()
Resets the connection manager in the way that makes sense for the implementation.

Specified by:
reset in interface IConnectionManager

stop

public void stop()
Stops the connection manager.

Specified by:
stop in interface IConnectionManager

main

public static void main(java.lang.String[] args)
main() For testing and sandboxing

Parameters:
args - The test data directory.