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

---
 opendj-sdk/opends/src/server/org/opends/server/replication/plugin/LDAPReplicationDomain.java |   42 ++++++++----------------------------------
 1 files changed, 8 insertions(+), 34 deletions(-)

diff --git a/opendj-sdk/opends/src/server/org/opends/server/replication/plugin/LDAPReplicationDomain.java b/opendj-sdk/opends/src/server/org/opends/server/replication/plugin/LDAPReplicationDomain.java
index a0ebbc7..1477f0a 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/replication/plugin/LDAPReplicationDomain.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/replication/plugin/LDAPReplicationDomain.java
@@ -76,7 +76,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.opends.messages.ReplicationMessages.*;
@@ -475,7 +474,7 @@
     storeECLConfiguration(configuration);
     solveConflictFlag = isSolveConflict(configuration);
 
-    Backend backend = getBackend();
+    Backend<?> backend = getBackend();
     if (backend == null)
     {
       throw new ConfigException(ERR_SEARCHING_DOMAIN_BACKEND.get(
@@ -3490,7 +3489,7 @@
   private long exportBackend(OutputStream output, boolean checksumOutput)
       throws DirectoryException
   {
-    Backend backend = getBackend();
+    Backend<?> backend = getBackend();
 
     //  Acquire a shared lock for the backend.
     try
@@ -3623,7 +3622,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;
@@ -3653,10 +3652,9 @@
   @Override
   protected void importBackend(InputStream input) throws DirectoryException
   {
+    Backend<?> backend = getBackend();
+
     LDIFImportConfig importConfig = null;
-
-    Backend backend = getBackend();
-
     ImportExportContext ieCtx = getImportExportContext();
     try
     {
@@ -3742,7 +3740,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();
@@ -3810,7 +3808,7 @@
    * Returns the backend associated to this domain.
    * @return The associated backend.
    */
-  private Backend getBackend()
+  private Backend<?> getBackend()
   {
     return DirectoryServer.getBackend(getBaseDN());
   }
@@ -4098,30 +4096,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)
-      {
-        logError(NOTE_ERR_UNABLE_TO_ENABLE_ECL.get(
-            "Replication Domain on " + getBaseDNString(),
-            stackTraceToSingleLineString(de)));
-        // and go on
-      }
-    }
-
     // Now for bad data set status if needed
     if (forceBadDataSet)
     {
@@ -4375,7 +4349,7 @@
   @Override
   public long countEntries() throws DirectoryException
   {
-    Backend backend = getBackend();
+    Backend<?> backend = getBackend();
     if (!backend.supportsLDIFExport())
     {
       Message msg = ERR_INIT_EXPORT_NOT_SUPPORTED.get(backend.getBackendID());

--
Gitblit v1.10.0