|
|||||||||
| Home >> All >> com >> jcorporate >> expresso >> core >> [ db overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
com.jcorporate.expresso.core.db
Class SimpleDataSource

java.lang.Objectcom.jcorporate.expresso.core.db.SimpleDataSource
- All Implemented Interfaces:
- javax.sql.DataSource
- public class SimpleDataSource
- extends java.lang.Object
- implements javax.sql.DataSource
- extends java.lang.Object
DataConnectionPool is an implementation of the javax.sql.DataSource.
Normally you would get an instance of the DataConnectionPool using
DBConnectionPool.getDataSource(String)
Typical Usage:
javax.sql.DataSource dataSource = DBConnectionPool.getDataSource("default");
java.sql.Connection connection = dataSource.getConnection();
...
connection.close();
| Field Summary | |
private static org.apache.log4j.Logger |
log
The log4j Logger |
private java.io.PrintWriter |
logWriter
|
private DBConnectionPool |
poolInstance
The pool instance |
| Constructor Summary | |
SimpleDataSource(DBConnectionPool newPoolInstance)
Wrapping constructor. |
|
| Method Summary | |
java.sql.Connection |
getConnection()
Retreive a java.sql.Connection for this data source. |
java.sql.Connection |
getConnection(java.lang.String username,
java.lang.String password)
[Unused] |
protected DBConnectionPool |
getConnectionPool()
Helper method to retrieve the instance of the connectionPool we're attached to |
int |
getLoginTimeout()
Retrieve the login timeout [unimplemented] |
java.io.PrintWriter |
getLogWriter()
Retrieve the current logWriter. |
void |
setLoginTimeout(int seconds)
Set the login timeout. |
void |
setLogWriter(java.io.PrintWriter out)
Sets the log writer and thus turns on logging |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
logWriter
private java.io.PrintWriter logWriter
log
private static final org.apache.log4j.Logger log
- The log4j Logger
poolInstance
private DBConnectionPool poolInstance
- The pool instance
| Constructor Detail |
SimpleDataSource
public SimpleDataSource(DBConnectionPool newPoolInstance)
- Wrapping constructor. Takes a DBConnectionPool instance and wraps it
for the DataSource implementation
| Method Detail |
getConnectionPool
protected DBConnectionPool getConnectionPool()
- Helper method to retrieve the instance of the connectionPool we're attached
to
getConnection
public java.sql.Connection getConnection() throws java.sql.SQLException
- Retreive a java.sql.Connection for this data source. It does not attempt
to retrieve pooled connections.
- Specified by:
getConnectionin interfacejavax.sql.DataSource
getConnection
public java.sql.Connection getConnection(java.lang.String username, java.lang.String password) throws java.sql.SQLException
- [Unused]
Normally would retrieve a connection with the given username and password. However, that is not possible with the Expresso's DBConnectionPool which manages the default username and password as given in the configuration file. So this implementation logs a warning about this method and falls back to
getConnection()- Specified by:
getConnectionin interfacejavax.sql.DataSource
getLogWriter
public java.io.PrintWriter getLogWriter() throws java.sql.SQLException
- Retrieve the current logWriter. Default is null
- Specified by:
getLogWriterin interfacejavax.sql.DataSource
setLogWriter
public void setLogWriter(java.io.PrintWriter out) throws java.sql.SQLException
- Sets the log writer and thus turns on logging
- Specified by:
setLogWriterin interfacejavax.sql.DataSource
setLoginTimeout
public void setLoginTimeout(int seconds)
throws java.sql.SQLException
- Set the login timeout. [unimplemented]
- Specified by:
setLoginTimeoutin interfacejavax.sql.DataSource
getLoginTimeout
public int getLoginTimeout()
throws java.sql.SQLException
- Retrieve the login timeout [unimplemented]
- Specified by:
getLoginTimeoutin interfacejavax.sql.DataSource
|
|||||||||
| Home >> All >> com >> jcorporate >> expresso >> core >> [ db overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC
com.jcorporate.expresso.core.db.SimpleDataSource