public final class LdapApiIntegrationUtils extends Object
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. |
static org.apache.directory.ldap.client.api.LdapConnection |
getAnonymousNetworkConnection(LdapServer ldapServer)
Gets an anonymous LdapNetworkConnection
|
static org.apache.directory.ldap.client.api.LdapConnection |
getAnonymousNetworkConnection(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.
|
public static org.apache.directory.ldap.client.api.LdapNetworkConnection createAdminConnection(LdapServer ldapServer) throws org.apache.directory.api.ldap.model.exception.LdapException, 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 exceptionIOException
- 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, IOException
LdapNetworkConnection
.conn
- the connection to closeorg.apache.directory.api.ldap.model.exception.LdapException
- the LDAP exceptionIOException
- Signals that an I/O exception has occurred.public static org.apache.directory.ldap.client.api.LdapConnection getPooledAdminConnection(LdapServer ldapServer) throws 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 usedException
- the exceptionpublic static void releasePooledAdminConnection(org.apache.directory.ldap.client.api.LdapConnection conn, LdapServer ldapServer) throws Exception
conn
- the connection to releaseldapServer
- the LDAP server instance, used to obtain the port usedException
- the exceptionpublic static org.apache.directory.ldap.client.api.LdapConnection getAnonymousNetworkConnection(String host, int port) throws Exception
dirService
- The Directory Service to be connected toIf
- the connection could not be established.Exception
public static org.apache.directory.ldap.client.api.LdapConnection getAnonymousNetworkConnection(LdapServer ldapServer) throws Exception
ldapServer
- The LDAP server we want to connect toIf
- the connection could not be established.Exception
Copyright © 2018. All rights reserved.