Package edu.vt.middleware.ldap.handler
Interface ConnectionHandler
-
- All Known Implementing Classes:
AbstractConnectionHandler,DefaultConnectionHandler,TlsConnectionHandler
public interface ConnectionHandlerConnectionHandler 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 classConnectionHandler.ConnectionStrategyEnum to define the type of connection strategy.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidclose()Close a connection to an LDAP.voidconnect(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.ConnectionStrategygetConnectionStrategy()Returns the connection strategy.LdapConfiggetLdapConfig()Returns the ldap configuration.javax.naming.ldap.LdapContextgetLdapContext()Returns an ldap context to use for ldap operations.booleanisConnected()Returns whether the underlying context has been established.ConnectionHandlernewInstance()Returns a separate instance of this connection handler with the same underlying ldap configuration.voidsetConnectionRetryExceptions(java.lang.Class<?>[] exceptions)This sets the exception types to retry connections on.voidsetConnectionStrategy(ConnectionHandler.ConnectionStrategy strategy)Sets the connection strategy.voidsetLdapConfig(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.NamingExceptionOpen 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.NamingExceptionReturns 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.NamingExceptionClose 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
-
-