From 25862fdf888ed23207ab51937a43e6f9ad41d805 Mon Sep 17 00:00:00 2001
From: Jean-Noel Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Mon, 22 Sep 2014 16:23:50 +0000
Subject: [PATCH] OPENDJ-1206 (CR-4393) Create a new ReplicationBackend/ChangelogBackend to support cn=changelog

---
 opendj3-server-dev/src/server/org/opends/server/replication/plugin/LDAPReplicationDomain.java |   41 ++++++++---------------------------------
 1 files changed, 8 insertions(+), 33 deletions(-)

diff --git a/opendj3-server-dev/src/server/org/opends/server/replication/plugin/LDAPReplicationDomain.java b/opendj3-server-dev/src/server/org/opends/server/replication/plugin/LDAPReplicationDomain.java
index 2ee7049..fe8a0ee 100644
--- a/opendj3-server-dev/src/server/org/opends/server/replication/plugin/LDAPReplicationDomain.java
+++ b/opendj3-server-dev/src/server/org/opends/server/replication/plugin/LDAPReplicationDomain.java
@@ -85,7 +85,6 @@
 import org.opends.server.types.operation.*;
 import org.opends.server.util.LDIFReader;
 import org.opends.server.util.TimeThread;
-import org.opends.server.workflowelement.externalchangelog.ECLWorkflowElement;
 import org.opends.server.workflowelement.localbackend.LocalBackendModifyOperation;
 
 import static org.forgerock.opendj.ldap.ResultCode.*;
@@ -478,7 +477,7 @@
     storeECLConfiguration(configuration);
     solveConflictFlag = isSolveConflict(configuration);
 
-    Backend backend = getBackend();
+    Backend<?> backend = getBackend();
     if (backend == null)
     {
       throw new ConfigException(ERR_SEARCHING_DOMAIN_BACKEND.get(
@@ -3468,7 +3467,7 @@
   private long exportBackend(OutputStream output, boolean checksumOutput)
       throws DirectoryException
   {
-    Backend backend = getBackend();
+    Backend<?> backend = getBackend();
 
     //  Acquire a shared lock for the backend.
     try
@@ -3601,7 +3600,7 @@
    * @throws DirectoryException
    *           If the backend could not be disabled or locked exclusively.
    */
-  private void preBackendImport(Backend backend) throws DirectoryException
+  private void preBackendImport(Backend<?> backend) throws DirectoryException
   {
     // Stop saving state
     stateSavingDisabled = true;
@@ -3629,10 +3628,9 @@
   @Override
   protected void importBackend(InputStream input) throws DirectoryException
   {
+    Backend<?> backend = getBackend();
+
     LDIFImportConfig importConfig = null;
-
-    Backend backend = getBackend();
-
     ImportExportContext ieCtx = getImportExportContext();
     try
     {
@@ -3718,7 +3716,7 @@
    * @param backend The backend implied in the import.
    * @exception DirectoryException Thrown when an error occurs.
    */
-  private void closeBackendImport(Backend backend) throws DirectoryException
+  private void closeBackendImport(Backend<?> backend) throws DirectoryException
   {
     String lockFile = LockFileManager.getBackendLockFileName(backend);
     StringBuilder failureReason = new StringBuilder();
@@ -3785,7 +3783,7 @@
    * Returns the backend associated to this domain.
    * @return The associated backend.
    */
-  private Backend getBackend()
+  private Backend<?> getBackend()
   {
     return DirectoryServer.getBackend(getBaseDN());
   }
@@ -4071,29 +4069,6 @@
 
     super.sessionInitiated(initStatus, rsState);
 
-    // Now that we are connected , we can enable ECL if :
-    // 1/ RS must in the same JVM and created an ECL_WORKFLOW_ELEMENT
-    // and 2/ this domain must NOT be private
-    if (!getBackend().isPrivateBackend())
-    {
-      try
-      {
-        ECLWorkflowElement wfe = (ECLWorkflowElement)
-        DirectoryServer.getWorkflowElement(
-            ECLWorkflowElement.ECL_WORKFLOW_ELEMENT);
-        if (wfe != null)
-        {
-          wfe.getReplicationServer().enableECL();
-        }
-      }
-      catch (DirectoryException de)
-      {
-        logger.info(NOTE_ERR_UNABLE_TO_ENABLE_ECL,
-            "Replication Domain on " + getBaseDNString(), stackTraceToSingleLineString(de));
-        // and go on
-      }
-    }
-
     // Now for bad data set status if needed
     if (forceBadDataSet)
     {
@@ -4346,7 +4321,7 @@
   @Override
   public long countEntries() throws DirectoryException
   {
-    Backend backend = getBackend();
+    Backend<?> backend = getBackend();
     if (!backend.supportsLDIFExport())
     {
       LocalizableMessage msg = ERR_INIT_EXPORT_NOT_SUPPORTED.get(backend.getBackendID());

--
Gitblit v1.10.0