Class VirtualListViewClient
- All Implemented Interfaces:
ConnectionFactoryManager,Freezable
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final LoggerLogger for this class.private final SortRequestControlUsed on the search operation. -
Constructor Summary
ConstructorsConstructorDescriptionVirtualListViewClient(ConnectionFactory cf, SortKey... keys) Creates a new virtual list view client. -
Method Summary
Modifier and TypeMethodDescriptionprivate RequestControl[]appendRequestControls(SearchRequest request, VirtualListViewRequestControl cntrl) Creates a new array of request controls which includes the VLV and sort controls.execute(SearchRequest request, VirtualListViewParams params) Performs a search operation with theVirtualListViewRequestControl.execute(SearchRequest request, VirtualListViewParams params, SearchResponse result) Performs a search operation with theVirtualListViewRequestControl.executeToCompletion(SearchRequest request, VirtualListViewParams params) Performs a search operation with theVirtualListViewRequestControl.getResponseControl(SearchResponse result) Returns theVirtualListViewResponseControlin the supplied response.protected byte[]Returns the VLV results cookie in the supplied response or null if no cookie exists.Methods inherited from class org.ldaptive.AbstractSearchOperationFactory
createSearchOperation, createSearchOperation, freeze, getEntryHandlers, getReferenceHandlers, getSearchResultHandlers, setEntryHandlers, setReferenceHandlers, setSearchResultHandlers, toStringMethods inherited from class org.ldaptive.AbstractOperationFactory
getConnectionFactory, getControlHandlers, getExceptionHandler, getIntermediateResponseHandlers, getReferralHandlers, getRequestHandlers, getResultHandlers, getThrowCondition, getUnsolicitedNotificationHandlers, initializeOperation, setConnectionFactory, setControlHandlers, setExceptionHandler, setIntermediateResponseHandlers, setReferralHandlers, setRequestHandlers, setResultHandlers, setThrowCondition, setUnsolicitedNotificationHandlersMethods inherited from class org.ldaptive.AbstractFreezable
assertMutable, freeze, freeze, isFrozen
-
Field Details
-
logger
Logger for this class. -
sortControl
Used on the search operation.
-
-
Constructor Details
-
VirtualListViewClient
Creates a new virtual list view client.- Parameters:
cf- to get a connection fromkeys- to supply to a sort request control
-
-
Method Details
-
execute
public SearchResponse execute(SearchRequest request, VirtualListViewParams params) throws LdapException Performs a search operation with theVirtualListViewRequestControl. The supplied request is modified in the following way:AbstractRequestMessage.setControls(RequestControl...)is invoked withSortRequestControlandVirtualListViewRequestControland any other controls previously set on the search request.
- Parameters:
request- search request to executeparams- virtual list view data- Returns:
- search operation response
- Throws:
LdapException- if the search fails
-
execute
public SearchResponse execute(SearchRequest request, VirtualListViewParams params, SearchResponse result) throws LdapException Performs a search operation with theVirtualListViewRequestControl. The supplied request is modified in the following way:AbstractRequestMessage.setControls(RequestControl...)is invoked withSortRequestControlandVirtualListViewRequestControland any other controls previously set on the search request.
The content count and context id are extracted from the supplied response and replayed as appropriate in the request.
- Parameters:
request- search request to executeparams- virtual list view dataresult- of a previous VLV operation- Returns:
- search operation response
- Throws:
LdapException- if the search fails
-
executeToCompletion
public SearchResponse executeToCompletion(SearchRequest request, VirtualListViewParams params) throws LdapException Performs a search operation with theVirtualListViewRequestControl. The supplied request is modified in the following way:AbstractRequestMessage.setControls(RequestControl...)is invoked withSortRequestControlandVirtualListViewRequestControland any other controls previously set on the search request.
This method will continue to execute search operations until all search entries have been retrieved from the server. The returned response contains the response data of the last search result operation plus the entries and references returned by all previous search operations. The criteria used ot determine whether to continue searching is that the last response contained a cookie, produced a success result code, has a greater than zero contentCount and we have currently processed less entries than the contentCount.
The cookie used for each request is read from the cookie manager and written to the cookie manager after a successful search, if the response contains a cookie.
This method builds a synthetic response which contains the results of all search operations. Any ordering imposed by result handlers may be lost by this process.
- Parameters:
request- search request to executeparams- virtual list view data- Returns:
- search operation response of the last paged result operation
- Throws:
LdapException- if the search fails
-
getResponseControl
Returns theVirtualListViewResponseControlin the supplied response.- Parameters:
result- to inspect for a response control- Returns:
- VLV response control or null if it does not exist
-
getVirtualListViewCookie
Returns the VLV results cookie in the supplied response or null if no cookie exists.- Parameters:
result- of a previous VLV results operation- Returns:
- VLV results cookie or null
-
appendRequestControls
private RequestControl[] appendRequestControls(SearchRequest request, VirtualListViewRequestControl cntrl) Creates a new array of request controls which includes the VLV and sort controls. Any other request controls are included.- Parameters:
request- to read controls fromcntrl- VLV control to include- Returns:
- array of request controls ready to be used in a search operation
-