org.javasimon.jdbcx
Class SimonDataSource

java.lang.Object
  extended by org.javasimon.jdbcx.AbstractSimonDataSource
      extended by org.javasimon.jdbcx.SimonDataSource
All Implemented Interfaces:
Wrapper, CommonDataSource, DataSource

public final class SimonDataSource
extends AbstractSimonDataSource
implements DataSource

Wrapper class for real DataSource implementation, produces standard Connection object.

To use SimonDataSource, MUST properties are:

MAY properties are:

As mentioned in package description all getConnection methods just invokes real DataSource object methods and wraps obtained Connection with SimonConnection object.

Real DataSource is obtained in method datasource(). It tries to instantiate real datasource object by property realDataSourceClassName (setters and getters for properties are in AbstractSimonDataSource) and then sets basic properties (url, user, password).

Since:
1.0
Version:
$Revision: 304 $ $Date: 2011-04-08 10:39:02 +0200 (Fri, 08 Apr 2011) $
Author:
Radovan Sninsky

Field Summary
private  DataSource ds
           
 
Fields inherited from class org.javasimon.jdbcx.AbstractSimonDataSource
loginTimeout, logWriter, password, prefix, realDataSourceClassName, url, user
 
Constructor Summary
SimonDataSource()
           
 
Method Summary
private  DataSource datasource()
           
 Connection getConnection()
          Attempts to establish a connection with the data source that this DataSource object represents.
 Connection getConnection(String user, String password)
          Attempts to establish a connection with the data source that this DataSource object represents.
 
Methods inherited from class org.javasimon.jdbcx.AbstractSimonDataSource
getLoginTimeout, getLogWriter, getPassword, getPrefix, getRealDataSourceClassName, getUrl, getUser, setLoginTimeout, setLogWriter, setPassword, setPrefix, setRealDataSourceClassName, setUrl, setUser
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.sql.CommonDataSource
getLoginTimeout, getLogWriter, setLoginTimeout, setLogWriter
 
Methods inherited from interface java.sql.Wrapper
isWrapperFor, unwrap
 

Field Detail

ds

private DataSource ds
Constructor Detail

SimonDataSource

public SimonDataSource()
Method Detail

datasource

private DataSource datasource()
                       throws SQLException
Throws:
SQLException

getConnection

public Connection getConnection()
                         throws SQLException

Attempts to establish a connection with the data source that this DataSource object represents.

Specified by:
getConnection in interface DataSource
Returns:
a connection to the data source
Throws:
SQLException - if a database access error occurs

getConnection

public Connection getConnection(String user,
                                String password)
                         throws SQLException

Attempts to establish a connection with the data source that this DataSource object represents.

Specified by:
getConnection in interface DataSource
Parameters:
user - the database user on whose behalf the connection is being made
password - the user's password
Returns:
a connection to the data source
Throws:
SQLException - if a database access error occurs


Copyright © 2011. All Rights Reserved.