com.unboundid.ldap.sdk.controls
Class EntryChangeNotificationControl

java.lang.Object
  extended by com.unboundid.ldap.sdk.Control
      extended by com.unboundid.ldap.sdk.controls.EntryChangeNotificationControl
All Implemented Interfaces:
DecodeableControl, java.io.Serializable

@NotMutable
@ThreadSafety(level=COMPLETELY_THREADSAFE)
public final class EntryChangeNotificationControl
extends Control
implements DecodeableControl

This class provides an implementation of the entry change notification control as defined in draft-ietf-ldapext-psearch. It will be returned in search result entries that match the criteria associated with a persistent search (see the PersistentSearchRequestControl class) and have been changed in a way associated with the registered change types for that search.

The information that can be included in an entry change notification control includes:

Note that the entry change notification control should only be included in search result entries that are associated with a search request that included the persistent search request control, and only if that persistent search request control had the returnECs flag set to true to indicate that entry change notification controls should be included in resulting entries. Further, the entry change notification control will only be included in entries that are returned as the result of a change in the server and not any of the preliminary entries that may be returned if the corresponding persistent search request had the changesOnly flag set to false.

See Also:
Serialized Form

Field Summary
static java.lang.String ENTRY_CHANGE_NOTIFICATION_OID
          The OID (2.16.840.1.113730.3.4.7) for the entry change notification control.
 
Constructor Summary
EntryChangeNotificationControl(PersistentSearchChangeType changeType, java.lang.String previousDN, long changeNumber)
          Creates a new entry change notification control with the provided information.
EntryChangeNotificationControl(PersistentSearchChangeType changeType, java.lang.String previousDN, long changeNumber, boolean isCritical)
          Creates a new entry change notification control with the provided information.
EntryChangeNotificationControl(java.lang.String oid, boolean isCritical, ASN1OctetString value)
          Creates a new entry change notification control with the provided information.
 
Method Summary
 EntryChangeNotificationControl decodeControl(java.lang.String oid, boolean isCritical, ASN1OctetString value)
          Creates a new instance of this decodeable control from the provided information.
static EntryChangeNotificationControl get(SearchResultEntry entry)
          Extracts an entry change notification control from the provided search result entry.
 long getChangeNumber()
          Retrieves the change number for the associated change, if available.
 PersistentSearchChangeType getChangeType()
          Retrieves the change type for this entry change notification control.
 java.lang.String getControlName()
          Retrieves the user-friendly name for this control, if available.
 java.lang.String getPreviousDN()
          Retrieves the previous DN for the entry, if applicable.
 void toString(java.lang.StringBuilder buffer)
          Appends a string representation of this LDAP control to the provided buffer.
 
Methods inherited from class com.unboundid.ldap.sdk.Control
decode, decode, decodeControls, deregisterDecodeableControl, encode, encodeControls, equals, getOID, getValue, hashCode, hasValue, isCritical, readFrom, registerDecodeableControl, toString, writeTo
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

ENTRY_CHANGE_NOTIFICATION_OID

public static final java.lang.String ENTRY_CHANGE_NOTIFICATION_OID
The OID (2.16.840.1.113730.3.4.7) for the entry change notification control.

See Also:
Constant Field Values
Constructor Detail

EntryChangeNotificationControl

public EntryChangeNotificationControl(PersistentSearchChangeType changeType,
                                      java.lang.String previousDN,
                                      long changeNumber)
Creates a new entry change notification control with the provided information. It will not be critical.

Parameters:
changeType - The change type for the change. It must not be null.
previousDN - The previous DN of the entry, if applicable.
changeNumber - The change number to include in this control, or -1 if there should not be a change number.

EntryChangeNotificationControl

public EntryChangeNotificationControl(PersistentSearchChangeType changeType,
                                      java.lang.String previousDN,
                                      long changeNumber,
                                      boolean isCritical)
Creates a new entry change notification control with the provided information.

Parameters:
changeType - The change type for the change. It must not be null.
previousDN - The previous DN of the entry, if applicable.
changeNumber - The change number to include in this control, or -1 if there should not be a change number.
isCritical - Indicates whether this control should be marked critical.

EntryChangeNotificationControl

public EntryChangeNotificationControl(java.lang.String oid,
                                      boolean isCritical,
                                      ASN1OctetString value)
                               throws LDAPException
Creates a new entry change notification control with the provided information.

Parameters:
oid - 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.
Throws:
LDAPException - If the provided control cannot be decoded as an entry change notification control.
Method Detail

decodeControl

public EntryChangeNotificationControl decodeControl(java.lang.String oid,
                                                    boolean isCritical,
                                                    ASN1OctetString value)
                                             throws LDAPException
Creates a new instance of this decodeable control from the provided information.

Specified by:
decodeControl in interface DecodeableControl
Parameters:
oid - 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.
Returns:
The decoded representation of this control.
Throws:
LDAPException - If the provided information cannot be decoded as a valid instance of this decodeable control.

get

public static EntryChangeNotificationControl get(SearchResultEntry entry)
                                          throws LDAPException
Extracts an entry change notification control from the provided search result entry.

Parameters:
entry - The search result entry from which to retrieve the entry change notification control.
Returns:
The entry change notification control contained in the provided search result entry, or null if the entry did not contain an entry change notification control.
Throws:
LDAPException - If a problem is encountered while attempting to decode the entry change notification control contained in the provided entry.

getChangeType

public PersistentSearchChangeType getChangeType()
Retrieves the change type for this entry change notification control.

Returns:
The change type for this entry change notification control.

getPreviousDN

public java.lang.String getPreviousDN()
Retrieves the previous DN for the entry, if applicable.

Returns:
The previous DN for the entry, or null if there is none.

getChangeNumber

public long getChangeNumber()
Retrieves the change number for the associated change, if available.

Returns:
The change number for the associated change, or -1 if none was provided.

getControlName

public java.lang.String getControlName()
Retrieves the user-friendly name for this control, if available. If no user-friendly name has been defined, then the OID will be returned.

Overrides:
getControlName in class Control
Returns:
The user-friendly name for this control, or the OID if no user-friendly name is available.

toString

public void toString(java.lang.StringBuilder buffer)
Appends a string representation of this LDAP control to the provided buffer.

Overrides:
toString in class Control
Parameters:
buffer - The buffer to which to append the string representation of this buffer.