From b4f8838b15342670c31753a484abf0129e3c9653 Mon Sep 17 00:00:00 2001
From: jcduff <jcduff@localhost>
Date: Thu, 23 Oct 2008 14:04:24 +0000
Subject: [PATCH] The commit will bring the following features : - An updated version of the underlying database. BDB JE 3.3 is now used. - Attribute API refactoring providing a better abstraction and offering improved performances. - A new GUI called the Control-Panel to replace the Status-Panel: the specifications for this GUI are available on OpenDS Wiki and contains a link to a mockup. See <https://www.opends.org/wiki/page/ControlPanelUISpecification>. - Some changes in the replication protocol to implement "Assured Replication Mode". The specifications are on OpenDS Wiki at <https://www.opends.org/wiki/page/AssuredMode> and section 7 described some of the replication changes required to support this. Assured Replication is not finished, but the main replication protocol changes to support it are done. As explained by Gilles on an email on the Dev mailing list (http://markmail.org/message/46rgo3meq3vriy4a), with these changes the newer versions of OpenDS may not be able to replicate with OpenDS 1.0 instances. - Support for Service Tags on the platforms where the functionality is available and enabled. Specifications are published at <https://www.opends.org/wiki/page/OpenDSServiceTagEnabled>. For more information on Service Tags see <http://wikis.sun.com/display/ServiceTag/Sun+Service+Tag+FAQ>. - The Admin Connector service. In order to provide agentry of the OpenDS server at any time, a new service has been added, dedicated to the administration, configuration and monitoring of the server. An overview of the Admin Connector service and it's use is available on the OpenDS wiki <https://www.opends.org/wiki/page/ManagingAdministrationTrafficToTheServer> - Updates to the various command line tools to support the Admin Connector service. - Some internal re-architecting of the server to put the foundation of future developments such as virtual directory services. The new NetworkGroups and WorkFlow internal services which have been specified in <https://www.opends.org/wiki/page/BasicOperationRoutingThroughNetworkGroup> are now implemented. - Many bug fixes...
---
opendj-sdk/opends/src/server/org/opends/server/replication/protocol/ModifyDNMsg.java | 157 +++++++++++++++++++++++++++++++++++++++++++++++-----
1 files changed, 142 insertions(+), 15 deletions(-)
diff --git a/opendj-sdk/opends/src/server/org/opends/server/replication/protocol/ModifyDNMsg.java b/opendj-sdk/opends/src/server/org/opends/server/replication/protocol/ModifyDNMsg.java
index 9dac7f6..1a3cd39 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/replication/protocol/ModifyDNMsg.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/replication/protocol/ModifyDNMsg.java
@@ -44,13 +44,12 @@
/**
* Message used to send Modify DN information.
*/
-public class ModifyDNMsg extends UpdateMessage
+public class ModifyDNMsg extends UpdateMsg
{
private String newRDN;
private String newSuperior;
private boolean deleteOldRdn;
private String newSuperiorId;
- private static final long serialVersionUID = -4905520652801395185L;
/**
* construct a new Modify DN message.
@@ -104,15 +103,16 @@
* Creates a new ModifyDN message from a byte[].
*
* @param in The byte[] from which the operation must be read.
- * @throws DataFormatException The input byte[] is not a valid AddMsg.
+ * @throws DataFormatException The input byte[] is not a valid ModifyDNMsg.
* @throws UnsupportedEncodingException If UTF8 is not supported.
*/
public ModifyDNMsg(byte[] in) throws DataFormatException,
UnsupportedEncodingException
{
- super(in);
-
- int pos = decodeHeader(MSG_TYPE_MODIFYDN_REQUEST, in);
+ byte[] allowedPduTypes = new byte[2];
+ allowedPduTypes[0] = MSG_TYPE_MODIFYDN;
+ allowedPduTypes[1] = MSG_TYPE_MODIFYDN_V1;
+ int pos = decodeHeader(allowedPduTypes, in);
/* read the newRDN
* first calculate the length then construct the string
@@ -167,12 +167,7 @@
}
/**
- * Get the byte array representation of this Message.
- *
- * @return The byte array representation of this Message.
- *
- * @throws UnsupportedEncodingException When the encoding of the message
- * failed because the UTF-8 encoding is not supported.
+ * {@inheritDoc}
*/
@Override
public byte[] getBytes() throws UnsupportedEncodingException
@@ -199,7 +194,7 @@
else
length += 1;
- byte[] resultByteArray = encodeHeader(MSG_TYPE_MODIFYDN_REQUEST, length);
+ byte[] resultByteArray = encodeHeader(MSG_TYPE_MODIFYDN, length);
int pos = resultByteArray.length - length;
/* put the new RDN and a terminating 0 */
@@ -236,8 +231,33 @@
@Override
public String toString()
{
- return ("MODDN " + getDn() + " " + newRDN + " " + newSuperior + " " +
- getChangeNumber());
+ if (protocolVersion == ProtocolVersion.REPLICATION_PROTOCOL_V1)
+ {
+ return "ModifyDNMsg content: " +
+ "\nprotocolVersion: " + protocolVersion +
+ "\ndn: " + dn +
+ "\nchangeNumber: " + changeNumber +
+ "\nuniqueId: " + uniqueId +
+ "\nassuredFlag: " + assuredFlag +
+ "\nnewRDN: " + newRDN +
+ "\nnewSuperior: " + newSuperior +
+ "\ndeleteOldRdn: " + deleteOldRdn;
+ }
+ if (protocolVersion == ProtocolVersion.REPLICATION_PROTOCOL_V2)
+ {
+ return "ModifyDNMsg content: " +
+ "\nprotocolVersion: " + protocolVersion +
+ "\ndn: " + dn +
+ "\nchangeNumber: " + changeNumber +
+ "\nuniqueId: " + uniqueId +
+ "\nnewRDN: " + newRDN +
+ "\nnewSuperior: " + newSuperior +
+ "\ndeleteOldRdn: " + deleteOldRdn +
+ "\nassuredFlag: " + assuredFlag +
+ "\nassuredMode: " + assuredMode +
+ "\nsafeDataLevel: " + safeDataLevel;
+ }
+ return "!!! Unknown version: " + protocolVersion + "!!!";
}
/**
@@ -250,6 +270,56 @@
}
/**
+ * Get the new superior.
+ *
+ * @return The new superior.
+ */
+ public String getNewSuperior()
+ {
+ return newSuperior;
+ }
+
+ /**
+ * Get the new superior id.
+ *
+ * @return The new superior id.
+ */
+ public String getNewSuperiorId()
+ {
+ return newSuperiorId;
+ }
+
+ /**
+ * Get the delete old rdn option.
+ *
+ * @return The delete old rdn option.
+ */
+ public boolean deleteOldRdn()
+ {
+ return deleteOldRdn;
+ }
+
+ /**
+ * Set the new superior id.
+ *
+ * @param newSup The new superior id.
+ */
+ public void setNewSuperiorId(String newSup)
+ {
+ newSuperiorId = newSup;
+ }
+
+ /**
+ * Set the delete old rdn option.
+ *
+ * @param delete The delete old rdn option.
+ */
+ public void setDeleteOldRdn(boolean delete)
+ {
+ deleteOldRdn = delete;
+ }
+
+ /**
* Get the new RDN of this operation.
*
* @return The new RDN of this operation.
@@ -371,4 +441,61 @@
return 100;
}
+ /**
+ * {@inheritDoc}
+ */
+ public byte[] getBytes_V1() throws UnsupportedEncodingException
+ {
+ byte[] byteNewRdn = newRDN.getBytes("UTF-8");
+ byte[] byteNewSuperior = null;
+ byte[] byteNewSuperiorId = null;
+
+ // calculate the length necessary to encode the parameters
+ int length = byteNewRdn.length + 1 + 1;
+ if (newSuperior != null)
+ {
+ byteNewSuperior = newSuperior.getBytes("UTF-8");
+ length += byteNewSuperior.length + 1;
+ }
+ else
+ length += 1;
+
+ if (newSuperiorId != null)
+ {
+ byteNewSuperiorId = newSuperiorId.getBytes("UTF-8");
+ length += byteNewSuperiorId.length + 1;
+ }
+ else
+ length += 1;
+
+ byte[] resultByteArray = encodeHeader_V1(MSG_TYPE_MODIFYDN_V1, length);
+ int pos = resultByteArray.length - length;
+
+ /* put the new RDN and a terminating 0 */
+ pos = addByteArray(byteNewRdn, resultByteArray, pos);
+
+ /* put the newsuperior and a terminating 0 */
+ if (newSuperior != null)
+ {
+ pos = addByteArray(byteNewSuperior, resultByteArray, pos);
+ }
+ else
+ resultByteArray[pos++] = 0;
+
+ /* put the newsuperiorId and a terminating 0 */
+ if (newSuperiorId != null)
+ {
+ pos = addByteArray(byteNewSuperiorId, resultByteArray, pos);
+ }
+ else
+ resultByteArray[pos++] = 0;
+
+ /* put the deleteoldrdn flag */
+ if (deleteOldRdn)
+ resultByteArray[pos++] = 1;
+ else
+ resultByteArray[pos++] = 0;
+
+ return resultByteArray;
+ }
}
--
Gitblit v1.10.0