org.apache.directory.shared.ldap.codec.decorators
Class MessageDecorator<E extends Message>

java.lang.Object
  extended by org.apache.directory.shared.ldap.codec.decorators.MessageDecorator<E>
All Implemented Interfaces:
Decorator<E>, Message
Direct Known Subclasses:
IntermediateResponseDecorator, RequestDecorator, ResponseDecorator, SearchRequestDecorator, SearchResultEntryDecorator, SearchResultReferenceDecorator

public abstract class MessageDecorator<E extends Message>
extends Object
implements Message, Decorator<E>

A decorator for the generic LDAP Message

Author:
Apache Directory Project

Field Summary
protected  int messageLength
          The encoded Message length
 
Constructor Summary
protected MessageDecorator(LdapCodecService codec, E decoratedMessage)
          Makes a Message an Decorator object.
 
Method Summary
 void addAllControls(Control[] controls)
          
 void addControl(Control control)
          
 Object get(Object key)
          
 LdapCodecService getCodecService()
          Gets the codec service responsible for managing the encoding and decoding of the decorated objects.
 Control getControl(String oid)
          
 Map<String,Control> getControls()
          
 int getControlsLength()
           
 CodecControl<? extends Control> getCurrentControl()
          Get the current Control Object
 E getDecorated()
          Gets the object being decorated by this IDecorator.
static MessageDecorator<? extends Message> getDecorator(LdapCodecService codec, Message decoratedMessage)
           
 int getMessageId()
          
 int getMessageLength()
           
 MessageTypeEnum getType()
          
 boolean hasControl(String oid)
          
 Object put(Object key, Object value)
          
 void removeControl(Control control)
          
 void setControlsLength(int controlsLength)
           
 void setMessageId(int messageId)
          
 void setMessageLength(int messageLength)
           
 String toString()
          Delegates to the toString() method of the decorated Message.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.apache.directory.shared.ldap.codec.api.Decorator
computeLength, encode
 

Field Detail

messageLength

protected int messageLength
The encoded Message length

Constructor Detail

MessageDecorator

protected MessageDecorator(LdapCodecService codec,
                           E decoratedMessage)
Makes a Message an Decorator object.

Method Detail

getDecorator

public static MessageDecorator<? extends Message> getDecorator(LdapCodecService codec,
                                                               Message decoratedMessage)

setControlsLength

public void setControlsLength(int controlsLength)
Parameters:
controlsLength - the encoded controls length

getControlsLength

public int getControlsLength()
Returns:
the encoded controls length

setMessageLength

public void setMessageLength(int messageLength)
Parameters:
messageLength - The encoded message length

getMessageLength

public int getMessageLength()
Returns:
The encoded message length

getCurrentControl

public CodecControl<? extends Control> getCurrentControl()
Get the current Control Object

Returns:
The current Control Object

getType

public MessageTypeEnum getType()

Specified by:
getType in interface Message

getControls

public Map<String,Control> getControls()

Specified by:
getControls in interface Message

getControl

public Control getControl(String oid)

Specified by:
getControl in interface Message

hasControl

public boolean hasControl(String oid)

Specified by:
hasControl in interface Message

addControl

public void addControl(Control control)
                throws MessageException

Specified by:
addControl in interface Message
Throws:
MessageException

addAllControls

public void addAllControls(Control[] controls)
                    throws MessageException

Specified by:
addAllControls in interface Message
Throws:
MessageException

removeControl

public void removeControl(Control control)
                   throws MessageException

Specified by:
removeControl in interface Message
Throws:
MessageException

getMessageId

public int getMessageId()

Specified by:
getMessageId in interface Message

get

public Object get(Object key)

Specified by:
get in interface Message

put

public Object put(Object key,
                  Object value)

Specified by:
put in interface Message

setMessageId

public void setMessageId(int messageId)

Specified by:
setMessageId in interface Message

toString

public String toString()
Delegates to the toString() method of the decorated Message.

Overrides:
toString in class Object

getDecorated

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

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

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 Message>
Returns:
the codec service


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