public class DirSyncClient extends Object
Modifier and Type | Field and Description |
---|---|
private Connection |
connection
Connection to invoke the search operation on.
|
private DirSyncControl.Flag[] |
dirSyncFlags
DirSync flags.
|
private ExtendedDnControl.Flag |
extendedDnFlag
ExtendedDn flags.
|
protected Logger |
logger
Logger for this class.
|
private int |
maxAttributeCount
Maximum attribute count.
|
Constructor and Description |
---|
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.
|
Modifier and Type | Method and Description |
---|---|
private RequestControl[] |
createRequestControls(byte[] cookie)
Returns the list of request controls configured for this client.
|
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.
|
protected final Logger logger
private final Connection connection
private final DirSyncControl.Flag[] dirSyncFlags
private final int maxAttributeCount
private ExtendedDnControl.Flag extendedDnFlag
public DirSyncClient(Connection conn)
conn
- to execute the search operation onpublic DirSyncClient(Connection conn, DirSyncControl.Flag[] dsFlags)
conn
- to execute the search operation ondsFlags
- to set on the dir sync controlpublic DirSyncClient(Connection conn, DirSyncControl.Flag[] dsFlags, int count)
conn
- to execute the search operation ondsFlags
- to set on the dir sync controlcount
- max attribute countpublic ExtendedDnControl.Flag getExtendedDnFlag()
public void setExtendedDnFlag(ExtendedDnControl.Flag flag)
flag
- to set on the extended dn controlpublic Response<SearchResult> execute(SearchRequest request) throws LdapException
DirSyncControl
. The supplied request is modified in the following way:
request
- search request to executeLdapException
- if the search failspublic Response<SearchResult> execute(SearchRequest request, Response<SearchResult> response) throws LdapException
DirSyncControl
. The supplied request is modified in the following way:
AbstractRequest.setControls( org.ldaptive.control.RequestControl...)
is invoked with DirSyncControl
, ShowDeletedControl
, and ExtendedDnControl
The cookie is extracted from the supplied response and replayed in the request.
request
- search request to executeresponse
- of a previous dir sync operationIllegalArgumentException
- if the response does not contain a dir sync cookieLdapException
- if the search failspublic Response<SearchResult> execute(SearchRequest request, CookieManager manager) throws LdapException
DirSyncControl
. The supplied request is modified in the following way:
AbstractRequest.setControls( org.ldaptive.control.RequestControl...)
is invoked with DirSyncControl
, ShowDeletedControl
, and ExtendedDnControl
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.
request
- search request to executemanager
- for reading and writing cookiesLdapException
- if the search failspublic boolean hasMore(Response<SearchResult> response)
execute(SearchRequest, Response)
can be invoked again.response
- of a previous paged results operationpublic Response<SearchResult> executeToCompletion(SearchRequest request) throws LdapException
execute(SearchRequest, CookieManager)
with a DefaultCookieManager
.request
- search request to executeLdapException
- if the search failspublic Response<SearchResult> executeToCompletion(SearchRequest request, CookieManager manager) throws LdapException
DirSyncControl
. The supplied request is modified in the following way:
AbstractRequest.setControls( org.ldaptive.control.RequestControl...)
is invoked with DirSyncControl
, ShowDeletedControl
, and ExtendedDnControl
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.
request
- search request to executemanager
- for reading and writing cookiesLdapException
- if the search failsprotected long getDirSyncFlags(Response<SearchResult> response)
response
- of a previous dir sync operationprotected byte[] getDirSyncCookie(Response<SearchResult> response)
response
- of a previous dir sync operationprivate RequestControl[] createRequestControls(byte[] cookie)
cookie
- to add to the dir sync control or nullCopyright © 2003-2019 Virginia Tech. All Rights Reserved.