From d408e72de6b31ec6e44a073beb47c067f09fea78 Mon Sep 17 00:00:00 2001
From: gbellato <gbellato@localhost>
Date: Wed, 12 Jul 2006 09:23:19 +0000
Subject: [PATCH] - pre-operation plugins are not called anymore when processing synchronization operations for ADD,DELELTE and MODIFYDN as it was already the case for MODIFY operation This is necessary to make sure that entries use the same unique ID everywhere.
---
opends/src/server/org/opends/server/synchronization/AckMessage.java | 63 +++++++++++++++++++++++++++++++
1 files changed, 63 insertions(+), 0 deletions(-)
diff --git a/opends/src/server/org/opends/server/synchronization/AckMessage.java b/opends/src/server/org/opends/server/synchronization/AckMessage.java
index 61ba20d..90c9e22 100644
--- a/opends/src/server/org/opends/server/synchronization/AckMessage.java
+++ b/opends/src/server/org/opends/server/synchronization/AckMessage.java
@@ -27,6 +27,8 @@
package org.opends.server.synchronization;
import java.io.Serializable;
+import java.io.UnsupportedEncodingException;
+import java.util.zip.DataFormatException;
/**
* This Class is used to send acks between LDAP and changelog servers.
@@ -49,6 +51,34 @@
}
/**
+ * Creates a new AckMessage by decoding the provided byte array.
+ *
+ * @param in The byte array containing the encoded form of the AckMessage.
+ * @throws DataFormatException If in does not contain a properly encoded
+ * AckMessage.
+ */
+ public AckMessage(byte[] in) throws DataFormatException
+ {
+ try
+ {
+ /* first byte is the type */
+ if (in[0] != MSG_TYPE_ACK)
+ throw new DataFormatException("byte[] is not a valid modify msg");
+ int pos = 1;
+
+ /* read the changeNumber
+ * it is always 24 characters long
+ */
+ String changenumberStr = new String(in, pos, 24, "UTF-8");
+ changeNumber = new ChangeNumber(changenumberStr);
+ pos +=24;
+ } catch (UnsupportedEncodingException e)
+ {
+ throw new DataFormatException("UTF-8 is not supported by this jvm.");
+ }
+ }
+
+ /**
* Get the ChangeNumber from the message.
*
* @return the ChangeNumber
@@ -57,6 +87,7 @@
{
return changeNumber;
}
+
/**
* {@inheritDoc}
*/
@@ -66,4 +97,36 @@
domain.receiveAck(this);
return null;
}
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public byte[] getBytes()
+ {
+ try
+ {
+ int length = 1 + 24;
+ byte[] resultByteArray = new byte[length];
+ int pos = 1;
+
+ /* put the type of the operation */
+ resultByteArray[0] = MSG_TYPE_ACK;
+
+ resultByteArray[pos++] = 0;
+ /* put the ChangeNumber */
+ byte[] changeNumberByte;
+
+ changeNumberByte = this.getChangeNumber().toString().getBytes("UTF-8");
+
+ for (int i=0; i<24; i++,pos++)
+ {
+ resultByteArray[pos] = changeNumberByte[i];
+ }
+ return resultByteArray;
+ } catch (UnsupportedEncodingException e)
+ {
+ return null;
+ }
+ }
}
--
Gitblit v1.10.0