From aa09acea1d63383816178c2d4cd9637a8cce9721 Mon Sep 17 00:00:00 2001
From: jvergara <jvergara@localhost>
Date: Fri, 04 Dec 2009 10:20:42 +0000
Subject: [PATCH] Refactor some constants.
---
opends/src/server/org/opends/server/util/cli/CommandBuilder.java | 43 ++++++++++++++++++++++++++++++++++++++-----
1 files changed, 38 insertions(+), 5 deletions(-)
diff --git a/opends/src/server/org/opends/server/util/cli/CommandBuilder.java b/opends/src/server/org/opends/server/util/cli/CommandBuilder.java
index fe544f1..b8b35f8 100644
--- a/opends/src/server/org/opends/server/util/cli/CommandBuilder.java
+++ b/opends/src/server/org/opends/server/util/cli/CommandBuilder.java
@@ -75,6 +75,24 @@
}
/**
+ * The separator used to link the lines of the resulting command-lines in
+ * HTML format.
+ */
+ public final static String HTML_LINE_SEPARATOR;
+ static
+ {
+ if (SetupUtils.isWindows())
+ {
+ HTML_LINE_SEPARATOR = " ";
+ }
+ else
+ {
+ HTML_LINE_SEPARATOR =
+ " \\<br> ";
+ }
+ }
+
+ /**
* The constructor for the CommandBuilder.
* @param commandName the command name.
*/
@@ -157,17 +175,32 @@
*/
public String toString()
{
- return toString(false);
+ return toString(false, LINE_SEPARATOR);
+ }
+
+ /**
+ * Returns the String representation of this command builder (i.e. what we
+ * want to show to the user).
+ * @param lineSeparator the String to be used to separate lines of the
+ * command-builder.
+ * @return the String representation of this command builder (i.e. what we
+ * want to show to the user).
+ */
+ public String toString(String lineSeparator)
+ {
+ return toString(false, lineSeparator);
}
/**
* Returns the String representation of this command builder (i.e. what we
* want to show to the user).
* @param showObfuscated displays in clear the obfuscated values.
+ * @param lineSeparator the String to be used to separate lines of the
+ * command-builder.
* @return the String representation of this command builder (i.e. what we
* want to show to the user).
*/
- private String toString(boolean showObfuscated)
+ private String toString(boolean showObfuscated, String lineSeparator)
{
StringBuilder builder = new StringBuilder();
builder.append(commandName);
@@ -194,14 +227,14 @@
if (arg instanceof BooleanArgument)
{
- builder.append(LINE_SEPARATOR+argName);
+ builder.append(lineSeparator+argName);
}
else if (arg instanceof FileBasedArgument)
{
for (String value :
((FileBasedArgument)arg).getNameToValueMap().keySet())
{
- builder.append(LINE_SEPARATOR+argName+" ");
+ builder.append(lineSeparator+argName+" ");
if (isObfuscated(arg) && !showObfuscated)
{
value = OBFUSCATED_VALUE;
@@ -217,7 +250,7 @@
{
for (String value : arg.getValues())
{
- builder.append(LINE_SEPARATOR+argName+" ");
+ builder.append(lineSeparator+argName+" ");
if (isObfuscated(arg) && !showObfuscated)
{
value = OBFUSCATED_VALUE;
--
Gitblit v1.10.0