org.ldaptive
Class AbstractOperation<Q extends Request,S>

java.lang.Object
  extended by org.ldaptive.AbstractOperation<Q,S>
Type Parameters:
Q - type of ldap request
S - type of ldap response
All Implemented Interfaces:
Operation<Q,S>
Direct Known Subclasses:
AbstractAsyncOperation, AddOperation, BindOperation, CancelOperation, CompareOperation, DeleteOperation, FastBindOperation, MergeOperation, ModifyDnOperation, ModifyOperation, PasswordModifyOperation, SearchOperation, WhoAmIOperation

public abstract class AbstractOperation<Q extends Request,S>
extends Object
implements Operation<Q,S>

Provides common implementation for ldap operations.

Version:
$Revision: 2885 $ $Date: 2014-02-05 16:28:49 -0500 (Wed, 05 Feb 2014) $
Author:
Middleware Services

Nested Class Summary
 class AbstractOperation.ReopenOperationExceptionHandler
          Exception handler that invokes Connection.reopen(BindRequest) when an operation exception occurs and then invokes the operation again.
 
Field Summary
protected  org.slf4j.Logger logger
          Logger for this class.
 
Constructor Summary
AbstractOperation(Connection conn)
          Creates a new abstract operation.
 
Method Summary
 Response<S> execute(Q request)
          Execute this ldap operation.
protected
<Q extends Request,S>
HandlerResult<S>
executeHandlers(Handler<Q,S>[] handlers, Q request, S result)
          Processes each handler and returns a handler result containing a result processed by all handlers.
protected  Connection getConnection()
          Returns the connection used for this operation.
 OperationExceptionHandler<Q,S> getOperationExceptionHandler()
          Returns the operation exception handler.
 OperationResponseHandler<Q,S>[] getOperationResponseHandlers()
          Returns the operation response handlers.
protected abstract  Response<S> invoke(Q request)
          Call the provider specific implementation of this ldap operation.
 void setOperationExceptionHandler(OperationExceptionHandler<Q,S> handler)
          Sets the operation exception handler.
 void setOperationResponseHandlers(OperationResponseHandler<Q,S>... handlers)
          Sets the operation response handlers.
 String toString()
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

logger

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

Constructor Detail

AbstractOperation

public AbstractOperation(Connection conn)
Creates a new abstract operation.

Parameters:
conn - to use for this operation
Method Detail

getConnection

protected Connection getConnection()
Returns the connection used for this operation.

Returns:
connection

getOperationExceptionHandler

public OperationExceptionHandler<Q,S> getOperationExceptionHandler()
Returns the operation exception handler.

Returns:
operation exception handler

setOperationExceptionHandler

public void setOperationExceptionHandler(OperationExceptionHandler<Q,S> handler)
Sets the operation exception handler.

Parameters:
handler - operation exception handler

getOperationResponseHandlers

public OperationResponseHandler<Q,S>[] getOperationResponseHandlers()
Returns the operation response handlers.

Returns:
operation response handlers

setOperationResponseHandlers

public void setOperationResponseHandlers(OperationResponseHandler<Q,S>... handlers)
Sets the operation response handlers.

Parameters:
handlers - operation response handlers

invoke

protected abstract Response<S> invoke(Q request)
                               throws LdapException
Call the provider specific implementation of this ldap operation.

Parameters:
request - ldap request
Returns:
ldap response
Throws:
LdapException - if the invocation fails

execute

public Response<S> execute(Q request)
                    throws LdapException
Execute this ldap operation.

Specified by:
execute in interface Operation<Q extends Request,S>
Parameters:
request - containing the data required by this operation
Returns:
response for this operation
Throws:
LdapException - if the operation fails

executeHandlers

protected <Q extends Request,S> HandlerResult<S> executeHandlers(Handler<Q,S>[] handlers,
                                                                 Q request,
                                                                 S result)
                                    throws LdapException
Processes each handler and returns a handler result containing a result processed by all handlers. If any handler indicates that the operation should be aborted, that flag is returned to the operation after all handlers have been invoked.

Type Parameters:
Q - type of request
S - type of response
Parameters:
handlers - to invoke
request - the operation was performed with
result - from the operation
Returns:
handler result
Throws:
LdapException - if an error occurs processing a handler

toString

public String toString()

Overrides:
toString in class Object


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