Package com.unboundid.ldap.sdk
Class BasicAsyncSearchResultListener
- java.lang.Object
-
- com.unboundid.ldap.sdk.BasicAsyncSearchResultListener
-
- All Implemented Interfaces:
AsyncSearchResultListener
,SearchResultListener
,java.io.Serializable
@Mutable @ThreadSafety(level=NOT_THREADSAFE) public final class BasicAsyncSearchResultListener extends java.lang.Object implements AsyncSearchResultListener
This class provides a basic implementation of theAsyncSearchResultListener
interface that will merely set the result object to a local variable that can be accessed through a getter method. It provides a listener that may be easily used when processing an asynchronous search operation using theAsyncRequestID
as ajava.util.concurrent.Future
object.
Note that this class stores all entries and references returned by the associated search in memory so that they can be retrieved in lists. This may not be suitable for searches that have the potential return a large number of entries. For such searches, an alternateAsyncSearchResultListener
implementation may be needed, or it may be more appropriate to use anLDAPEntrySource
object for the search.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description BasicAsyncSearchResultListener()
Creates a new instance of this class for use in processing a single search operation.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.List<SearchResultEntry>
getSearchEntries()
Retrieves a list of the entries returned for the search operation.java.util.List<SearchResultReference>
getSearchReferences()
Retrieves a list of the references returned for the search operation.SearchResult
getSearchResult()
Retrieves the result that has been received for the associated asynchronous search operation, if it has been received.void
searchEntryReturned(SearchResultEntry searchEntry)
Indicates that the provided search result entry has been returned by the server and may be processed by this search result listener.void
searchReferenceReturned(SearchResultReference searchReference)
Indicates that the provided search result reference has been returned by the server and may be processed by this search result listener.void
searchResultReceived(AsyncRequestID requestID, SearchResult searchResult)
Indicates that the provided search result has been received in response to an asynchronous search operation.
-
-
-
Constructor Detail
-
BasicAsyncSearchResultListener
public BasicAsyncSearchResultListener()
Creates a new instance of this class for use in processing a single search operation. A single basic async search result listener object may not be used for multiple operations.
-
-
Method Detail
-
searchEntryReturned
@InternalUseOnly public void searchEntryReturned(@NotNull SearchResultEntry searchEntry)
Indicates that the provided search result entry has been returned by the server and may be processed by this search result listener.- Specified by:
searchEntryReturned
in interfaceSearchResultListener
- Parameters:
searchEntry
- The search result entry that has been returned by the server.
-
searchReferenceReturned
@InternalUseOnly public void searchReferenceReturned(@NotNull SearchResultReference searchReference)
Indicates that the provided search result reference has been returned by the server and may be processed by this search result listener.- Specified by:
searchReferenceReturned
in interfaceSearchResultListener
- Parameters:
searchReference
- The search result reference that has been returned by the server.
-
searchResultReceived
@InternalUseOnly public void searchResultReceived(@NotNull AsyncRequestID requestID, @NotNull SearchResult searchResult)
Indicates that the provided search result has been received in response to an asynchronous search operation. Note that automatic referral following is not supported for asynchronous operations, so it is possible that this result could include a referral.- Specified by:
searchResultReceived
in interfaceAsyncSearchResultListener
- Parameters:
requestID
- The async request ID of the request for which the response was received.searchResult
- The search result that has been received.
-
getSearchResult
@Nullable public SearchResult getSearchResult()
Retrieves the result that has been received for the associated asynchronous search operation, if it has been received.- Returns:
- The result that has been received for the associated asynchronous
search operation, or
null
if no response has been received yet.
-
getSearchEntries
@NotNull public java.util.List<SearchResultEntry> getSearchEntries()
Retrieves a list of the entries returned for the search operation. This should only be called after the operation has completed and a non-null
search result object is available, because it may not be safe to access the contents of the list if it may be altered while the search is still in progress.- Returns:
- A list of the entries returned for the search operation.
-
getSearchReferences
@NotNull public java.util.List<SearchResultReference> getSearchReferences()
Retrieves a list of the references returned for the search operation. This should only be called after the operation has completed and a non-null
search result object is available, because it may not be safe to access the contents of the list if it may be altered while the search is still in progress.- Returns:
- A list of the references returned for the search operation.
-
-