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 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.LDAPUpdateMsg
bytes, dn, encodedEclIncludes, entryUUID
-
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 Constructor Description AddMsg(byte[] in)Creates a new Add message from a byte[].AddMsg(CSN csn, DN dn, String entryUUID, String parentEntryUUID, Map<ObjectClass,String> objectClasses, Map<AttributeType,List<Attribute>> userAttributes, Map<AttributeType,List<Attribute>> operationalAttributes)Creates a new AddMessage.AddMsg(CSN csn, DN dn, String uniqueId, String parentId, Attribute objectClass, Iterable<Attribute> userAttributes, Iterable<Attribute> operationalAttributes)Creates a new AddMessage.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddAttribute(String name, String value)Add the specified attribute/attribute value in the entry contained in this AddMsg.AddOperationcreateOperation(InternalClientConnection connection, DN newDN)Create and Operation from the message using the provided DN.List<Attribute>getAttributes()Get the attributes of this add msg.byte[]getBytes_V1()Get the byte array representation of this message.byte[]getBytes_V23()Get the byte array representation of this message.byte[]getBytes_V45(short protocolVersion)Get the byte array representation of this message.StringgetParentEntryUUID()Get the parent unique id of this add msg.voidsetParentEntryUUID(String entryUUID)Set the parent unique id of this add msg.intsize()Return the number of bytes used by this message.StringtoString()-
Methods inherited from class org.opends.server.replication.protocol.LDAPUpdateMsg
createOperation, encode, encodeHeader, generateMsg, getBytes, getDN, getEclIncludes, getEntryUUID, headerSize, setDN, setEclIncludes
-
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
-
-
-
-
Constructor Detail
-
AddMsg
public AddMsg(CSN csn, DN dn, String entryUUID, String parentEntryUUID, Map<ObjectClass,String> objectClasses, Map<AttributeType,List<Attribute>> userAttributes, Map<AttributeType,List<Attribute>> operationalAttributes)
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.objectClasses- objectclass of the added entry.userAttributes- user attributes of the added entry.operationalAttributes- operational attributes of the added entry.
-
AddMsg
public AddMsg(CSN csn, DN dn, String uniqueId, String parentId, Attribute objectClass, Iterable<Attribute> userAttributes, Iterable<Attribute> operationalAttributes)
Creates a new AddMessage.- Parameters:
csn- CSN 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 DataFormatExceptionCreates 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
-
createOperation
public AddOperation createOperation(InternalClientConnection connection, DN newDN) throws LDAPException, DecodeException
Create and Operation from the message using the provided DN.- Specified by:
createOperationin classLDAPUpdateMsg- 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.DecodeException
-
getBytes_V1
public byte[] getBytes_V1()
Get the byte array representation of this message. This uses the version 1 of the replication protocol (used for compatibility purpose).- Specified by:
getBytes_V1in classLDAPUpdateMsg- Returns:
- The byte array representation of this message.
-
getBytes_V23
public byte[] getBytes_V23()
Get the byte array representation of this message. This uses the version 2 of the replication protocol (used for compatibility purpose).- Specified by:
getBytes_V23in classLDAPUpdateMsg- Returns:
- The byte array representation of this message.
-
getBytes_V45
public 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.- Specified by:
getBytes_V45in classLDAPUpdateMsg- Parameters:
protocolVersion- the actual protocol version to encode into- Returns:
- The byte array representation of this Message.
-
addAttribute
public void addAttribute(String name, String value) throws IOException
Add the specified attribute/attribute value in the entry contained in this AddMsg.A failure to encode the attribute is reported rather than swallowed: the caller adds the attribute because the entry must carry it - addConflict() adds the ds-sync-conflict marker which says why an entry was renamed - and an entry stored without it is a conflict the repair tool has nothing to find it by. The attributes this message already carries are left as they were, so a message which could not take the new attribute still encodes the entry it did before.
- Parameters:
name- The name of the attribute to add.value- The value of the attribute to add.- Throws:
IOException- When the attribute could not be encoded.
-
getAttributes
public List<Attribute> getAttributes() throws LDAPException, DecodeException
Get the attributes of this add msg.- Returns:
- the list of attributes
- Throws:
LDAPException- In case of LDAP decoding exceptionDecodeException- In case of ASN1 decoding exception
-
setParentEntryUUID
public void setParentEntryUUID(String entryUUID)
Set the parent unique id of this add msg.- Parameters:
entryUUID- the parent unique id.
-
getParentEntryUUID
public String getParentEntryUUID()
Get the parent unique id of this add msg.- Returns:
- the parent unique id.
-
size
public int size()
Return the number of bytes used by this message.- Specified by:
sizein classLDAPUpdateMsg- Returns:
- The number of bytes used by this message.
-
-