From 18de8b9ed9f6ba9780d3292d2828f67de08b7483 Mon Sep 17 00:00:00 2001
From: jvergara <jvergara@localhost>
Date: Fri, 24 Jul 2009 09:46:24 +0000
Subject: [PATCH] Refactor the code of dsreplication and extract some of its commodity methods and move them to the classes they apply to.

---
 opends/src/server/org/opends/server/util/args/ArgumentParser.java |   33 +++++++++++++++++++++++++++++++++
 1 files changed, 33 insertions(+), 0 deletions(-)

diff --git a/opends/src/server/org/opends/server/util/args/ArgumentParser.java b/opends/src/server/org/opends/server/util/args/ArgumentParser.java
index b5168a6..1c1e412 100644
--- a/opends/src/server/org/opends/server/util/args/ArgumentParser.java
+++ b/opends/src/server/org/opends/server/util/args/ArgumentParser.java
@@ -1828,5 +1828,38 @@
   {
     return versionPresent;
   }
+
+
+
+  /**
+   * Get the password which has to be used for the command without prompting
+   * the user.  If no password was specified, return null.
+   *
+   * @param clearArg
+   *          The password StringArgument argument.
+   * @param fileArg
+   *          The password FileBased argument.
+   * @return The password stored into the specified file on by the
+   *         command line argument, or null it if not specified.
+   */
+  public static String getBindPassword(StringArgument clearArg,
+      FileBasedArgument fileArg)
+  {
+    String pwd;
+    if (clearArg.isPresent())
+    {
+      pwd = clearArg.getValue();
+    }
+    else
+    if (fileArg.isPresent())
+    {
+      pwd = fileArg.getValue();
+    }
+    else
+    {
+      pwd = null;
+    }
+    return pwd;
+  }
 }
 

--
Gitblit v1.10.0