org.opends.server.protocols.ldap
Class LDAPControl

java.lang.Object
  extended by org.opends.server.protocols.ldap.LDAPControl

public class LDAPControl
extends java.lang.Object

This class defines the data structures and methods to use when interacting with a generic LDAP control or set of controls.


Constructor Summary
LDAPControl(Control control)
          Creates a new LDAP control with the information in the provided control.
LDAPControl(java.lang.String oid)
          Creates a new LDAP control with the specified OID.
LDAPControl(java.lang.String oid, boolean isCritical)
          Creates a new LDAP control with the specified OID and criticality.
LDAPControl(java.lang.String oid, boolean isCritical, ASN1OctetString value)
          Creates a new LDAP control with the specified OID, criticality, and value.
 
Method Summary
static LDAPControl decode(ASN1Element element)
          Decodes the provided ASN.1 element as an LDAP control.
static java.util.ArrayList<LDAPControl> decodeControls(ASN1Element element)
          Decodes the provided ASN.1 element as a set of controls.
 ASN1Element encode()
          Encodes this control to an ASN.1 element.
static ASN1Element encodeControls(java.util.ArrayList<LDAPControl> controls)
          Encodes the provided set of controls into an ASN.1 sequence.
 Control getControl()
          Retrieves the control wrapped by this LDAP control.
 java.lang.String getOID()
          Retrieves the OID for this control.
 ASN1OctetString getValue()
          Retrieves the value for this control.
 boolean isCritical()
          Indicates whether this control should be considered critical.
 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 toString(java.lang.StringBuilder buffer, int indent)
          Appends a multi-line string representation of this LDAP control to the provided buffer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LDAPControl

public LDAPControl(Control control)
Creates a new LDAP control with the information in the provided control.

Parameters:
control - The control to use to create this LDAP control.

LDAPControl

public LDAPControl(java.lang.String oid)
Creates a new LDAP control with the specified OID. It will not be critical, and will not have a value.

Parameters:
oid - The OID for this LDAP control.

LDAPControl

public LDAPControl(java.lang.String oid,
                   boolean isCritical)
Creates a new LDAP control with the specified OID and criticality. It will not have a value.

Parameters:
oid - The OID for this LDAP control.
isCritical - Indicates whether this control should be considered critical.

LDAPControl

public LDAPControl(java.lang.String oid,
                   boolean isCritical,
                   ASN1OctetString value)
Creates a new LDAP control with the specified OID, criticality, and value.

Parameters:
oid - The OID for this LDAP control.
isCritical - Indicates whether this control should be considered critical.
value - The value for this LDAP control.
Method Detail

getControl

public Control getControl()
Retrieves the control wrapped by this LDAP control.

Returns:
The control wrapped by this LDAP control.

encode

public ASN1Element encode()
Encodes this control to an ASN.1 element.

Returns:
The ASN.1 element containing the encoded control.

encodeControls

public static ASN1Element encodeControls(java.util.ArrayList<LDAPControl> controls)
Encodes the provided set of controls into an ASN.1 sequence.

Parameters:
controls - The set of controls to encode.
Returns:
The ASN.1 element containing the encoded set of controls.

decode

public static LDAPControl decode(ASN1Element element)
                          throws LDAPException
Decodes the provided ASN.1 element as an LDAP control.

Parameters:
element - The ASN.1 element to decode.
Returns:
The decoded LDAP control.
Throws:
LDAPException - If a problem occurs while attempting to decode the provided ASN.1 element as an LDAP control.

decodeControls

public static java.util.ArrayList<LDAPControl> decodeControls(ASN1Element element)
                                                       throws LDAPException
Decodes the provided ASN.1 element as a set of controls.

Parameters:
element - The ASN.1 element containing the encoded set of controls.
Returns:
The decoded set of controls.
Throws:
LDAPException - If a problem occurs while attempting to decode the controls.

getOID

public java.lang.String getOID()
Retrieves the OID for this control.

Returns:
The OID for this control.

isCritical

public boolean isCritical()
Indicates whether this control should be considered critical.

Returns:
true if this control should be considered critical, or false if not.

getValue

public ASN1OctetString getValue()
Retrieves the value for this control.

Returns:
The value for this control, or null if there is none.

toString

public java.lang.String toString()
Retrieves a string representation of this LDAP control.

Overrides:
toString in class java.lang.Object
Returns:
A string representation of this LDAP control.

toString

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

Parameters:
buffer - The buffer to which the information should be appended.

toString

public void toString(java.lang.StringBuilder buffer,
                     int indent)
Appends a multi-line string representation of this LDAP control to the provided buffer.

Parameters:
buffer - The buffer to which the information should be appended.
indent - The number of spaces to indent the information.