From f5e61220e9878f71165989bd9f21f1d0a568bb87 Mon Sep 17 00:00:00 2001
From: ludovicp <ludovicp@localhost>
Date: Fri, 30 Jul 2010 13:23:20 +0000
Subject: [PATCH] Code refactoring, renaming and commenting only. No feature nor behavior change.

---
 opends/src/server/org/opends/server/replication/plugin/MultimasterReplication.java |   34 ++++++++++++++++++++--------------
 1 files changed, 20 insertions(+), 14 deletions(-)

diff --git a/opends/src/server/org/opends/server/replication/plugin/MultimasterReplication.java b/opends/src/server/org/opends/server/replication/plugin/MultimasterReplication.java
index 92c628a..ddc8b01 100644
--- a/opends/src/server/org/opends/server/replication/plugin/MultimasterReplication.java
+++ b/opends/src/server/org/opends/server/replication/plugin/MultimasterReplication.java
@@ -493,18 +493,17 @@
     if ((domain == null) || (!domain.solveConflict()))
       return new SynchronizationProviderResult.ContinueProcessing();
 
-    Historical historicalInformation = (Historical)
-                            modifyOperation.getAttachment(
-                                    Historical.HISTORICAL);
+    EntryHistorical historicalInformation = (EntryHistorical)
+      modifyOperation.getAttachment(EntryHistorical.HISTORICAL);
     if (historicalInformation == null)
     {
       Entry entry = modifyOperation.getModifiedEntry();
-      historicalInformation = Historical.load(entry);
-      modifyOperation.setAttachment(Historical.HISTORICAL,
-              historicalInformation);
+      historicalInformation = EntryHistorical.newInstanceFromEntry(entry);
+      modifyOperation.setAttachment(EntryHistorical.HISTORICAL,
+          historicalInformation);
     }
 
-    historicalInformation.generateState(modifyOperation);
+    historicalInformation.setHistoricalAttrToOperation(modifyOperation);
 
     if (modifyOperation.getModifications().isEmpty())
     {
@@ -543,18 +542,22 @@
     if ((domain == null) || (!domain.solveConflict()))
       return new SynchronizationProviderResult.ContinueProcessing();
 
-    Historical historicalInformation = (Historical)
-    modifyDNOperation.getAttachment(
-        Historical.HISTORICAL);
+    // The historical object is retrieved from the attachment created
+    // in the HandleConflictResolution phase.
+    EntryHistorical historicalInformation = (EntryHistorical)
+    modifyDNOperation.getAttachment(EntryHistorical.HISTORICAL);
     if (historicalInformation == null)
     {
+      // When no Historical attached, create once by loading from the entry
+      // and attach it to the operation
       Entry entry = modifyDNOperation.getUpdatedEntry();
-      historicalInformation = Historical.load(entry);
-      modifyDNOperation.setAttachment(Historical.HISTORICAL,
+      historicalInformation = EntryHistorical.newInstanceFromEntry(entry);
+      modifyDNOperation.setAttachment(EntryHistorical.HISTORICAL,
           historicalInformation);
     }
 
-    historicalInformation.generateState(modifyDNOperation);
+    // Add to the operation the historical attribute : "dn:changeNumger:moddn"
+    historicalInformation.setHistoricalAttrToOperation(modifyDNOperation);
 
     return new SynchronizationProviderResult.ContinueProcessing();
   }
@@ -566,15 +569,18 @@
   public SynchronizationProviderResult doPreOperation(
          PreOperationAddOperation addOperation)
   {
+    // Check replication domain
     LDAPReplicationDomain domain =
       findDomain(addOperation.getEntryDN(), addOperation);
     if (domain == null)
       return new SynchronizationProviderResult.ContinueProcessing();
 
+    // For LOCAL op only, generate ChangeNumber and attach Context
     if (!addOperation.isSynchronizationOperation())
       domain.doPreOperation(addOperation);
 
-    Historical.generateState(addOperation);
+    // Add to the operation the historical attribute : "dn:changeNumger:add"
+    EntryHistorical.setHistoricalAttrToOperation(addOperation);
 
     return new SynchronizationProviderResult.ContinueProcessing();
   }

--
Gitblit v1.10.0