org.apache.directory.shared.ldap.codec.add
Class AddRequest

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.add.AddRequest

public class AddRequest
extends LdapMessage

An AddRequest Message. Its syntax is : AddRequest ::= [APPLICATION 8] SEQUENCE { entry LDAPDN, attributes AttributeList } AttributeList ::= SEQUENCE OF 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
AddRequest()
          Creates a new AddRequest object.
 
Method Summary
 void addAttributeType(LdapString type)
          Create a new attributeValue
 void addAttributeValue(java.lang.Object 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 | +--> ...
 java.nio.ByteBuffer encode(java.nio.ByteBuffer buffer)
          Encode the AddRequest message to a PDU.
 javax.naming.directory.Attributes getAttributes()
          Get the entry's attributes to be added
 java.lang.String getCurrentAttributeType()
           
 java.lang.String getEntry()
          Get the added DN
 int getMessageType()
          Get the message type
 void initAttributes()
          Initialize the ArrayList for attributes.
 void setEntry(javax.naming.Name entry)
          Set the added DN.
 java.lang.String toString()
          Return a String representing an AddRequest
 
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

AddRequest

public AddRequest()
Creates a new AddRequest object.

Method Detail

getMessageType

public int getMessageType()
Get the message type

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

initAttributes

public void initAttributes()
Initialize the ArrayList for attributes.


getAttributes

public javax.naming.directory.Attributes getAttributes()
Get the entry's attributes to be added

Returns:
Returns the attributes.

addAttributeType

public void addAttributeType(LdapString type)
Create a new attributeValue

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

addAttributeValue

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

Parameters:
value - The value to be added

getEntry

public java.lang.String getEntry()
Get the added DN

Returns:
Returns the entry.

setEntry

public void setEntry(javax.naming.Name entry)
Set the added DN.

Parameters:
entry - The entry to set.

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

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 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

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()
Return a String representing an AddRequest

Overrides:
toString in class LdapMessage
Returns:
A String representing the AddRequest

getCurrentAttributeType

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


Copyright © 2003-2006 . All Rights Reserved.