org.firebirdsql.pool
Class SimpleDataSource

java.lang.Object
  extended by org.firebirdsql.pool.SimpleDataSource
All Implemented Interfaces:
Wrapper, CommonDataSource, DataSource

public class SimpleDataSource
extends Object
implements DataSource

This is simple implementation of DataSource interface that uses ConnectionPoolDataSource as connection provider.

Author:
Roman Rokytskyy

Constructor Summary
SimpleDataSource(ConnectionPoolDataSource pool)
          Create instance of this class.
 
Method Summary
 Connection getConnection()
          Get JDBC connection.
 Connection getConnection(String username, String password)
          Get JDBC connection for the specified username and password.
 int getLoginTimeout()
           
 PrintWriter getLogWriter()
           
 boolean isWrapperFor(Class arg0)
           
 void setLoginTimeout(int seconds)
           
 void setLogWriter(PrintWriter out)
           
 Object unwrap(Class arg0)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleDataSource

public SimpleDataSource(ConnectionPoolDataSource pool)
Create instance of this class.

Parameters:
pool - instance of ConnectionPoolDataSource that will provide connections to this data source.
Method Detail

getConnection

public Connection getConnection()
                         throws SQLException
Get JDBC connection.

Specified by:
getConnection in interface DataSource
Returns:
instance of Connection from this data source.
Throws:
SQLException - if connection cannot be obtained.

getConnection

public Connection getConnection(String username,
                                String password)
                         throws SQLException
Get JDBC connection for the specified username and password.

Specified by:
getConnection in interface DataSource
Parameters:
username - username for new connection.
password - password corresponding to the username.
Returns:
instance of Connection.
Throws:
SQLException - if connection cannot be obtained.

getLogWriter

public PrintWriter getLogWriter()
                         throws SQLException
Specified by:
getLogWriter in interface CommonDataSource
Throws:
SQLException

getLoginTimeout

public int getLoginTimeout()
                    throws SQLException
Specified by:
getLoginTimeout in interface CommonDataSource
Throws:
SQLException

setLogWriter

public void setLogWriter(PrintWriter out)
                  throws SQLException
Specified by:
setLogWriter in interface CommonDataSource
Throws:
SQLException

setLoginTimeout

public void setLoginTimeout(int seconds)
                     throws SQLException
Specified by:
setLoginTimeout in interface CommonDataSource
Throws:
SQLException

isWrapperFor

public boolean isWrapperFor(Class arg0)
                     throws SQLException
Specified by:
isWrapperFor in interface Wrapper
Throws:
SQLException

unwrap

public Object unwrap(Class arg0)
              throws SQLException
Specified by:
unwrap in interface Wrapper
Throws:
SQLException


Copyright © 2001-2010. All Rights Reserved.