From 7938c7ece07363df886d2a3be2cd55870fffbfe4 Mon Sep 17 00:00:00 2001
From: fdorson <fdorson@localhost>
Date: Tue, 06 Jan 2009 14:05:02 +0000
Subject: [PATCH] With these changes the openDS servers are able to load data coming from a Sun Java System Directory Server Enterprise Edition. 

---
 opends/src/server/org/opends/server/replication/plugin/LDAPReplicationDomain.java |   34 +++++++++++++++++++++++++++++++---
 1 files changed, 31 insertions(+), 3 deletions(-)

diff --git a/opends/src/server/org/opends/server/replication/plugin/LDAPReplicationDomain.java b/opends/src/server/org/opends/server/replication/plugin/LDAPReplicationDomain.java
index 076d5d6..c6629eb 100644
--- a/opends/src/server/org/opends/server/replication/plugin/LDAPReplicationDomain.java
+++ b/opends/src/server/org/opends/server/replication/plugin/LDAPReplicationDomain.java
@@ -22,7 +22,7 @@
  * CDDL HEADER END
  *
  *
- *      Copyright 2006-2008 Sun Microsystems, Inc.
+ *      Copyright 2006-2009 Sun Microsystems, Inc.
  */
 package org.opends.server.replication.plugin;
 
@@ -364,6 +364,18 @@
      */
     state = new PersistentServerState(baseDn, serverId, getServerState());
 
+    /* Check if a ReplicaUpdateVector entry is present
+     * if so, and no state is already initialized
+     * translate the ruv into a serverState and
+     * a generationId
+     */
+    Long compatGenId  = state.checkRUVCompat();
+    if (compatGenId != null)
+    {
+      generationId = compatGenId;
+      saveGenerationId(generationId);
+    }
+
     startPublishService(replicationServers, window, heartbeatInterval);
 
     /*
@@ -1878,16 +1890,32 @@
   /**
    * Do what necessary when the data have changed : load state, load
    * generation Id.
+   * If there is no such information check if there is a
+   * ReplicaUpdateVector entry and translate it into a state
+   * and generationId.
    * @exception DirectoryException Thrown when an error occurs.
-  */
+   */
   protected void loadDataState()
   throws DirectoryException
   {
+    Long compatGenId = null;
+
     state.clearInMemory();
     state.loadState();
+
+    // Check to see if a Ruv needs to be translated
+    compatGenId  = state.checkRUVCompat();
+
     generator.adjust(state.getMaxChangeNumber(serverId));
     // Retrieves the generation ID associated with the data imported
-    generationId = loadGenerationId();
+
+    if (compatGenId != null)
+    {
+      generationId = compatGenId;
+      saveGenerationId(generationId);
+    }
+    else
+      generationId = loadGenerationId();
   }
 
   /**

--
Gitblit v1.10.0