org.apache.directory.shared.dsmlv2
Class LdapMessageDecorator

java.lang.Object
  extended by org.apache.directory.shared.asn1.AbstractAsn1Object
      extended by org.apache.directory.shared.ldap.codec.LdapMessageCodec
          extended by org.apache.directory.shared.dsmlv2.LdapMessageDecorator
All Implemented Interfaces:
Asn1Object
Direct Known Subclasses:
LdapRequestDecorator, LdapResponseDecorator

public abstract class LdapMessageDecorator
extends LdapMessageCodec

Decorator class for LDAP Message. This is the top level class, the one that holds the instance.

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

Field Summary
protected  LdapMessageCodec instance
          The decorated instance
 
Fields inherited from class org.apache.directory.shared.ldap.codec.LdapMessageCodec
ldapMessageLength
 
Fields inherited from class org.apache.directory.shared.asn1.AbstractAsn1Object
parent
 
Constructor Summary
LdapMessageDecorator(LdapMessageCodec ldapMessage)
          Creates a new instance of LdapMessageDecorator.
 
Method Summary
 void addControl(Control control)
          Add a control to the Controls array
 void addLength(int length)
          Add a length to the object
 int computeLength()
          Compute the LdapMessage length LdapMessage : 0x30 L1 | +--> 0x02 0x0(1-4) [0..2^31-1] (MessageId) +--> protocolOp [+--> Controls] MessageId length = Length(0x02) + length(MessageId) + MessageId.length L1 = length(ProtocolOp) LdapMessage length = Length(0x30) + Length(L1) + MessageId length + L1
 int computeLengthProtocolOp()
           
 java.nio.ByteBuffer encode(java.nio.ByteBuffer buffer)
          Encode the object to a PDU.
 void encodeProtocolOp(java.nio.ByteBuffer buffer)
           
 AbandonRequestCodec getAbandonRequest()
           
 AddRequestCodec getAddRequest()
           
 AddResponseCodec getAddResponse()
           
 BindRequestCodec getBindRequest()
           
 BindResponseCodec getBindResponse()
           
 CompareRequestCodec getCompareRequest()
           
 CompareResponseCodec getCompareResponse()
           
 java.util.List<Control> getControls()
          Get the Control Objects
 Control getControls(int i)
          Get the Control Object at a specific index
 Control getCurrentControl()
          Get the current Control Object
 int getCurrentLength()
          Get the current object length, which is the sum of all inner length already decoded.
 DelRequestCodec getDelRequest()
           
 DelResponseCodec getDelResponse()
           
 int getExpectedLength()
          Get the expected object length.
 ExtendedRequestCodec getExtendedRequest()
           
 ExtendedResponseCodec getExtendedResponse()
           
 LdapResponseCodec getLdapResponse()
           
 int getMessageId()
          Get the message ID
 MessageTypeEnum getMessageType()
          Get the message type
 java.lang.String getMessageTypeName()
          Get the message type Name
 ModifyDNRequestCodec getModifyDNRequest()
           
 ModifyDNResponseCodec getModifyDNResponse()
           
 ModifyRequestCodec getModifyRequest()
           
 ModifyResponseCodec getModifyResponse()
           
 AbstractAsn1Object getParent()
          Get the parent
 SearchRequestCodec getSearchRequest()
           
 SearchResultDoneCodec getSearchResultDone()
           
 SearchResultEntryCodec getSearchResultEntry()
           
 SearchResultReferenceCodec getSearchResultReference()
           
 UnBindRequestCodec getUnBindRequest()
           
 void setCurrentLength(int currentLength)
          Set the current length
 void setExpectedLength(int expectedLength)
          Set the expected length
 void setMessageId(int messageId)
          Set the message ID
 void setParent(AbstractAsn1Object parent)
          Set the parent
 java.lang.String toString()
           
 
Methods inherited from class org.apache.directory.shared.ldap.codec.LdapMessageCodec
addControls, encode, getCodecControl, initControls, toString
 
Methods inherited from class org.apache.directory.shared.asn1.AbstractAsn1Object
getTlvId
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

instance

protected LdapMessageCodec instance
The decorated instance

Constructor Detail

LdapMessageDecorator

public LdapMessageDecorator(LdapMessageCodec ldapMessage)
Creates a new instance of LdapMessageDecorator.

Parameters:
ldapMessage - the message to decorate
Method Detail

addControl

public void addControl(Control control)
Description copied from class: LdapMessageCodec
Add a control to the Controls array

Overrides:
addControl in class LdapMessageCodec
Parameters:
control - The Control to add

computeLength

public int computeLength()
Description copied from class: LdapMessageCodec
Compute the LdapMessage length LdapMessage : 0x30 L1 | +--> 0x02 0x0(1-4) [0..2^31-1] (MessageId) +--> protocolOp [+--> Controls] MessageId length = Length(0x02) + length(MessageId) + MessageId.length L1 = length(ProtocolOp) LdapMessage length = Length(0x30) + Length(L1) + MessageId length + L1

Specified by:
computeLength in interface Asn1Object
Overrides:
computeLength in class LdapMessageCodec
Returns:
The object's computed length

computeLengthProtocolOp

public int computeLengthProtocolOp()
Specified by:
computeLengthProtocolOp in class LdapMessageCodec

encode

public java.nio.ByteBuffer encode(java.nio.ByteBuffer buffer)
                           throws EncoderException
Description copied from class: AbstractAsn1Object
Encode the object to a PDU.

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

encodeProtocolOp

public void encodeProtocolOp(java.nio.ByteBuffer buffer)
                      throws EncoderException
Specified by:
encodeProtocolOp in class LdapMessageCodec
Throws:
EncoderException

getAbandonRequest

public AbandonRequestCodec getAbandonRequest()

getAddRequest

public AddRequestCodec getAddRequest()

getAddResponse

public AddResponseCodec getAddResponse()

getBindRequest

public BindRequestCodec getBindRequest()

getBindResponse

public BindResponseCodec getBindResponse()

getCompareRequest

public CompareRequestCodec getCompareRequest()

getCompareResponse

public CompareResponseCodec getCompareResponse()

getControls

public java.util.List<Control> getControls()
Description copied from class: LdapMessageCodec
Get the Control Objects

Overrides:
getControls in class LdapMessageCodec
Returns:
The Control Objects

getControls

public Control getControls(int i)
Description copied from class: LdapMessageCodec
Get the Control Object at a specific index

Overrides:
getControls in class LdapMessageCodec
Parameters:
i - The index of the Control Object to get
Returns:
The selected Control Object

getCurrentControl

public Control getCurrentControl()
Description copied from class: LdapMessageCodec
Get the current Control Object

Overrides:
getCurrentControl in class LdapMessageCodec
Returns:
The current Control Object

getDelRequest

public DelRequestCodec getDelRequest()

getDelResponse

public DelResponseCodec getDelResponse()

getExtendedRequest

public ExtendedRequestCodec getExtendedRequest()

getExtendedResponse

public ExtendedResponseCodec getExtendedResponse()

getLdapResponse

public LdapResponseCodec getLdapResponse()

getMessageId

public int getMessageId()
Description copied from class: LdapMessageCodec
Get the message ID

Overrides:
getMessageId in class LdapMessageCodec
Returns:
The message ID

getMessageType

public MessageTypeEnum getMessageType()
Description copied from class: LdapMessageCodec
Get the message type

Specified by:
getMessageType in class LdapMessageCodec
Returns:
The message type

getMessageTypeName

public java.lang.String getMessageTypeName()
Description copied from class: LdapMessageCodec
Get the message type Name

Specified by:
getMessageTypeName in class LdapMessageCodec
Returns:
The message type name

getModifyDNRequest

public ModifyDNRequestCodec getModifyDNRequest()

getModifyDNResponse

public ModifyDNResponseCodec getModifyDNResponse()

getModifyRequest

public ModifyRequestCodec getModifyRequest()

getModifyResponse

public ModifyResponseCodec getModifyResponse()

getSearchRequest

public SearchRequestCodec getSearchRequest()

getSearchResultDone

public SearchResultDoneCodec getSearchResultDone()

getSearchResultEntry

public SearchResultEntryCodec getSearchResultEntry()

getSearchResultReference

public SearchResultReferenceCodec getSearchResultReference()

getUnBindRequest

public UnBindRequestCodec getUnBindRequest()

setMessageId

public void setMessageId(int messageId)
Description copied from class: LdapMessageCodec
Set the message ID

Overrides:
setMessageId in class LdapMessageCodec
Parameters:
messageId - The message ID

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

addLength

public void addLength(int length)
               throws DecoderException
Description copied from class: AbstractAsn1Object
Add a length to the object

Specified by:
addLength in interface Asn1Object
Overrides:
addLength in class AbstractAsn1Object
Parameters:
length - The length to add.
Throws:
DecoderException - Thrown if the current length exceed the expected length

getCurrentLength

public int getCurrentLength()
Description copied from class: AbstractAsn1Object
Get the current object length, which is the sum of all inner length already decoded.

Specified by:
getCurrentLength in interface Asn1Object
Overrides:
getCurrentLength in class AbstractAsn1Object
Returns:
The current object's length

getExpectedLength

public int getExpectedLength()
Description copied from class: AbstractAsn1Object
Get the expected object length.

Specified by:
getExpectedLength in interface Asn1Object
Overrides:
getExpectedLength in class AbstractAsn1Object
Returns:
The expected object's length

getParent

public AbstractAsn1Object getParent()
Description copied from class: AbstractAsn1Object
Get the parent

Specified by:
getParent in interface Asn1Object
Overrides:
getParent in class AbstractAsn1Object
Returns:
Returns the parent.

setCurrentLength

public void setCurrentLength(int currentLength)
Description copied from class: AbstractAsn1Object
Set the current length

Specified by:
setCurrentLength in interface Asn1Object
Overrides:
setCurrentLength in class AbstractAsn1Object
Parameters:
currentLength - The currentLength to set.

setExpectedLength

public void setExpectedLength(int expectedLength)
Description copied from class: AbstractAsn1Object
Set the expected length

Specified by:
setExpectedLength in interface Asn1Object
Overrides:
setExpectedLength in class AbstractAsn1Object
Parameters:
expectedLength - The expectedLength to set.

setParent

public void setParent(AbstractAsn1Object parent)
Description copied from class: AbstractAsn1Object
Set the parent

Overrides:
setParent in class AbstractAsn1Object
Parameters:
parent - The parent to set.


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