From 8f59b2f80eab5a18bc35028b29b9160195409e9c Mon Sep 17 00:00:00 2001
From: jvergara <jvergara@localhost>
Date: Tue, 28 Jul 2009 14:34:08 +0000
Subject: [PATCH] Fix for issue 4148 (setup fails : The import LDIF tool returned error code 1) Since the import-ldif utility does not support any more (temporarily) the append option the setup (and the control-panel) were broken.
---
opends/src/guitools/org/opends/guitools/controlpanel/ui/NewBaseDNPanel.java | 41 ++++++++++++++++++++++++++++++++++++++++-
1 files changed, 40 insertions(+), 1 deletions(-)
diff --git a/opends/src/guitools/org/opends/guitools/controlpanel/ui/NewBaseDNPanel.java b/opends/src/guitools/org/opends/guitools/controlpanel/ui/NewBaseDNPanel.java
index 115150d..c14dbd5 100644
--- a/opends/src/guitools/org/opends/guitools/controlpanel/ui/NewBaseDNPanel.java
+++ b/opends/src/guitools/org/opends/guitools/controlpanel/ui/NewBaseDNPanel.java
@@ -625,6 +625,11 @@
}
if (errors.isEmpty())
{
+ // TODO: delete this check
+ if (!continueToOverwriteBackend())
+ {
+ return;
+ }
launchOperation(newTask,
INFO_CTRL_PANEL_CREATING_BASE_DN_SUMMARY.get(dn),
INFO_CTRL_PANEL_CREATING_BASE_DN_COMPLETE.get(),
@@ -645,6 +650,38 @@
}
}
+ /**
+ * TODO: once the append is supported in the import-ldif, delete this method.
+ * @return <CODE>true</CODE> if the user accepted to overwrite the backend
+ * contents and <CODE>false</CODE> otherwise.
+ */
+ private boolean continueToOverwriteBackend()
+ {
+ boolean userConfirmed = true;
+ if (!isNewBackend() && isServerRunning())
+ {
+ String backendName = getBackendName();
+ for (BackendDescriptor bck :
+ getInfo().getServerDescriptor().getBackends())
+ {
+ if (bck.getBackendID().equalsIgnoreCase(backendName))
+ {
+ if (bck.getEntries() > 0)
+ {
+ // Ask confirmation: append is not supported and we are going to
+ // overwrite the contents of the backend.
+ userConfirmed = displayConfirmationDialog(
+ INFO_CTRL_PANEL_CONFIRMATION_REQUIRED_SUMMARY.get(),
+ INFO_CTRL_PANEL_CONFIRMATION_IMPORT_LDIF_DETAILS.get(
+ backendName));
+ }
+ break;
+ }
+ }
+ }
+ return userConfirmed;
+ }
+
private String getBackendName()
{
Object backendName = backends.getSelectedItem();
@@ -829,10 +866,12 @@
}
args.add("--backendID");
args.add(getBackendName());
- args.add("--append");
+ // TODO: uncomment this line once import supports append again
+ // args.add("--append");
}
else
{
+ // If we are not local, we use ldapmodify to update the contents.
args.add("-a");
args.add("-f");
args.add(ldifFile);
--
Gitblit v1.10.0