Class LdapConnectionProvider


  • public class LdapConnectionProvider
    extends Object
    This utility manages the LDAP connection pools and provides methods for adding / removing connections from the three pools.
    • Admin Connections - bound with ldap service account creds
    • User Connections - unbound used for authentication
    • Audit Log Connections - bound with slapo access log service account creds (OpenLDAP only)
    Each connection pool is initialized on first invocation of getInstance() which stores a reference to self used by subsequent callers.

    This class is not thread safe.

    Author:
    Apache Directory Project
    • Method Detail

      • getInstance

        public static LdapConnectionProvider getInstance()
        Synchronized getter guards access to reference to self which is a singleton and only be created the first time invoked.
        Returns:
        reference to self.
      • closeAdminConnection

        public void closeAdminConnection​(org.apache.directory.ldap.client.api.LdapConnection connection)
        Calls the PoolMgr to close the Admin LDAP connection.
        Parameters:
        connection - handle to ldap connection object.
      • closeLogConnection

        public void closeLogConnection​(org.apache.directory.ldap.client.api.LdapConnection connection)
        Calls the PoolMgr to close the Log LDAP connection.
        Parameters:
        connection - handle to ldap connection object.
      • closeUserConnection

        public void closeUserConnection​(org.apache.directory.ldap.client.api.LdapConnection connection)
        Calls the PoolMgr to close the User LDAP connection.
        Parameters:
        connection - handle to ldap connection object.
      • getAdminConnection

        public org.apache.directory.ldap.client.api.LdapConnection getAdminConnection()
                                                                               throws org.apache.directory.api.ldap.model.exception.LdapException
        Calls the PoolMgr to get an Admin connection to the LDAP server.
        Returns:
        ldap connection.
        Throws:
        org.apache.directory.api.ldap.model.exception.LdapException - If we had an issue getting an LDAP connection
      • getLogConnection

        public org.apache.directory.ldap.client.api.LdapConnection getLogConnection()
                                                                             throws org.apache.directory.api.ldap.model.exception.LdapException
        Calls the PoolMgr to get an Log connection to the LDAP server.
        Returns:
        ldap connection.
        Throws:
        org.apache.directory.api.ldap.model.exception.LdapException - If we had an issue getting an LDAP connection
      • getUserConnection

        public org.apache.directory.ldap.client.api.LdapConnection getUserConnection()
                                                                              throws org.apache.directory.api.ldap.model.exception.LdapException
        Calls the PoolMgr to get an User connection to the LDAP server.
        Returns:
        ldap connection.
        Throws:
        org.apache.directory.api.ldap.model.exception.LdapException - If we had an issue getting an LDAP connection
      • closeAllConnectionPools

        public static void closeAllConnectionPools()
        Closes all the ldap connection pools.