From 0ed3ce1253d7276824493d90a8312a2c117ea1c7 Mon Sep 17 00:00:00 2001
From: gbellato <gbellato@localhost>
Date: Fri, 02 Mar 2007 09:22:58 +0000
Subject: [PATCH] issue 504,505,507 : res-synchronization after restore or import

---
 opends/src/server/org/opends/server/synchronization/plugin/MultimasterSynchronization.java |   52 +++++++++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 49 insertions(+), 3 deletions(-)

diff --git a/opends/src/server/org/opends/server/synchronization/plugin/MultimasterSynchronization.java b/opends/src/server/org/opends/server/synchronization/plugin/MultimasterSynchronization.java
index c600300..d0cb7b9 100644
--- a/opends/src/server/org/opends/server/synchronization/plugin/MultimasterSynchronization.java
+++ b/opends/src/server/org/opends/server/synchronization/plugin/MultimasterSynchronization.java
@@ -445,8 +445,10 @@
   /**
    * Finds the Synchronization domain for a given DN.
    *
-   * @param dn The DN for which the domain must be returned.
-   * @return The Synchronization domain for this DN.
+   * @param dn   The DN for which the domain must be returned.
+   * @param op   An optional operation for which the check is done.
+   *             Can be null is the request has no associated operation.
+   * @return     The Synchronization domain for this DN.
    */
   private static SynchronizationDomain findDomain(DN dn, Operation op)
   {
@@ -454,7 +456,7 @@
      * Don't run the special synchronization code on Operation that are
      * specifically marked as don't synchronize.
      */
-    if (op.dontSynchronize())
+    if ((op != null) && op.dontSynchronize())
       return null;
 
     SynchronizationDomain domain = null;
@@ -489,6 +491,50 @@
     return;
   }
 
+
+  /**
+   * Handle a Notification of restore start from the core server.
+   *
+   * @param dn The baseDn of the restore.
+   */
+  public static void notificationRestoreStart(DN dn)
+  {
+    SynchronizationDomain domain = findDomain(dn, null);
+    domain.disable();
+  }
+
+  /**
+   * Handle a Notification of restore end from the core server.
+   *
+   * @param dn The baseDn of the restore.
+   */
+  public static void notificationRestoreEnd(DN dn)
+  {
+    SynchronizationDomain domain = findDomain(dn, null);
+    domain.enable();
+  }
+
+  /**
+   * Handle a Notification of backup start from the core server.
+   *
+   * @param dn The baseDn of the backup.
+   */
+  public static void notificationBackupStart(DN dn)
+  {
+    SynchronizationDomain domain = findDomain(dn, null);
+    domain.backupStart();
+  }
+
+  /**
+   * Handle a Notification of backup end from the core server.
+   *
+   * @param dn The baseDn of the backup.
+   */
+  public static void notificationBackupEnd(DN dn)
+  {
+    SynchronizationDomain domain = findDomain(dn, null);
+    domain.backupEnd();
+  }
 }
 
 

--
Gitblit v1.10.0