|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.unboundid.ldap.sdk.Control
@Extensible @NotMutable @ThreadSafety(level=COMPLETELY_THREADSAFE) public class Control
This class provides a data structure that represents an LDAP control. A
control is an element that may be attached to an LDAP request or response
to provide additional information about the processing that should be (or has
been) performed. This class may be overridden to provide additional
processing for specific types of controls.
A control includes the following elements:
UpdatableLDAPRequest
objects. When using
response controls, each response control class includes a get
method
that can be used to extract the appropriate control from an appropriate
result (e.g., LDAPResult
, SearchResultEntry
, or
SearchResultReference
).
Constructor Summary | |
---|---|
protected |
Control()
Creates a new empty control instance that is intended to be used only for decoding controls via the DecodeableControl interface. |
protected |
Control(Control control)
Creates a new control whose fields are initialized from the contents of the provided control. |
|
Control(java.lang.String oid)
Creates a new control with the provided OID. |
|
Control(java.lang.String oid,
boolean isCritical)
Creates a new control with the provided OID and criticality. |
|
Control(java.lang.String oid,
boolean isCritical,
ASN1OctetString value)
Creates a new control with the provided information. |
Method Summary | |
---|---|
static Control |
decode(ASN1Sequence controlSequence)
Decodes the provided ASN.1 sequence as an LDAP control. |
static Control |
decode(java.lang.String oid,
boolean isCritical,
ASN1OctetString value)
Attempts to create the most appropriate control instance from the provided information. |
static Control[] |
decodeControls(ASN1Sequence controlSequence)
Decodes the contents of the provided sequence as a set of controls. |
static void |
deregisterDecodeableControl(java.lang.String oid)
Deregisters the decodeable control class associated with the provided OID. |
ASN1Sequence |
encode()
Encodes this control to an ASN.1 sequence suitable for use in an LDAP message. |
static ASN1Sequence |
encodeControls(Control[] controls)
Encodes the provided set of controls to an ASN.1 sequence suitable for inclusion in an LDAP message. |
boolean |
equals(java.lang.Object o)
Indicates whether the provided object may be considered equal to this control. |
java.lang.String |
getControlName()
Retrieves the user-friendly name for this control, if available. |
java.lang.String |
getOID()
Retrieves the OID for this control. |
ASN1OctetString |
getValue()
Retrieves the encoded value for this control. |
int |
hashCode()
Retrieves a hash code for this control. |
boolean |
hasValue()
Indicates whether this control has a value. |
boolean |
isCritical()
Indicates whether this control should be considered critical. |
static Control |
readFrom(ASN1StreamReader reader)
Reads an LDAP control from the provided ASN.1 stream reader. |
static void |
registerDecodeableControl(java.lang.String oid,
DecodeableControl controlInstance)
Registers the provided class to be used in an attempt to decode controls with the specified OID. |
java.lang.String |
toString()
Retrieves a string representation of this LDAP control. |
void |
toString(java.lang.StringBuilder buffer)
Appends a string representation of this LDAP control to the provided buffer. |
void |
writeTo(ASN1Buffer writer)
Writes an ASN.1-encoded representation of this control to the provided ASN.1 stream writer. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
protected Control()
DecodeableControl
interface. All
DecodeableControl
objects must provide a default constructor that
can be used to create an instance suitable for invoking the
decodeControl
method.
protected Control(Control control)
control
- The control whose information should be used to create
this new control.public Control(java.lang.String oid)
oid
- The OID for this control. It must not be null
.public Control(java.lang.String oid, boolean isCritical)
oid
- The OID for this control. It must not be null
.isCritical
- Indicates whether this control should be considered
critical.public Control(java.lang.String oid, boolean isCritical, ASN1OctetString value)
oid
- The OID for this control. It must not be null
.isCritical
- Indicates whether this control should be considered
critical.value
- The value for this control. It may be null
if
there is no value.Method Detail |
---|
public final java.lang.String getOID()
public final boolean isCritical()
true
if this control should be considered critical, or
false
if not.public final boolean hasValue()
true
if this control has a value, or false
if not.public final ASN1OctetString getValue()
null
if there is no
value.public final void writeTo(ASN1Buffer writer)
writer
- The ASN.1 stream writer to which the encoded representation
should be written.public final ASN1Sequence encode()
public static Control readFrom(ASN1StreamReader reader) throws LDAPException
reader
- The ASN.1 stream reader from which to read the control.
LDAPException
- If a problem occurs while attempting to read or
parse the control.public static Control decode(ASN1Sequence controlSequence) throws LDAPException
controlSequence
- The ASN.1 sequence to be decoded.
LDAPException
- If a problem occurs while attempting to decode the
provided ASN.1 sequence as an LDAP control.public static Control decode(java.lang.String oid, boolean isCritical, ASN1OctetString value) throws LDAPException
DecodeableControl
instance has been registered
for the specified OID, then this method will attempt to use that instance
to construct a control. If that fails, or if no appropriate
DecodeableControl
is registered, then a generic control will be
returned.
oid
- The OID for the control. It must not be null
.isCritical
- Indicates whether the control should be considered
critical.value
- The value for the control. It may be null
if
there is no value.
LDAPException
- If a problem occurs while attempting to decode the
provided ASN.1 sequence as an LDAP control.public static ASN1Sequence encodeControls(Control[] controls)
controls
- The set of controls to be encoded.
public static Control[] decodeControls(ASN1Sequence controlSequence) throws LDAPException
controlSequence
- The ASN.1 sequence containing the encoded set of
controls.
LDAPException
- If a problem occurs while attempting to decode any
of the controls.public static void registerDecodeableControl(java.lang.String oid, DecodeableControl controlInstance)
oid
- The response control OID for which the provided
class will be registered.controlInstance
- The control instance that should be used to decode
controls with the provided OID.public static void deregisterDecodeableControl(java.lang.String oid)
oid
- The response control OID for which to deregister the
decodeable control class.public final int hashCode()
hashCode
in class java.lang.Object
public final boolean equals(java.lang.Object o)
equals
in class java.lang.Object
o
- The object for which to make the determination.
true
if the provided object may be considered equal to
this control, or false
if not.public java.lang.String getControlName()
public java.lang.String toString()
toString
in class java.lang.Object
public void toString(java.lang.StringBuilder buffer)
buffer
- The buffer to which to append the string representation of
this buffer.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |