Package org.ldaptive.transport
Class DefaultCompareOperationHandle
- java.lang.Object
-
- org.ldaptive.transport.DefaultOperationHandle<CompareRequest,CompareResponse>
-
- org.ldaptive.transport.DefaultCompareOperationHandle
-
- All Implemented Interfaces:
CompareOperationHandle
,OperationHandle<CompareRequest,CompareResponse>
public class DefaultCompareOperationHandle extends DefaultOperationHandle<CompareRequest,CompareResponse> implements CompareOperationHandle
Handle that notifies on the components of a compare request.
-
-
Field Summary
Fields Modifier and Type Field Description private CompareValueHandler[]
onCompare
Functions to handle the compare result.-
Fields inherited from class org.ldaptive.transport.DefaultOperationHandle
logger
-
-
Constructor Summary
Constructors Constructor Description DefaultCompareOperationHandle(CompareRequest req, TransportConnection conn, Duration timeout)
Creates a new compare operation handle.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CompareResponse
await()
Waits for a result or reports a timeout exception.void
compare(CompareResponse response)
InvokesonCompare
.DefaultCompareOperationHandle
onCompare(CompareValueHandler... function)
Sets the function to execute when a compare result is received.DefaultCompareOperationHandle
onComplete(CompleteHandler function)
Sets the function to execute when the operation completes.DefaultCompareOperationHandle
onControl(ResponseControlHandler... function)
Sets the functions to execute when a control is received.DefaultCompareOperationHandle
onException(ExceptionHandler function)
Sets the function to execute when an exception occurs.DefaultCompareOperationHandle
onIntermediate(IntermediateResponseHandler... function)
Sets the functions to execute when an intermediate response is received.DefaultCompareOperationHandle
onReferral(ReferralHandler... function)
Sets the functions to execute when a referral is received.DefaultCompareOperationHandle
onResult(ResultHandler... function)
Sets the functions to execute when a result is received.DefaultCompareOperationHandle
onUnsolicitedNotification(UnsolicitedNotificationHandler... function)
Sets the functions to execute when an unsolicited notification is received.DefaultCompareOperationHandle
send()
Sends this request to the server.DefaultCompareOperationHandle
throwIf(ResultPredicate function)
Sets the function to determine whether an exception should be raised by a particular result.String
toString()
-
Methods inherited from class org.ldaptive.transport.DefaultOperationHandle
abandon, abandon, cancel, consumedMessage, consumedMessage, control, exception, getMessageID, getOnComplete, getOnControl, getOnException, getOnIntermediate, getOnReferral, getOnResult, getOnUnsolicitedNotification, getReceivedTime, getRequest, getResponseTimeoutCondition, getSentTime, getThrowCondition, hasConsumedMessage, initializeMessageFunctional, intermediate, messageID, referral, result, sent, unsolicitedNotification
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.ldaptive.CompareOperationHandle
execute
-
Methods inherited from interface org.ldaptive.OperationHandle
abandon, cancel, getReceivedTime, getSentTime
-
-
-
-
Field Detail
-
onCompare
private CompareValueHandler[] onCompare
Functions to handle the compare result.
-
-
Constructor Detail
-
DefaultCompareOperationHandle
public DefaultCompareOperationHandle(CompareRequest req, TransportConnection conn, Duration timeout)
Creates a new compare operation handle.- Parameters:
req
- compare request to expect a response forconn
- the request will be executed ontimeout
- duration to wait for a response
-
-
Method Detail
-
send
public DefaultCompareOperationHandle send()
Description copied from interface:OperationHandle
Sends this request to the server.- Specified by:
send
in interfaceCompareOperationHandle
- Specified by:
send
in interfaceOperationHandle<CompareRequest,CompareResponse>
- Overrides:
send
in classDefaultOperationHandle<CompareRequest,CompareResponse>
- Returns:
- this handle
-
await
public CompareResponse await() throws LdapException
Description copied from interface:OperationHandle
Waits for a result or reports a timeout exception.- Specified by:
await
in interfaceCompareOperationHandle
- Specified by:
await
in interfaceOperationHandle<CompareRequest,CompareResponse>
- Overrides:
await
in classDefaultOperationHandle<CompareRequest,CompareResponse>
- Returns:
- result of the operation or empty if the operation is abandoned
- Throws:
LdapException
- if an error occurs executing the request
-
onResult
public DefaultCompareOperationHandle onResult(ResultHandler... function)
Description copied from interface:OperationHandle
Sets the functions to execute when a result is received.- Specified by:
onResult
in interfaceCompareOperationHandle
- Specified by:
onResult
in interfaceOperationHandle<CompareRequest,CompareResponse>
- Overrides:
onResult
in classDefaultOperationHandle<CompareRequest,CompareResponse>
- Parameters:
function
- to execute on a result- Returns:
- this handle
-
onControl
public DefaultCompareOperationHandle onControl(ResponseControlHandler... function)
Description copied from interface:OperationHandle
Sets the functions to execute when a control is received.- Specified by:
onControl
in interfaceCompareOperationHandle
- Specified by:
onControl
in interfaceOperationHandle<CompareRequest,CompareResponse>
- Overrides:
onControl
in classDefaultOperationHandle<CompareRequest,CompareResponse>
- Parameters:
function
- to execute on a control- Returns:
- this handle
-
onReferral
public DefaultCompareOperationHandle onReferral(ReferralHandler... function)
Description copied from interface:OperationHandle
Sets the functions to execute when a referral is received.- Specified by:
onReferral
in interfaceCompareOperationHandle
- Specified by:
onReferral
in interfaceOperationHandle<CompareRequest,CompareResponse>
- Overrides:
onReferral
in classDefaultOperationHandle<CompareRequest,CompareResponse>
- Parameters:
function
- to execute on a referral- Returns:
- this handle
-
onIntermediate
public DefaultCompareOperationHandle onIntermediate(IntermediateResponseHandler... function)
Description copied from interface:OperationHandle
Sets the functions to execute when an intermediate response is received.- Specified by:
onIntermediate
in interfaceCompareOperationHandle
- Specified by:
onIntermediate
in interfaceOperationHandle<CompareRequest,CompareResponse>
- Overrides:
onIntermediate
in classDefaultOperationHandle<CompareRequest,CompareResponse>
- Parameters:
function
- to execute on an intermediate response- Returns:
- this handle
-
onUnsolicitedNotification
public DefaultCompareOperationHandle onUnsolicitedNotification(UnsolicitedNotificationHandler... function)
Description copied from interface:OperationHandle
Sets the functions to execute when an unsolicited notification is received.- Specified by:
onUnsolicitedNotification
in interfaceCompareOperationHandle
- Specified by:
onUnsolicitedNotification
in interfaceOperationHandle<CompareRequest,CompareResponse>
- Overrides:
onUnsolicitedNotification
in classDefaultOperationHandle<CompareRequest,CompareResponse>
- Parameters:
function
- to execute on an unsolicited notification- Returns:
- this handle
-
onException
public DefaultCompareOperationHandle onException(ExceptionHandler function)
Description copied from interface:OperationHandle
Sets the function to execute when an exception occurs.- Specified by:
onException
in interfaceCompareOperationHandle
- Specified by:
onException
in interfaceOperationHandle<CompareRequest,CompareResponse>
- Overrides:
onException
in classDefaultOperationHandle<CompareRequest,CompareResponse>
- Parameters:
function
- to execute when an exception occurs- Returns:
- this handle
-
throwIf
public DefaultCompareOperationHandle throwIf(ResultPredicate function)
Description copied from interface:OperationHandle
Sets the function to determine whether an exception should be raised by a particular result.- Specified by:
throwIf
in interfaceCompareOperationHandle
- Specified by:
throwIf
in interfaceOperationHandle<CompareRequest,CompareResponse>
- Overrides:
throwIf
in classDefaultOperationHandle<CompareRequest,CompareResponse>
- Parameters:
function
- to determine whether to throw an exception- Returns:
- this handle
-
onComplete
public DefaultCompareOperationHandle onComplete(CompleteHandler function)
Description copied from interface:OperationHandle
Sets the function to execute when the operation completes.- Specified by:
onComplete
in interfaceCompareOperationHandle
- Specified by:
onComplete
in interfaceOperationHandle<CompareRequest,CompareResponse>
- Overrides:
onComplete
in classDefaultOperationHandle<CompareRequest,CompareResponse>
- Parameters:
function
- to execute on completion- Returns:
- this handle
-
onCompare
public DefaultCompareOperationHandle onCompare(CompareValueHandler... function)
Sets the function to execute when a compare result is received.- Specified by:
onCompare
in interfaceCompareOperationHandle
- Parameters:
function
- to execute on a compare result- Returns:
- this handle
-
compare
public void compare(CompareResponse response)
InvokesonCompare
.- Parameters:
response
- compare response
-
toString
public String toString()
- Overrides:
toString
in classDefaultOperationHandle<CompareRequest,CompareResponse>
-
-