Package edu.vt.middleware.ldap.handler
Interface ConnectionHandler
-
- All Known Implementing Classes:
AbstractConnectionHandler
,DefaultConnectionHandler
,TlsConnectionHandler
public interface ConnectionHandler
ConnectionHandler provides an interface for creating and closing LDAP connections.- Version:
- $Revision: 1616 $
- Author:
- Middleware Services
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
ConnectionHandler.ConnectionStrategy
Enum to define the type of connection strategy.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
close()
Close a connection to an LDAP.void
connect(java.lang.String dn, java.lang.Object credential)
Open a connection to an LDAP.java.lang.Class<?>[]
getConnectionRetryExceptions()
This returns the exception types to retry connections on.ConnectionHandler.ConnectionStrategy
getConnectionStrategy()
Returns the connection strategy.LdapConfig
getLdapConfig()
Returns the ldap configuration.javax.naming.ldap.LdapContext
getLdapContext()
Returns an ldap context to use for ldap operations.boolean
isConnected()
Returns whether the underlying context has been established.ConnectionHandler
newInstance()
Returns a separate instance of this connection handler with the same underlying ldap configuration.void
setConnectionRetryExceptions(java.lang.Class<?>[] exceptions)
This sets the exception types to retry connections on.void
setConnectionStrategy(ConnectionHandler.ConnectionStrategy strategy)
Sets the connection strategy.void
setLdapConfig(LdapConfig lc)
Sets the ldap configuration.
-
-
-
Method Detail
-
getConnectionStrategy
ConnectionHandler.ConnectionStrategy getConnectionStrategy()
Returns the connection strategy.- Returns:
- strategy for making connections
-
setConnectionStrategy
void setConnectionStrategy(ConnectionHandler.ConnectionStrategy strategy)
Sets the connection strategy.- Parameters:
strategy
- for making connections
-
getConnectionRetryExceptions
java.lang.Class<?>[] getConnectionRetryExceptions()
This returns the exception types to retry connections on.- Returns:
Class[]
-
setConnectionRetryExceptions
void setConnectionRetryExceptions(java.lang.Class<?>[] exceptions)
This sets the exception types to retry connections on.- Parameters:
exceptions
-Class[]
-
getLdapConfig
LdapConfig getLdapConfig()
Returns the ldap configuration.- Returns:
- ldap config
-
setLdapConfig
void setLdapConfig(LdapConfig lc)
Sets the ldap configuration.- Parameters:
lc
- ldap config
-
connect
void connect(java.lang.String dn, java.lang.Object credential) throws javax.naming.NamingException
Open a connection to an LDAP.- Parameters:
dn
- to attempt bind withcredential
- to attempt bind with- Throws:
javax.naming.NamingException
- if an LDAP error occurs
-
isConnected
boolean isConnected()
Returns whether the underlying context has been established.- Returns:
- whether a connection has been made
-
getLdapContext
javax.naming.ldap.LdapContext getLdapContext() throws javax.naming.NamingException
Returns an ldap context to use for ldap operations.connect(String, Object)
must be called prior to invoking this.- Returns:
- ldap context
- Throws:
javax.naming.NamingException
- if an LDAP error occurs
-
close
void close() throws javax.naming.NamingException
Close a connection to an LDAP.- Throws:
javax.naming.NamingException
- if an LDAP error occurs
-
newInstance
ConnectionHandler newInstance()
Returns a separate instance of this connection handler with the same underlying ldap configuration.- Returns:
- connection handler
-
-