org.opencms.db
Class CmsSqlManager

java.lang.Object
  extended by org.opencms.db.CmsSqlManager
Direct Known Subclasses:
CmsSqlManager

public class CmsSqlManager
extends java.lang.Object

Superclass for all SQL manager implementations.

Since:
6.0.0
Version:
$Revision: 1.15 $
Author:
Carsten Weinholz

Constructor Summary
protected CmsSqlManager()
          Protected constructor to allow only subclassing.
protected CmsSqlManager(CmsDriverManager driverManager)
          Creates a new SQL manager from the provided driver manager.
 
Method Summary
 int getActiveConnections(java.lang.String dbPoolUrl)
          Returns the number of active connections managed by a pool.
 java.sql.Connection getConnection(java.lang.String dbPoolName)
          Returns a connection to the database using the given pool identified by its name.
 java.sql.Connection getConnectionByUrl(java.lang.String dbPoolUrl)
          Returns a connection to the database using the given pool identified by its full url.
 java.util.List getDbPoolUrls()
          Returns a list of available database connection pool names.
 java.lang.String getDefaultDbPoolName()
          Returns the name of the default database connection pool.
 int getIdleConnections(java.lang.String dbPoolUrl)
          Returns the number of idle connections managed by a pool.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CmsSqlManager

protected CmsSqlManager()
Protected constructor to allow only subclassing.


CmsSqlManager

protected CmsSqlManager(CmsDriverManager driverManager)
Creates a new SQL manager from the provided driver manager.

Parameters:
driverManager - the low level database driver manager
Method Detail

getActiveConnections

public int getActiveConnections(java.lang.String dbPoolUrl)
                         throws CmsDbException
Returns the number of active connections managed by a pool.

Parameters:
dbPoolUrl - the url of a pool
Returns:
the number of active connections
Throws:
CmsDbException - if something goes wrong

getConnection

public java.sql.Connection getConnection(java.lang.String dbPoolName)
                                  throws java.sql.SQLException
Returns a connection to the database using the given pool identified by its name.

Parameters:
dbPoolName - the pool name
Returns:
a database connection
Throws:
java.sql.SQLException - if something goes wrong

getConnectionByUrl

public java.sql.Connection getConnectionByUrl(java.lang.String dbPoolUrl)
                                       throws java.sql.SQLException
Returns a connection to the database using the given pool identified by its full url.

Parameters:
dbPoolUrl - the pool url
Returns:
a database connection
Throws:
java.sql.SQLException - if something goes wrong

getDbPoolUrls

public java.util.List getDbPoolUrls()
Returns a list of available database connection pool names.

Returns:
a list of database connection pool names

getDefaultDbPoolName

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

Returns:
the name of the default database connection pool

getIdleConnections

public int getIdleConnections(java.lang.String dbPoolUrl)
                       throws CmsDbException
Returns the number of idle connections managed by a pool.

Parameters:
dbPoolUrl - the url of a pool
Returns:
the number of idle connections
Throws:
CmsDbException - if something goes wrong