org.ldaptive.ad.control.util
Class DirSyncClient

java.lang.Object
  extended by org.ldaptive.ad.control.util.DirSyncClient

public class DirSyncClient
extends Object

Client that simplifies using the active directory dir sync 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
DirSyncClient(Connection conn)
          Creates a new dir sync client.
DirSyncClient(Connection conn, DirSyncControl.Flag[] dsFlags)
          Creates a new dir sync client.
DirSyncClient(Connection conn, DirSyncControl.Flag[] dsFlags, int count)
          Creates a new dir sync client.
 
Method Summary
 Response<SearchResult> execute(SearchRequest request)
          Performs a search operation with the DirSyncControl.
 Response<SearchResult> execute(SearchRequest request, CookieManager manager)
          Performs a search operation with the DirSyncControl.
 Response<SearchResult> execute(SearchRequest request, Response<SearchResult> response)
          Performs a search operation with the DirSyncControl.
 Response<SearchResult> executeToCompletion(SearchRequest request)
          Invokes execute(SearchRequest, CookieManager) with a DefaultCookieManager.
 Response<SearchResult> executeToCompletion(SearchRequest request, CookieManager manager)
          Performs a search operation with the DirSyncControl.
protected  byte[] getDirSyncCookie(Response<SearchResult> response)
          Returns the dir sync cookie in the supplied response or null if no cookie exists.
protected  long getDirSyncFlags(Response<SearchResult> response)
          Returns the dir sync flags in the supplied response or -1 if no flags exists.
 ExtendedDnControl.Flag getExtendedDnFlag()
          Returns the flag that is used on the extended dn control.
 boolean hasMore(Response<SearchResult> response)
          Returns whether execute(SearchRequest, Response) can be invoked again.
 void setExtendedDnFlag(ExtendedDnControl.Flag flag)
          Sets the flag to use on the extended dn control.
 
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

DirSyncClient

public DirSyncClient(Connection conn)
Creates a new dir sync client.

Parameters:
conn - to execute the search operation on

DirSyncClient

public DirSyncClient(Connection conn,
                     DirSyncControl.Flag[] dsFlags)
Creates a new dir sync client.

Parameters:
conn - to execute the search operation on
dsFlags - to set on the dir sync control

DirSyncClient

public DirSyncClient(Connection conn,
                     DirSyncControl.Flag[] dsFlags,
                     int count)
Creates a new dir sync client.

Parameters:
conn - to execute the search operation on
dsFlags - to set on the dir sync control
count - max attribute count
Method Detail

getExtendedDnFlag

public ExtendedDnControl.Flag getExtendedDnFlag()
Returns the flag that is used on the extended dn control.

Returns:
extended dn control flag

setExtendedDnFlag

public void setExtendedDnFlag(ExtendedDnControl.Flag flag)
Sets the flag to use on the extended dn control.

Parameters:
flag - to set on the extended dn control

execute

public Response<SearchResult> execute(SearchRequest request)
                               throws LdapException
Performs a search operation with the DirSyncControl. 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 DirSyncControl. 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 dir sync operation
Returns:
search operation response
Throws:
IllegalArgumentException - if the response does not contain a dir sync cookie
LdapException - if the search fails

execute

public Response<SearchResult> execute(SearchRequest request,
                                      CookieManager manager)
                               throws LdapException
Performs a search operation with the DirSyncControl. 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 dir sync results can be retrieved from the server

executeToCompletion

public Response<SearchResult> executeToCompletion(SearchRequest request)
                                           throws LdapException
Invokes execute(SearchRequest, CookieManager) with a DefaultCookieManager.

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

executeToCompletion

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

This method will continue to execute search operations until all dir sync search results have been retrieved from the server. The returned response contains the response data of the last dir sync 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 dir sync operation
Throws:
LdapException - if the search fails

getDirSyncFlags

protected long getDirSyncFlags(Response<SearchResult> response)
Returns the dir sync flags in the supplied response or -1 if no flags exists.

Parameters:
response - of a previous dir sync operation
Returns:
dir sync flags or -1

getDirSyncCookie

protected byte[] getDirSyncCookie(Response<SearchResult> response)
Returns the dir sync cookie in the supplied response or null if no cookie exists.

Parameters:
response - of a previous dir sync operation
Returns:
dir sync cookie or null


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