org.opends.server.replication.protocol
Class AddMsg

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.AddMsg
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable<UpdateMessage>

public class AddMsg
extends UpdateMessage

This class is used to exchange Add operation between LDAP servers and replication servers.

See Also:
Serialized Form

Constructor Summary
AddMsg(byte[] in)
          Creates a new Add message from a byte[].
AddMsg(ChangeNumber cn, java.lang.String dn, java.lang.String uniqueId, java.lang.String parentId, Attribute objectClass, java.util.Collection<Attribute> userAttributes, java.util.Collection<Attribute> operationalAttributes)
          Creates a new AddMessage.
AddMsg(PostOperationAddOperation op)
          Creates a new AddMessage.
 
Method Summary
 void addAttribute(java.lang.String name, java.lang.String value)
          Add the specified attribute/attribute value in the entry contained in this AddMsg.
 AbstractOperation createOperation(InternalClientConnection connection, java.lang.String newDn)
          Create and Operation from the message using the provided DN.
 byte[] getBytes()
          Get the byte[] representation of this Message.
 java.lang.String getParentUid()
          Get the parent unique id of this add msg.
 void setParentUid(java.lang.String uid)
          Set the parent unique id of this add msg.
 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

AddMsg

public AddMsg(PostOperationAddOperation op)
Creates a new AddMessage.

Parameters:
op - the operation to use when creating the message

AddMsg

public AddMsg(ChangeNumber cn,
              java.lang.String dn,
              java.lang.String uniqueId,
              java.lang.String parentId,
              Attribute objectClass,
              java.util.Collection<Attribute> userAttributes,
              java.util.Collection<Attribute> operationalAttributes)
Creates a new AddMessage.

Parameters:
cn - ChangeNumber of the add.
dn - DN of the added entry.
uniqueId - The Unique identifier of the added entry.
parentId - The unique Id of the parent of the added entry.
objectClass - objectclass of the added entry.
userAttributes - user attributes of the added entry.
operationalAttributes - operational attributes of the added entry.

AddMsg

public AddMsg(byte[] in)
       throws java.util.zip.DataFormatException,
              java.io.UnsupportedEncodingException
Creates a new Add 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 by the jvm
Method Detail

createOperation

public AbstractOperation createOperation(InternalClientConnection connection,
                                         java.lang.String newDn)
                                  throws LDAPException,
                                         ASN1Exception
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.
Throws:
LDAPException - In case of LDAP decoding exception.
ASN1Exception - In case of ASN1 decoding exception.

getBytes

public byte[] getBytes()
                throws java.io.UnsupportedEncodingException
Get the byte[] 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

addAttribute

public void addAttribute(java.lang.String name,
                         java.lang.String value)
                  throws ASN1Exception
Add the specified attribute/attribute value in the entry contained in this AddMsg.

Parameters:
name - The name of the attribute to add.
value - The value of the attribute to add.
Throws:
ASN1Exception - When this Msg is not valid.

setParentUid

public void setParentUid(java.lang.String uid)
Set the parent unique id of this add msg.

Parameters:
uid - the parent unique id.

getParentUid

public java.lang.String getParentUid()
Get the parent unique id of this add msg.

Returns:
the parent unique id.