Package org.ldaptive

Interface OperationHandle<Q extends Request,S extends Result>

Type Parameters:
Q - type of request
S - type of result
All Known Subinterfaces:
CompareOperationHandle, ExtendedOperationHandle, SearchOperationHandle
All Known Implementing Classes:
DefaultCompareOperationHandle, DefaultExtendedOperationHandle, DefaultOperationHandle, DefaultSearchOperationHandle, NettyConnection.BindOperationHandle

public interface OperationHandle<Q extends Request,S extends Result>
Handle that notifies on the components of an LDAP operation request.
  • Method Details

    • send

      Sends this request to the server.
      Returns:
      this handle
      Throws:
      IllegalStateException - if this request has already been sent
    • await

      S await() throws LdapException
      Waits for a result or reports a timeout exception.
      Returns:
      result of the operation or empty if the operation is abandoned
      Throws:
      LdapException - if an error occurs executing the request
    • execute

      default S execute() throws LdapException
      Convenience method that invokes send() followed by await(). Provides a single method to make a synchronous request.
      Returns:
      result of the operation or empty if the operation is abandoned
      Throws:
      LdapException - if an error occurs executing the request
    • onResult

      OperationHandle<Q,S> onResult(ResultHandler... function)
      Sets the functions to execute when a result is received.
      Parameters:
      function - to execute on a result
      Returns:
      this handle
    • onControl

      OperationHandle<Q,S> onControl(ResponseControlHandler... function)
      Sets the functions to execute when a control is received.
      Parameters:
      function - to execute on a control
      Returns:
      this handle
    • onReferral

      OperationHandle<Q,S> onReferral(ReferralHandler... function)
      Sets the functions to execute when a referral is received.
      Parameters:
      function - to execute on a referral
      Returns:
      this handle
    • onIntermediate

      OperationHandle<Q,S> onIntermediate(IntermediateResponseHandler... function)
      Sets the functions to execute when an intermediate response is received.
      Parameters:
      function - to execute on an intermediate response
      Returns:
      this handle
    • onUnsolicitedNotification

      OperationHandle<Q,S> onUnsolicitedNotification(UnsolicitedNotificationHandler... function)
      Sets the functions to execute when an unsolicited notification is received.
      Parameters:
      function - to execute on an unsolicited notification
      Returns:
      this handle
    • onException

      OperationHandle<Q,S> onException(ExceptionHandler function)
      Sets the function to execute when an exception occurs.
      Parameters:
      function - to execute when an exception occurs
      Returns:
      this handle
    • onComplete

      OperationHandle<Q,S> onComplete(CompleteHandler function)
      Sets the function to execute when the operation completes.
      Parameters:
      function - to execute on completion
      Returns:
      this handle
    • throwIf

      OperationHandle<Q,S> throwIf(ResultPredicate function)
      Sets the function to determine whether an exception should be raised by a particular result.
      Parameters:
      function - to determine whether to throw an exception
      Returns:
      this handle
    • abandon

      void abandon()
      Abandons this operation.
      Throws:
      IllegalStateException - if the request has not been sent to the server
    • cancel

      Cancels this operation. See CancelRequest.
      Returns:
      extended operation handle
      Throws:
      IllegalStateException - if the request has not been sent to the server
    • getSentTime

      Instant getSentTime()
      Returns the time this operation sent a request.
      Returns:
      sent time
    • getReceivedTime

      Instant getReceivedTime()
      Returns the time this operation received a result or encountered an exception.
      Returns:
      received time