org.apache.directory.api.ldap.codec.decorators
Class BindResponseDecorator

java.lang.Object
  extended by org.apache.directory.api.ldap.codec.api.MessageDecorator<M>
      extended by org.apache.directory.api.ldap.codec.decorators.ResponseDecorator<BindResponse>
          extended by org.apache.directory.api.ldap.codec.decorators.BindResponseDecorator
All Implemented Interfaces:
Decorator<BindResponse>, BindResponse, Message, Response, ResultResponse

public class BindResponseDecorator
extends ResponseDecorator<BindResponse>
implements BindResponse

A decorator for the BindResponse message

Author:
Apache Directory Project

Field Summary
 
Fields inherited from class org.apache.directory.api.ldap.codec.api.MessageDecorator
messageLength
 
Fields inherited from interface org.apache.directory.api.ldap.model.message.BindResponse
TYPE
 
Constructor Summary
BindResponseDecorator(LdapApiService codec, BindResponse decoratedMessage)
          Makes a BindResponse a MessageDecorator.
 
Method Summary
 int computeLength()
          Compute the BindResponse length BindResponse :
 ByteBuffer encode(ByteBuffer buffer)
          Encode the BindResponse message to a PDU.
 int getBindResponseLength()
           
 byte[] getServerSaslCreds()
          Gets the optional property holding SASL authentication response parameters that are SASL mechanism specific.
 void setBindResponseLength(int bindResponseLength)
          Stores the encoded length for the BindResponse
 void setServerSaslCreds(byte[] serverSaslCreds)
          Sets the optional property holding SASL authentication response paramters that are SASL mechanism specific.
 
Methods inherited from class org.apache.directory.api.ldap.codec.decorators.ResponseDecorator
getLdapResult, setLdapResult
 
Methods inherited from class org.apache.directory.api.ldap.codec.api.MessageDecorator
addAllControls, addControl, get, getCodecService, getControl, getControls, getControlsLength, getCurrentControl, getDecorated, getDecorator, getMessageId, getMessageLength, getType, hasControl, put, removeControl, setControlsLength, setMessageId, setMessageLength, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.apache.directory.api.ldap.model.message.ResultResponse
getLdapResult
 
Methods inherited from interface org.apache.directory.api.ldap.model.message.Message
addAllControls, addControl, get, getControl, getControls, getMessageId, getType, hasControl, put, removeControl, setMessageId
 

Constructor Detail

BindResponseDecorator

public BindResponseDecorator(LdapApiService codec,
                             BindResponse decoratedMessage)
Makes a BindResponse a MessageDecorator.

Parameters:
decoratedMessage - the decorated BindResponse
Method Detail

setBindResponseLength

public void setBindResponseLength(int bindResponseLength)
Stores the encoded length for the BindResponse

Parameters:
bindResponseLength - The encoded length

getBindResponseLength

public int getBindResponseLength()
Returns:
The encoded BindResponse's length

getServerSaslCreds

public byte[] getServerSaslCreds()
Gets the optional property holding SASL authentication response parameters that are SASL mechanism specific. Will return null if the authentication is simple.

Specified by:
getServerSaslCreds in interface BindResponse
Returns:
the sasl mech. specific credentials or null of auth. is simple

setServerSaslCreds

public void setServerSaslCreds(byte[] serverSaslCreds)
Sets the optional property holding SASL authentication response paramters that are SASL mechanism specific. Leave null if authentication mode is simple.

Specified by:
setServerSaslCreds in interface BindResponse
Parameters:
serverSaslCreds - the sasl auth. mech. specific credentials

computeLength

public int computeLength()
Compute the BindResponse length BindResponse :
 0x61 L1 
   | 
   +--> LdapResult
   +--> [serverSaslCreds] 
   
 L1 = Length(LdapResult) [ + Length(serverSaslCreds) ] 
 Length(BindResponse) = Length(0x61) + Length(L1) + L1
 

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

encode

public ByteBuffer encode(ByteBuffer buffer)
                  throws EncoderException
Encode the BindResponse message to a PDU. BindResponse :
 LdapResult.encode 
 [0x87 LL serverSaslCreds]
 

Specified by:
encode in interface Decorator<BindResponse>
Parameters:
bb - The buffer where to put the PDU
bindResponseDecorator - The decorated BindResponse to encode
Returns:
The PDU.
Throws:
EncoderException - when encoding operations fail


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