org.apache.directory.shared.ldap.codec.modify
Class ModifyRequest

java.lang.Object
  extended byorg.apache.directory.shared.asn1.Asn1Object
      extended byorg.apache.directory.shared.ldap.codec.LdapMessage
          extended byorg.apache.directory.shared.ldap.codec.modify.ModifyRequest

public class ModifyRequest
extends LdapMessage

A ModifyRequest Message. Its syntax is : ModifyRequest ::= [APPLICATION 6] SEQUENCE { object LDAPDN, modification SEQUENCE OF SEQUENCE { operation ENUMERATED { add (0), delete (1), replace (2) }, modification AttributeTypeAndValues } } AttributeTypeAndValues ::= SEQUENCE { type AttributeDescription, vals SET OF AttributeValue } AttributeValue ::= OCTET STRING

Author:
Apache Directory Project

Field Summary
 
Fields inherited from class org.apache.directory.shared.asn1.Asn1Object
parent
 
Constructor Summary
ModifyRequest()
          Creates a new ModifyRequest object.
 
Method Summary
 void addAttributeTypeAndValues(LdapString type)
          Add a new attributeTypeAndValue
 void addAttributeValue(java.lang.Object value)
          Add a new value to the current attribute
 void addModification(int operation)
          Add a new modification to the list
 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 | +--> ...
 java.nio.ByteBuffer encode(java.nio.ByteBuffer buffer)
          Encode the ModifyRequest message to a PDU.
 java.lang.String getCurrentAttributeType()
          Return the current attribute's type
 int getCurrentOperation()
          Get the current operation
 int getMessageType()
          Get the message type
 java.util.ArrayList getModifications()
          Get the entry's attributes
 java.lang.String getObject()
          Get the modification's DN
 void initModifications()
          Initialize the ArrayList for modifications.
 void setCurrentOperation(int currentOperation)
          Store the current operation
 void setObject(javax.naming.Name object)
          Set the modification DN.
 java.lang.String toString()
          Get a String representation of a ModifyRequest
 
Methods inherited from class org.apache.directory.shared.ldap.codec.LdapMessage
addControl, getAbandonRequest, getAddRequest, getAddResponse, getBindRequest, getBindResponse, getCompareRequest, getCompareResponse, getControls, getControls, getCurrentControl, getDelRequest, getDelResponse, getExtendedRequest, getExtendedResponse, getLdapResponse, getMessageId, getMessageTypeName, getModifyDNRequest, getModifyDNResponse, getModifyRequest, getModifyResponse, getSearchRequest, getSearchResultDone, getSearchResultEntry, getSearchResultReference, getUnBindRequest, initControl, setMessageId, setProtocolOP
 
Methods inherited from class org.apache.directory.shared.asn1.Asn1Object
addLength, getCurrentLength, getExpectedLength, getParent, setCurrentLength, setExpectedLength, setParent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ModifyRequest

public ModifyRequest()
Creates a new ModifyRequest object.

Method Detail

getMessageType

public int getMessageType()
Get the message type

Overrides:
getMessageType in class LdapMessage
Returns:
Returns the type.

initModifications

public void initModifications()
Initialize the ArrayList for modifications.


getModifications

public java.util.ArrayList getModifications()
Get the entry's attributes

Returns:
Returns the modifications.

addModification

public void addModification(int operation)
Add a new modification to the list

Parameters:
operation - The type of operation (add, delete or replace)

addAttributeTypeAndValues

public void addAttributeTypeAndValues(LdapString type)
Add a new attributeTypeAndValue

Parameters:
type - The attribute's name

addAttributeValue

public void addAttributeValue(java.lang.Object value)
Add a new value to the current attribute

Parameters:
value - The value to add

getCurrentAttributeType

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


getObject

public java.lang.String getObject()
Get the modification's DN

Returns:
Returns the object.

setObject

public void setObject(javax.naming.Name object)
Set the modification DN.

Parameters:
object - The DN to set.

getCurrentOperation

public int getCurrentOperation()
Get the current operation

Returns:
Returns the currentOperation.

setCurrentOperation

public void setCurrentOperation(int currentOperation)
Store the current operation

Parameters:
currentOperation - The currentOperation to set.

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

Overrides:
computeLength in class LdapMessage

encode

public java.nio.ByteBuffer encode(java.nio.ByteBuffer buffer)
                           throws org.apache.directory.shared.asn1.codec.EncoderException
Encode the ModifyRequest message to a PDU. AddRequest : 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

Overrides:
encode in class LdapMessage
Parameters:
buffer - The buffer where to put the PDU
Returns:
The PDU.
Throws:
org.apache.directory.shared.asn1.codec.EncoderException - If anything goes wrong.

toString

public java.lang.String toString()
Get a String representation of a ModifyRequest

Overrides:
toString in class LdapMessage
Returns:
A ModifyRequest String


Copyright © 2003-2006 . All Rights Reserved.