| | |
| | | */ |
| | | public LDAPControl(Control control) |
| | | { |
| | | |
| | | this.control = control; |
| | | } |
| | | |
| | |
| | | */ |
| | | public LDAPControl(String oid) |
| | | { |
| | | |
| | | control = new Control(oid, false); |
| | | } |
| | | |
| | |
| | | */ |
| | | public LDAPControl(String oid, boolean isCritical) |
| | | { |
| | | |
| | | control = new Control(oid, isCritical); |
| | | } |
| | | |
| | |
| | | */ |
| | | public LDAPControl(String oid, boolean isCritical, ASN1OctetString value) |
| | | { |
| | | |
| | | control = new Control(oid, isCritical, value); |
| | | } |
| | | |
| | |
| | | */ |
| | | public Control getControl() |
| | | { |
| | | |
| | | return control; |
| | | } |
| | | |
| | |
| | | */ |
| | | public ASN1Element encode() |
| | | { |
| | | |
| | | ArrayList<ASN1Element> elements = new ArrayList<ASN1Element>(3); |
| | | elements.add(new ASN1OctetString(control.getOID())); |
| | | |
| | |
| | | */ |
| | | public static ASN1Element encodeControls(ArrayList<LDAPControl> controls) |
| | | { |
| | | |
| | | ArrayList<ASN1Element> elements = |
| | | new ArrayList<ASN1Element>(controls.size()); |
| | | for (LDAPControl c : controls) |
| | |
| | | public static LDAPControl decode(ASN1Element element) |
| | | throws LDAPException |
| | | { |
| | | |
| | | if (element == null) |
| | | { |
| | | int msgID = MSGID_LDAP_CONTROL_DECODE_NULL; |
| | |
| | | public static ArrayList<LDAPControl> decodeControls(ASN1Element element) |
| | | throws LDAPException |
| | | { |
| | | |
| | | if (element == null) |
| | | { |
| | | int msgID = MSGID_LDAP_CONTROL_DECODE_CONTROLS_NULL; |
| | |
| | | */ |
| | | public String getOID() |
| | | { |
| | | |
| | | return control.getOID(); |
| | | } |
| | | |
| | |
| | | */ |
| | | public boolean isCritical() |
| | | { |
| | | |
| | | return control.isCritical(); |
| | | } |
| | | |
| | |
| | | */ |
| | | public ASN1OctetString getValue() |
| | | { |
| | | |
| | | return control.getValue(); |
| | | } |
| | | |
| | |
| | | */ |
| | | public String toString() |
| | | { |
| | | |
| | | StringBuilder buffer = new StringBuilder(); |
| | | toString(buffer); |
| | | return buffer.toString(); |
| | |
| | | */ |
| | | public void toString(StringBuilder buffer) |
| | | { |
| | | |
| | | buffer.append("LDAPControl(oid="); |
| | | buffer.append(control.getOID()); |
| | | buffer.append(", criticality="); |
| | |
| | | */ |
| | | public void toString(StringBuilder buffer, int indent) |
| | | { |
| | | |
| | | StringBuilder indentBuf = new StringBuilder(indent); |
| | | for (int i=0 ; i < indent; i++) |
| | | { |