Class LDAPUpdateMsg
- java.lang.Object
-
- org.opends.server.replication.protocol.ReplicationMsg
-
- org.opends.server.replication.protocol.UpdateMsg
-
- org.opends.server.replication.protocol.LDAPUpdateMsg
-
- All Implemented Interfaces:
Comparable<UpdateMsg>
- Direct Known Subclasses:
AddMsg,DeleteMsg,ModifyCommonMsg
public abstract class LDAPUpdateMsg extends UpdateMsg
Abstract class that must be extended to define a message used for sending Updates between servers.
-
-
Field Summary
Fields Modifier and Type Field Description protected byte[]bytesEncoded form of the LDAPUpdateMsg.protected DNdnThe DN on which the update was originally done.protected byte[]encodedEclIncludesEncoded form of entry attributes.protected StringentryUUIDThe entryUUID of the entry that was updated.-
Fields inherited from class org.opends.server.replication.protocol.UpdateMsg
assuredFlag, assuredMode, csn, protocolVersion, safeDataLevel
-
Fields inherited from class org.opends.server.replication.protocol.ReplicationMsg
MSG_TYPE_DISK_ENCODING
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedLDAPUpdateMsg()Creates a new UpdateMsg.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description OperationcreateOperation(InternalClientConnection conn)Create and Operation from the message.abstract OperationcreateOperation(InternalClientConnection conn, DN newDN)Create and Operation from the message using the provided DN.voidencode()Do all the work necessary for the encoding.ByteArrayBuilderencodeHeader(byte msgType, short protocolVersion)Encode the common header for all the UpdateMsg.static LDAPUpdateMsggenerateMsg(PostOperationOperation op)Generates an Update message with the provided information.byte[]getBytes(short protocolVersion)This implementation is only called during unit testing, so we are free to force the protocol version.protected abstract byte[]getBytes_V1()Get the byte array representation of this message.protected abstract byte[]getBytes_V23()Get the byte array representation of this message.protected abstract byte[]getBytes_V45(short protocolVersion)Get the byte array representation of this message.DNgetDN()Get the DN on which the operation happened.ArrayList<RawAttribute>getEclIncludes()Returns the list of entry attributes.StringgetEntryUUID()Get the entryUUID of the entry on which the operation happened.protected intheaderSize()Return the number of bytes used by the header.voidsetDN(DN dn)Set the DN.voidsetEclIncludes(Collection<Attribute> entryAttrs)Set a provided list of entry attributes.abstract intsize()Return the number of bytes used by this message.-
Methods inherited from class org.opends.server.replication.protocol.UpdateMsg
compareTo, contributesToDomainState, decodeHeader, equals, getAssuredMode, getBytes, getCSN, getPayload, getSafeDataLevel, getVersion, hashCode, isAssured, setAssured, setAssuredMode, setSafeDataLevel
-
Methods inherited from class org.opends.server.replication.protocol.ReplicationMsg
generateMsg, isEncodableFor
-
-
-
-
Field Detail
-
dn
protected DN dn
The DN on which the update was originally done.
-
entryUUID
protected String entryUUID
The entryUUID of the entry that was updated.
-
bytes
protected byte[] bytes
Encoded form of the LDAPUpdateMsg.
-
encodedEclIncludes
protected byte[] encodedEclIncludes
Encoded form of entry attributes.
-
-
Method Detail
-
generateMsg
public static LDAPUpdateMsg generateMsg(PostOperationOperation op)
Generates an Update message with the provided information.- Parameters:
op- The operation for which the message must be created.- Returns:
- The generated message.
-
getDN
public DN getDN()
Get the DN on which the operation happened.- Returns:
- The DN on which the operations happened.
-
setDN
public void setDN(DN dn)
Set the DN.- Parameters:
dn- The dn that must now be used for this message.
-
getEntryUUID
public String getEntryUUID()
Get the entryUUID of the entry on which the operation happened.- Returns:
- The entryUUID of the entry on which the operation happened.
-
createOperation
public Operation createOperation(InternalClientConnection conn) throws LDAPException, IOException, DataFormatException
Create and Operation from the message.- Parameters:
conn- connection to use when creating the message- Returns:
- the created Operation
- Throws:
LDAPException- In case of LDAP decoding exception.IOException- In case of ASN1 decoding exception.DataFormatException- In case of bad msg format.
-
createOperation
public abstract Operation createOperation(InternalClientConnection conn, DN newDN) throws LDAPException, IOException, DataFormatException
Create and Operation from the message using the provided DN.- Parameters:
conn- 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.IOException- In case of ASN1 decoding exception.DataFormatException- In case of bad msg format.
-
encode
public void encode()
Do all the work necessary for the encoding. This is useful in case when one wants to perform this outside of a synchronized portion of code. This method is not synchronized and therefore not MT safe.
-
encodeHeader
public ByteArrayBuilder encodeHeader(byte msgType, short protocolVersion)
Encode the common header for all the UpdateMsg. This uses the current protocol version.- Overrides:
encodeHeaderin classUpdateMsg- Parameters:
msgType- The type of UpdateMsg to encode.protocolVersion- The ProtocolVersion to use when encoding.- Returns:
- a byte array builder containing the common header
-
getBytes
public byte[] getBytes(short protocolVersion)
This implementation is only called during unit testing, so we are free to force the protocol version. Underlying implementations override this method in order to provide version specific encodings. Serializes the PDU using the provided replication protocol version. WARNING: should be overwritten by a PDU (sub class) we want to support older protocol version serialization for.
-
getBytes_V1
protected abstract byte[] getBytes_V1()
Get the byte array representation of this message. This uses the version 1 of the replication protocol (used for compatibility purpose).- Returns:
- The byte array representation of this message.
-
getBytes_V23
protected abstract byte[] getBytes_V23()
Get the byte array representation of this message. This uses the version 2 of the replication protocol (used for compatibility purpose).- Returns:
- The byte array representation of this message.
-
getBytes_V45
protected abstract byte[] getBytes_V45(short protocolVersion)
Get the byte array representation of this message. This uses the provided version number which must be version 4 or newer.- Parameters:
protocolVersion- the actual protocol version to encode into- Returns:
- The byte array representation of this Message.
-
size
public abstract int size()
Return the number of bytes used by this message.
-
headerSize
protected int headerSize()
Return the number of bytes used by the header.- Returns:
- The number of bytes used by the header.
-
setEclIncludes
public void setEclIncludes(Collection<Attribute> entryAttrs)
Set a provided list of entry attributes.- Parameters:
entryAttrs- The provided list of entry attributes.
-
getEclIncludes
public ArrayList<RawAttribute> getEclIncludes()
Returns the list of entry attributes.- Returns:
- The list of entry attributes.
-
-