Package org.ldaptive.transport
Class DefaultSearchOperationHandle
java.lang.Object
org.ldaptive.transport.DefaultOperationHandle<SearchRequest,SearchResponse>
org.ldaptive.transport.DefaultSearchOperationHandle
- All Implemented Interfaces:
OperationHandle<SearchRequest,,SearchResponse> SearchOperationHandle
public final class DefaultSearchOperationHandle
extends DefaultOperationHandle<SearchRequest,SearchResponse>
implements SearchOperationHandle
Handle that notifies on the components of a search request.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate intNumber of entries received.private LdapEntryHandler[]Functions to handle response entries.private SearchReferenceHandler[]Functions to handle response references.private SearchResultHandler[]Functions to handle complete response.private final SearchResponseSynthetic result that is built as entries and references are received.Predicate that requires any message except unsolicited.private static final booleanWhether to automatically sort search results.Fields inherited from class org.ldaptive.transport.DefaultOperationHandle
logger -
Constructor Summary
ConstructorsConstructorDescriptionDefaultSearchOperationHandle(SearchRequest req, TransportConnection conn, Duration timeout) Creates a new search operation handle. -
Method Summary
Modifier and TypeMethodDescriptionawait()Waits for a result or reports a timeout exception.voidInvokesonEntry.protected voidInvokesDefaultOperationHandle.throwCondition, if it exists, for the supplied result.Returns the ldap entry handlers.Returns the search reference handlers.Returns the search result handlers.Returns a predicate to determine whether the responseTimeout semaphore should be released.onComplete(CompleteHandler function) Sets the function to execute when the operation completes.onControl(ResponseControlHandler... function) Sets the functions to execute when a control is received.onEntry(LdapEntryHandler... function) Sets the functions to execute when a search result entry is received.onException(ExceptionHandler function) Sets the function to execute when an exception occurs.onIntermediate(IntermediateResponseHandler... function) Sets the functions to execute when an intermediate response is received.onReference(SearchReferenceHandler... function) Sets the functions to execute when a search result reference is received.onReferral(ReferralHandler... function) Sets the functions to execute when a referral is received.onReferralResult(ReferralResultHandler<SearchResponse> function) Sets the functions to execute when a response is complete and contains a referral result code.onResult(ResultHandler... function) Sets the functions to execute when a result is received.onSearchResult(SearchResultHandler... function) Sets the functions to execute when a search result is complete.onUnsolicitedNotification(UnsolicitedNotificationHandler... function) Sets the functions to execute when an unsolicited notification is received.voidInvokesonReference.voidInvokesDefaultOperationHandle.onResultand sets the result.send()Sends this request to the server.throwIf(ResultPredicate function) Sets the function to determine whether an exception should be raised by a particular result.toString()Methods inherited from class org.ldaptive.transport.DefaultOperationHandle
abandon, abandon, cancel, consumedMessage, consumedMessage, control, exception, finalizeResult, getAbandonedTime, getMessageID, getOnComplete, getOnControl, getOnException, getOnIntermediate, getOnReferral, getOnReferralResult, getOnResult, getOnUnsolicitedNotification, getReceivedTime, getRequest, getSentTime, getThrowCondition, hasConsumedMessage, initializeMessageFunctional, initializeMessageFunctional, intermediate, messageID, notifyExceptionHandlers, processHandlerException, processReferralResult, processResult, referral, sent, unsolicitedNotificationMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.ldaptive.OperationHandle
abandon, cancel, getAbandonedTime, getReceivedTime, getSentTimeMethods inherited from interface org.ldaptive.SearchOperationHandle
execute
-
Field Details
-
SEARCH_RESPONSE_TIMEOUT_CONDITION
Predicate that requires any message except unsolicited. -
SORT_RESULTS
private static final boolean SORT_RESULTSWhether to automatically sort search results. -
result
Synthetic result that is built as entries and references are received. -
entryCount
private int entryCountNumber of entries received. -
onEntry
Functions to handle response entries. -
onReference
Functions to handle response references. -
onSearchResult
Functions to handle complete response.
-
-
Constructor Details
-
DefaultSearchOperationHandle
Creates a new search operation handle.- Parameters:
req- search request to expect a response forconn- the request will be executed ontimeout- duration to wait for a response
-
-
Method Details
-
getResponseTimeoutCondition
Description copied from class:DefaultOperationHandleReturns a predicate to determine whether the responseTimeout semaphore should be released.- Overrides:
getResponseTimeoutConditionin classDefaultOperationHandle<SearchRequest,SearchResponse> - Returns:
- response timeout condition
-
send
Description copied from interface:OperationHandleSends this request to the server.- Specified by:
sendin interfaceOperationHandle<SearchRequest,SearchResponse> - Specified by:
sendin interfaceSearchOperationHandle- Overrides:
sendin classDefaultOperationHandle<SearchRequest,SearchResponse> - Returns:
- this handle
-
await
Description copied from interface:OperationHandleWaits for a result or reports a timeout exception.- Specified by:
awaitin interfaceOperationHandle<SearchRequest,SearchResponse> - Specified by:
awaitin interfaceSearchOperationHandle- Overrides:
awaitin classDefaultOperationHandle<SearchRequest,SearchResponse> - Returns:
- result of the operation or empty if the operation is abandoned
- Throws:
LdapException- if an error occurs executing the request
-
evaluateThrowCondition
Description copied from class:DefaultOperationHandleInvokesDefaultOperationHandle.throwCondition, if it exists, for the supplied result.- Overrides:
evaluateThrowConditionin classDefaultOperationHandle<SearchRequest,SearchResponse> - Parameters:
r- to evaluate
-
onResult
Description copied from interface:OperationHandleSets the functions to execute when a result is received.- Specified by:
onResultin interfaceOperationHandle<SearchRequest,SearchResponse> - Specified by:
onResultin interfaceSearchOperationHandle- Overrides:
onResultin classDefaultOperationHandle<SearchRequest,SearchResponse> - Parameters:
function- to execute on a result- Returns:
- this handle
-
onControl
Description copied from interface:OperationHandleSets the functions to execute when a control is received.- Specified by:
onControlin interfaceOperationHandle<SearchRequest,SearchResponse> - Specified by:
onControlin interfaceSearchOperationHandle- Overrides:
onControlin classDefaultOperationHandle<SearchRequest,SearchResponse> - Parameters:
function- to execute on a control- Returns:
- this handle
-
onReferral
Description copied from interface:OperationHandleSets the functions to execute when a referral is received.- Specified by:
onReferralin interfaceOperationHandle<SearchRequest,SearchResponse> - Specified by:
onReferralin interfaceSearchOperationHandle- Overrides:
onReferralin classDefaultOperationHandle<SearchRequest,SearchResponse> - Parameters:
function- to execute on a referral- Returns:
- this handle
-
onIntermediate
Description copied from interface:OperationHandleSets the functions to execute when an intermediate response is received.- Specified by:
onIntermediatein interfaceOperationHandle<SearchRequest,SearchResponse> - Specified by:
onIntermediatein interfaceSearchOperationHandle- Overrides:
onIntermediatein classDefaultOperationHandle<SearchRequest,SearchResponse> - Parameters:
function- to execute on an intermediate response- Returns:
- this handle
-
onUnsolicitedNotification
public DefaultSearchOperationHandle onUnsolicitedNotification(UnsolicitedNotificationHandler... function) Description copied from interface:OperationHandleSets the functions to execute when an unsolicited notification is received.- Specified by:
onUnsolicitedNotificationin interfaceOperationHandle<SearchRequest,SearchResponse> - Specified by:
onUnsolicitedNotificationin interfaceSearchOperationHandle- Overrides:
onUnsolicitedNotificationin classDefaultOperationHandle<SearchRequest,SearchResponse> - Parameters:
function- to execute on an unsolicited notification- Returns:
- this handle
-
onReferralResult
public DefaultSearchOperationHandle onReferralResult(ReferralResultHandler<SearchResponse> function) Description copied from interface:OperationHandleSets the functions to execute when a response is complete and contains a referral result code.- Specified by:
onReferralResultin interfaceOperationHandle<SearchRequest,SearchResponse> - Specified by:
onReferralResultin interfaceSearchOperationHandle- Overrides:
onReferralResultin classDefaultOperationHandle<SearchRequest,SearchResponse> - Parameters:
function- to execute on a referral response- Returns:
- this handle
-
onException
Description copied from interface:OperationHandleSets the function to execute when an exception occurs.- Specified by:
onExceptionin interfaceOperationHandle<SearchRequest,SearchResponse> - Specified by:
onExceptionin interfaceSearchOperationHandle- Overrides:
onExceptionin classDefaultOperationHandle<SearchRequest,SearchResponse> - Parameters:
function- to execute when an exception occurs- Returns:
- this handle
-
throwIf
Description copied from interface:OperationHandleSets the function to determine whether an exception should be raised by a particular result.- Specified by:
throwIfin interfaceOperationHandle<SearchRequest,SearchResponse> - Specified by:
throwIfin interfaceSearchOperationHandle- Overrides:
throwIfin classDefaultOperationHandle<SearchRequest,SearchResponse> - Parameters:
function- to determine whether to throw an exception- Returns:
- this handle
-
onComplete
Description copied from interface:OperationHandleSets the function to execute when the operation completes.- Specified by:
onCompletein interfaceOperationHandle<SearchRequest,SearchResponse> - Specified by:
onCompletein interfaceSearchOperationHandle- Overrides:
onCompletein classDefaultOperationHandle<SearchRequest,SearchResponse> - Parameters:
function- to execute on completion- Returns:
- this handle
-
onEntry
Description copied from interface:SearchOperationHandleSets the functions to execute when a search result entry is received.- Specified by:
onEntryin interfaceSearchOperationHandle- Parameters:
function- to execute on a search result entry- Returns:
- this handle
-
onReference
Description copied from interface:SearchOperationHandleSets the functions to execute when a search result reference is received.- Specified by:
onReferencein interfaceSearchOperationHandle- Parameters:
function- to execute on a search result reference- Returns:
- this handle
-
onSearchResult
Description copied from interface:SearchOperationHandleSets the functions to execute when a search result is complete.- Specified by:
onSearchResultin interfaceSearchOperationHandle- Parameters:
function- to execute on a search result- Returns:
- this handle
-
getOnEntry
Returns the ldap entry handlers.- Returns:
- ldap entry handlers
-
getOnReference
Returns the search reference handlers.- Returns:
- search reference handlers
-
getOnSearchResult
Returns the search result handlers.- Returns:
- search result handlers
-
entry
InvokesonEntry.- Parameters:
r- search result entry
-
reference
InvokesonReference.- Parameters:
r- search result reference
-
result
Description copied from class:DefaultOperationHandleInvokesDefaultOperationHandle.onResultand sets the result. Handle is considered done when this is invoked.- Overrides:
resultin classDefaultOperationHandle<SearchRequest,SearchResponse> - Parameters:
r- result
-
toString
- Overrides:
toStringin classDefaultOperationHandle<SearchRequest,SearchResponse>
-