com.solarmetric.datasource
Class DataSourceImpl
java.lang.Object
|
+--com.solarmetric.datasource.DataSourceImpl
- All Implemented Interfaces:
- DataSource
- public class DataSourceImpl
- extends Object
- implements 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.
Inner Class Summary |
class |
DataSourceImpl.AbstractPool
|
static interface |
DataSourceImpl.Pool
|
class |
DataSourceImpl.SortablePool
Implementation of a Pool that relies on the underlying
Connection object to implement the Sortable interface
in such a way that the highest priority Connection to be
removed from the pool will be the last element in a sorted
list of Connection objects. |
Field Summary |
static boolean |
JDBC
|
static boolean |
SQL
|
JDBC
public static final boolean JDBC
SQL
public static final boolean SQL
DataSourceImpl
public DataSourceImpl()
DataSourceImpl
public DataSourceImpl(String url,
String driverName,
PrintWriter logWriter)
throws SQLException
DataSourceImpl
public DataSourceImpl(String url,
String driverName,
PrintWriter logWriter,
org.apache.commons.logging.Log jdbcLog,
org.apache.commons.logging.Log sqlLog)
throws SQLException
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 DataSource
setLogWriter
public void setLogWriter(PrintWriter out)
throws SQLException
- Specified by:
setLogWriter
in interface DataSource
setJDBCLog
public void setJDBCLog(org.apache.commons.logging.Log log)
setSQLLog
public void setSQLLog(org.apache.commons.logging.Log log)
getLoginTimeout
public int getLoginTimeout()
throws SQLException
- Specified by:
getLoginTimeout
in interface DataSource
setLoginTimeout
public void setLoginTimeout(int timeout)
throws SQLException
- Specified by:
setLoginTimeout
in interface 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)
isLogging
public boolean isLogging(boolean sql)
isTraceEnabled
public boolean isTraceEnabled(boolean sql)
getConnection
public Connection getConnection()
throws SQLException
- Specified by:
getConnection
in interface DataSource
getConnection
public Connection getConnection(String user,
String pass)
throws SQLException
- Specified by:
getConnection
in interface DataSource
getConnection
public Connection getConnection(JDBCConnectionRequestInfo cri)
throws SQLException
closeAll
public void closeAll()
- Close all pooled connections.
Copyright 2001,2002 SolarMetric, Inc. All Rights Reserved.