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

java.lang.Object
  extended by org.apache.directory.shared.asn1.AbstractAsn1Object
      extended by org.apache.directory.shared.ldap.codec.LdapMessageCodec
          extended by org.apache.directory.shared.ldap.codec.add.AddRequestCodec
All Implemented Interfaces:
Asn1Object

public class AddRequestCodec
extends LdapMessageCodec

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

Version:
$Rev: 923524 $, $Date: 2010-03-16 01:31:36 +0100 (Tue, 16 Mar 2010) $,
Author:
Apache Directory Project

Field Summary
 
Fields inherited from class org.apache.directory.shared.ldap.codec.LdapMessageCodec
ldapMessageLength
 
Fields inherited from class org.apache.directory.shared.asn1.AbstractAsn1Object
parent
 
Constructor Summary
AddRequestCodec()
          Creates a new AddRequest object.
 
Method Summary
 void addAttributeType(java.lang.String type)
          Create a new attributeValue
 void addAttributeValue(byte[] value)
          Add a new value to the current attribute
 void addAttributeValue(java.lang.String value)
          Add a new value to the current attribute
 void addAttributeValue(Value<?> value)
          Add a new value to the current attribute
protected  int computeLengthProtocolOp()
          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 | +--> ...
protected  void encodeProtocolOp(java.nio.ByteBuffer buffer)
          Encode the AddRequest message to a PDU.
 java.lang.String getCurrentAttributeType()
           
 Entry getEntry()
          Get the entry to be added
 DN getEntryDn()
          Get the added DN
 MessageTypeEnum getMessageType()
          Get the message type
 java.lang.String getMessageTypeName()
          Get the message type Name
 void initEntry()
          Initialize the Entry.
 void setEntry(Entry entry)
          Sets the entry.
 void setEntryDn(DN entryDn)
          Set the added DN.
 java.lang.String toString()
          Return a String representing an AddRequest
 
Methods inherited from class org.apache.directory.shared.ldap.codec.LdapMessageCodec
addControl, addControls, computeLength, encode, getCodecControl, getControls, getControls, getCurrentControl, getMessageId, initControls, setMessageId, toString
 
Methods inherited from class org.apache.directory.shared.asn1.AbstractAsn1Object
addLength, encode, getCurrentLength, getExpectedLength, getParent, getTlvId, setCurrentLength, setExpectedLength, setParent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AddRequestCodec

public AddRequestCodec()
Creates a new AddRequest object.

Method Detail

getMessageType

public MessageTypeEnum getMessageType()
Get the message type

Specified by:
getMessageType in class LdapMessageCodec
Returns:
Returns the type.

getMessageTypeName

public java.lang.String getMessageTypeName()
Get the message type Name

Specified by:
getMessageTypeName in class LdapMessageCodec
Returns:
The message type name

initEntry

public void initEntry()
Initialize the Entry.


getEntry

public Entry getEntry()
Get the entry to be added

Returns:
Returns the entry.

setEntry

public void setEntry(Entry entry)
Sets the entry.

Parameters:
entry - the entry

addAttributeType

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

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

addAttributeValue

public void addAttributeValue(java.lang.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

getEntryDn

public DN getEntryDn()
Get the added DN

Returns:
Returns the entry DN.

setEntryDn

public void setEntryDn(DN entryDn)
Set the added DN.

Parameters:
entry - The DN to set.

computeLengthProtocolOp

protected int computeLengthProtocolOp()
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:
computeLengthProtocolOp in class LdapMessageCodec

encodeProtocolOp

protected void encodeProtocolOp(java.nio.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:
encodeProtocolOp in class LdapMessageCodec
Parameters:
buffer - The buffer where to put the PDU
Throws:
EncoderException

getCurrentAttributeType

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

toString

public java.lang.String toString()
Return a String representing an AddRequest

Overrides:
toString in class java.lang.Object
Returns:
A String representing the AddRequest


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