org.jtools.jpool.system
Class PoolManager

java.lang.Object
  extended byorg.jtools.jpool.system.PoolManager

public class PoolManager
extends java.lang.Object

 PoolManager Class
 This class represent the collection of pools. With the methods defined in this
 class you can access each existing pool based upon the xml configuration file.
 On creation of this object all the pools are created and held into a map. The
 necessary actions are also taken like registering of the jdbc driver(s) needed
 in order to work with the database(s).
 

Version:
$Id: PoolManager.java,v 1.1 2003/10/15 15:37:31 stfndln Exp $
Author:
Stefaan Delanghe (stfndln@yahoo.com)

Constructor Summary
PoolManager(java.util.Vector _configs)
          Construct the manager class based upon the configuration object created through the xml file.
 
Method Summary
protected  void deregisterDriver(java.lang.String _driver)
          Deregisters a given driver.
 Pool getPool(java.lang.String _name)
          Retrieves the pool object in order to access the database connections by it's given name as specified in the xml configuration file.
protected  void initialize(java.util.Vector _configs)
          Initializes the manager class by creating all the pools as defined in the xml configuration file.
protected  boolean isRegistered(java.lang.String _driver)
          Checks if a given jdbc driver is already registered or not
protected  void registerDriver(java.lang.String _driver)
          Registers a driver as specified in the configuration object(s).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PoolManager

public PoolManager(java.util.Vector _configs)
Construct the manager class based upon the configuration object created through the xml file.

Parameters:
_configs - The configuration objects read from the xml configuration file
Method Detail

initialize

protected void initialize(java.util.Vector _configs)
                   throws java.lang.Exception
Initializes the manager class by creating all the pools as defined in the xml configuration file.

Parameters:
_configs - The configuration objects as defined by the xml file
Throws:
java.lang.Exception - thrown when failed to initialize the pool manager

registerDriver

protected void registerDriver(java.lang.String _driver)
                       throws java.lang.ClassNotFoundException,
                              java.lang.IllegalAccessException,
                              java.lang.InstantiationException,
                              java.sql.SQLException
Registers a driver as specified in the configuration object(s).

Parameters:
_driver - The jdbc driver to register
Throws:
java.lang.ClassNotFoundException - thrown when the jdbc driver class was not found
java.lang.IllegalAccessException - thrown when an illegal access occures
java.lang.InstantiationException - thrown on problem of instantiating of the driver
java.sql.SQLException - thrown when a sql error occurs on registration of the driver

deregisterDriver

protected void deregisterDriver(java.lang.String _driver)
                         throws java.sql.SQLException
Deregisters a given driver. This is only neccessary if a specified driver is not needed anymore.

Parameters:
_driver - The jdbc driver to deregister
Throws:
java.sql.SQLException - thrown when an error occured on the deregistering of the driver

isRegistered

protected boolean isRegistered(java.lang.String _driver)
Checks if a given jdbc driver is already registered or not

Parameters:
_driver - The jdbc driver to check
Returns:
if jdbc driver is registered returns true otherwise returns false

getPool

public Pool getPool(java.lang.String _name)
Retrieves the pool object in order to access the database connections by it's given name as specified in the xml configuration file.

Parameters:
_name - The name of the database from which you want to retrieve the pool
Returns:
The corresponding pool object