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/plugin/RemotePendingChanges.java |   66 +++++++++++++++++++++++++-------
 1 files changed, 51 insertions(+), 15 deletions(-)

diff --git a/opendj-sdk/opends/src/server/org/opends/server/replication/plugin/RemotePendingChanges.java b/opendj-sdk/opends/src/server/org/opends/server/replication/plugin/RemotePendingChanges.java
index 2b0f45b..3552aa6 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/replication/plugin/RemotePendingChanges.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/replication/plugin/RemotePendingChanges.java
@@ -34,6 +34,7 @@
 
 import org.opends.server.core.AddOperation;
 import org.opends.server.core.DeleteOperation;
+import org.opends.server.core.ModifyDNOperationBasis;
 import org.opends.server.core.ModifyOperation;
 import org.opends.server.replication.common.ChangeNumber;
 import org.opends.server.replication.common.ChangeNumberGenerator;
@@ -42,19 +43,20 @@
 import org.opends.server.replication.protocol.DeleteMsg;
 import org.opends.server.replication.protocol.ModifyDNMsg;
 import org.opends.server.replication.protocol.OperationContext;
-import org.opends.server.replication.protocol.UpdateMessage;
+import org.opends.server.replication.protocol.UpdateMsg;
 import org.opends.server.types.DN;
+import org.opends.server.types.Operation;
 
 /**
  *
  * This class is used to store the list of remote changes received
- * from a replication server and taht are either currently being replayed
+ * from a replication server and that are either currently being replayed
  * or that are waiting for being replayed.
  *
- * It is used to know when the ServerState must be updated and to conpute
+ * It is used to know when the ServerState must be updated and to compute
  * the dependencies between operations.
  *
- * One of this object is instanciated for each ReplicationDomain.
+ * One of this object is instantiated for each ReplicationDomain.
  *
  */
 public class RemotePendingChanges
@@ -74,7 +76,7 @@
     new TreeSet<PendingChange>();
 
   /**
-   * The ServerState that will be updated when UpdateMessage are fully replayed.
+   * The ServerState that will be updated when UpdateMsg are fully replayed.
    */
   private ServerState state;
 
@@ -89,7 +91,7 @@
    *
    * @param changeNumberGenerator The ChangeNumberGenerator that should
    *                              be adjusted when changes are received.
-   * @param state   The ServerState that will be updated when UpdateMessage
+   * @param state   The ServerState that will be updated when UpdateMsg
    *                have been fully replayed.
    */
   public RemotePendingChanges(ChangeNumberGenerator changeNumberGenerator,
@@ -100,13 +102,13 @@
   }
 
   /**
-   * Add a new UpdateMessage that was received from the replication server
+   * Add a new UpdateMsg that was received from the replication server
    * to the pendingList.
    *
-   * @param update The UpdateMessage that was received from the replication
+   * @param update The UpdateMsg that was received from the replication
    *               server and that will be added to the pending list.
    */
-  public synchronized void putRemoteUpdate(UpdateMessage update)
+  public synchronized void putRemoteUpdate(UpdateMsg update)
   {
     ChangeNumber changeNumber = update.getChangeNumber();
     changeNumberGenerator.adjust(changeNumber);
@@ -152,9 +154,9 @@
   /**
    * Get the first update in the list that have some dependencies cleared.
    *
-   * @return The UpdateMessage to be handled.
+   * @return The UpdateMsg to be handled.
    */
-  public synchronized UpdateMessage getNextUpdate()
+  public synchronized UpdateMsg getNextUpdate()
   {
     /*
      * Parse the list of Update with dependencies and check if the dependencies
@@ -214,7 +216,7 @@
     {
       if (pendingChange.getChangeNumber().older(changeNumber))
       {
-        UpdateMessage pendingMsg = pendingChange.getMsg();
+        UpdateMsg pendingMsg = pendingChange.getMsg();
         if (pendingMsg != null)
         {
           if (pendingMsg instanceof DeleteMsg)
@@ -295,7 +297,7 @@
     {
       if (pendingChange.getChangeNumber().older(changeNumber))
       {
-        UpdateMessage pendingMsg = pendingChange.getMsg();
+        UpdateMsg pendingMsg = pendingChange.getMsg();
         if (pendingMsg != null)
         {
           if (pendingMsg instanceof AddMsg)
@@ -347,7 +349,7 @@
     {
       if (pendingChange.getChangeNumber().older(changeNumber))
       {
-        UpdateMessage pendingMsg = pendingChange.getMsg();
+        UpdateMsg pendingMsg = pendingChange.getMsg();
         if (pendingMsg != null)
         {
           if (pendingMsg instanceof DeleteMsg)
@@ -422,7 +424,7 @@
     {
       if (pendingChange.getChangeNumber().older(changeNumber))
       {
-        UpdateMessage pendingMsg = pendingChange.getMsg();
+        UpdateMsg pendingMsg = pendingChange.getMsg();
         if (pendingMsg != null)
         {
           if (pendingMsg instanceof DeleteMsg)
@@ -468,4 +470,38 @@
     }
     return hasDependencies;
   }
+
+  /**
+   * Check the dependencies of a given Operation/UpdateMsg.
+   *
+   * @param op   The Operation for which dependencies must be checked.
+   * @param msg  The Message for which dependencies must be checked.
+   * @return     A boolean indicating if an operation cannot be replayed
+   *             because of dependencies.
+   */
+  public boolean checkDependencies(Operation op, UpdateMsg msg)
+  {
+    if (op instanceof ModifyOperation)
+    {
+      ModifyOperation newOp = (ModifyOperation) op;
+      return checkDependencies(newOp);
+
+    } else if (op instanceof DeleteOperation)
+    {
+      DeleteOperation newOp = (DeleteOperation) op;
+      return checkDependencies(newOp);
+
+    } else if (op instanceof AddOperation)
+    {
+      AddOperation newOp = (AddOperation) op;
+      return checkDependencies(newOp);
+    } else if (op instanceof ModifyDNOperationBasis)
+    {
+      ModifyDNMsg newMsg = (ModifyDNMsg) msg;
+      return checkDependencies(newMsg);
+    } else
+    {
+      return true;  // unknown type of operation ?!
+    }
+  }
 }

--
Gitblit v1.10.0