ca.bc.gov.webade.dbpool
Class ConnectionPoolParams

java.lang.Object
  extended byca.bc.gov.webade.dbpool.ConnectionPoolParams

public final class ConnectionPoolParams
extends java.lang.Object

Author:
jross

Field Summary
static java.lang.String DATABASE_PASSWORD
          The JDBC password for the target database
static java.lang.String DATABASE_URL
          The JDBC URL for the target database
static java.lang.String DATABASE_USER
          The JDBC user name for the target database
static int DEFAULT_MAX_CHECKOUT_TIME
          The default pool connection maximum checkout time value.
static int DEFAULT_MAX_CONNECTIONS
          The default pool maximum connections value.
static int DEFAULT_MAX_IDLE_TIME
          The default pool connection maximum idle time value.
static int DEFAULT_MAX_WAIT_TIME
          The default pool connection maximum wait time value.
static int DEFAULT_MIN_CONNECTIONS
          The default pool minimum connections value.
static int DEFAULT_MONITOR_SLEEP_TIME
          The default pool sleep time value.
static boolean DEFAULT_PING_CONNECTIONS_FLAG
          The default ping connections flag value.
static boolean DEFAULT_POOL_CONNECTIONS_FLAG
          The default pool connections flag value.
static java.lang.String MAX_CONNECTION_CHECKOUT_TIME
          The maximum time, in minutes, a connection should remain checked out of the pool (0 if the connection should be left open indefinitely).
static java.lang.String MAX_CONNECTION_IDLE_TIME
          The maximum time, in minutes, a connection should remain open while available in the pool (0 if the connection should be left open indefinitely).
static java.lang.String MAX_CONNECTION_WAIT_TIME
          The maximum time, in milliseconds, a thread should block while waiting for a connection from the pool (0 if the thread should block indefinitely, -1 of it should never block).
static java.lang.String MAX_CONNECTIONS
          The maximum number of database connections to be opened at one time.
static java.lang.String MIN_CONNECTIONS
          The minimum number of database connections to be opened at one time.
static java.lang.String MONITOR_SLEEP_TIME
          The wait time, in minutes, the monitor thread will wait between connection pool checks.
static java.lang.String PING_CONNECTIONS_FLAG
          A flag indicating whether or not to test every database connection before allowing it to be checked out.
static java.lang.String POOL_CONNECTIONS_FLAG
          A flag indicating whether or not to pool database connections.
 
Constructor Summary
ConnectionPoolParams()
          Default constructor
ConnectionPoolParams(java.util.Properties props)
          Create a params object with the given config properties.
 
Method Summary
 long getMaxCheckoutTime()
           
 int getMaxConnections()
           
 long getMaxIdleTime()
           
 long getMaxWaitTime()
           
 int getMinConnections()
           
 long getMonitorSleepTime()
           
 java.lang.String getUrl()
           
 java.lang.String getUser()
           
 void setMaxCheckoutTime(long maxCheckoutTime)
           
 void setMaxConnections(int maxConnections)
           
 void setMaxIdleTime(long maxIdleTime)
           
 void setMaxWaitTime(long maxWaitTime)
           
 void setMinConnections(int minConnections)
           
 void setMonitorSleepTime(long monitorSleepTime)
           
 void setPassword(java.lang.String password)
           
 void setPingConnections(boolean shouldPingConnections)
           
 void setPoolConnections(boolean shouldPoolConnections)
           
 void setUrl(java.lang.String url)
           
 void setUser(java.lang.String user)
           
 boolean shouldPingConnections()
           
 boolean shouldPoolConnections()
           
 java.lang.String toString()
           
 void validateSettings()
          Validates the current settings for the connection pool.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DATABASE_URL

public static final java.lang.String DATABASE_URL
The JDBC URL for the target database

See Also:
Constant Field Values

DATABASE_USER

public static final java.lang.String DATABASE_USER
The JDBC user name for the target database

See Also:
Constant Field Values

DATABASE_PASSWORD

public static final java.lang.String DATABASE_PASSWORD
The JDBC password for the target database

See Also:
Constant Field Values

MIN_CONNECTIONS

public static final java.lang.String MIN_CONNECTIONS
The minimum number of database connections to be opened at one time.

See Also:
Constant Field Values

MAX_CONNECTIONS

public static final java.lang.String MAX_CONNECTIONS
The maximum number of database connections to be opened at one time.

See Also:
Constant Field Values

MAX_CONNECTION_IDLE_TIME

public static final java.lang.String MAX_CONNECTION_IDLE_TIME
The maximum time, in minutes, a connection should remain open while available in the pool (0 if the connection should be left open indefinitely).

See Also:
Constant Field Values

MAX_CONNECTION_CHECKOUT_TIME

public static final java.lang.String MAX_CONNECTION_CHECKOUT_TIME
The maximum time, in minutes, a connection should remain checked out of the pool (0 if the connection should be left open indefinitely).

See Also:
Constant Field Values

MAX_CONNECTION_WAIT_TIME

public static final java.lang.String MAX_CONNECTION_WAIT_TIME
The maximum time, in milliseconds, a thread should block while waiting for a connection from the pool (0 if the thread should block indefinitely, -1 of it should never block).

See Also:
Constant Field Values

MONITOR_SLEEP_TIME

public static final java.lang.String MONITOR_SLEEP_TIME
The wait time, in minutes, the monitor thread will wait between connection pool checks.

See Also:
Constant Field Values

POOL_CONNECTIONS_FLAG

public static final java.lang.String POOL_CONNECTIONS_FLAG
A flag indicating whether or not to pool database connections.

See Also:
Constant Field Values

PING_CONNECTIONS_FLAG

public static final java.lang.String PING_CONNECTIONS_FLAG
A flag indicating whether or not to test every database connection before allowing it to be checked out. Acceptable values are true or false.

See Also:
Constant Field Values

DEFAULT_MIN_CONNECTIONS

public static final int DEFAULT_MIN_CONNECTIONS
The default pool minimum connections value.

See Also:
Constant Field Values

DEFAULT_MAX_CONNECTIONS

public static final int DEFAULT_MAX_CONNECTIONS
The default pool maximum connections value.

See Also:
Constant Field Values

DEFAULT_MAX_IDLE_TIME

public static final int DEFAULT_MAX_IDLE_TIME
The default pool connection maximum idle time value.

See Also:
Constant Field Values

DEFAULT_MAX_CHECKOUT_TIME

public static final int DEFAULT_MAX_CHECKOUT_TIME
The default pool connection maximum checkout time value.

See Also:
Constant Field Values

DEFAULT_MAX_WAIT_TIME

public static final int DEFAULT_MAX_WAIT_TIME
The default pool connection maximum wait time value.

See Also:
Constant Field Values

DEFAULT_MONITOR_SLEEP_TIME

public static final int DEFAULT_MONITOR_SLEEP_TIME
The default pool sleep time value.

See Also:
Constant Field Values

DEFAULT_POOL_CONNECTIONS_FLAG

public static final boolean DEFAULT_POOL_CONNECTIONS_FLAG
The default pool connections flag value.

See Also:
Constant Field Values

DEFAULT_PING_CONNECTIONS_FLAG

public static final boolean DEFAULT_PING_CONNECTIONS_FLAG
The default ping connections flag value.

See Also:
Constant Field Values
Constructor Detail

ConnectionPoolParams

public ConnectionPoolParams()
Default constructor


ConnectionPoolParams

public ConnectionPoolParams(java.util.Properties props)
                     throws ConnectionPoolInitializationException
Create a params object with the given config properties.

Parameters:
props - The name-value pairs of configuration settings.
Throws:
ConnectionPoolInitializationException - Thrown if the given configuration settings are invalid.
Method Detail

getMinConnections

public int getMinConnections()
Returns:
Returns the minConnections.

setMinConnections

public void setMinConnections(int minConnections)
Parameters:
minConnections - The minConnections to set.

getMaxConnections

public int getMaxConnections()
Returns:
Returns the maxConnections.

setMaxConnections

public void setMaxConnections(int maxConnections)
Parameters:
maxConnections - The maxConnections to set.

getMaxIdleTime

public long getMaxIdleTime()
Returns:
Returns the maxIdleTime.

setMaxIdleTime

public void setMaxIdleTime(long maxIdleTime)
Parameters:
maxIdleTime - The maxIdleTime to set.

getMaxCheckoutTime

public long getMaxCheckoutTime()
Returns:
Returns the maxCheckoutTime.

setMaxCheckoutTime

public void setMaxCheckoutTime(long maxCheckoutTime)
Parameters:
maxCheckoutTime - The maxCheckoutTime to set.

getMaxWaitTime

public long getMaxWaitTime()
Returns:
Returns the maxWaitTime.

setMaxWaitTime

public void setMaxWaitTime(long maxWaitTime)
Parameters:
maxWaitTime - The maxWaitTime to set.

getMonitorSleepTime

public long getMonitorSleepTime()
Returns:
Returns the monitorSleepTime.

setMonitorSleepTime

public void setMonitorSleepTime(long monitorSleepTime)
Parameters:
monitorSleepTime - The monitorSleepTime to set.

getUrl

public java.lang.String getUrl()
Returns:
Returns the url.

setUrl

public void setUrl(java.lang.String url)
Parameters:
url - The url to set.

getUser

public java.lang.String getUser()
Returns:
Returns the user.

setUser

public void setUser(java.lang.String user)
Parameters:
user - The user to set.

setPassword

public void setPassword(java.lang.String password)
Parameters:
password - The password to set.

shouldPoolConnections

public boolean shouldPoolConnections()
Returns:
Returns the Pool Connections flag.

setPoolConnections

public void setPoolConnections(boolean shouldPoolConnections)
Parameters:
shouldPoolConnections - The Pool Connections flag to set.

shouldPingConnections

public boolean shouldPingConnections()
Returns:
Returns the Ping Connections flag.

setPingConnections

public void setPingConnections(boolean shouldPingConnections)
Parameters:
shouldPingConnections - The Ping Connections flag to set.

validateSettings

public void validateSettings()
                      throws ConnectionPoolInitializationException
Validates the current settings for the connection pool.

Throws:
ConnectionPoolInitializationException

toString

public java.lang.String toString()
See Also:
Object.toString()