org.apache.directory.shared.ldap.codec.controls
Class AbstractControl

java.lang.Object
  extended by org.apache.directory.shared.asn1.AbstractAsn1Object
      extended by org.apache.directory.shared.ldap.codec.controls.AbstractControl
All Implemented Interfaces:
Asn1Object, CodecControl, Control
Direct Known Subclasses:
CascadeControl, ControlImpl, EntryChangeControl, LdifControl, ManageDsaITControl, PagedResultsControl, PersistentSearchControl, SubentriesControl, SyncDoneValueControl, SyncInfoValueControl, SyncRequestValueControl, SyncStateValueControl

public abstract class AbstractControl
extends AbstractAsn1Object
implements Control, CodecControl

A Asn1Object to store a Control.

Version:
$Rev: 912399 $, $Date: 2010-02-21 21:52:31 +0100 (Sun, 21 Feb 2010) $,
Author:
Apache Directory Project

Field Summary
protected  ControlDecoder decoder
           
protected  byte[] value
          Optional control value
protected  int valueLength
          The encoded value length
 
Fields inherited from class org.apache.directory.shared.asn1.AbstractAsn1Object
parent
 
Constructor Summary
AbstractControl(java.lang.String oid)
          Default constructor.
 
Method Summary
 int computeLength()
          Compute the object length, which is the sum of all inner length.
 int computeLength(int valueLength)
          
 java.nio.ByteBuffer encode(java.nio.ByteBuffer buffer)
          Encode the object to a PDU.
 ControlDecoder getDecoder()
          Get the associated decoder
 java.lang.String getOid()
          Get the OID
 byte[] getValue()
          Get the control value
 boolean hasValue()
          Tells if the Control has a value or not
 boolean isCritical()
          Get the criticality
 void setCritical(boolean criticality)
          Set the criticality
 void setValue(byte[] value)
          Set the encoded control value
 java.lang.String toString()
          Return a String representing a Control
 
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, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

value

protected byte[] value
Optional control value


valueLength

protected int valueLength
The encoded value length


decoder

protected ControlDecoder decoder
Constructor Detail

AbstractControl

public AbstractControl(java.lang.String oid)
Default constructor.

Method Detail

getOid

public java.lang.String getOid()
Get the OID

Specified by:
getOid in interface Control
Returns:
A string which represent the control oid

getValue

public byte[] getValue()
Get the control value

Specified by:
getValue in interface Control
Returns:
The control value

setValue

public void setValue(byte[] value)
Set the encoded control value

Specified by:
setValue in interface Control
Parameters:
encodedValue - The encoded control value to store

isCritical

public boolean isCritical()
Get the criticality

Specified by:
isCritical in interface Control
Returns:
true if the criticality flag is true.

setCritical

public void setCritical(boolean criticality)
Set the criticality

Specified by:
setCritical in interface Control
Parameters:
criticality - The criticality value

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 CodecControl
Specified by:
computeLength in class AbstractAsn1Object
Returns:
The object's computed length

computeLength

public int computeLength(int valueLength)


encode

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

Specified by:
encode in interface Asn1Object
Specified by:
encode in interface CodecControl
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

hasValue

public boolean hasValue()
Tells if the Control has a value or not

Specified by:
hasValue in interface Control
Returns:
true if th Control has a value, even containing no bytes.

getDecoder

public ControlDecoder getDecoder()
Description copied from interface: CodecControl
Get the associated decoder

Specified by:
getDecoder in interface CodecControl
Returns:
The Control decoder

toString

public java.lang.String toString()
Return a String representing a Control

Overrides:
toString in class java.lang.Object


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