@NotMutable @ThreadSafety(level=COMPLETELY_THREADSAFE) public final class ActiveDirectoryDirSyncControl extends Control implements DecodeableControl
// Create a search request that will be used to identify all users below
// "dc=example,dc=com".
final SearchRequest searchRequest = new SearchRequest("dc=example,dc=com",
SearchScope.SUB, Filter.createEqualityFilter("objectClass", "User"));
// Define the components that will be included in the DirSync request
// control.
ASN1OctetString cookie = null;
final int flags = ActiveDirectoryDirSyncControl.FLAG_INCREMENTAL_VALUES |
ActiveDirectoryDirSyncControl.FLAG_OBJECT_SECURITY;
// Create a loop that will be used to keep polling for changes.
while (keepLooping)
{
// Update the controls that will be used for the search request.
searchRequest.setControls(new ActiveDirectoryDirSyncControl(true, flags,
50, cookie));
// Process the search and get the response control.
final SearchResult searchResult = connection.search(searchRequest);
ActiveDirectoryDirSyncControl dirSyncResponse =
ActiveDirectoryDirSyncControl.get(searchResult);
cookie = dirSyncResponse.getCookie();
// Process the search result entries because they represent entries that
// have been created or modified.
for (final SearchResultEntry updatedEntry :
searchResult.getSearchEntries())
{
// Do something with the entry.
}
// If the client might want to continue the search even after shutting
// down and starting back up later, then persist the cookie now.
}
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
DIRSYNC_OID
The OID (1.2.840.113556.1.4.841) for the DirSync control.
|
static int |
FLAG_ANCESTORS_FIRST_ORDER
The value of the flag that indicates the server should return parent
objects before child objects.
|
static int |
FLAG_INCREMENTAL_VALUES
The value of the flag that indicates that only changed values of attributes
should be included in search results.
|
static int |
FLAG_OBJECT_SECURITY
The value of the flag that indicates that the client should only be allowed
to view objects and attributes that are otherwise accessible to the client.
|
static int |
FLAG_PUBLIC_DATA_ONLY
The value of the flag that indicates that the server should not return
private data in search results.
|
| Constructor and Description |
|---|
ActiveDirectoryDirSyncControl(boolean isCritical,
int flags,
int maxAttributeCount,
ASN1OctetString cookie)
Creates a new DirSync control with the provided information.
|
ActiveDirectoryDirSyncControl(java.lang.String oid,
boolean isCritical,
ASN1OctetString value)
Creates a new DirSync control with settings decoded from the provided
control information.
|
| Modifier and Type | Method and Description |
|---|---|
ActiveDirectoryDirSyncControl |
decodeControl(java.lang.String oid,
boolean isCritical,
ASN1OctetString value)
Creates a new instance of this decodeable control from the provided
information.
|
static ActiveDirectoryDirSyncControl |
get(SearchResult result)
Extracts a DirSync response control from the provided result.
|
java.lang.String |
getControlName()
Retrieves the user-friendly name for this control, if available.
|
ASN1OctetString |
getCookie()
Retrieves a cookie that may be used to resume a previous DirSync search,
if available.
|
int |
getFlags()
Retrieves the value of the flags that should be used for DirSync operation.
|
int |
getMaxAttributeCount()
Retrieves the maximum number of attributes to return.
|
void |
toString(java.lang.StringBuilder buffer)
Appends a string representation of this LDAP control to the provided
buffer.
|
decode, decode, decodeControls, decodeJSONControl, deregisterDecodeableControl, encode, encodeControls, equals, getOID, getValue, hashCode, hasValue, isCritical, readFrom, registerDecodeableControl, registerDecodeableControl, toJSONControl, toString, writeTo@NotNull public static final java.lang.String DIRSYNC_OID
public static final int FLAG_OBJECT_SECURITY
public static final int FLAG_ANCESTORS_FIRST_ORDER
public static final int FLAG_PUBLIC_DATA_ONLY
public static final int FLAG_INCREMENTAL_VALUES
public ActiveDirectoryDirSyncControl(boolean isCritical, int flags, int maxAttributeCount, @Nullable ASN1OctetString cookie)
isCritical - Indicates whether this control should be marked
critical.flags - The value of the flags that should be used for
DirSync operation. This should be zero if no
special flags or needed, or a bitwise OR of the
values of the individual flags that are desired.maxAttributeCount - The maximum number of attributes to return.cookie - A cookie that may be used to resume a previous
DirSync search. This may be null if
no previous cookie is available.public ActiveDirectoryDirSyncControl(@NotNull java.lang.String oid, boolean isCritical, @Nullable ASN1OctetString value) throws LDAPException
oid - The OID of the control to be decoded.isCritical - The criticality of the control to be decoded.value - The value of the control to be decoded.LDAPException - If a problem is encountered while attempting to
decode the control value as appropriate for a
DirSync control.@NotNull public ActiveDirectoryDirSyncControl decodeControl(@NotNull java.lang.String oid, boolean isCritical, @Nullable ASN1OctetString value) throws LDAPException
decodeControl in interface DecodeableControloid - The OID for the control.isCritical - Indicates whether the control should be marked
critical.value - The encoded value for the control. This may be
null if no value was provided.LDAPException - If the provided information cannot be decoded as a
valid instance of this decodeable control.public int getFlags()
public int getMaxAttributeCount()
@Nullable public ASN1OctetString getCookie()
@Nullable public static ActiveDirectoryDirSyncControl get(@NotNull SearchResult result) throws LDAPException
result - The result from which to retrieve the DirSync response
control.null if the result did not include a DirSync response
control.LDAPException - If a problem is encountered while attempting to
decode the DirSync response control contained in
the provided result.@NotNull public java.lang.String getControlName()
getControlName in class Control