org.logicalcobwebs.proxool
Class ProxoolDataSource

java.lang.Object
  extended by org.logicalcobwebs.proxool.ProxoolDataSource
All Implemented Interfaces:
javax.naming.spi.ObjectFactory, javax.sql.DataSource

public class ProxoolDataSource
extends java.lang.Object
implements javax.sql.DataSource, javax.naming.spi.ObjectFactory

The Proxool DataSource implementation. Supports three modes of configuration:

TODO - expand

Since:
Proxool 0.9
Version:
$Revision: 1.4 $, $Date: 2004/08/19 12:28:28 $
Author:
bill, $Author: chr32 $ (current maintainer)

Field Summary
private  java.lang.String alias
           
private  java.lang.String driver
           
private  java.lang.String driverUrl
           
private  java.lang.String fatalSqlExceptionsAsString
          A String of all the fatalSqlExceptions delimited by ConnectionPoolDefinitionIF.FATAL_SQL_EXCEPTIONS_DELIMITER
private  java.lang.String fatalSqlExceptionWrapperClass
           
private  int houseKeepingSleepTime
           
private  java.lang.String houseKeepingTestSql
           
private  boolean jmx
           
private  java.lang.String jmxAgentId
           
private static Log LOG
           
private  int loginTimeout
           
private  java.io.PrintWriter logWriter
           
private  int maximumActiveTime
           
private  int maximumConnectionCount
           
private  int maximumConnectionLifetime
           
private  int minimumConnectionCount
           
private  int overloadWithoutRefusalLifetime
           
private  java.lang.String password
           
private  int prototypeCount
           
private  int recentlyStartedThreshold
           
private  int simultaneousBuildThrottle
           
private  java.lang.String statistics
           
private  java.lang.String statisticsLogLevel
           
private  boolean testAfterUse
           
private  boolean testBeforeUse
           
private  boolean trace
           
private  java.lang.String user
           
private  boolean verbose
           
 
Constructor Summary
ProxoolDataSource()
           
ProxoolDataSource(java.lang.String alias)
           
 
Method Summary
 java.lang.String getAlias()
           
 java.sql.Connection getConnection()
           
 java.sql.Connection getConnection(java.lang.String s, java.lang.String s1)
           
 java.lang.String getDriver()
           
 java.lang.String getDriverUrl()
           
 java.lang.String getFatalSqlExceptionsAsString()
           
 java.lang.String getFatalSqlExceptionWrapperClass()
           
 int getHouseKeepingSleepTime()
           
 java.lang.String getHouseKeepingTestSql()
           
 java.lang.String getJmxAgentId()
           
 int getLoginTimeout()
           
 java.io.PrintWriter getLogWriter()
           
 int getMaximumActiveTime()
           
 int getMaximumConnectionCount()
           
 int getMaximumConnectionLifetime()
           
 int getMinimumConnectionCount()
           
 java.lang.Object getObjectInstance(java.lang.Object refObject, javax.naming.Name name, javax.naming.Context context, java.util.Hashtable hashtable)
           
 int getOverloadWithoutRefusalLifetime()
           
 java.lang.String getPassword()
           
 int getPrototypeCount()
           
 int getRecentlyStartedThreshold()
           
 int getSimultaneousBuildThrottle()
           
 java.lang.String getStatistics()
           
 java.lang.String getStatisticsLogLevel()
           
 java.lang.String getUser()
           
 boolean isJmx()
           
 boolean isTestAfterUse()
           
 boolean isTestBeforeUse()
           
 boolean isTrace()
           
 boolean isVerbose()
           
private  void populatePropertiesFromReference(javax.naming.Reference reference)
           
private  void registerPool()
          Register a pool using the properties of this data source.
private  void reset()
          Reset all properties to their default values
 void setAlias(java.lang.String alias)
           
 void setDriver(java.lang.String driver)
           
 void setDriverUrl(java.lang.String url)
           
 void setFatalSqlExceptionsAsString(java.lang.String fatalSqlExceptionsAsString)
           
 void setFatalSqlExceptionWrapperClass(java.lang.String fatalSqlExceptionWrapperClass)
           
 void setHouseKeepingSleepTime(int houseKeepingSleepTime)
           
 void setHouseKeepingTestSql(java.lang.String houseKeepingTestSql)
           
 void setJmx(boolean jmx)
           
 void setJmxAgentId(java.lang.String jmxAgentId)
           
 void setLoginTimeout(int loginTimeout)
           
 void setLogWriter(java.io.PrintWriter logWriter)
           
 void setMaximumActiveTime(int maximumActiveTime)
           
 void setMaximumConnectionCount(int maximumConnectionCount)
           
 void setMaximumConnectionLifetime(int maximumConnectionLifetime)
           
 void setMinimumConnectionCount(int minimumConnectionCount)
           
 void setOverloadWithoutRefusalLifetime(int overloadWithoutRefusalLifetime)
           
 void setPassword(java.lang.String password)
           
 void setPrototypeCount(int prototypeCount)
           
 void setRecentlyStartedThreshold(int recentlyStartedThreshold)
           
 void setSimultaneousBuildThrottle(int simultaneousBuildThrottle)
           
 void setStatistics(java.lang.String statistics)
           
 void setStatisticsLogLevel(java.lang.String statisticsLogLevel)
           
 void setTestAfterUse(boolean testAfterUse)
           
 void setTestBeforeUse(boolean testBeforeUse)
           
 void setTrace(boolean trace)
           
 void setUser(java.lang.String user)
           
 void setVerbose(boolean verbose)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOG

private static final Log LOG

loginTimeout

private int loginTimeout

logWriter

private java.io.PrintWriter logWriter

alias

private java.lang.String alias

driver

private java.lang.String driver

fatalSqlExceptionWrapperClass

private java.lang.String fatalSqlExceptionWrapperClass

houseKeepingSleepTime

private int houseKeepingSleepTime

houseKeepingTestSql

private java.lang.String houseKeepingTestSql

maximumActiveTime

private int maximumActiveTime

maximumConnectionCount

private int maximumConnectionCount

maximumConnectionLifetime

private int maximumConnectionLifetime

minimumConnectionCount

private int minimumConnectionCount

overloadWithoutRefusalLifetime

private int overloadWithoutRefusalLifetime

password

private java.lang.String password

prototypeCount

private int prototypeCount

recentlyStartedThreshold

private int recentlyStartedThreshold

simultaneousBuildThrottle

private int simultaneousBuildThrottle

statistics

private java.lang.String statistics

statisticsLogLevel

private java.lang.String statisticsLogLevel

trace

private boolean trace

driverUrl

private java.lang.String driverUrl

user

private java.lang.String user

verbose

private boolean verbose

jmx

private boolean jmx

jmxAgentId

private java.lang.String jmxAgentId

testBeforeUse

private boolean testBeforeUse

testAfterUse

private boolean testAfterUse

fatalSqlExceptionsAsString

private java.lang.String fatalSqlExceptionsAsString
A String of all the fatalSqlExceptions delimited by ConnectionPoolDefinitionIF.FATAL_SQL_EXCEPTIONS_DELIMITER

Constructor Detail

ProxoolDataSource

public ProxoolDataSource()

ProxoolDataSource

public ProxoolDataSource(java.lang.String alias)
Method Detail

getConnection

public java.sql.Connection getConnection()
                                  throws java.sql.SQLException
Specified by:
getConnection in interface javax.sql.DataSource
Throws:
java.sql.SQLException
See Also:
DataSource.getConnection()

registerPool

private void registerPool()
                   throws ProxoolException
Register a pool using the properties of this data source. (Check that it exists first)

Throws:
ProxoolException - if the pool couldn't be registered

getObjectInstance

public java.lang.Object getObjectInstance(java.lang.Object refObject,
                                          javax.naming.Name name,
                                          javax.naming.Context context,
                                          java.util.Hashtable hashtable)
                                   throws java.lang.Exception
Specified by:
getObjectInstance in interface javax.naming.spi.ObjectFactory
Throws:
java.lang.Exception

getAlias

public java.lang.String getAlias()
See Also:
ConnectionPoolDefinitionIF.getAlias()

setAlias

public void setAlias(java.lang.String alias)
See Also:
ConnectionPoolDefinitionIF.getAlias()

getDriverUrl

public java.lang.String getDriverUrl()
See Also:
ConnectionPoolDefinitionIF.getUrl()

setDriverUrl

public void setDriverUrl(java.lang.String url)
See Also:
ConnectionPoolDefinitionIF.getUrl()

getDriver

public java.lang.String getDriver()
See Also:
ConnectionPoolDefinitionIF.getDriver()

setDriver

public void setDriver(java.lang.String driver)
See Also:
ConnectionPoolDefinitionIF.getDriver()

getMaximumConnectionLifetime

public int getMaximumConnectionLifetime()
See Also:
ConnectionPoolDefinitionIF.getMaximumConnectionLifetime()

setMaximumConnectionLifetime

public void setMaximumConnectionLifetime(int maximumConnectionLifetime)
See Also:
ConnectionPoolDefinitionIF.getMaximumConnectionLifetime()

getPrototypeCount

public int getPrototypeCount()
See Also:
ConnectionPoolDefinitionIF.getPrototypeCount()

setPrototypeCount

public void setPrototypeCount(int prototypeCount)
See Also:
ConnectionPoolDefinitionIF.getPrototypeCount()

getMinimumConnectionCount

public int getMinimumConnectionCount()
See Also:
ConnectionPoolDefinitionIF.getMinimumConnectionCount()

setMinimumConnectionCount

public void setMinimumConnectionCount(int minimumConnectionCount)
See Also:
ConnectionPoolDefinitionIF.getMinimumConnectionCount()

getMaximumConnectionCount

public int getMaximumConnectionCount()
See Also:
ConnectionPoolDefinitionIF.getMaximumConnectionCount()

setMaximumConnectionCount

public void setMaximumConnectionCount(int maximumConnectionCount)
See Also:
ConnectionPoolDefinitionIF.getMaximumConnectionCount()

getHouseKeepingSleepTime

public int getHouseKeepingSleepTime()
See Also:
ConnectionPoolDefinitionIF.getHouseKeepingSleepTime()

setHouseKeepingSleepTime

public void setHouseKeepingSleepTime(int houseKeepingSleepTime)
See Also:
ConnectionPoolDefinitionIF.getHouseKeepingSleepTime()

getSimultaneousBuildThrottle

public int getSimultaneousBuildThrottle()
See Also:
ConnectionPoolDefinitionIF.getSimultaneousBuildThrottle()

setSimultaneousBuildThrottle

public void setSimultaneousBuildThrottle(int simultaneousBuildThrottle)
See Also:
ConnectionPoolDefinitionIF.getSimultaneousBuildThrottle()

getRecentlyStartedThreshold

public int getRecentlyStartedThreshold()
See Also:
ConnectionPoolDefinitionIF.getRecentlyStartedThreshold()

setRecentlyStartedThreshold

public void setRecentlyStartedThreshold(int recentlyStartedThreshold)
See Also:
ConnectionPoolDefinitionIF.getRecentlyStartedThreshold()

getOverloadWithoutRefusalLifetime

public int getOverloadWithoutRefusalLifetime()
See Also:
ConnectionPoolDefinitionIF.getOverloadWithoutRefusalLifetime()

setOverloadWithoutRefusalLifetime

public void setOverloadWithoutRefusalLifetime(int overloadWithoutRefusalLifetime)
See Also:
ConnectionPoolDefinitionIF.getOverloadWithoutRefusalLifetime()

getMaximumActiveTime

public int getMaximumActiveTime()
See Also:
ConnectionPoolDefinitionIF.getMaximumActiveTime()

setMaximumActiveTime

public void setMaximumActiveTime(int maximumActiveTime)
See Also:
ConnectionPoolDefinitionIF.getMaximumActiveTime()

isVerbose

public boolean isVerbose()
See Also:
ConnectionPoolDefinitionIF.isVerbose()

setVerbose

public void setVerbose(boolean verbose)
See Also:
ConnectionPoolDefinitionIF.isVerbose()

isTrace

public boolean isTrace()
See Also:
ConnectionPoolDefinitionIF.isTrace()

setTrace

public void setTrace(boolean trace)
See Also:
ConnectionPoolDefinitionIF.isTrace()

getStatistics

public java.lang.String getStatistics()
See Also:
ConnectionPoolDefinitionIF.getStatistics()

setStatistics

public void setStatistics(java.lang.String statistics)
See Also:
ConnectionPoolDefinitionIF.getStatistics()

getStatisticsLogLevel

public java.lang.String getStatisticsLogLevel()
See Also:
ConnectionPoolDefinitionIF.getStatisticsLogLevel()

setStatisticsLogLevel

public void setStatisticsLogLevel(java.lang.String statisticsLogLevel)
See Also:
ConnectionPoolDefinitionIF.getStatisticsLogLevel()

getFatalSqlExceptionsAsString

public java.lang.String getFatalSqlExceptionsAsString()
See Also:
ConnectionPoolDefinitionIF.getFatalSqlExceptions()

setFatalSqlExceptionsAsString

public void setFatalSqlExceptionsAsString(java.lang.String fatalSqlExceptionsAsString)
See Also:
ConnectionPoolDefinitionIF.getFatalSqlExceptions()

getFatalSqlExceptionWrapperClass

public java.lang.String getFatalSqlExceptionWrapperClass()
See Also:
ConnectionPoolDefinitionIF.getFatalSqlExceptionWrapper()

setFatalSqlExceptionWrapperClass

public void setFatalSqlExceptionWrapperClass(java.lang.String fatalSqlExceptionWrapperClass)
See Also:
ConnectionPoolDefinitionIF.getFatalSqlExceptionWrapper()

getHouseKeepingTestSql

public java.lang.String getHouseKeepingTestSql()
See Also:
ConnectionPoolDefinitionIF.getHouseKeepingTestSql()

setHouseKeepingTestSql

public void setHouseKeepingTestSql(java.lang.String houseKeepingTestSql)
See Also:
ConnectionPoolDefinitionIF.getHouseKeepingTestSql()

getUser

public java.lang.String getUser()
See Also:
ConnectionPoolDefinitionIF.getUser()

setUser

public void setUser(java.lang.String user)
See Also:
ConnectionPoolDefinitionIF.getUser()

getPassword

public java.lang.String getPassword()
See Also:
ConnectionPoolDefinitionIF.getPassword()

setPassword

public void setPassword(java.lang.String password)
See Also:
ConnectionPoolDefinitionIF.getPassword()

isJmx

public boolean isJmx()
See Also:
ConnectionPoolDefinitionIF.isJmx()

setJmx

public void setJmx(boolean jmx)
See Also:
ConnectionPoolDefinitionIF.isJmx()

getJmxAgentId

public java.lang.String getJmxAgentId()
See Also:
ConnectionPoolDefinitionIF.getJmxAgentId()

setJmxAgentId

public void setJmxAgentId(java.lang.String jmxAgentId)
See Also:
ConnectionPoolDefinitionIF.getJmxAgentId()

isTestBeforeUse

public boolean isTestBeforeUse()
See Also:
ConnectionPoolDefinitionIF.isTestBeforeUse()

setTestBeforeUse

public void setTestBeforeUse(boolean testBeforeUse)
See Also:
ConnectionPoolDefinitionIF.isTestBeforeUse()

isTestAfterUse

public boolean isTestAfterUse()
See Also:
ConnectionPoolDefinitionIF.isTestAfterUse()

setTestAfterUse

public void setTestAfterUse(boolean testAfterUse)
See Also:
ConnectionPoolDefinitionIF.isTestAfterUse()

populatePropertiesFromReference

private void populatePropertiesFromReference(javax.naming.Reference reference)

reset

private void reset()
Reset all properties to their default values


getLogWriter

public java.io.PrintWriter getLogWriter()
                                 throws java.sql.SQLException
Specified by:
getLogWriter in interface javax.sql.DataSource
Throws:
java.sql.SQLException

getLoginTimeout

public int getLoginTimeout()
                    throws java.sql.SQLException
Specified by:
getLoginTimeout in interface javax.sql.DataSource
Throws:
java.sql.SQLException

setLogWriter

public void setLogWriter(java.io.PrintWriter logWriter)
                  throws java.sql.SQLException
Specified by:
setLogWriter in interface javax.sql.DataSource
Throws:
java.sql.SQLException

setLoginTimeout

public void setLoginTimeout(int loginTimeout)
                     throws java.sql.SQLException
Specified by:
setLoginTimeout in interface javax.sql.DataSource
Throws:
java.sql.SQLException

getConnection

public java.sql.Connection getConnection(java.lang.String s,
                                         java.lang.String s1)
                                  throws java.sql.SQLException
Specified by:
getConnection in interface javax.sql.DataSource
Throws:
java.sql.SQLException