From 5991fd9ccc2c1635668cc4b8e4bae181d09b460e Mon Sep 17 00:00:00 2001
From: jvergara <jvergara@localhost>
Date: Thu, 19 Nov 2009 23:53:25 +0000
Subject: [PATCH] Fix for issue 3551 (Consider proposing to initialize a topology when the user imports an LDIF in a replicated base DN) When the user imports a file in a backend with replicated suffixes, the possibility of initializing the whole replication topology using the replication protocol is offered to the user.
---
opends/src/server/org/opends/server/tools/dsreplication/ReplicationCliMain.java | 38 ++++++++++++++++++++++++++++++++------
1 files changed, 32 insertions(+), 6 deletions(-)
diff --git a/opends/src/server/org/opends/server/tools/dsreplication/ReplicationCliMain.java b/opends/src/server/org/opends/server/tools/dsreplication/ReplicationCliMain.java
index e603575..16f8b62 100644
--- a/opends/src/server/org/opends/server/tools/dsreplication/ReplicationCliMain.java
+++ b/opends/src/server/org/opends/server/tools/dsreplication/ReplicationCliMain.java
@@ -335,8 +335,7 @@
// program.
try
{
- argParser = new ReplicationCliArgumentParser(CLASS_NAME);
- argParser.initializeParser(getOutputStream());
+ createArgumenParser();
}
catch (ArgumentException ae)
{
@@ -574,6 +573,12 @@
return returnValue.getReturnCode();
}
+ private void createArgumenParser() throws ArgumentException
+ {
+ argParser = new ReplicationCliArgumentParser(CLASS_NAME);
+ argParser.initializeParser(getOutputStream());
+ }
+
/**
* Based on the data provided in the command-line it enables replication
* between two servers.
@@ -7588,9 +7593,29 @@
}
}
- private void initializeAllSuffix(String baseDN, InitialLdapContext ctx,
+ /**
+ * Initializes all the replicas in the topology with the contents of a
+ * given replica.
+ * @param ctx the connection to the server where the source replica of the
+ * initialization is.
+ * @param baseDN the dn of the suffix.
+ * @param displayProgress whether we want to display progress or not.
+ * @throws ReplicationCliException if an unexpected error occurs.
+ */
+ public void initializeAllSuffix(String baseDN, InitialLdapContext ctx,
boolean displayProgress) throws ReplicationCliException
{
+ if (argParser == null)
+ {
+ try
+ {
+ createArgumenParser();
+ }
+ catch (ArgumentException ae)
+ {
+ throw new RuntimeException("Error creating argument parser: "+ae, ae);
+ }
+ }
int nTries = 5;
boolean initDone = false;
while (!initDone)
@@ -7836,9 +7861,10 @@
}
/**
- * Initializes a suffix with the contents of a replica that has a given
- * replication id.
- * @param ctx the connection to the server whose suffix we want to initialize.
+ * Initializes all the replicas in the topology with the contents of a
+ * given replica. This method will try to create the task only once.
+ * @param ctx the connection to the server where the source replica of the
+ * initialization is.
* @param baseDN the dn of the suffix.
* @param displayProgress whether we want to display progress or not.
* @throws ApplicationException if an unexpected error occurs.
--
Gitblit v1.10.0