com.cafesoft.core.ldap.pool
Class LdapConnectionManager

java.lang.Object
  |
  +--com.cafesoft.core.ldap.pool.LdapConnectionManager

public class LdapConnectionManager
extends Object

Manager that manages various LdapConnectionPools for use with various applications. It allows for the registration, unregistration, and retrieval of connection pools.

Since:
11/7/01

Constructor Summary
LdapConnectionManager()
           
 
Method Summary
static void close()
          Close the LdapConnectionManager.
static String generatePoolId(Properties properties)
          Generate a unique Id for a LdapConnectionPool instance.
static String generatePoolId(String hostname, String port, String version, String username, String password)
          Generate a unique Id for a LdapConnectionPool instance.
static LdapConnectionPool getPool(Properties poolProperties)
          Get a LdapConnectionPool with a properties object that contains the hostname, port, version, username, password.
static LdapConnectionPool getPool(String poolId)
          Get a LdapConnectionPool with the specified poolId
static LdapConnectionPool getPool(String hostname, String port, String version, String username, String password)
          Get a LdapConnectionPool with the specified parameters
static void initialize(List connectionPropertiesList)
          Initialize the LdapConnectionManager
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LdapConnectionManager

public LdapConnectionManager()
Method Detail

initialize

public static void initialize(List connectionPropertiesList)
Initialize the LdapConnectionManager

Parameters:
connectionPropertiesList - a list of LdapConnectionPool properties objects. Each set of properties are used to create a new connection pool.

getPool

public static LdapConnectionPool getPool(String poolId)
                                  throws com.novell.ldap.LDAPException
Get a LdapConnectionPool with the specified poolId

Parameters:
poolId - the id of the connection pool to obtain
Returns:
return the requested LdapConnectionPool if it exists within the Manager, null if the Pool cannot be found or a parameter is wrong
Throws:
com.novell.ldap.LDAPException - thrown if the manager is not initialized

getPool

public static LdapConnectionPool getPool(Properties poolProperties)
                                  throws com.novell.ldap.LDAPException
Get a LdapConnectionPool with a properties object that contains the hostname, port, version, username, password.

Parameters:
poolProperties - a properties object that contains the hostname, port, version, username, and password
Returns:
the requested LdapConnectionPool if it exists within the Manager, null if the Poolcannot be found or a parameter is wrong
Throws:
com.novell.ldap.LDAPException - thrown if the manager is not initialized

getPool

public static LdapConnectionPool getPool(String hostname,
                                         String port,
                                         String version,
                                         String username,
                                         String password)
                                  throws com.novell.ldap.LDAPException
Get a LdapConnectionPool with the specified parameters

Parameters:
hostname - the hostname of the request pool
port - the port of the request pool
version - the version of the request pool
username - the username of the request pool
password - the password of the request pool
Returns:
the requested LdapConnectionPool if it exists within the Manager, null if the Pool cannot be found or a parameter is wrong
Throws:
com.novell.ldap.LDAPException - thrown if the manager is not initialized

generatePoolId

public static String generatePoolId(Properties properties)
Generate a unique Id for a LdapConnectionPool instance. Used as a key for insertion into an internal Map and also used to retrieve a LdapConnectionPool via the getPool(String poolId) method.

NOTE:If for any reason a parameter is missing or not properly configured a null string will be returned.

Parameters:
properties - a properties object that contains values for the hostname, port, version, username, and password.
Returns:
a string containing a unique string. The string is created by combining the hostname, port, version, username, password along with a "-" to separate each parameter and then performing the hashCode() method on that string

generatePoolId

public static String generatePoolId(String hostname,
                                    String port,
                                    String version,
                                    String username,
                                    String password)
Generate a unique Id for a LdapConnectionPool instance. Used as a key for insertion into an internal Map and also used to retrieve a LdapConnectionPool via the getPool(String poolId) method.

NOTE:If for any reason a parameter is missing or not properly configured a null string will be returned.

Parameters:
hostname - the hostname of the ldap repository
port - the port connecting to the ldap repository
version - the version of the repository
username - the username
password - the password
Returns:
a string containing a unique string. The string is created by combining the hostname, port, version, username, password along with a "-" to separate each parameter and then performing the hashCode() method on that string

close

public static void close()
                  throws com.novell.ldap.LDAPException
Close the LdapConnectionManager. Frees all connections and resources used by the various LdapConnectionPools

Throws:
com.novell.ldap.LDAPException - thrown if manager has not been initialized


Generated on 10:40:31 AM September 10, 2003, © 1996-2003 Cafésoft LLC. All rights reserved.