From ef632b7eec69d4cce09c45c299a0b0fa0fd69b3c Mon Sep 17 00:00:00 2001
From: jvergara <jvergara@localhost>
Date: Mon, 02 Jun 2008 20:44:47 +0000
Subject: [PATCH] Fix for issue 3311 (import-ldif --templateFile does not work when the server is  running) The fix consists on not assuming that the ldif file path is required to launch an import (the ds-task-import task definition has been modified for this) and allowing to create a task that imports contents based on a  template.

---
 opends/src/server/org/opends/server/tools/ImportLDIF.java |   30 +++++++++++++++++++++++++-----
 1 files changed, 25 insertions(+), 5 deletions(-)

diff --git a/opends/src/server/org/opends/server/tools/ImportLDIF.java b/opends/src/server/org/opends/server/tools/ImportLDIF.java
index f242747..a6ebe3f 100644
--- a/opends/src/server/org/opends/server/tools/ImportLDIF.java
+++ b/opends/src/server/org/opends/server/tools/ImportLDIF.java
@@ -465,13 +465,33 @@
     // Required attributes
     //
     ArrayList<ASN1OctetString> values;
+
     List<String> fileList = ldifFiles.getValues();
-    if (fileList != null && fileList.size() > 0) {
-      values = new ArrayList<ASN1OctetString>(fileList.size());
-      for (String file : fileList) {
-        values.add(new ASN1OctetString(file));
+    if ((fileList != null) && (fileList.size() > 0))
+    {
+      if (fileList != null && fileList.size() > 0) {
+        values = new ArrayList<ASN1OctetString>(fileList.size());
+        for (String file : fileList) {
+          values.add(new ASN1OctetString(file));
+        }
+        attributes.add(new LDAPAttribute(ATTR_IMPORT_LDIF_FILE, values));
       }
-      attributes.add(new LDAPAttribute(ATTR_IMPORT_LDIF_FILE, values));
+    }
+
+    String templateFileValue = templateFile.getValue();
+    if (templateFileValue != null)
+    {
+      values = new ArrayList<ASN1OctetString>(1);
+      values.add(new ASN1OctetString(templateFileValue));
+      attributes.add(new LDAPAttribute(ATTR_IMPORT_TEMPLATE_FILE, values));
+    }
+
+    String randomSeedValue = randomSeed.getValue();
+    if (randomSeedValue != null)
+    {
+      values = new ArrayList<ASN1OctetString>(1);
+      values.add(new ASN1OctetString(randomSeedValue));
+      attributes.add(new LDAPAttribute(ATTR_IMPORT_RANDOM_SEED, values));
     }
 
     //

--
Gitblit v1.10.0