org.apache.directory.shared.ldap.codec.modifyDn
Class ModifyDNRequestCodec

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.modifyDn.ModifyDNRequestCodec
All Implemented Interfaces:
Asn1Object

public class ModifyDNRequestCodec
extends LdapMessageCodec

A ModifyDNRequest Message. Its syntax is : ModifyDNRequest ::= [APPLICATION 12] SEQUENCE { entry LDAPDN, newrdn RelativeLDAPDN, deleteoldrdn BOOLEAN, newSuperior [0] LDAPDN OPTIONAL }

Version:
$Rev: 926019 $, $Date: 2010-03-22 11:14:55 +0100 (Mon, 22 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
ModifyDNRequestCodec()
          Creates a new ModifyDNRequest object.
 
Method Summary
protected  int computeLengthProtocolOp()
          Compute the ModifyDNRequest length ModifyDNRequest :
protected  void encodeProtocolOp(java.nio.ByteBuffer buffer)
          Encode the ModifyDNRequest message to a PDU.
 DN getEntry()
          Get the modification's DN
 MessageTypeEnum getMessageType()
          Get the message type
 java.lang.String getMessageTypeName()
          Get the message type Name
 RDN getNewRDN()
          Get the new RDN
 DN getNewSuperior()
          Get the newSuperior
 boolean isDeleteOldRDN()
          Tells if the old RDN is to be deleted
 void setDeleteOldRDN(boolean deleteOldRDN)
          Set the flag to delete the old RDN
 void setEntry(DN entry)
          Set the modification DN.
 void setNewRDN(RDN newRDN)
          Set the new RDN
 void setNewSuperior(DN newSuperior)
          Set the new superior
 java.lang.String toString()
          Get a String representation of a ModifyDNRequest
 
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

ModifyDNRequestCodec

public ModifyDNRequestCodec()
Creates a new ModifyDNRequest 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

getEntry

public DN getEntry()
Get the modification's DN

Returns:
Returns the entry.

setEntry

public void setEntry(DN entry)
Set the modification DN.

Parameters:
entry - The entry to set.

isDeleteOldRDN

public boolean isDeleteOldRDN()
Tells if the old RDN is to be deleted

Returns:
Returns the deleteOldRDN.

setDeleteOldRDN

public void setDeleteOldRDN(boolean deleteOldRDN)
Set the flag to delete the old RDN

Parameters:
deleteOldRDN - The deleteOldRDN to set.

getNewRDN

public RDN getNewRDN()
Get the new RDN

Returns:
Returns the newRDN.

setNewRDN

public void setNewRDN(RDN newRDN)
Set the new RDN

Parameters:
newRDN - The newRDN to set.

getNewSuperior

public DN getNewSuperior()
Get the newSuperior

Returns:
Returns the newSuperior.

setNewSuperior

public void setNewSuperior(DN newSuperior)
Set the new superior

Parameters:
newSuperior - The newSuperior to set.

computeLengthProtocolOp

protected int computeLengthProtocolOp()
Compute the ModifyDNRequest length ModifyDNRequest :
 0x6C L1
  |
  +--> 0x04 L2 entry
  +--> 0x04 L3 newRDN
  +--> 0x01 0x01 (true/false) deleteOldRDN (3 bytes)
 [+--> 0x80 L4 newSuperior ] 
 
 L2 = Length(0x04) + Length(Length(entry)) + Length(entry) 
 L3 = Length(0x04) + Length(Length(newRDN)) + Length(newRDN) 
 L4 = Length(0x80) + Length(Length(newSuperior)) + Length(newSuperior)
 L1 = L2 + L3 + 3 [+ L4] 
 
 Length(ModifyDNRequest) = Length(0x6C) + Length(L1) + L1
 

Specified by:
computeLengthProtocolOp in class LdapMessageCodec
Returns:
The PDU's length of a ModifyDN Request

encodeProtocolOp

protected void encodeProtocolOp(java.nio.ByteBuffer buffer)
                         throws EncoderException
Encode the ModifyDNRequest message to a PDU. ModifyDNRequest :
 0x6C LL
   0x04 LL entry
   0x04 LL newRDN
   0x01 0x01 deleteOldRDN
   [0x80 LL newSuperior]
 

Specified by:
encodeProtocolOp in class LdapMessageCodec
Parameters:
buffer - The buffer where to put the PDU
Throws:
EncoderException

toString

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

Overrides:
toString in class java.lang.Object
Returns:
A ModifyDNRequest String


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