public final class LdapApiIntegrationUtils
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
private static java.lang.String |
DEFAULT_ADMIN
The Constant DEFAULT_ADMIN.
|
private static java.lang.String |
DEFAULT_HOST
The Constant DEFAULT_HOST.
|
private static java.lang.String |
DEFAULT_PASSWORD
The Constant DEFAULT_PASSWORD.
|
private static java.util.Map<java.lang.Integer,org.apache.directory.ldap.client.api.LdapConnectionPool> |
POOLS
The pools.
|
| Modifier | Constructor and Description |
|---|---|
private |
LdapApiIntegrationUtils() |
| Modifier and Type | Method and Description |
|---|---|
static void |
closeConnection(org.apache.directory.ldap.client.api.LdapNetworkConnection conn)
Closes the
LdapNetworkConnection. |
static org.apache.directory.ldap.client.api.LdapNetworkConnection |
createAdminConnection(LdapServer ldapServer)
Creates a new
LdapNetworkConnection and authenticates as admin user. |
private static org.apache.directory.ldap.client.api.LdapConnectionPool |
getAdminPool(LdapServer ldapServer)
Gets the admin pool.
|
static org.apache.directory.ldap.client.api.LdapConnection |
getAnonymousNetworkConnection(LdapServer ldapServer)
Gets an anonymous LdapNetworkConnection
|
static org.apache.directory.ldap.client.api.LdapConnection |
getAnonymousNetworkConnection(java.lang.String host,
int port)
Gets an anonymous LdapNetworkConnection
|
static org.apache.directory.ldap.client.api.LdapConnection |
getPooledAdminConnection(LdapServer ldapServer)
Gets the pooled
LdapConnectionPool, authenticated as admin user. |
static void |
releasePooledAdminConnection(org.apache.directory.ldap.client.api.LdapConnection conn,
LdapServer ldapServer)
Releases a pooled connection back to the pool.
|
private static final java.lang.String DEFAULT_HOST
private static final java.lang.String DEFAULT_ADMIN
private static final java.lang.String DEFAULT_PASSWORD
private static final java.util.Map<java.lang.Integer,org.apache.directory.ldap.client.api.LdapConnectionPool> POOLS
public static org.apache.directory.ldap.client.api.LdapNetworkConnection createAdminConnection(LdapServer ldapServer) throws org.apache.directory.api.ldap.model.exception.LdapException, java.io.IOException
LdapNetworkConnection and authenticates as admin user.
The caller is responsible for closing the connection, use closeConnection().ldapServer - the LDAP server instance, used to obtain the port usedorg.apache.directory.api.ldap.model.exception.LdapException - the LDAP exceptionjava.io.IOException - Signals that an I/O exception has occurred.public static void closeConnection(org.apache.directory.ldap.client.api.LdapNetworkConnection conn)
throws org.apache.directory.api.ldap.model.exception.LdapException,
java.io.IOException
LdapNetworkConnection.conn - the connection to closeorg.apache.directory.api.ldap.model.exception.LdapException - the LDAP exceptionjava.io.IOException - Signals that an I/O exception has occurred.public static org.apache.directory.ldap.client.api.LdapConnection getPooledAdminConnection(LdapServer ldapServer) throws java.lang.Exception
LdapConnectionPool, authenticated as admin user.
The caller is reponsible for releasing the connection, use releasePooledConnection().ldapServer - the LDAP server instance, used to obtain the port usedjava.lang.Exception - the exceptionpublic static void releasePooledAdminConnection(org.apache.directory.ldap.client.api.LdapConnection conn,
LdapServer ldapServer)
throws java.lang.Exception
conn - the connection to releaseldapServer - the LDAP server instance, used to obtain the port usedjava.lang.Exception - the exceptionprivate static org.apache.directory.ldap.client.api.LdapConnectionPool getAdminPool(LdapServer ldapServer)
ldapServer - the ldap serverpublic static org.apache.directory.ldap.client.api.LdapConnection getAnonymousNetworkConnection(java.lang.String host,
int port)
throws java.lang.Exception
dirService - The Directory Service to be connected toIf - the connection could not be established.java.lang.Exceptionpublic static org.apache.directory.ldap.client.api.LdapConnection getAnonymousNetworkConnection(LdapServer ldapServer) throws java.lang.Exception
ldapServer - The LDAP server we want to connect toIf - the connection could not be established.java.lang.Exception