Package org.ldaptive

Class AbstractOperation<Q extends Request,S extends Result>

java.lang.Object
org.ldaptive.AbstractOperation<Q,S>
Type Parameters:
Q - type of request
S - type of result
All Implemented Interfaces:
Operation<Q,S>
Direct Known Subclasses:
AddOperation, BindOperation, CompareOperation, DeleteOperation, ExtendedOperation, ModifyDnOperation, ModifyOperation, SearchOperation

public abstract class AbstractOperation<Q extends Request,S extends Result> extends Object implements Operation<Q,S>
Base class for operations.
  • Field Details

    • connectionFactory

      private ConnectionFactory connectionFactory
      Connection factory.
    • requestHandlers

      private RequestHandler<Q extends Request>[] requestHandlers
      Functions to handle requests.
    • resultHandlers

      private ResultHandler[] resultHandlers
      Functions to handle response results.
    • controlHandlers

      private ResponseControlHandler[] controlHandlers
      Functions to handle response controls.
    • referralHandlers

      private ReferralHandler[] referralHandlers
      Functions to handle referrals.
    • intermediateResponseHandlers

      private IntermediateResponseHandler[] intermediateResponseHandlers
      Functions to handle intermediate responses.
    • exceptionHandler

      private ExceptionHandler exceptionHandler
      Function to handle exceptions.
    • throwCondition

      private ResultPredicate throwCondition
      Function to test results.
    • unsolicitedNotificationHandlers

      private UnsolicitedNotificationHandler[] unsolicitedNotificationHandlers
      Functions to handle unsolicited notifications.
    • referralResultHandler

      private ReferralResultHandler<S extends Result> referralResultHandler
      Functions to handle referral responses.
  • Constructor Details

    • AbstractOperation

      public AbstractOperation()
      Default constructor.
    • AbstractOperation

      public AbstractOperation(ConnectionFactory factory)
      Creates a new abstract operation.
      Parameters:
      factory - connection factory
  • Method Details

    • getConnectionFactory

      public ConnectionFactory getConnectionFactory()
      Returns the connection factory.
      Returns:
      connection factory
    • setConnectionFactory

      public void setConnectionFactory(ConnectionFactory factory)
      Sets the connection factory.
      Parameters:
      factory - connection factory
    • getRequestHandlers

      public RequestHandler<Q>[] getRequestHandlers()
      Returns the request handlers.
      Returns:
      request handlers
    • setRequestHandlers

      public void setRequestHandlers(RequestHandler<Q>... handlers)
      Sets the request handlers.
      Parameters:
      handlers - request handlers
    • getResultHandlers

      public ResultHandler[] getResultHandlers()
      Returns the result handlers.
      Returns:
      result handlers
    • setResultHandlers

      public void setResultHandlers(ResultHandler... handlers)
      Sets the result handlers.
      Parameters:
      handlers - result handlers
    • getControlHandlers

      public ResponseControlHandler[] getControlHandlers()
      Returns the control handlers.
      Returns:
      control handlers
    • setControlHandlers

      public void setControlHandlers(ResponseControlHandler... handlers)
      Sets the control handlers.
      Parameters:
      handlers - control handlers
    • getReferralHandlers

      public ReferralHandler[] getReferralHandlers()
      Returns the referral handlers.
      Returns:
      referral handlers
    • setReferralHandlers

      public void setReferralHandlers(ReferralHandler... handlers)
      Sets the referral handlers.
      Parameters:
      handlers - referral handlers
    • getIntermediateResponseHandlers

      public IntermediateResponseHandler[] getIntermediateResponseHandlers()
      Returns the intermediate response handlers.
      Returns:
      intermediate response handlers
    • setIntermediateResponseHandlers

      public void setIntermediateResponseHandlers(IntermediateResponseHandler... handlers)
      Sets the intermediate response handlers.
      Parameters:
      handlers - intermediate response handlers
    • getExceptionHandler

      public ExceptionHandler getExceptionHandler()
      Returns the exception handler.
      Returns:
      exception handler
    • setExceptionHandler

      public void setExceptionHandler(ExceptionHandler handler)
      Sets the exception handler.
      Parameters:
      handler - exception handler
    • getThrowCondition

      public ResultPredicate getThrowCondition()
      Returns the throw condition.
      Returns:
      throw condition
    • setThrowCondition

      public void setThrowCondition(ResultPredicate function)
      Sets the throw condition.
      Parameters:
      function - throw condition
    • getUnsolicitedNotificationHandlers

      public UnsolicitedNotificationHandler[] getUnsolicitedNotificationHandlers()
      Returns the unsolicited notification handlers.
      Returns:
      unsolicited notification handlers
    • setUnsolicitedNotificationHandlers

      public void setUnsolicitedNotificationHandlers(UnsolicitedNotificationHandler... handlers)
      Sets the unsolicited notification handlers.
      Parameters:
      handlers - unsolicited notification handlers
    • getReferralResultHandler

      public ReferralResultHandler<S> getReferralResultHandler()
      Returns the referral result handler.
      Returns:
      referral result handler
    • setReferralResultHandler

      public void setReferralResultHandler(ReferralResultHandler<S> handler)
      Sets the referral result handler.
      Parameters:
      handler - referral result handler
    • configureRequest

      protected Q configureRequest(Q request)
      Applies any configured request handlers to the supplied request. Returns the supplied request unaltered if no request handlers are configured.
      Parameters:
      request - to configure
      Returns:
      configured request
    • configureHandle

      protected OperationHandle<Q,S> configureHandle(OperationHandle<Q,S> handle)
      Adds configured functions to the supplied handle.
      Parameters:
      handle - to configure
      Returns:
      configured handle
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • copy

      protected static <Q extends Request, S extends Result> void copy(AbstractOperation<Q,S> from, AbstractOperation<Q,S> to, boolean deep)
      Copies properties from one operation to another.
      Type Parameters:
      Q - type of request
      S - type of result
      Parameters:
      from - to copy properties from
      to - to copy properties to
      deep - whether to make a deep copy