org.opencms.db
Class CmsDbPool

java.lang.Object
  extended by org.opencms.db.CmsDbPool

public final class CmsDbPool
extends Object

Various methods to create DBCP pools.

Only JDBC Driver based pools are supported currently. JNDI DataSource based pools might be added probably later.

Please note: This class is subject to change in later versions. To obtain information about the connections, please use the CmsSqlManager.

Since:
6.0.0
Version:
$Revision: 1.45 $
Author:
Thomas Weckert

Field Summary
static String DBCP_JDBC_URL_PREFIX
          This prefix is required to make the JDBC DriverManager return pooled DBCP connections.
static String KEY_DATABASE
          Prefix for database keys.
static String KEY_DATABASE_NAME
          Key for the database name.
static String KEY_DATABASE_POOL
          Key for the pool id.
static String KEY_DATABASE_STATEMENTS
          Key for statement pooling.
static String KEY_JDBC_DRIVER
          Key for jdbc driver.
static String KEY_JDBC_URL
          Key for jdbc url.
static String KEY_JDBC_URL_PARAMS
          Key for jdbc url params.
static String KEY_MAX_ACTIVE
          Key for maximum active connections.
static String KEY_MAX_IDLE
          Key for maximum idle connections.
static String KEY_MAX_WAIT
          Key for maximum wait time.
static String KEY_PASSWORD
          Key for database password.
static String KEY_POOL_DEFAULT
          Key for default.
static String KEY_POOL_URL
          Key for pool url.
static String KEY_POOL_USER
          Key for pool user.
static String KEY_POOL_VFS
          Key for vfs pool.
static String KEY_POOLING
          Key for pooling flag.
static String KEY_TEST_ON_BORROW
          Key for test on borrow flag.
static String KEY_TEST_QUERY
          Key for test query.
static String KEY_USERNAME
          Key for user name.
static String KEY_WHEN_EXHAUSTED_ACTION
          Key for "when pool exhausted" action.
static String OPENCMS_DEFAULT_POOL_NAME
          The name of the opencms default pool.
static String OPENCMS_DEFAULT_POOL_URL
          The default OpenCms JDBC pool URL.
static String OPENCMS_URL_PREFIX
          The prefix used for opencms JDBC pools.
 
Method Summary
static PoolingDriver createDriverManagerConnectionPool(Map configuration, String key)
          Creates a JDBC DriverManager based DBCP connection pool.
static String getDbPoolName(Map configuration, String key)
          Returns the database pool name for a given configuration key.
static List getDbPoolNames(Map configuration)
          Returns a list of available database pool names.
static String getDefaultDbPoolName()
          Returns the name of the default database connection pool.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DBCP_JDBC_URL_PREFIX

public static final String DBCP_JDBC_URL_PREFIX
This prefix is required to make the JDBC DriverManager return pooled DBCP connections.

See Also:
Constant Field Values

KEY_DATABASE

public static final String KEY_DATABASE
Prefix for database keys.

See Also:
Constant Field Values

KEY_DATABASE_NAME

public static final String KEY_DATABASE_NAME
Key for the database name.

See Also:
Constant Field Values

KEY_DATABASE_POOL

public static final String KEY_DATABASE_POOL
Key for the pool id.

See Also:
Constant Field Values

KEY_DATABASE_STATEMENTS

public static final String KEY_DATABASE_STATEMENTS
Key for statement pooling.

See Also:
Constant Field Values

KEY_JDBC_DRIVER

public static final String KEY_JDBC_DRIVER
Key for jdbc driver.

See Also:
Constant Field Values

KEY_JDBC_URL

public static final String KEY_JDBC_URL
Key for jdbc url.

See Also:
Constant Field Values

KEY_JDBC_URL_PARAMS

public static final String KEY_JDBC_URL_PARAMS
Key for jdbc url params.

See Also:
Constant Field Values

KEY_MAX_ACTIVE

public static final String KEY_MAX_ACTIVE
Key for maximum active connections.

See Also:
Constant Field Values

KEY_MAX_IDLE

public static final String KEY_MAX_IDLE
Key for maximum idle connections.

See Also:
Constant Field Values

KEY_MAX_WAIT

public static final String KEY_MAX_WAIT
Key for maximum wait time.

See Also:
Constant Field Values

KEY_PASSWORD

public static final String KEY_PASSWORD
Key for database password.

See Also:
Constant Field Values

KEY_POOL_DEFAULT

public static final String KEY_POOL_DEFAULT
Key for default.

See Also:
Constant Field Values

KEY_POOL_URL

public static final String KEY_POOL_URL
Key for pool url.

See Also:
Constant Field Values

KEY_POOL_USER

public static final String KEY_POOL_USER
Key for pool user.

See Also:
Constant Field Values

KEY_POOL_VFS

public static final String KEY_POOL_VFS
Key for vfs pool.

See Also:
Constant Field Values

KEY_POOLING

public static final String KEY_POOLING
Key for pooling flag.

See Also:
Constant Field Values

KEY_TEST_ON_BORROW

public static final String KEY_TEST_ON_BORROW
Key for test on borrow flag.

See Also:
Constant Field Values

KEY_TEST_QUERY

public static final String KEY_TEST_QUERY
Key for test query.

See Also:
Constant Field Values

KEY_USERNAME

public static final String KEY_USERNAME
Key for user name.

See Also:
Constant Field Values

KEY_WHEN_EXHAUSTED_ACTION

public static final String KEY_WHEN_EXHAUSTED_ACTION
Key for "when pool exhausted" action.

See Also:
Constant Field Values

OPENCMS_DEFAULT_POOL_NAME

public static final String OPENCMS_DEFAULT_POOL_NAME
The name of the opencms default pool.

See Also:
Constant Field Values

OPENCMS_DEFAULT_POOL_URL

public static final String OPENCMS_DEFAULT_POOL_URL
The default OpenCms JDBC pool URL.

See Also:
Constant Field Values

OPENCMS_URL_PREFIX

public static final String OPENCMS_URL_PREFIX
The prefix used for opencms JDBC pools.

See Also:
Constant Field Values
Method Detail

createDriverManagerConnectionPool

public static PoolingDriver createDriverManagerConnectionPool(Map configuration,
                                                              String key)
                                                       throws Exception
Creates a JDBC DriverManager based DBCP connection pool.

Parameters:
configuration - the configuration (opencms.properties)
key - the key of the database pool in the configuration
Returns:
String the URL to access the created DBCP pool
Throws:
Exception - if the pool could not be initialized

getDbPoolName

public static String getDbPoolName(Map configuration,
                                   String key)
Returns the database pool name for a given configuration key.

Parameters:
configuration - the configuration
key - a db pool configuration key
Returns:
the database pool name

getDbPoolNames

public static List getDbPoolNames(Map configuration)
Returns a list of available database pool names.

Parameters:
configuration - the configuration
Returns:
a list of database pool names

getDefaultDbPoolName

public static String getDefaultDbPoolName()
Returns the name of the default database connection pool.

Returns:
the name of the default database connection pool