com.cafesoft.core.jdbc
Class StandardConnectionPoolManager

java.lang.Object
  |
  +--com.cafesoft.core.jdbc.StandardConnectionPoolManager
All Implemented Interfaces:
ConnectionPoolManager, Debuggable, LoggerClient

public class StandardConnectionPoolManager
extends Object
implements ConnectionPoolManager

Standard implementation of the ConnectionPoolManager interface

Since:
11/1/02
See Also:
ConnectionPoolManager, ConnectionPool

Method Summary
 void addPool(String poolName, ConnectionPool pool)
          Add a ConnectionPool to the Manager
 void close()
          Close the ConnectionPoolManager NOTE: Once the manager is closed it cannot be restarted The close method will remove all ConnectionPools from any internal lists and will close them.
 ConnectionPoolManagerInfo getInfo()
          Get information about the ConnectionPoolManager
static ConnectionPoolManager getInstance()
          Static accessor that gets the Singleton instance of the ConnectionPoolManager.
 ConnectionPool getPool(String poolName, Properties info)
          Get the ConnectionPool with the given poolName
 String[] getPoolNames()
          Get all of the ConnectionPool names within the Manager
 ConnectionPool[] getPools()
          Get all ConnectionPools within the Manager
 boolean poolExists(String poolName)
          Determine if a ConnectionPool with the given name exists in the Manager
 ConnectionPool removePool(String poolName)
          Remove a ConnectionPool from the Manager
 boolean setDebug(boolean enable)
          Enable or disable debugging.
 void setLogger(Logger logger)
          Sets the logger.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static final ConnectionPoolManager getInstance()
Static accessor that gets the Singleton instance of the ConnectionPoolManager.

Returns:
the single ConnectionPoolManager instance

setLogger

public void setLogger(Logger logger)
Sets the logger.

Specified by:
setLogger in interface LoggerClient
Parameters:
logger - logs messages

setDebug

public boolean setDebug(boolean enable)
Enable or disable debugging.

Specified by:
setDebug in interface Debuggable
Parameters:
enable - if true, enable debugging, else disable debugging.
Returns:
the previous value of the debug flag, which is useful for restoring the debug state if temporarily changed.

getInfo

public ConnectionPoolManagerInfo getInfo()
Get information about the ConnectionPoolManager

Specified by:
getInfo in interface ConnectionPoolManager
Returns:
a ConnectionPoolManagerInfo object containing the current state of the ConnectionPoolManager

addPool

public void addPool(String poolName,
                    ConnectionPool pool)
             throws ConnectionPoolException
Add a ConnectionPool to the Manager

Specified by:
addPool in interface ConnectionPoolManager
Parameters:
poolName - the name of the pool
pool - the ConnectionPool object to add
Throws:
ConnectionPoolException - thrown if a ConnectionPool is already registered with the same name

removePool

public ConnectionPool removePool(String poolName)
Remove a ConnectionPool from the Manager

Specified by:
removePool in interface ConnectionPoolManager
Parameters:
poolName - the name of the ConnectionPool to remove
Returns:
the ConnectionPool that was just removed. If the pool does not exist then method will return null.

poolExists

public boolean poolExists(String poolName)
Determine if a ConnectionPool with the given name exists in the Manager

Specified by:
poolExists in interface ConnectionPoolManager
Parameters:
poolName - the name of the ConnectionPool to check
Returns:
true if a pool with the same name already exists in the manager, false otherwise

getPools

public ConnectionPool[] getPools()
Get all ConnectionPools within the Manager

Specified by:
getPools in interface ConnectionPoolManager
Returns:
an array of all managed ConnectionPools. If the manager does not contain any ConnectionPools a zero-length array will be returned

getPoolNames

public String[] getPoolNames()
Get all of the ConnectionPool names within the Manager

Specified by:
getPoolNames in interface ConnectionPoolManager
Returns:
an array of all managed ConnectionPool names. If the manager does not contain any ConnectionPools a zero-length array will be returned

getPool

public ConnectionPool getPool(String poolName,
                              Properties info)
                       throws ConnectionPoolException
Get the ConnectionPool with the given poolName

Specified by:
getPool in interface ConnectionPoolManager
Parameters:
poolName - the poolName of the ConnectionPool to get
info - Properties object which may contain authentication material. If authentication materials are included the two expected values are "user" and "password"
Returns:
the ConnectionPool if it exists, null otherwise
Throws:
ConnectionPoolException - thrown if authentication fails

close

public void close()
Close the ConnectionPoolManager

NOTE: Once the manager is closed it cannot be restarted

The close method will remove all ConnectionPools from any internal lists and will close them.

Specified by:
close in interface ConnectionPoolManager


Generated on 8:41:50 AM June 06, 2005, © 1996-2005 Cafésoft LLC. All rights reserved.