Package org.ldaptive
Interface OperationHandle<Q extends Request,S extends Result>
-
- Type Parameters:
Q
- type of requestS
- 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 Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description void
abandon()
Abandons this operation.S
await()
Waits for a result or reports a timeout exception.ExtendedOperationHandle
cancel()
Cancels this operation.default S
execute()
Instant
getReceivedTime()
Returns the time this operation received a result or encountered an exception.Instant
getSentTime()
Returns the time this operation sent a request.OperationHandle<Q,S>
onComplete(CompleteHandler function)
Sets the function to execute when the operation completes.OperationHandle<Q,S>
onControl(ResponseControlHandler... function)
Sets the functions to execute when a control is received.OperationHandle<Q,S>
onException(ExceptionHandler function)
Sets the function to execute when an exception occurs.OperationHandle<Q,S>
onIntermediate(IntermediateResponseHandler... function)
Sets the functions to execute when an intermediate response is received.OperationHandle<Q,S>
onReferral(ReferralHandler... function)
Sets the functions to execute when a referral is received.OperationHandle<Q,S>
onReferralResult(ReferralResultHandler<S> function)
Sets the functions to execute when a response is complete and contains a referral result code.OperationHandle<Q,S>
onResult(ResultHandler... function)
Sets the functions to execute when a result is received.OperationHandle<Q,S>
onUnsolicitedNotification(UnsolicitedNotificationHandler... function)
Sets the functions to execute when an unsolicited notification is received.OperationHandle<Q,S>
send()
Sends this request to the server.OperationHandle<Q,S>
throwIf(ResultPredicate function)
Sets the function to determine whether an exception should be raised by a particular result.
-
-
-
Method Detail
-
send
OperationHandle<Q,S> 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 invokessend()
followed byawait()
. 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
-
onReferralResult
OperationHandle<Q,S> onReferralResult(ReferralResultHandler<S> function)
Sets the functions to execute when a response is complete and contains a referral result code.- Parameters:
function
- to execute on a referral response- 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
ExtendedOperationHandle cancel()
Cancels this operation. SeeCancelRequest
.- 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
-
-