SolarMetric Kodo JDO 2.4.3 generated on March 27 2003

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
           
 
Constructor Summary
DataSourceImpl()
           
DataSourceImpl(String url, String driverName, PrintWriter logWriter)
           
DataSourceImpl(String url, String driverName, PrintWriter logWriter, org.apache.commons.logging.Log jdbcLog, org.apache.commons.logging.Log sqlLog)
           
 
Method Summary
 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()
           
 int getStatementCacheMax()
           
 boolean isLogging(boolean sql)
           
 boolean isTraceEnabled(boolean sql)
           
 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)
           
 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 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
 

Field Detail

JDBC

public static final boolean JDBC

SQL

public static final boolean SQL
Constructor Detail

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
Method Detail

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.

SolarMetric Kodo JDO 2.4.3 generated on March 27 2003

Copyright 2001,2002 SolarMetric, Inc. All Rights Reserved.