From f8ef0eed366445c5a341dbcc7882a7104c1cac1b Mon Sep 17 00:00:00 2001
From: boli <boli@localhost>
Date: Thu, 26 Jul 2007 16:31:34 +0000
Subject: [PATCH] This fixes issue 1971 and allows partial non-append imports of a backend:

---
 opends/src/server/org/opends/server/backends/jeb/ImportContext.java |  128 +++++++++++++++++++++++++++++++++++-------
 1 files changed, 106 insertions(+), 22 deletions(-)

diff --git a/opends/src/server/org/opends/server/backends/jeb/ImportContext.java b/opends/src/server/org/opends/server/backends/jeb/ImportContext.java
index 7298ac7..d7e8392 100644
--- a/opends/src/server/org/opends/server/backends/jeb/ImportContext.java
+++ b/opends/src/server/org/opends/server/backends/jeb/ImportContext.java
@@ -35,16 +35,13 @@
 import java.util.concurrent.BlockingQueue;
 import java.util.concurrent.atomic.AtomicLong;
 import java.util.ArrayList;
+import java.util.List;
 
 /**
  * This class represents the import context for a destination base DN.
  */
 public class ImportContext
 {
-  /**
-   * The name of the entryContainer for the destination base DN.
-   */
-  private String containerName;
 
   /**
    * The destination base DN.
@@ -52,6 +49,16 @@
   private DN baseDN;
 
   /**
+   * The include branches below the base DN.
+   */
+  private List<DN> includeBranches;
+
+  /**
+   * The exclude branches below the base DN.
+   */
+  private List<DN> excludeBranches;
+
+  /**
    * The configuration of the destination backend.
    */
   private JEBackendCfg config;
@@ -72,6 +79,11 @@
   private EntryContainer entryContainer;
 
   /**
+   * The source entryContainer if this is a partial import of a base DN.
+   */
+  private EntryContainer srcEntryContainer;
+
+  /**
    * The amount of buffer memory available in bytes.
    */
   private long bufferSize;
@@ -121,24 +133,6 @@
   }
 
   /**
-   * Set the name of the entryContainer for the destination base DN.
-   * @param containerName The entryContainer name.
-   */
-  public void setContainerName(String containerName)
-  {
-    this.containerName = containerName;
-  }
-
-  /**
-   * Get the name of the entryContainer for the destination base DN.
-   * @return The entryContainer name.
-   */
-  public String getContainerName()
-  {
-    return containerName;
-  }
-
-  /**
    * Set the destination base DN.
    * @param baseDN The destination base DN.
    */
@@ -229,6 +223,25 @@
   }
 
   /**
+   * Set the source entry entryContainer for the destination base DN.
+   * @param srcEntryContainer The entry source entryContainer for the
+   * destination base DN.
+   */
+  public void setSrcEntryContainer(EntryContainer srcEntryContainer)
+  {
+    this.srcEntryContainer = srcEntryContainer;
+  }
+
+  /**
+   * Get the source entry entryContainer for the destination base DN.
+   * @return The source entry entryContainer for the destination base DN.
+   */
+  public EntryContainer getSrcEntryContainer()
+  {
+    return srcEntryContainer;
+  }
+
+  /**
    * Get the available buffer size in bytes.
    * @return The available buffer size.
    */
@@ -300,4 +313,75 @@
   {
     this.IDs = IDs;
   }
+
+  /**
+     * Retrieves the set of base DNs that specify the set of entries to
+     * exclude from the import.  The contents of the returned list may
+     * be altered by the caller.
+     *
+     * @return  The set of base DNs that specify the set of entries to
+     *          exclude from the import.
+     */
+    public List<DN> getExcludeBranches()
+    {
+      return excludeBranches;
+    }
+
+
+
+    /**
+     * Specifies the set of base DNs that specify the set of entries to
+     * exclude from the import.
+     *
+     * @param  excludeBranches  The set of base DNs that specify the set
+     *                          of entries to exclude from the import.
+     */
+    public void setExcludeBranches(List<DN> excludeBranches)
+    {
+      if (excludeBranches == null)
+      {
+        this.excludeBranches = new ArrayList<DN>(0);
+      }
+      else
+      {
+        this.excludeBranches = excludeBranches;
+      }
+    }
+
+
+
+    /**
+     * Retrieves the set of base DNs that specify the set of entries to
+     * include in the import.  The contents of the returned list may be
+     * altered by the caller.
+     *
+     * @return  The set of base DNs that specify the set of entries to
+     *          include in the import.
+     */
+    public List<DN> getIncludeBranches()
+    {
+      return includeBranches;
+    }
+
+
+
+    /**
+     * Specifies the set of base DNs that specify the set of entries to
+     * include in the import.
+     *
+     * @param  includeBranches  The set of base DNs that specify the set
+     *                          of entries to include in the import.
+     */
+    public void setIncludeBranches(List<DN> includeBranches)
+    {
+      if (includeBranches == null)
+      {
+        this.includeBranches = new ArrayList<DN>(0);
+      }
+      else
+      {
+        this.includeBranches = includeBranches;
+      }
+    }
+
 }

--
Gitblit v1.10.0