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

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<AddRequest>
                  extended by org.apache.directory.shared.ldap.codec.decorators.AddRequestDecorator
All Implemented Interfaces:
Decorator<AddRequest>, AbandonableRequest, AddRequest, Message, Request, ResultResponseRequest, SingleReplyRequest

public final class AddRequestDecorator
extends SingleReplyRequestDecorator<AddRequest>
implements AddRequest

A decorator for the AddRequest 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.AddRequest
RESP_TYPE, TYPE
 
Constructor Summary
AddRequestDecorator(LdapCodecService codec, AddRequest decoratedMessage)
          Makes a AddRequest a MessageDecorator.
 
Method Summary
 void addAttributeType(String type)
          Create a new attributeValue
 void addAttributeValue(byte[] value)
          Add a new value to the current attribute
 void addAttributeValue(String value)
          Add a new value to the current attribute
 void addAttributeValue(Value<?> value)
          Add a new value to the current attribute
 int computeLength()
          Compute the AddRequest length AddRequest : 0x68 L1 | +--> 0x04 L2 entry +--> 0x30 L3 (attributes) | +--> 0x30 L4-1 (attribute) | | | +--> 0x04 L5-1 type | +--> 0x31 L6-1 (values) | | | +--> 0x04 L7-1-1 value | +--> ...
 ByteBuffer encode(ByteBuffer buffer)
          Encode the AddRequest message to a PDU.
 int getAddRequestLength()
           
 List<Integer> getAttributesLength()
           
 String getCurrentAttributeType()
           
 Entry getEntry()
          
 Dn getEntryDn()
          
 int getEntryLength()
           
 List<Integer> getValuesLength()
           
 void setAddRequestLength(int addRequestLength)
          Stores the encoded length for the AddRequest
 void setAttributesLength(List<Integer> attributesLength)
          Stores the encoded length for the attributes
 void setEntry(Entry entry)
          
 void setEntryDn(Dn entry)
          
 void setEntryLength(int entryLength)
          Stores the encoded length for the Entry
 void setValuesLength(List<Integer> valuesLength)
          Stores the encoded length for the values
 
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

AddRequestDecorator

public AddRequestDecorator(LdapCodecService codec,
                           AddRequest decoratedMessage)
Makes a AddRequest a MessageDecorator.

Parameters:
decoratedMessage - the decorated AddRequest
Method Detail

setAddRequestLength

public void setAddRequestLength(int addRequestLength)
Stores the encoded length for the AddRequest

Parameters:
addRequestLength - The encoded length

getAddRequestLength

public int getAddRequestLength()
Returns:
The encoded AddRequest's length

setEntryLength

public void setEntryLength(int entryLength)
Stores the encoded length for the Entry

Parameters:
entryLength - The encoded length

getEntryLength

public int getEntryLength()
Returns:
The encoded Entry's length

setAttributesLength

public void setAttributesLength(List<Integer> attributesLength)
Stores the encoded length for the attributes

Parameters:
attributesLength - The encoded length

getAttributesLength

public List<Integer> getAttributesLength()
Returns:
The encoded values length

setValuesLength

public void setValuesLength(List<Integer> valuesLength)
Stores the encoded length for the values

Parameters:
valuesLength - The encoded length

getValuesLength

public List<Integer> getValuesLength()
Returns:
The encoded values length

getEntryDn

public Dn getEntryDn()

Specified by:
getEntryDn in interface AddRequest

setEntryDn

public void setEntryDn(Dn entry)

Specified by:
setEntryDn in interface AddRequest

getEntry

public Entry getEntry()

Specified by:
getEntry in interface AddRequest

setEntry

public void setEntry(Entry entry)

Specified by:
setEntry in interface AddRequest

addAttributeType

public void addAttributeType(String type)
                      throws LdapException
Create a new attributeValue

Parameters:
type - The attribute's name (called 'type' in the grammar)
Throws:
LdapException

getCurrentAttributeType

public String getCurrentAttributeType()
Returns:
Returns the currentAttribute type.

addAttributeValue

public void addAttributeValue(String value)
Add a new value to the current attribute

Parameters:
value - The value to add

addAttributeValue

public void addAttributeValue(Value<?> value)
Add a new value to the current attribute

Parameters:
value - The value to add

addAttributeValue

public void addAttributeValue(byte[] value)
Add a new value to the current attribute

Parameters:
value - The value to add

computeLength

public int computeLength()
Compute the AddRequest length AddRequest : 0x68 L1 | +--> 0x04 L2 entry +--> 0x30 L3 (attributes) | +--> 0x30 L4-1 (attribute) | | | +--> 0x04 L5-1 type | +--> 0x31 L6-1 (values) | | | +--> 0x04 L7-1-1 value | +--> ... | +--> 0x04 L7-1-n value | +--> 0x30 L4-2 (attribute) | | | +--> 0x04 L5-2 type | +--> 0x31 L6-2 (values) | | | +--> 0x04 L7-2-1 value | +--> ... | +--> 0x04 L7-2-n value | +--> ... | +--> 0x30 L4-m (attribute) | +--> 0x04 L5-m type +--> 0x31 L6-m (values) | +--> 0x04 L7-m-1 value +--> ... +--> 0x04 L7-m-n value

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

encode

public ByteBuffer encode(ByteBuffer buffer)
                  throws EncoderException
Encode the AddRequest message to a PDU. AddRequest : 0x68 LL 0x04 LL entry 0x30 LL attributesList 0x30 LL attributeList 0x04 LL attributeDescription 0x31 LL attributeValues 0x04 LL attributeValue ... 0x04 LL attributeValue ... 0x30 LL attributeList 0x04 LL attributeDescription 0x31 LL attributeValue 0x04 LL attributeValue ... 0x04 LL attributeValue

Specified by:
encode in interface Decorator<AddRequest>
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.