Class VirtualListViewClient
- java.lang.Object
-
- org.ldaptive.AbstractSearchOperationFactory
-
- org.ldaptive.control.util.VirtualListViewClient
-
- All Implemented Interfaces:
ConnectionFactoryManager
public class VirtualListViewClient extends AbstractSearchOperationFactory
Client that simplifies using the virtual list view control.
-
-
Field Summary
Fields Modifier and Type Field Description protected Logger
logger
Logger for this class.private SortRequestControl
sortControl
Used on the search operation.
-
Constructor Summary
Constructors Constructor Description VirtualListViewClient(ConnectionFactory cf, SortKey... keys)
Creates a new virtual list view client.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private RequestControl[]
appendRequestControls(SearchRequest request, VirtualListViewRequestControl cntrl)
Creates a new array of request controls which includes the VLV and sort controls.SearchResponse
execute(SearchRequest request, VirtualListViewParams params)
Performs a search operation with theVirtualListViewRequestControl
.SearchResponse
execute(SearchRequest request, VirtualListViewParams params, SearchResponse result)
Performs a search operation with theVirtualListViewRequestControl
.SearchResponse
executeToCompletion(SearchRequest request, VirtualListViewParams params)
Performs a search operation with theVirtualListViewRequestControl
.VirtualListViewResponseControl
getResponseControl(SearchResponse result)
Returns theVirtualListViewResponseControl
in the supplied response.protected byte[]
getVirtualListViewCookie(SearchResponse result)
Returns the VLV results cookie in the supplied response or null if no cookie exists.-
Methods inherited from class org.ldaptive.AbstractSearchOperationFactory
createSearchOperation, createSearchOperation, getConnectionFactory, getControlHandlers, getEntryHandlers, getExceptionHandler, getIntermediateResponseHandlers, getReferenceHandlers, getReferralHandlers, getRequestHandlers, getResultHandlers, getSearchResultHandlers, getThrowCondition, getUnsolicitedNotificationHandlers, setConnectionFactory, setControlHandlers, setEntryHandlers, setExceptionHandler, setIntermediateResponseHandlers, setReferenceHandlers, setReferralHandlers, setRequestHandlers, setResultHandlers, setSearchResultHandlers, setThrowCondition, setUnsolicitedNotificationHandlers
-
-
-
-
Field Detail
-
logger
protected final Logger logger
Logger for this class.
-
sortControl
private final SortRequestControl sortControl
Used on the search operation.
-
-
Constructor Detail
-
VirtualListViewClient
public VirtualListViewClient(ConnectionFactory cf, SortKey... keys)
Creates a new virtual list view client.- Parameters:
cf
- to get a connection fromkeys
- to supply to a sort request control
-
-
Method Detail
-
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 withSortRequestControl
andVirtualListViewRequestControl
and 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 withSortRequestControl
andVirtualListViewRequestControl
and 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 withSortRequestControl
andVirtualListViewRequestControl
and 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
public VirtualListViewResponseControl getResponseControl(SearchResponse result)
Returns theVirtualListViewResponseControl
in the supplied response.- Parameters:
result
- to inspect for a response control- Returns:
- VLV response control or null if it does not exist
-
getVirtualListViewCookie
protected byte[] getVirtualListViewCookie(SearchResponse result)
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 in included- Parameters:
request
- to read controls fromcntrl
- VLV control to include- Returns:
- array of request controls ready to be used in a search operation
-
-