org.apache.directory.shared.ldap.codec
Class BasicControlDecorator<E>

java.lang.Object
  extended by org.apache.directory.shared.asn1.AbstractAsn1Object
      extended by org.apache.directory.shared.ldap.codec.controls.ControlDecorator<Control>
          extended by org.apache.directory.shared.ldap.codec.BasicControlDecorator<E>
All Implemented Interfaces:
Asn1Object, CodecControl<Control>, Decorator<Control>, Control

public class BasicControlDecorator<E>
extends ControlDecorator<Control>

A decorator for handling opaque Control objects where we know nothing about their encoded value. These Controls are generated by default when an ControlFactory for them has not been registered with the LdapCodecService.

Version:
$Rev$, $Date$
Author:
Apache Directory Project

Field Summary
 
Fields inherited from class org.apache.directory.shared.ldap.codec.controls.ControlDecorator
value, valueLength
 
Constructor Summary
BasicControlDecorator(LdapCodecService codec, Control control)
          Creates a new instance of BasicControlDecorator, decorating a AbstractControl.
 
Method Summary
 int computeLength()
          Compute the object length, which is the sum of all inner length.
 Asn1Object decode(byte[] controlBytes)
          Decodes raw ASN.1 encoded bytes into an Asn1Object for the control.
 ByteBuffer encode(ByteBuffer buffer)
          Encode the object to a PDU.
 
Methods inherited from class org.apache.directory.shared.ldap.codec.controls.ControlDecorator
equals, getCodecService, getDecorated, getOid, getValue, hashCode, hasValue, isCritical, setCritical, setDecorated, setValue, toString
 
Methods inherited from class org.apache.directory.shared.asn1.AbstractAsn1Object
addLength, getCurrentLength, getExpectedLength, getParent, getTlvId, setCurrentLength, setExpectedLength, setParent
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BasicControlDecorator

public BasicControlDecorator(LdapCodecService codec,
                             Control control)
Creates a new instance of BasicControlDecorator, decorating a AbstractControl.

Parameters:
codec - The LDAP codec service.
control - The AbstractControl to decorate.
Method Detail

decode

public Asn1Object decode(byte[] controlBytes)
                  throws DecoderException
Decodes raw ASN.1 encoded bytes into an Asn1Object for the control.

Parameters:
controlBytes - the encoded control bytes
Returns:
the decoded Asn1Object for the control
Throws:
DecoderException - if anything goes wrong

computeLength

public int computeLength()
Compute the object length, which is the sum of all inner length.

Specified by:
computeLength in interface Asn1Object
Specified by:
computeLength in interface Decorator<Control>
Overrides:
computeLength in class ControlDecorator<Control>
Returns:
The object's computed length

encode

public ByteBuffer encode(ByteBuffer buffer)
                  throws EncoderException
Encode the object to a PDU.

Specified by:
encode in interface Asn1Object
Specified by:
encode in interface Decorator<Control>
Overrides:
encode in class AbstractAsn1Object
Parameters:
buffer - The buffer where to put the PDU
Returns:
The PDU.
Throws:
EncoderException - if the buffer can't be encoded


Copyright © 2003-2011 The Apache Software Foundation. All Rights Reserved.