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

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

public class ModifyRequestDecorator
extends SingleReplyRequestDecorator<ModifyRequest>
implements ModifyRequest

A decorator for the ModifyRequest 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.ModifyRequest
RESP_TYPE, TYPE
 
Constructor Summary
ModifyRequestDecorator(LdapCodecService codec, ModifyRequest decoratedMessage)
          Makes a ModifyRequest encodable.
 
Method Summary
 void add(EntryAttribute attr)
          
 void add(String attributeName, byte[]... attributeValue)
          
 void add(String attributeName, String... attributeValue)
          
 void addAttributeTypeAndValues(String type)
          Add a new attributeTypeAndValue
 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 addModification(EntryAttribute attr, ModificationOperation modOp)
          
 void addModification(Modification mod)
          
 int computeLength()
          Compute the ModifyRequest length ModifyRequest : 0x66 L1 | +--> 0x04 L2 object +--> 0x30 L3 modifications | +--> 0x30 L4-1 modification sequence | | | +--> 0x0A 0x01 (0..2) operation | +--> 0x30 L5-1 modification | | | +--> 0x04 L6-1 type | +--> 0x31 L7-1 vals | | | +--> 0x04 L8-1-1 attributeValue | +--> 0x04 L8-1-2 attributeValue | +--> ...
 ByteBuffer encode(ByteBuffer buffer)
          Encode the ModifyRequest message to a PDU.
 List<Integer> getChangeLength()
           
 int getChangesLength()
           
 String getCurrentAttributeType()
          Return the current attribute's type
 List<Integer> getModificationLength()
           
 Collection<Modification> getModifications()
          
 int getModifyRequestLength()
           
 Dn getName()
          
 List<Integer> getValuesLength()
           
 void remove(EntryAttribute attr)
          
 void remove(String attributeName, byte[]... attributeValue)
          
 void remove(String attributeName, String... attributeValue)
          
 void removeModification(Modification mod)
          
 void replace(EntryAttribute attr)
          
 void replace(String attributeName)
          
 void replace(String attributeName, byte[]... attributeValue)
          
 void replace(String attributeName, String... attributeValue)
          
 void setChangeLength(List<Integer> changeLength)
           
 void setChangesLength(int changesLength)
           
 void setCurrentOperation(int currentOperation)
          Store the current operation
 void setModificationLength(List<Integer> modificationLength)
           
 void setModifyRequestLength(int modifyRequestLength)
           
 void setName(Dn name)
          
 void setValuesLength(List<Integer> valuesLength)
           
 
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

ModifyRequestDecorator

public ModifyRequestDecorator(LdapCodecService codec,
                              ModifyRequest decoratedMessage)
Makes a ModifyRequest encodable.

Parameters:
decoratedMessage - the decorated ModifyRequest
Method Detail

setModifyRequestLength

public void setModifyRequestLength(int modifyRequestLength)
Parameters:
modifyRequestLength - The encoded ModifyRequest's length

getModifyRequestLength

public int getModifyRequestLength()
Returns:
The encoded length

setChangesLength

public void setChangesLength(int changesLength)
Parameters:
changesLength - The encoded Changes length

getChangesLength

public int getChangesLength()
Returns:
The encoded length

setChangeLength

public void setChangeLength(List<Integer> changeLength)

getChangeLength

public List<Integer> getChangeLength()
Returns:
The list of encoded Change length

setModificationLength

public void setModificationLength(List<Integer> modificationLength)
Parameters:
modificationLength - The list of encoded Modification length

getModificationLength

public List<Integer> getModificationLength()
Returns:
The list of encoded Modification length

setValuesLength

public void setValuesLength(List<Integer> valuesLength)
Parameters:
valuesLength - The list of encoded Values length

getValuesLength

public List<Integer> getValuesLength()
Returns:
The list of encoded Values length

setCurrentOperation

public void setCurrentOperation(int currentOperation)
Store the current operation

Parameters:
currentOperation - The currentOperation to set.

addAttributeTypeAndValues

public void addAttributeTypeAndValues(String type)
Add a new attributeTypeAndValue

Parameters:
type - The attribute's name

getCurrentAttributeType

public String getCurrentAttributeType()
Return the current attribute's type


addAttributeValue

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

Parameters:
value - The value to add

addAttributeValue

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

Parameters:
value - The value to add

getName

public Dn getName()

Specified by:
getName in interface ModifyRequest

setName

public void setName(Dn name)

Specified by:
setName in interface ModifyRequest

getModifications

public Collection<Modification> getModifications()

Specified by:
getModifications in interface ModifyRequest

addModification

public void addModification(Modification mod)

Specified by:
addModification in interface ModifyRequest

removeModification

public void removeModification(Modification mod)

Specified by:
removeModification in interface ModifyRequest

remove

public void remove(String attributeName,
                   String... attributeValue)

Specified by:
remove in interface ModifyRequest

remove

public void remove(String attributeName,
                   byte[]... attributeValue)

Specified by:
remove in interface ModifyRequest

remove

public void remove(EntryAttribute attr)

Specified by:
remove in interface ModifyRequest

addModification

public void addModification(EntryAttribute attr,
                            ModificationOperation modOp)

Specified by:
addModification in interface ModifyRequest

add

public void add(String attributeName,
                String... attributeValue)

Specified by:
add in interface ModifyRequest

add

public void add(String attributeName,
                byte[]... attributeValue)

Specified by:
add in interface ModifyRequest

add

public void add(EntryAttribute attr)

Specified by:
add in interface ModifyRequest

replace

public void replace(String attributeName)

Specified by:
replace in interface ModifyRequest

replace

public void replace(String attributeName,
                    String... attributeValue)

Specified by:
replace in interface ModifyRequest

replace

public void replace(String attributeName,
                    byte[]... attributeValue)

Specified by:
replace in interface ModifyRequest

replace

public void replace(EntryAttribute attr)

Specified by:
replace in interface ModifyRequest

computeLength

public int computeLength()
Compute the ModifyRequest length ModifyRequest : 0x66 L1 | +--> 0x04 L2 object +--> 0x30 L3 modifications | +--> 0x30 L4-1 modification sequence | | | +--> 0x0A 0x01 (0..2) operation | +--> 0x30 L5-1 modification | | | +--> 0x04 L6-1 type | +--> 0x31 L7-1 vals | | | +--> 0x04 L8-1-1 attributeValue | +--> 0x04 L8-1-2 attributeValue | +--> ... | +--> 0x04 L8-1-i attributeValue | +--> ... | +--> 0x04 L8-1-n attributeValue | +--> 0x30 L4-2 modification sequence . | . +--> 0x0A 0x01 (0..2) operation . +--> 0x30 L5-2 modification | +--> 0x04 L6-2 type +--> 0x31 L7-2 vals | +--> 0x04 L8-2-1 attributeValue +--> 0x04 L8-2-2 attributeValue +--> ... +--> 0x04 L8-2-i attributeValue +--> ... +--> 0x04 L8-2-n attributeValue

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

encode

public ByteBuffer encode(ByteBuffer buffer)
                  throws EncoderException
Encode the ModifyRequest message to a PDU. ModifyRequest :
 0x66 LL
   0x04 LL object
   0x30 LL modifiations
     0x30 LL modification sequence
       0x0A 0x01 operation
       0x30 LL modification
         0x04 LL type
         0x31 LL vals
           0x04 LL attributeValue
           ... 
           0x04 LL attributeValue
     ... 
     0x30 LL modification sequence
       0x0A 0x01 operation
       0x30 LL modification
         0x04 LL type
         0x31 LL vals
           0x04 LL attributeValue
           ... 
           0x04 LL attributeValue
 

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