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

java.lang.Object
  extended by org.apache.directory.shared.ldap.codec.decorators.MessageDecorator<M>
      extended by org.apache.directory.shared.ldap.codec.decorators.RequestDecorator<M>
          extended by org.apache.directory.shared.ldap.codec.decorators.ResultResponseRequestDecorator<M>
              extended by org.apache.directory.shared.ldap.codec.decorators.SingleReplyRequestDecorator<BindRequest>
                  extended by org.apache.directory.shared.ldap.codec.decorators.BindRequestDecorator
All Implemented Interfaces:
Decorator<BindRequest>, AbandonableRequest, BindRequest, Message, Request, ResultResponseRequest, SingleReplyRequest

public class BindRequestDecorator
extends SingleReplyRequestDecorator<BindRequest>
implements BindRequest

A decorator for the BindRequest message

Author:
Apache Directory Project

Field Summary
 
Fields inherited from class org.apache.directory.shared.ldap.codec.decorators.MessageDecorator
messageLength
 
Fields inherited from interface org.apache.directory.shared.ldap.model.message.BindRequest
RESP_TYPE, TYPE
 
Constructor Summary
BindRequestDecorator(LdapCodecService codec, BindRequest decoratedMessage)
          Makes a BindRequest a MessageDecorator.
 
Method Summary
 int computeLength()
          Compute the BindRequest length BindRequest :
 ByteBuffer encode(ByteBuffer buffer)
          Encode the BindRequest message to a PDU.
 int getBindRequestLength()
           
 byte[] getCredentials()
          
 Dn getName()
          
 int getSaslCredentialsLength()
           
 String getSaslMechanism()
          
 int getSaslMechanismLength()
           
 boolean getSimple()
          
 boolean getVersion3()
          
 boolean isSimple()
          
 boolean isVersion3()
          
 void setBindRequestLength(int bindRequestLength)
          Stores the encoded length for the BindRequest
 void setCredentials(byte[] credentials)
          
 void setCredentials(String credentials)
          
 void setName(Dn name)
          
 void setSaslCredentialsLength(int saslCredentialsLength)
          Stores the encoded length for the SaslCredentials
 void setSaslMechanism(String saslMechanism)
          
 void setSaslMechanismLength(int saslMechanismLength)
          Stores the encoded length for the Mechanism
 void setSimple(boolean isSimple)
          
 void setVersion3(boolean isVersion3)
          
 
Methods inherited from class org.apache.directory.shared.ldap.codec.decorators.SingleReplyRequestDecorator
abandon, addAbandonListener, getResponseType, isAbandoned
 
Methods inherited from class org.apache.directory.shared.ldap.codec.decorators.ResultResponseRequestDecorator
getResultResponse, hasResponse
 
Methods inherited from class org.apache.directory.shared.ldap.codec.decorators.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.shared.ldap.model.message.SingleReplyRequest
getResponseType
 
Methods inherited from interface org.apache.directory.shared.ldap.model.message.ResultResponseRequest
getResultResponse
 
Methods inherited from interface org.apache.directory.shared.ldap.model.message.Request
hasResponse
 
Methods inherited from interface org.apache.directory.shared.ldap.model.message.Message
addAllControls, addControl, get, getControl, getControls, getMessageId, getType, hasControl, put, removeControl, setMessageId
 
Methods inherited from interface org.apache.directory.shared.ldap.model.message.AbandonableRequest
abandon, addAbandonListener, isAbandoned
 

Constructor Detail

BindRequestDecorator

public BindRequestDecorator(LdapCodecService codec,
                            BindRequest decoratedMessage)
Makes a BindRequest a MessageDecorator.

Parameters:
decoratedMessage - the decorated BindRequests.
Method Detail

setBindRequestLength

public void setBindRequestLength(int bindRequestLength)
Stores the encoded length for the BindRequest

Parameters:
bindRequestLength - The encoded length

getBindRequestLength

public int getBindRequestLength()
Returns:
The encoded BindRequest's length

setSaslCredentialsLength

public void setSaslCredentialsLength(int saslCredentialsLength)
Stores the encoded length for the SaslCredentials

Parameters:
saslCredentialsLength - The encoded length

getSaslCredentialsLength

public int getSaslCredentialsLength()
Returns:
The encoded SaslCredentials's length

setSaslMechanismLength

public void setSaslMechanismLength(int saslMechanismLength)
Stores the encoded length for the Mechanism

Parameters:
saslMechanismLength - The encoded length

getSaslMechanismLength

public int getSaslMechanismLength()
Returns:
The encoded SaslMechanism's length

isSimple

public boolean isSimple()

Specified by:
isSimple in interface BindRequest

getSimple

public boolean getSimple()

Specified by:
getSimple in interface BindRequest

setSimple

public void setSimple(boolean isSimple)

Specified by:
setSimple in interface BindRequest

getCredentials

public byte[] getCredentials()

Specified by:
getCredentials in interface BindRequest

setCredentials

public void setCredentials(String credentials)

Specified by:
setCredentials in interface BindRequest

setCredentials

public void setCredentials(byte[] credentials)

Specified by:
setCredentials in interface BindRequest

getName

public Dn getName()

Specified by:
getName in interface BindRequest

setName

public void setName(Dn name)

Specified by:
setName in interface BindRequest

isVersion3

public boolean isVersion3()

Specified by:
isVersion3 in interface BindRequest

getVersion3

public boolean getVersion3()

Specified by:
getVersion3 in interface BindRequest

setVersion3

public void setVersion3(boolean isVersion3)

Specified by:
setVersion3 in interface BindRequest

getSaslMechanism

public String getSaslMechanism()

Specified by:
getSaslMechanism in interface BindRequest

setSaslMechanism

public void setSaslMechanism(String saslMechanism)

Specified by:
setSaslMechanism in interface BindRequest

computeLength

public int computeLength()
Compute the BindRequest length BindRequest :
 0x60 L1 
   | 
   +--> 0x02 0x01 (1..127) version 
   +--> 0x04 L2 name 
   +--> authentication 
   
 L2 = Length(name)
 L3/4 = Length(authentication) 
 Length(BindRequest) = Length(0x60) + Length(L1) + L1 + Length(0x02) + 1 + 1 + 
      Length(0x04) + Length(L2) + L2 + Length(authentication)
 

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

encode

public ByteBuffer encode(ByteBuffer buffer)
                  throws EncoderException
Encode the BindRequest message to a PDU. BindRequest :
 0x60 LL 
   0x02 LL version         0x80 LL simple 
   0x04 LL name           /   
   authentication.encode() 
                          \ 0x83 LL mechanism [0x04 LL credential]
 

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


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