org.ldaptive
Class DefaultConnectionFactory.DefaultConnection

java.lang.Object
  extended by org.ldaptive.DefaultConnectionFactory.DefaultConnection
All Implemented Interfaces:
Connection
Enclosing class:
DefaultConnectionFactory

protected static class DefaultConnectionFactory.DefaultConnection
extends Object
implements Connection

Default implementation for managing a connection to an LDAP.


Field Summary
protected  org.slf4j.Logger logger
          Logger for this class.
 
Constructor Summary
DefaultConnectionFactory.DefaultConnection(ConnectionConfig cc, ProviderConnectionFactory<?> cf)
          Creates a new default connection.
 
Method Summary
 void close()
          This will close the connection to the LDAP.
 void close(RequestControl[] controls)
          This will close the connection to the LDAP using the supplied controls.
protected  void finalize()
          
 ConnectionConfig getConnectionConfig()
          Returns the connection config for this connection.
 ProviderConnection getProviderConnection()
          Returns the provider specific connection.
 boolean isOpen()
          Returns whether the underlying provider connection is not null.
 Response<Void> open()
          This will establish a connection if one does not already exist.
 Response<Void> open(BindRequest request)
          This will establish a connection if one does not already exist and bind to the LDAP using the supplied bind request.
 Response<Void> reopen()
          This will close an existing connection to the LDAP and establish a new connection to the LDAP.
 Response<Void> reopen(BindRequest request)
          This will close an existing connection to the LDAP and establish a new connection to the LDAP using the supplied bind request.
 String toString()
          
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

logger

protected final org.slf4j.Logger logger
Logger for this class.

Constructor Detail

DefaultConnectionFactory.DefaultConnection

public DefaultConnectionFactory.DefaultConnection(ConnectionConfig cc,
                                                  ProviderConnectionFactory<?> cf)
Creates a new default connection.

Parameters:
cc - connection configuration
cf - provider connection factory
Method Detail

getConnectionConfig

public ConnectionConfig getConnectionConfig()
Returns the connection config for this connection. The config may be read-only.

Specified by:
getConnectionConfig in interface Connection
Returns:
connection config

getProviderConnection

public ProviderConnection getProviderConnection()
Returns the provider specific connection. Must be called after a successful call to open().

Specified by:
getProviderConnection in interface Connection
Returns:
provider connection
Throws:
IllegalStateException - if the connection is not open

open

public Response<Void> open()
                    throws LdapException
This will establish a connection if one does not already exist. This connection should be closed using close().

Specified by:
open in interface Connection
Returns:
response associated with the ConnectionInitializer or an empty response if no connection initializer was configured
Throws:
IllegalStateException - if the connection is already open
LdapException - if the LDAP cannot be reached

open

public Response<Void> open(BindRequest request)
                    throws LdapException
This will establish a connection if one does not already exist and bind to the LDAP using the supplied bind request. This connection should be closed using close().

Specified by:
open in interface Connection
Parameters:
request - bind request
Returns:
response associated with the bind operation
Throws:
IllegalStateException - if the connection is already open
LdapException - if the LDAP cannot be reached

isOpen

public boolean isOpen()
Returns whether the underlying provider connection is not null.

Specified by:
isOpen in interface Connection
Returns:
whether the provider connection has been initialized

close

public void close()
This will close the connection to the LDAP.

Specified by:
close in interface Connection

close

public void close(RequestControl[] controls)
This will close the connection to the LDAP using the supplied controls.

Specified by:
close in interface Connection
Parameters:
controls - request controls

reopen

public Response<Void> reopen()
                      throws LdapException
This will close an existing connection to the LDAP and establish a new connection to the LDAP.

Specified by:
reopen in interface Connection
Returns:
response associated with the ConnectionInitializer or an empty response if no connection initializer was configured
Throws:
LdapException - if the LDAP cannot be reached

reopen

public Response<Void> reopen(BindRequest request)
                      throws LdapException
This will close an existing connection to the LDAP and establish a new connection to the LDAP using the supplied bind request.

Specified by:
reopen in interface Connection
Parameters:
request - containing bind information
Returns:
response associated with the bind operation
Throws:
LdapException - if the LDAP cannot be reached

toString

public String toString()

Overrides:
toString in class Object

finalize

protected void finalize()
                 throws Throwable

Overrides:
finalize in class Object
Throws:
Throwable


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