From d2fe340f67619135f69eb58a11897753fff88739 Mon Sep 17 00:00:00 2001
From: dugan <dugan@localhost>
Date: Thu, 12 Oct 2006 20:27:35 +0000
Subject: [PATCH] Re-write entries in sorted order. Andy suggested changes
---
opends/src/server/org/opends/server/util/LDIFWriter.java | 28 ++++++++++++++++++++++++++++
1 files changed, 28 insertions(+), 0 deletions(-)
diff --git a/opends/src/server/org/opends/server/util/LDIFWriter.java b/opends/src/server/org/opends/server/util/LDIFWriter.java
index c32412f..686075e 100644
--- a/opends/src/server/org/opends/server/util/LDIFWriter.java
+++ b/opends/src/server/org/opends/server/util/LDIFWriter.java
@@ -33,6 +33,7 @@
import java.util.Iterator;
import java.util.List;
import java.util.regex.Pattern;
+import java.util.Collection;
import org.opends.server.types.Attribute;
import org.opends.server.types.AttributeType;
@@ -204,6 +205,33 @@
}
}
+ /**
+ * Iterates over each entry contained in the map and writes out the entry in
+ * LDIF format. The main benefit of this method is that the entries can be
+ * sorted by DN and output in sorted order.
+ *
+ * @param entries The Map containing the entries keyed by DN.
+ *
+ * @return <CODE>true</CODE>of all of the entries were
+ * written out, <CODE>false</CODE>if it was not
+ * because of the export configuration.
+ *
+ * @throws IOException If a problem occurs while writing the entry to LDIF.
+ *
+ * @throws LDIFException If a problem occurs while trying to determine
+ * whether to include the entry in the export.
+ */
+public boolean writeEntries(Collection <Entry> entries)
+ throws IOException, LDIFException {
+ assert debugEnter(CLASS_NAME, "writeEntry", String.valueOf(entries));
+
+ boolean ret=true;
+ Iterator<Entry> i = entries.iterator();
+ while(ret && i.hasNext()) {
+ ret=writeEntry(i.next());
+ }
+ return ret;
+ }
/**
--
Gitblit v1.10.0