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
static class ConnectionHandler.ConnectionStrategy
          Enum to define the type of connection strategy.
 
Method Summary
 void close()
          Close a connection to an LDAP.
 void connect(String dn, Object credential)
          Open a connection to an LDAP.
 Class<?>[] getConnectionRetryExceptions()
          This returns the exception types to retry connections on.
 ConnectionHandler.ConnectionStrategy getConnectionStrategy()
          Returns the connection strategy.
 LdapConfig getLdapConfig()
          Returns the ldap configuration.
 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(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

Class<?>[] getConnectionRetryExceptions()
This returns the exception types to retry connections on.

Returns:
Class[]

setConnectionRetryExceptions

void setConnectionRetryExceptions(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(String dn,
             Object credential)
             throws NamingException
Open a connection to an LDAP.

Parameters:
dn - to attempt bind with
credential - to attempt bind with
Throws:
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

LdapContext getLdapContext()
                           throws NamingException
Returns an ldap context to use for ldap operations. connect(String, Object) must be called prior to invoking this.

Returns:
ldap context
Throws:
NamingException - if an LDAP error occurs

close

void close()
           throws NamingException
Close a connection to an LDAP.

Throws:
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


Copyright © 2003-2010 Virginia Tech. All Rights Reserved.