org.ldaptive.control.util
Class PagedResultsClient

java.lang.Object
  extended by org.ldaptive.control.util.PagedResultsClient

public class PagedResultsClient
extends Object

Client that simplifies using the paged results control.

Version:
$Revision: 2885 $ $Date: 2014-02-05 16:28:49 -0500 (Wed, 05 Feb 2014) $
Author:
Middleware Services

Field Summary
protected  org.slf4j.Logger logger
          Logger for this class.
 
Constructor Summary
PagedResultsClient(Connection conn, int size)
          Creates a new paged results client.
 
Method Summary
 Response<SearchResult> execute(SearchRequest request)
          Performs a search operation with the PagedResultsControl.
 Response<SearchResult> execute(SearchRequest request, CookieManager manager)
          Performs a search operation with the PagedResultsControl.
 Response<SearchResult> execute(SearchRequest request, Response<SearchResult> response)
          Performs a search operation with the PagedResultsControl.
 Response<SearchResult> executeToCompletion(SearchRequest request)
          Performs a search operation with the PagedResultsControl.
 Response<SearchResult> executeToCompletion(SearchRequest request, CookieManager manager)
          Performs a search operation with the PagedResultsControl.
protected  byte[] getPagedResultsCookie(Response<SearchResult> response)
          Returns the paged results cookie in the supplied response or null if no cookie exists.
 boolean hasMore(Response<SearchResult> response)
          Returns whether execute(SearchRequest, Response) can be invoked again.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected final org.slf4j.Logger logger
Logger for this class.

Constructor Detail

PagedResultsClient

public PagedResultsClient(Connection conn,
                          int size)
Creates a new paged results client.

Parameters:
conn - to execute the search operation on
size - the results page size to request
Method Detail

execute

public Response<SearchResult> execute(SearchRequest request)
                               throws LdapException
Performs a search operation with the PagedResultsControl. The supplied request is modified in the following way:

Parameters:
request - search request to execute
Returns:
search operation response
Throws:
LdapException - if the search fails

execute

public Response<SearchResult> execute(SearchRequest request,
                                      Response<SearchResult> response)
                               throws LdapException
Performs a search operation with the PagedResultsControl. The supplied request is modified in the following way:

The cookie is extracted from the supplied response and replayed in the request.

Parameters:
request - search request to execute
response - of a previous paged results operation
Returns:
search operation response
Throws:
LdapException - if the search fails

execute

public Response<SearchResult> execute(SearchRequest request,
                                      CookieManager manager)
                               throws LdapException
Performs a search operation with the PagedResultsControl. The supplied request is modified in the following way:

The cookie used in the request is read from the cookie manager and written to the cookie manager after a successful search, if the response contains a cookie.

Parameters:
request - search request to execute
manager - for reading and writing cookies
Returns:
search operation response
Throws:
LdapException - if the search fails

hasMore

public boolean hasMore(Response<SearchResult> response)
Returns whether execute(SearchRequest, Response) can be invoked again.

Parameters:
response - of a previous paged results operation
Returns:
whether more paged search results can be retrieved from the server

executeToCompletion

public Response<SearchResult> executeToCompletion(SearchRequest request)
                                           throws LdapException
Performs a search operation with the PagedResultsControl. The supplied request is modified in the following way:

This method will continue to execute search operations until all paged search results have been retrieved from the server. The returned response contains the response data of the last paged result operation plus the entries and references returned by all previous search operations.

Parameters:
request - search request to execute
Returns:
search operation response of the last paged result operation
Throws:
LdapException - if the search fails

executeToCompletion

public Response<SearchResult> executeToCompletion(SearchRequest request,
                                                  CookieManager manager)
                                           throws LdapException
Performs a search operation with the PagedResultsControl. The supplied request is modified in the following way:

This method will continue to execute search operations until all paged search results have been retrieved from the server. The returned response contains the response data of the last paged result operation plus the entries and references returned by all previous search operations.

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.

Parameters:
request - search request to execute
manager - for reading and writing cookies
Returns:
search operation response of the last paged result operation
Throws:
LdapException - if the search fails

getPagedResultsCookie

protected byte[] getPagedResultsCookie(Response<SearchResult> response)
Returns the paged results cookie in the supplied response or null if no cookie exists.

Parameters:
response - of a previous paged results operation
Returns:
paged results cookie or null


Copyright © 2003-2017 Virginia Tech. All Rights Reserved.