org.opends.server.replication.protocol
Class ModifyDNMsg

java.lang.Object
  extended by org.opends.server.replication.protocol.ReplicationMessage
      extended by org.opends.server.replication.protocol.UpdateMessage
          extended by org.opends.server.replication.protocol.ModifyDNMsg
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable<UpdateMessage>

public class ModifyDNMsg
extends UpdateMessage

Message used to send Modify DN information.

See Also:
Serialized Form

Constructor Summary
ModifyDNMsg(byte[] in)
          Creates a new ModifyDN message from a byte[].
ModifyDNMsg(PostOperationModifyDNOperation operation)
          construct a new Modify DN message.
ModifyDNMsg(java.lang.String dn, ChangeNumber changeNumber, java.lang.String uid, java.lang.String newParentUid, boolean deleteOldRdn, java.lang.String newSuperior, java.lang.String newRDN)
          construct a new Modify DN message.
 
Method Summary
 AbstractOperation createOperation(InternalClientConnection connection, java.lang.String newDn)
          Create and Operation from the message using the provided DN.
 byte[] getBytes()
          Get the byte array representation of this Message.
 java.lang.String getNewRDN()
          Get the new RDN of this operation.
 boolean newDNIsEqual(DN targetDN)
          Check if the new dn of this ModifyDNMsg is the same as the targetDN given in parameter.
 boolean newDNIsParent(DN targetDn)
          Check if this MSG will change the DN of the target entry to be the same as the dn given as a parameter.
 boolean newParentIsEqual(DN targetDN)
          Check if the new parent of the modifyDNMsg is the same as the targetDN given in parameter.
 void setNewRDN(java.lang.String newRDN)
          Set the new RDN of this operation.
 void setNewSuperior(java.lang.String string)
          Set the new superior.
 java.lang.String toString()
          
 
Methods inherited from class org.opends.server.replication.protocol.UpdateMessage
compareTo, createOperation, decodeHeader, encodeHeader, equals, generateMsg, getChangeNumber, getDn, getUniqueId, hashCode, isAssured, setAssured, setDn
 
Methods inherited from class org.opends.server.replication.protocol.ReplicationMessage
addByteArray, generateMsg, getNextLength
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ModifyDNMsg

public ModifyDNMsg(PostOperationModifyDNOperation operation)
construct a new Modify DN message.

Parameters:
operation - The operation to use for building the message

ModifyDNMsg

public ModifyDNMsg(java.lang.String dn,
                   ChangeNumber changeNumber,
                   java.lang.String uid,
                   java.lang.String newParentUid,
                   boolean deleteOldRdn,
                   java.lang.String newSuperior,
                   java.lang.String newRDN)
construct a new Modify DN message.

Parameters:
dn - The dn to use for building the message.
changeNumber - The changeNumberto use for building the message.
uid - The unique id to use for building the message.
newParentUid - The new parent unique id to use for building the message.
deleteOldRdn - boolean indicating if old rdn must be deleted to use for building the message.
newSuperior - The new Superior entry to use for building the message.
newRDN - The new Rdn to use for building the message.

ModifyDNMsg

public ModifyDNMsg(byte[] in)
            throws java.util.zip.DataFormatException,
                   java.io.UnsupportedEncodingException
Creates a new ModifyDN message from a byte[].

Parameters:
in - The byte[] from which the operation must be read.
Throws:
java.util.zip.DataFormatException - The input byte[] is not a valid AddMsg.
java.io.UnsupportedEncodingException - If UTF8 is not supported.
Method Detail

createOperation

public AbstractOperation createOperation(InternalClientConnection connection,
                                         java.lang.String newDn)
Create and Operation from the message using the provided DN.

Specified by:
createOperation in class UpdateMessage
Parameters:
connection - connection to use when creating the message.
newDn - the DN to use when creating the operation.
Returns:
the created Operation.

getBytes

public byte[] getBytes()
                throws java.io.UnsupportedEncodingException
Get the byte array representation of this Message.

Specified by:
getBytes in class ReplicationMessage
Returns:
The byte array representation of this Message.
Throws:
java.io.UnsupportedEncodingException - When the encoding of the message failed because the UTF-8 encoding is not supported.

toString

public java.lang.String toString()

Overrides:
toString in class java.lang.Object

setNewSuperior

public void setNewSuperior(java.lang.String string)
Set the new superior.

Parameters:
string - the new superior.

getNewRDN

public java.lang.String getNewRDN()
Get the new RDN of this operation.

Returns:
The new RDN of this operation.

setNewRDN

public void setNewRDN(java.lang.String newRDN)
Set the new RDN of this operation.

Parameters:
newRDN - the new RDN of this operation.

newDNIsParent

public boolean newDNIsParent(DN targetDn)
Check if this MSG will change the DN of the target entry to be the same as the dn given as a parameter.

Parameters:
targetDn - the DN to use when checking if this MSG will change the DN of the entry to a given DN.
Returns:
A boolean indicating if the modify DN MSG will change the DN of the target entry to be the same as the dn given as a parameter.

newDNIsEqual

public boolean newDNIsEqual(DN targetDN)
Check if the new dn of this ModifyDNMsg is the same as the targetDN given in parameter.

Parameters:
targetDN - The targetDN to use to check for equality.
Returns:
A boolean indicating if the targetDN if the same as the new DN of the ModifyDNMsg.

newParentIsEqual

public boolean newParentIsEqual(DN targetDN)
Check if the new parent of the modifyDNMsg is the same as the targetDN given in parameter.

Parameters:
targetDN - the targetDN to use when checking equality.
Returns:
A boolean indicating if the new parent of the modifyDNMsg is the same as the targetDN.