org.apache.directory.shared.ldap.codec.decorators
Class LdapResultDecorator

java.lang.Object
  extended by org.apache.directory.shared.ldap.codec.decorators.LdapResultDecorator
All Implemented Interfaces:
Decorator<LdapResult>, LdapResult

public class LdapResultDecorator
extends Object
implements LdapResult, Decorator<LdapResult>

A decorator for the LdapResultResponse message

Author:
Apache Directory Project

Constructor Summary
LdapResultDecorator(LdapResult decoratedLdapResult)
          Makes a LdapResult encodable.
 
Method Summary
 int computeLength()
          Compute the LdapResult length LdapResult : 0x0A 01 resultCode (0..80) 0x04 L1 matchedDN (L1 = Length(matchedDN)) 0x04 L2 errorMessage (L2 = Length(errorMessage)) [0x83 L3] referrals | +--> 0x04 L4 referral +--> 0x04 L5 referral +--> ...
 ByteBuffer encode(ByteBuffer buffer)
          Encode the LdapResult message to a PDU.
 LdapCodecService getCodecService()
          Gets the codec service responsible for managing the encoding and decoding of the decorated objects.
 LdapResult getDecorated()
          Gets the object being decorated by this IDecorator.
 String getErrorMessage()
          
 byte[] getErrorMessageBytes()
           
 Dn getMatchedDn()
          
 byte[] getMatchedDnBytes()
           
 Referral getReferral()
          
 ResultCodeEnum getResultCode()
          
 boolean isReferral()
          
 void setErrorMessage(String errorMessage)
          
 void setErrorMessageBytes(byte[] errorMessageBytes)
          Set the encoded message's bytes
 void setMatchedDn(Dn dn)
          
 void setMatchedDnBytes(byte[] matchedDnBytes)
          Sets the encoded value for MatchedDn
 void setReferral(Referral referral)
          
 void setResultCode(ResultCodeEnum resultCode)
          
 String toString()
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LdapResultDecorator

public LdapResultDecorator(LdapResult decoratedLdapResult)
Makes a LdapResult encodable.

Parameters:
decoratedLdapResult - the decorated LdapResult
Method Detail

getErrorMessageBytes

public byte[] getErrorMessageBytes()
Returns:
The encoded Error message

setErrorMessageBytes

public void setErrorMessageBytes(byte[] errorMessageBytes)
Set the encoded message's bytes

Parameters:
errorMessageBytes - The encoded bytes

setMatchedDnBytes

public void setMatchedDnBytes(byte[] matchedDnBytes)
Sets the encoded value for MatchedDn

Parameters:
matchedDnBytes - The encoded MatchedDN

getMatchedDnBytes

public byte[] getMatchedDnBytes()
Returns:
the encoded MatchedDN

getResultCode

public ResultCodeEnum getResultCode()

Specified by:
getResultCode in interface LdapResult

setResultCode

public void setResultCode(ResultCodeEnum resultCode)

Specified by:
setResultCode in interface LdapResult

getMatchedDn

public Dn getMatchedDn()

Specified by:
getMatchedDn in interface LdapResult

setMatchedDn

public void setMatchedDn(Dn dn)

Specified by:
setMatchedDn in interface LdapResult

getErrorMessage

public String getErrorMessage()

Specified by:
getErrorMessage in interface LdapResult

setErrorMessage

public void setErrorMessage(String errorMessage)

Specified by:
setErrorMessage in interface LdapResult

isReferral

public boolean isReferral()

Specified by:
isReferral in interface LdapResult

getReferral

public Referral getReferral()

Specified by:
getReferral in interface LdapResult

setReferral

public void setReferral(Referral referral)

Specified by:
setReferral in interface LdapResult

toString

public String toString()

Overrides:
toString in class Object

computeLength

public int computeLength()
Compute the LdapResult length LdapResult : 0x0A 01 resultCode (0..80) 0x04 L1 matchedDN (L1 = Length(matchedDN)) 0x04 L2 errorMessage (L2 = Length(errorMessage)) [0x83 L3] referrals | +--> 0x04 L4 referral +--> 0x04 L5 referral +--> ... +--> 0x04 Li referral +--> ... +--> 0x04 Ln referral L1 = Length(matchedDN) L2 = Length(errorMessage) L3 = n*Length(0x04) + sum(Length(L4) .. Length(Ln)) + sum(L4..Ln) L4..n = Length(0x04) + Length(Li) + Li Length(LdapResult) = Length(0x0x0A) + Length(0x01) + 1 + Length(0x04) + Length(L1) + L1 + Length(0x04) + Length(L2) + L2 + Length(0x83) + Length(L3) + L3

Specified by:
computeLength in interface Decorator<LdapResult>
Returns:
The object's computed length

encode

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

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

getDecorated

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

Specified by:
getDecorated in interface Decorator<LdapResult>
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<LdapResult>
Returns:
the codec service


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