From e0c5b184252862e29ca271955bcd15eebd752830 Mon Sep 17 00:00:00 2001
From: neil_a_wilson <neil_a_wilson@localhost>
Date: Thu, 05 Jul 2007 17:16:26 +0000
Subject: [PATCH] Update the import-ldif utility so that it includes a new "--countRejects" option that can be used to count the number of rejected entries. That value will be used as the exit code, and can be used in scripts to determine if there were any failures during the import.
---
opends/src/server/org/opends/server/backends/jeb/ImportJob.java | 10 +++++++++-
1 files changed, 9 insertions(+), 1 deletions(-)
diff --git a/opends/src/server/org/opends/server/backends/jeb/ImportJob.java b/opends/src/server/org/opends/server/backends/jeb/ImportJob.java
index 72b1c53..41cc438 100644
--- a/opends/src/server/org/opends/server/backends/jeb/ImportJob.java
+++ b/opends/src/server/org/opends/server/backends/jeb/ImportJob.java
@@ -39,6 +39,7 @@
import org.opends.server.types.ErrorLogCategory;
import org.opends.server.types.ErrorLogSeverity;
import org.opends.server.types.LDIFImportConfig;
+import org.opends.server.types.LDIFImportResult;
import org.opends.server.types.ResultCode;
import org.opends.server.util.LDIFException;
import org.opends.server.util.LDIFReader;
@@ -138,12 +139,15 @@
* files to load the index databases.
*
* @param rootContainer The root container to import into.
+ *
+ * @return Information about the result of the import.
+ *
* @throws DatabaseException If an error occurs in the JE database.
* @throws IOException If a problem occurs while opening the LDIF file for
* reading, or while reading from the LDIF file.
* @throws JebException If an error occurs in the JE backend.
*/
- public void importLDIF(RootContainer rootContainer)
+ public LDIFImportResult importLDIF(RootContainer rootContainer)
throws DatabaseException, IOException, JebException
{
@@ -304,6 +308,10 @@
message = getMessage(msgID, getEntryLimitExceededCount());
logError(ErrorLogCategory.BACKEND, ErrorLogSeverity.NOTICE,
message, msgID);
+
+ return new LDIFImportResult(reader.getEntriesRead(),
+ reader.getEntriesRejected(),
+ reader.getEntriesIgnored());
}
/**
--
Gitblit v1.10.0