org.apache.directory.shared.ldap.codec.controls
Class ControlDecorator<E extends Control>

java.lang.Object
  extended by org.apache.directory.shared.asn1.AbstractAsn1Object
      extended by org.apache.directory.shared.ldap.codec.controls.ControlDecorator<E>
Type Parameters:
E -
All Implemented Interfaces:
Asn1Object, CodecControl<E>, Decorator<E>, Control
Direct Known Subclasses:
BasicControlDecorator, CascadeDecorator, EntryChangeDecorator, ManageDsaITDecorator, PagedResultsDecorator, PasswordPolicyDecorator, PersistentSearchDecorator, SubentriesDecorator, SyncDoneValueDecorator, SyncInfoValueDecorator, SyncModifyDnDecorator, SyncRequestValueDecorator, SyncStateValueDecorator

public abstract class ControlDecorator<E extends Control>
extends AbstractAsn1Object
implements CodecControl<E>

Decorates Control objects by wrapping them, and enabling them as CodecControls so the codec to store transient information associated with the Control in the decorator while processing.

Author:
Apache Directory Project

Field Summary
protected  byte[] value
          The encoded value of the control.
protected  int valueLength
          The encoded value length
 
Constructor Summary
ControlDecorator(LdapCodecService codec, E decoratedControl)
          Creates a ControlDecorator to codec enable it.
 
Method Summary
 int computeLength()
          Compute the object length, which is the sum of all inner length.
 boolean equals(Object o)
           
 LdapCodecService getCodecService()
          Gets the codec service responsible for managing the encoding and decoding of the decorated objects.
 E getDecorated()
          Gets the object being decorated by this IDecorator.
 String getOid()
          Get the OID
 byte[] getValue()
          Get the control value
 int hashCode()
           
 boolean hasValue()
          Checks to see if a value is set for this CodecControl.
 boolean isCritical()
          Get the criticality
 void setCritical(boolean criticality)
          Set the criticality
 void setDecorated(E decorated)
          
 void setValue(byte[] value)
          Set the encoded control value
 String toString()
          Return a String representing a Control
 
Methods inherited from class org.apache.directory.shared.asn1.AbstractAsn1Object
addLength, encode, getCurrentLength, getExpectedLength, getParent, getTlvId, setCurrentLength, setExpectedLength, setParent
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.apache.directory.shared.ldap.codec.api.CodecControl
decode
 
Methods inherited from interface org.apache.directory.shared.ldap.codec.api.Decorator
encode
 

Field Detail

valueLength

protected int valueLength
The encoded value length


value

protected byte[] value
The encoded value of the control.

Constructor Detail

ControlDecorator

public ControlDecorator(LdapCodecService codec,
                        E decoratedControl)
Creates a ControlDecorator to codec enable it.

Parameters:
decoratedControl - The Control to decorate.
Method Detail

getDecorated

public E getDecorated()
Gets the object being decorated by this IDecorator.

Specified by:
getDecorated in interface Decorator<E extends Control>
Returns:
The decorated object

setDecorated

public void setDecorated(E decorated)


getCodecService

public LdapCodecService getCodecService()
Gets the codec service responsible for managing the encoding and decoding of the decorated objects.

Specified by:
getCodecService in interface Decorator<E extends Control>
Returns:
the codec service

getOid

public String getOid()
Get the OID

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

hasValue

public boolean hasValue()
Checks to see if a value is set for this CodecControl.

Specified by:
hasValue in interface CodecControl<E extends Control>
Returns:
true, if this control has a value, false otherwise

getValue

public byte[] getValue()
Get the control value

Specified by:
getValue in interface CodecControl<E extends Control>
Returns:
The control value

setValue

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

Specified by:
setValue in interface CodecControl<E extends Control>
Parameters:
value - 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 Decorator<E extends Control>
Specified by:
computeLength in class AbstractAsn1Object
Returns:
The object's computed length

hashCode

public int hashCode()
Overrides:
hashCode in class Object
See Also:
Object.hashCode()

equals

public boolean equals(Object o)
Overrides:
equals in class Object
See Also:
Object.equals(Object)

toString

public String toString()
Return a String representing a Control

Overrides:
toString in class Object


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