com.solarmetric.datasource
Class DataSourceImpl
java.lang.Object
|
+--com.solarmetric.datasource.DataSourceImpl
- All Implemented Interfaces:
- javax.sql.DataSource
- public class DataSourceImpl
- extends Object
- implements javax.sql.DataSource
Implementation of the DataSource
interface that maintains a
back-end connection pool.
Connections that are closed will be returned to the poll, unless
the pool capacity is full, or any SQLExceptions have occured on
any of the Connection's Statements in the course of its lifetime.
Field Summary |
static boolean |
JDBC
|
static boolean |
SQL
|
Method Summary |
(package private) void |
close(PoolConnection conn)
Return the given connection to the pool. |
void |
closeAll()
Close all pooled connections. |
Connection |
getConnection()
|
Connection |
getConnection(JDBCConnectionRequestInfo cri)
|
Connection |
getConnection(String user,
String pass)
|
Class |
getConnectionDriverClass()
|
String |
getConnectionDriverName()
|
int |
getConnectionTestTimeout()
|
String |
getConnectionURL()
|
String |
getConnectionUserName()
|
int |
getLoginTimeout()
|
PrintWriter |
getLogWriter()
|
int |
getMaxPool()
|
int |
getMinPool()
|
org.apache.commons.logging.Log |
getPerformanceLog()
|
int |
getStatementCacheMax()
|
boolean |
isLogging(boolean sql)
|
protected boolean |
isLogging(org.apache.commons.logging.Log log)
|
boolean |
isTraceEnabled(boolean sql)
|
protected boolean |
isTraceEnabled(org.apache.commons.logging.Log log)
|
void |
log(String msg,
Connection conn,
boolean sql)
Log a message to the source's stream. |
void |
log(String msg,
Connection conn,
Throwable t,
boolean sql)
|
protected void |
log(String msg,
Connection conn,
Throwable t,
org.apache.commons.logging.Log log)
|
void |
setConnectionDriverClass(Class driverClass)
|
void |
setConnectionDriverName(String val)
|
void |
setConnectionPassword(String val)
|
void |
setConnectionTestTimeout(int seconds)
|
void |
setConnectionURL(String val)
|
void |
setConnectionUserName(String val)
|
void |
setDriverProperties(Properties props)
|
void |
setJDBCLog(org.apache.commons.logging.Log log)
|
void |
setLoginTimeout(int timeout)
|
void |
setLogWriter(PrintWriter out)
|
void |
setMaxPool(int val)
|
void |
setMinPool(int val)
|
void |
setPerformanceLog(org.apache.commons.logging.Log log)
|
void |
setSQLLog(org.apache.commons.logging.Log log)
|
void |
setStatementCacheMax(int max)
|
String |
toString()
|
StringBuffer |
toString(StringBuffer buffer)
|
void |
warn(String msg,
Connection conn,
Throwable t,
boolean sql)
|
Methods inherited from class java.lang.Object |
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
JDBC
public static final boolean JDBC
SQL
public static final boolean SQL
DataSourceImpl
public DataSourceImpl()
setDriverProperties
public void setDriverProperties(Properties props)
toString
public StringBuffer toString(StringBuffer buffer)
toString
public String toString()
- Overrides:
toString
in class Object
getConnectionUserName
public String getConnectionUserName()
setConnectionUserName
public void setConnectionUserName(String val)
setConnectionPassword
public void setConnectionPassword(String val)
getConnectionURL
public String getConnectionURL()
setConnectionURL
public void setConnectionURL(String val)
getConnectionDriverName
public String getConnectionDriverName()
setConnectionDriverName
public void setConnectionDriverName(String val)
setConnectionDriverClass
public void setConnectionDriverClass(Class driverClass)
getConnectionDriverClass
public Class getConnectionDriverClass()
setStatementCacheMax
public void setStatementCacheMax(int max)
getStatementCacheMax
public int getStatementCacheMax()
getMaxPool
public int getMaxPool()
setMaxPool
public void setMaxPool(int val)
getMinPool
public int getMinPool()
setMinPool
public void setMinPool(int val)
getLogWriter
public PrintWriter getLogWriter()
throws SQLException
- Specified by:
getLogWriter
in interface javax.sql.DataSource
setLogWriter
public void setLogWriter(PrintWriter out)
throws SQLException
- Specified by:
setLogWriter
in interface javax.sql.DataSource
setJDBCLog
public void setJDBCLog(org.apache.commons.logging.Log log)
setSQLLog
public void setSQLLog(org.apache.commons.logging.Log log)
setPerformanceLog
public void setPerformanceLog(org.apache.commons.logging.Log log)
getPerformanceLog
public org.apache.commons.logging.Log getPerformanceLog()
getLoginTimeout
public int getLoginTimeout()
throws SQLException
- Specified by:
getLoginTimeout
in interface javax.sql.DataSource
setLoginTimeout
public void setLoginTimeout(int timeout)
throws SQLException
- Specified by:
setLoginTimeout
in interface javax.sql.DataSource
getConnectionTestTimeout
public int getConnectionTestTimeout()
setConnectionTestTimeout
public void setConnectionTestTimeout(int seconds)
log
public void log(String msg,
Connection conn,
boolean sql)
- Log a message to the source's stream.
warn
public void warn(String msg,
Connection conn,
Throwable t,
boolean sql)
log
public void log(String msg,
Connection conn,
Throwable t,
boolean sql)
log
protected void log(String msg,
Connection conn,
Throwable t,
org.apache.commons.logging.Log log)
isLogging
public boolean isLogging(boolean sql)
isLogging
protected boolean isLogging(org.apache.commons.logging.Log log)
isTraceEnabled
public boolean isTraceEnabled(boolean sql)
isTraceEnabled
protected boolean isTraceEnabled(org.apache.commons.logging.Log log)
getConnection
public Connection getConnection()
throws SQLException
- Specified by:
getConnection
in interface javax.sql.DataSource
getConnection
public Connection getConnection(String user,
String pass)
throws SQLException
- Specified by:
getConnection
in interface javax.sql.DataSource
getConnection
public Connection getConnection(JDBCConnectionRequestInfo cri)
throws SQLException
close
void close(PoolConnection conn)
- Return the given connection to the pool.
closeAll
public void closeAll()
- Close all pooled connections.
Copyright 2001,2002,2003 SolarMetric, Inc. All Rights Reserved.