com.bm.utils
Class BasicDataSource

java.lang.Object
  extended by com.bm.utils.BasicDataSource
All Implemented Interfaces:
javax.sql.DataSource

public class BasicDataSource
extends java.lang.Object
implements javax.sql.DataSource

Basic implementation of javax.sql.DataSource that is configured via Ejb3Prop properties.

Author:
Daniel Wiese

Constructor Summary
BasicDataSource(Ejb3UnitCfg config)
          Constructor.
 
Method Summary
 java.sql.Connection getConnection()
          The connection.
 java.sql.Connection getConnection(java.lang.String username, java.lang.String password)
          
 int getLoginTimeout()
          
 java.io.PrintWriter getLogWriter()
          
 boolean isWrapperFor(java.lang.Class<?> forInterface)
          Does not wrap anything.
 void setLoginTimeout(int arg0)
          
 void setLogWriter(java.io.PrintWriter logger)
          
 void shutdownInMemoryDatabase()
          If the datasource is in memory this will shutdown the database.
<T> T
unwrap(java.lang.Class<T> arg0)
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BasicDataSource

public BasicDataSource(Ejb3UnitCfg config)
Constructor.

Parameters:
config - - die konfiguration.
Method Detail

getConnection

public java.sql.Connection getConnection()
                                  throws java.sql.SQLException
The connection.

Specified by:
getConnection in interface javax.sql.DataSource
Returns:
connection
Throws:
java.sql.SQLException
Since:
08.11.2005
See Also:
DataSource.getConnection()

getConnection

public java.sql.Connection getConnection(java.lang.String username,
                                         java.lang.String password)
                                  throws java.sql.SQLException

Specified by:
getConnection in interface javax.sql.DataSource
Throws:
java.sql.SQLException

getLogWriter

public java.io.PrintWriter getLogWriter()
                                 throws java.sql.SQLException

Specified by:
getLogWriter in interface javax.sql.DataSource
Throws:
java.sql.SQLException

setLogWriter

public void setLogWriter(java.io.PrintWriter logger)
                  throws java.sql.SQLException

Specified by:
setLogWriter in interface javax.sql.DataSource
Throws:
java.sql.SQLException

setLoginTimeout

public void setLoginTimeout(int arg0)
                     throws java.sql.SQLException

Specified by:
setLoginTimeout in interface javax.sql.DataSource
Throws:
java.sql.SQLException

getLoginTimeout

public int getLoginTimeout()
                    throws java.sql.SQLException

Specified by:
getLoginTimeout in interface javax.sql.DataSource
Throws:
java.sql.SQLException

shutdownInMemoryDatabase

public void shutdownInMemoryDatabase()
                              throws java.lang.Exception
If the datasource is in memory this will shutdown the database.

Throws:
java.lang.Exception

isWrapperFor

public boolean isWrapperFor(java.lang.Class<?> forInterface)
                     throws java.sql.SQLException
Does not wrap anything.

Parameters:
forInterface - for which interface
Returns:
always false
Throws:
java.sql.SQLException

unwrap

public <T> T unwrap(java.lang.Class<T> arg0)
         throws java.sql.SQLException

Throws:
java.sql.SQLException


Copyright © 2008. All Rights Reserved.