Class AddMsg
- java.lang.Object
-
- org.opends.server.replication.protocol.ReplicationMsg
-
- org.opends.server.replication.protocol.UpdateMsg
-
- org.opends.server.replication.protocol.LDAPUpdateMsg
-
- org.opends.server.replication.protocol.AddMsg
-
- All Implemented Interfaces:
Comparable<UpdateMsg>
public final class AddMsg extends LDAPUpdateMsg
This class is used to exchange Add operation between LDAP servers and replication servers.
-
-
Field Summary
-
Fields inherited from class org.opends.server.replication.protocol.ReplicationMsg
COMPACT_MASK, COMPACT_TYPE_ADD, COMPACT_TYPE_DELETE, COMPACT_TYPE_MODIFY, COMPACT_TYPE_MODIFY_DN, COMPACT_TYPE_REPLICA_OFFLINE, MSG_TYPE_DISK_ENCODING
-
-
Constructor Summary
Constructors Constructor Description AddMsg(byte[] in)
Creates a new Add message from a byte[].AddMsg(CSN csn, Dn dn, UUID entryUuid, UUID parentEntryUuid, byte[] encodedAttributes, byte[] encodedEclIncludes)
Creates a new AddMessage.AddMsg(CSN csn, Entry entry, UUID entryUuid, UUID parentEntryUuid)
Creates a new AddMessage.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <E extends Exception>
voidaccept(UpdateMsgVisitor<E> visitor)
Applies anUpdateMsgVisitor
to thisUpdateMsg
.void
addAttribute(String name, Object value)
Add the specified attribute/attribute value in the entry contained in this AddMsg.void
appendEncodedAttributes(ByteStringBuilder builder)
Appends the encoded attributes to the provided builder.AddRequest
createRequest(Dn newDN)
Create a request from this message using the provided DN.List<Attribute>
getAttributes()
Get the attributes of this add msg.byte[]
getBytesLatest(short protocolVersion)
Get the byte array representation of this message.UUID
getParentEntryUUID()
Get the parent unique id of this add msg.void
setParentEntryUUID(UUID entryUUID)
Set the parent unique id of this add msg.int
size()
Return the number of bytes used by this message.String
toString()
-
Methods inherited from class org.opends.server.replication.protocol.LDAPUpdateMsg
appendEclIncludes, createRequest, generateMsg, getBytes, getDN, getEclIncludes, getEntryUUID, setDN, setEclIncludes, toJson
-
Methods inherited from class org.opends.server.replication.protocol.UpdateMsg
compareTo, equals, getBytes, getCSN, getVersion, hashCode
-
Methods inherited from class org.opends.server.replication.protocol.ReplicationMsg
decodeMsg, isRetryable
-
-
-
-
Constructor Detail
-
AddMsg
public AddMsg(CSN csn, Entry entry, UUID entryUuid, UUID parentEntryUuid)
Creates a new AddMessage.- Parameters:
csn
- CSN of the add.entry
- the added entry.entryUuid
- The Unique identifier of the added entry.parentEntryUuid
- The unique Id of the parent of the added entry.
-
AddMsg
public AddMsg(CSN csn, Dn dn, UUID entryUuid, UUID parentEntryUuid, byte[] encodedAttributes, byte[] encodedEclIncludes)
Creates a new AddMessage.- Parameters:
csn
- CSN of the add.dn
- DN of the added entry.entryUuid
- The Unique identifier of the added entry.parentEntryUuid
- The unique Id of the parent of the added entry.encodedAttributes
- The encodedAttributes of the operation.encodedEclIncludes
- The encodedEclIncludes of the operation.
-
AddMsg
public AddMsg(byte[] in) throws DataFormatException
Creates a new Add message from a byte[].- Parameters:
in
- The byte[] from which the operation must be read.- Throws:
DataFormatException
- The input byte[] is not a valid AddMsg
-
-
Method Detail
-
appendEncodedAttributes
public void appendEncodedAttributes(ByteStringBuilder builder)
Appends the encoded attributes to the provided builder.- Parameters:
builder
- TheByteStringBuilder
where the encoded attributes will be appended.
-
accept
public <E extends Exception> void accept(UpdateMsgVisitor<E> visitor) throws E extends Exception
Description copied from class:UpdateMsg
Applies anUpdateMsgVisitor
to thisUpdateMsg
.- Specified by:
accept
in classUpdateMsg
- Type Parameters:
E
- The type of the exception thrown by the visitor method if it fails, orNeverThrowsException
if the visitor cannot fail.- Parameters:
visitor
- The message visitor.- Throws:
E
- If the visitor failed.E extends Exception
-
createRequest
public AddRequest createRequest(Dn newDN)
Description copied from class:LDAPUpdateMsg
Create a request from this message using the provided DN.- Specified by:
createRequest
in classLDAPUpdateMsg
- Parameters:
newDN
- the DN to use when creating the request.- Returns:
- the created request
-
getBytesLatest
public byte[] getBytesLatest(short protocolVersion)
Description copied from class:LDAPUpdateMsg
Get the byte array representation of this message.This uses the provided version number which must be at least version 4.
- Specified by:
getBytesLatest
in classLDAPUpdateMsg
- Parameters:
protocolVersion
- the actual protocol version to encode into- Returns:
- The byte array representation of this Message.
-
addAttribute
public void addAttribute(String name, Object value)
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.
-
getAttributes
public List<Attribute> getAttributes()
Get the attributes of this add msg.- Returns:
- the list of attributes
-
setParentEntryUUID
public void setParentEntryUUID(UUID entryUUID)
Set the parent unique id of this add msg.- Parameters:
entryUUID
- the parent unique id.
-
getParentEntryUUID
public UUID getParentEntryUUID()
Get the parent unique id of this add msg.- Returns:
- the parent unique id.
-
size
public int size()
Description copied from class:UpdateMsg
Return the number of bytes used by this message.- Specified by:
size
in classLDAPUpdateMsg
- Returns:
- The number of bytes used by this message.
-
-