From 51b2d1c871e51efa30a8f419718d08be9be19f01 Mon Sep 17 00:00:00 2001
From: ludovicp <ludovicp@localhost>
Date: Thu, 27 May 2010 14:37:37 +0000
Subject: [PATCH] Fix issue #4537, naming changelog entries with changeNumber instead of cn. Improve ECL and tests as well

---
 opends/src/server/org/opends/server/replication/plugin/LDAPReplicationDomain.java |   38 ++++++++++++++++++++++++++------------
 1 files changed, 26 insertions(+), 12 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 c0d20e4..f597000 100644
--- a/opends/src/server/org/opends/server/replication/plugin/LDAPReplicationDomain.java
+++ b/opends/src/server/org/opends/server/replication/plugin/LDAPReplicationDomain.java
@@ -563,7 +563,7 @@
     setGroupId((byte)configuration.getGroupId());
     setURLs(configuration.getReferralsUrl());
 
-    createECLDomainCfg(configuration);
+    storeECLConfiguration(configuration);
 
     /*
      * Modify conflicts are solved for all suffixes but the schema suffix
@@ -4235,7 +4235,7 @@
 
     try
     {
-      createECLDomainCfg(configuration);
+      storeECLConfiguration(configuration);
     }
     catch(Exception e)
     {
@@ -4341,29 +4341,34 @@
   }
 
   /**
-   * Create the ECl configuration.
-   * @param  configuration The provided configuration.
-   * @throws ConfigException a.
+   * Store the provided ECL configuration for the domain.
+   * @param  domCfg       The provided configuration.
+   * @throws ConfigException When an error occured.
    */
-  public void createECLDomainCfg(ReplicationDomainCfg configuration)
+  public void storeECLConfiguration(ReplicationDomainCfg domCfg)
   throws ConfigException
   {
+    ExternalChangelogDomainCfg eclDomCfg = null;
     // create the ecl config if it does not exist
     // There may ot be any config entry related to this domain in some
     // unit test cases
     try
     {
-      ExternalChangelogDomainCfg eclDomCfg = null;
       if (DirectoryServer.getConfigHandler().entryExists(configDn))
       {
         try
-        { eclDomCfg = configuration.getExternalChangelogDomain();
-        }catch(Exception e) {}
-        if (eclDomCfg==null)
+        { eclDomCfg = domCfg.getExternalChangelogDomain();
+        } catch(Exception e) {}
+        // domain with no config entry only when running unit tests
+        if (eclDomCfg == null)
         {
+          // no ECL config provided hence create a default one
+          // create the default one
           DN eclConfigEntryDN = DN.decode("cn=external changelog," + configDn);
           if (!DirectoryServer.getConfigHandler().entryExists(eclConfigEntryDN))
           {
+            // no entry exist yet for the ECL config for this domain
+            // create it
             String ldif = makeLdif(
                 "dn: cn=external changelog," + configDn,
                 "objectClass: top",
@@ -4379,8 +4384,17 @@
           }
         }
       }
-      eclDomCfg = configuration.getExternalChangelogDomain();
-      eclDomain = new ExternalChangelogDomain(this, eclDomCfg);
+      eclDomCfg = domCfg.getExternalChangelogDomain();
+      if (eclDomain != null)
+      {
+        eclDomain.applyConfigurationChange(eclDomCfg);
+      }
+      else
+      {
+        // Create the ECL domain object
+        eclDomain = new ExternalChangelogDomain(this, eclDomCfg);
+      }
+
     }
     catch(Exception de)
     {

--
Gitblit v1.10.0