From 87b833785ea2cc806465bdecb446d422b57a6769 Mon Sep 17 00:00:00 2001
From: jvergara <jvergara@localhost>
Date: Tue, 21 Aug 2007 21:03:35 +0000
Subject: [PATCH] Update the messages in admin_tool.properties to use the proper severity and not only the INFO severity.
---
opendj-sdk/opends/src/server/org/opends/server/admin/client/cli/DsFrameworkCliParser.java | 2
opendj-sdk/opends/src/guitools/org/opends/guitools/uninstaller/ui/LoginDialog.java | 6
opendj-sdk/opends/src/guitools/org/opends/guitools/uninstaller/UninstallLauncher.java | 6
opendj-sdk/opends/src/guitools/org/opends/guitools/uninstaller/Uninstaller.java | 2
opendj-sdk/opends/src/guitools/org/opends/guitools/statuspanel/StatusPanelController.java | 15 -
opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/CliApplicationHelper.java | 21 -
opendj-sdk/opends/src/guitools/org/opends/guitools/statuspanel/StatusCli.java | 14 +
opendj-sdk/opends/src/guitools/org/opends/guitools/uninstaller/UninstallerArgumentParser.java | 71 ++++---
opendj-sdk/opends/src/messages/messages/admin_tool.properties | 151 +++++++++++++--
opendj-sdk/opends/src/server/org/opends/server/admin/client/cli/DsFrameworkCliMain.java | 2
opendj-sdk/opends/src/server/org/opends/server/admin/client/cli/SecureConnectionCliParser.java | 161 +++++++++++++----
opendj-sdk/opends/src/guitools/org/opends/guitools/statuspanel/ui/LoginDialog.java | 14
opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/upgrader/UpgradeLauncher.java | 14
opendj-sdk/opends/src/guitools/org/opends/guitools/statuspanel/StatusPanelLauncher.java | 4
opendj-sdk/opends/src/guitools/org/opends/guitools/statuspanel/ConfigFromLDAP.java | 24 +-
opendj-sdk/opends/src/guitools/org/opends/guitools/statuspanel/ConfigFromFile.java | 6
opendj-sdk/opends/src/guitools/org/opends/guitools/uninstaller/UninstallCliHelper.java | 12
17 files changed, 349 insertions(+), 176 deletions(-)
diff --git a/opendj-sdk/opends/src/guitools/org/opends/guitools/statuspanel/ConfigFromFile.java b/opendj-sdk/opends/src/guitools/org/opends/guitools/statuspanel/ConfigFromFile.java
index 4399a16..5c3beca 100644
--- a/opendj-sdk/opends/src/guitools/org/opends/guitools/statuspanel/ConfigFromFile.java
+++ b/opendj-sdk/opends/src/guitools/org/opends/guitools/statuspanel/ConfigFromFile.java
@@ -128,13 +128,13 @@
{
LOG.log(Level.SEVERE, "Error reading config file: "+ioe, ioe);
errorMessage = Utils.getThrowableMsg(
- INFO_ERROR_READING_CONFIG_FILE.get(), ioe);
+ ERR_READING_CONFIG_FILE.get(), ioe);
}
catch (LDIFException le)
{
LOG.log(Level.SEVERE, "Error reading config file: "+le, le);
errorMessage = Utils.getThrowableMsg(
- INFO_ERROR_READING_CONFIG_FILE.get(), le);
+ ERR_READING_CONFIG_FILE.get(), le);
}
catch (Throwable t)
{
@@ -142,7 +142,7 @@
// Bug
t.printStackTrace();
errorMessage = Utils.getThrowableMsg(
- INFO_ERROR_READING_CONFIG_FILE.get(), t);
+ ERR_READING_CONFIG_FILE.get(), t);
}
finally
{
diff --git a/opendj-sdk/opends/src/guitools/org/opends/guitools/statuspanel/ConfigFromLDAP.java b/opendj-sdk/opends/src/guitools/org/opends/guitools/statuspanel/ConfigFromLDAP.java
index 50537d4..ee770d6 100644
--- a/opendj-sdk/opends/src/guitools/org/opends/guitools/statuspanel/ConfigFromLDAP.java
+++ b/opendj-sdk/opends/src/guitools/org/opends/guitools/statuspanel/ConfigFromLDAP.java
@@ -218,14 +218,14 @@
}
else
{
- errorMessage = INFO_ERROR_READING_CONFIG_LDAP.get(detail);
+ errorMessage = ERR_READING_CONFIG_LDAP.get(detail);
}
}
catch (Throwable t)
{
// Bug
t.printStackTrace();
- errorMessage = INFO_ERROR_READING_CONFIG_LDAP.get(t.toString());
+ errorMessage = ERR_READING_CONFIG_LDAP.get(t.toString());
}
}
@@ -337,7 +337,7 @@
}
else
{
- throw new ConfigException(INFO_COULD_NOT_FIND_VALID_LDAPURL.get());
+ throw new ConfigException(ERR_COULD_NOT_FIND_VALID_LDAPURL.get());
}
break;
case USE_LDAPS:
@@ -348,7 +348,7 @@
}
else
{
- throw new ConfigException(INFO_COULD_NOT_FIND_VALID_LDAPURL.get());
+ throw new ConfigException(ERR_COULD_NOT_FIND_VALID_LDAPURL.get());
}
break;
case USE_LDAP:
@@ -359,7 +359,7 @@
}
else
{
- throw new ConfigException(INFO_COULD_NOT_FIND_VALID_LDAPURL.get());
+ throw new ConfigException(ERR_COULD_NOT_FIND_VALID_LDAPURL.get());
}
break;
case USE_MOST_SECURE_AVAILABLE:
@@ -381,7 +381,7 @@
}
else
{
- throw new ConfigException(INFO_COULD_NOT_FIND_VALID_LDAPURL.get());
+ throw new ConfigException(ERR_COULD_NOT_FIND_VALID_LDAPURL.get());
}
break;
case USE_LESS_SECURE_AVAILABLE:
@@ -397,7 +397,7 @@
}
else
{
- throw new ConfigException(INFO_COULD_NOT_FIND_VALID_LDAPURL.get());
+ throw new ConfigException(ERR_COULD_NOT_FIND_VALID_LDAPURL.get());
}
break;
default:
@@ -1020,7 +1020,7 @@
}
else
{
- throw new ConfigException(INFO_COULD_NOT_FIND_VALID_LDAPURL.get());
+ throw new ConfigException(ERR_COULD_NOT_FIND_VALID_LDAPURL.get());
}
break;
case USE_LDAPS:
@@ -1030,7 +1030,7 @@
}
else
{
- throw new ConfigException(INFO_COULD_NOT_FIND_VALID_LDAPURL.get());
+ throw new ConfigException(ERR_COULD_NOT_FIND_VALID_LDAPURL.get());
}
break;
case USE_LDAP:
@@ -1040,7 +1040,7 @@
}
else
{
- throw new ConfigException(INFO_COULD_NOT_FIND_VALID_LDAPURL.get());
+ throw new ConfigException(ERR_COULD_NOT_FIND_VALID_LDAPURL.get());
}
break;
case USE_MOST_SECURE_AVAILABLE:
@@ -1058,7 +1058,7 @@
}
else
{
- throw new ConfigException(INFO_COULD_NOT_FIND_VALID_LDAPURL.get());
+ throw new ConfigException(ERR_COULD_NOT_FIND_VALID_LDAPURL.get());
}
break;
case USE_LESS_SECURE_AVAILABLE:
@@ -1072,7 +1072,7 @@
}
else
{
- throw new ConfigException(INFO_COULD_NOT_FIND_VALID_LDAPURL.get());
+ throw new ConfigException(ERR_COULD_NOT_FIND_VALID_LDAPURL.get());
}
break;
default:
diff --git a/opendj-sdk/opends/src/guitools/org/opends/guitools/statuspanel/StatusCli.java b/opendj-sdk/opends/src/guitools/org/opends/guitools/statuspanel/StatusCli.java
index 5e9198c..346965a 100644
--- a/opendj-sdk/opends/src/guitools/org/opends/guitools/statuspanel/StatusCli.java
+++ b/opendj-sdk/opends/src/guitools/org/opends/guitools/statuspanel/StatusCli.java
@@ -28,6 +28,7 @@
package org.opends.guitools.statuspanel;
import java.io.File;
+import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
@@ -52,6 +53,7 @@
import static org.opends.messages.AdminToolMessages.*;
import static org.opends.messages.QuickSetupMessages.*;
+import org.opends.server.util.args.Argument;
import org.opends.server.util.args.ArgumentException;
/**
@@ -106,10 +108,12 @@
{
try
{
- initializeGlobalOption(System.err);
- removeGlobalArgument(portArg);
- removeGlobalArgument(hostNameArg);
- removeGlobalArgument(verboseArg);
+ ArrayList<Argument> defaultArgs =
+ new ArrayList<Argument>(createGlobalArguments(System.err));
+ defaultArgs.remove(portArg);
+ defaultArgs.remove(hostNameArg);
+ defaultArgs.remove(verboseArg);
+ initializeGlobalArguments(defaultArgs);
}
catch (ArgumentException ae)
{
@@ -138,7 +142,7 @@
{
return DsFrameworkCliReturnCode.SUCCESSFUL_NOP.getReturnCode();
}
- int v = validateGlobalOption(System.err);
+ int v = validateGlobalOptions(System.err);
if (v != DsFrameworkCliReturnCode.SUCCESSFUL_NOP.getReturnCode())
{
diff --git a/opendj-sdk/opends/src/guitools/org/opends/guitools/statuspanel/StatusPanelController.java b/opendj-sdk/opends/src/guitools/org/opends/guitools/statuspanel/StatusPanelController.java
index 62bf36c..88a60a0 100644
--- a/opendj-sdk/opends/src/guitools/org/opends/guitools/statuspanel/StatusPanelController.java
+++ b/opendj-sdk/opends/src/guitools/org/opends/guitools/statuspanel/StatusPanelController.java
@@ -619,7 +619,7 @@
if (!running)
{
updateProgress(getFormattedError(INFO_SUMMARY_START_ERROR.get()),
- getFormattedError(INFO_ERROR_STARTING_SERVER_GENERIC.get(),
+ getFormattedError(ERR_STARTING_SERVER_GENERIC.get(),
true));
}
else
@@ -997,19 +997,6 @@
/**
* Returns the formatted representation of a progress message for a given
- * text.
- * @param text the source text from which we want to get the formatted
- * representation
- * @return the formatted representation of a progress message for the given
- * text.
- */
- private Message getFormattedProgress(Message text)
- {
- return formatter.getFormattedProgress(text);
- }
-
- /**
- * Returns the formatted representation of a progress message for a given
* text with a line feed at the end.
* @param text the source text from which we want to get the formatted
* representation
diff --git a/opendj-sdk/opends/src/guitools/org/opends/guitools/statuspanel/StatusPanelLauncher.java b/opendj-sdk/opends/src/guitools/org/opends/guitools/statuspanel/StatusPanelLauncher.java
index 0afa8ef..d5ac976 100644
--- a/opendj-sdk/opends/src/guitools/org/opends/guitools/statuspanel/StatusPanelLauncher.java
+++ b/opendj-sdk/opends/src/guitools/org/opends/guitools/statuspanel/StatusPanelLauncher.java
@@ -127,14 +127,14 @@
if (logFileName != null)
{
System.err.println(StaticUtils.wrapText(
- INFO_STATUS_PANEL_LAUNCHER_GUI_LAUNCH_FAILED_DETAILS.get(
+ ERR_STATUS_PANEL_LAUNCHER_GUI_LAUNCH_FAILED_DETAILS.get(
logFileName),
Utils.getCommandLineMaxLineWidth()));
}
else
{
System.err.println(StaticUtils.wrapText(
- INFO_STATUS_PANEL_LAUNCHER_GUI_LAUNCH_FAILED.get(),
+ ERR_STATUS_PANEL_LAUNCHER_GUI_LAUNCH_FAILED.get(),
Utils.getCommandLineMaxLineWidth()));
}
System.exit(exitCode);
diff --git a/opendj-sdk/opends/src/guitools/org/opends/guitools/statuspanel/ui/LoginDialog.java b/opendj-sdk/opends/src/guitools/org/opends/guitools/statuspanel/ui/LoginDialog.java
index 36540a5..cca44c3 100644
--- a/opendj-sdk/opends/src/guitools/org/opends/guitools/statuspanel/ui/LoginDialog.java
+++ b/opendj-sdk/opends/src/guitools/org/opends/guitools/statuspanel/ui/LoginDialog.java
@@ -381,7 +381,7 @@
else
{
throw new ConfigException(
- INFO_COULD_NOT_FIND_VALID_LDAPURL.get());
+ ERR_COULD_NOT_FIND_VALID_LDAPURL.get());
}
break;
case USE_LDAPS:
@@ -395,7 +395,7 @@
else
{
throw new ConfigException(
- INFO_COULD_NOT_FIND_VALID_LDAPURL.get());
+ ERR_COULD_NOT_FIND_VALID_LDAPURL.get());
}
break;
case USE_LDAP:
@@ -408,7 +408,7 @@
else
{
throw new ConfigException(
- INFO_COULD_NOT_FIND_VALID_LDAPURL.get());
+ ERR_COULD_NOT_FIND_VALID_LDAPURL.get());
}
break;
case USE_MOST_SECURE_AVAILABLE:
@@ -435,7 +435,7 @@
else
{
throw new ConfigException(
- INFO_COULD_NOT_FIND_VALID_LDAPURL.get());
+ ERR_COULD_NOT_FIND_VALID_LDAPURL.get());
}
break;
case USE_LESS_SECURE_AVAILABLE:
@@ -455,7 +455,7 @@
else
{
throw new ConfigException(
- INFO_COULD_NOT_FIND_VALID_LDAPURL.get());
+ ERR_COULD_NOT_FIND_VALID_LDAPURL.get());
}
break;
default:
@@ -624,7 +624,7 @@
if (possibleCauses.size() > 0)
{
displayError(
- INFO_CANNOT_CONNECT_TO_LOGIN_WITH_CAUSE.get(
+ ERR_CANNOT_CONNECT_TO_LOGIN_WITH_CAUSE.get(
Utils.getMessageFromCollection(possibleCauses, "\n")),
INFO_ERROR_TITLE.get());
}
@@ -632,7 +632,7 @@
{
// Generic message
displayError(
- INFO_CANNOT_CONNECT_WITH_ADS_CREDENTIALS_WITHOUT_CAUSE.get(),
+ ERR_CANNOT_CONNECT_WITH_ADS_CREDENTIALS_WITHOUT_CAUSE.get(),
INFO_ERROR_TITLE.get());
}
}
diff --git a/opendj-sdk/opends/src/guitools/org/opends/guitools/uninstaller/UninstallCliHelper.java b/opendj-sdk/opends/src/guitools/org/opends/guitools/uninstaller/UninstallCliHelper.java
index f6d57b2..6ed747f 100644
--- a/opendj-sdk/opends/src/guitools/org/opends/guitools/uninstaller/UninstallCliHelper.java
+++ b/opendj-sdk/opends/src/guitools/org/opends/guitools/uninstaller/UninstallCliHelper.java
@@ -122,7 +122,7 @@
/* Step 2: check that the provided parameters are compatible.
*/
MessageBuilder buf = new MessageBuilder();
- int v = args.validateGlobalOption(buf);
+ int v = args.validateGlobalOptions(buf);
if (v != DsFrameworkCliReturnCode.SUCCESSFUL_NOP.getReturnCode())
{
throw new UserDataException(null, buf.toMessage());
@@ -179,7 +179,7 @@
if (!isInteractive)
{
throw new UserDataException(null,
- INFO_CLI_UNINSTALL_NOTHING_TO_BE_UNINSTALLED_NON_INTERACTIVE.get());
+ ERR_CLI_UNINSTALL_NOTHING_TO_BE_UNINSTALLED_NON_INTERACTIVE.get());
}
else
{
@@ -366,7 +366,7 @@
{
somethingSelected = false;
printLineBreak();
- printErrorMessage(INFO_CLI_UNINSTALL_NOTHING_TO_BE_UNINSTALLED.get());
+ printErrorMessage(ERR_CLI_UNINSTALL_NOTHING_TO_BE_UNINSTALLED.get());
}
else
{
@@ -664,7 +664,7 @@
LOG.log(Level.WARNING,
"Error retrieving a valid LDAP URL in conf file");
- printErrorMessage(INFO_COULD_NOT_FIND_VALID_LDAPURL.get());
+ printErrorMessage(ERR_COULD_NOT_FIND_VALID_LDAPURL.get());
}
if (usedUrl != null)
{
@@ -889,7 +889,7 @@
{
LOG.log(Level.WARNING,
"Error retrieving a valid LDAP URL in conf file");
- printErrorMessage(INFO_COULD_NOT_FIND_VALID_LDAPURL.get());
+ printErrorMessage(ERR_COULD_NOT_FIND_VALID_LDAPURL.get());
}
ADSContext adsContext = new ADSContext(ctx);
TopologyCache cache = new TopologyCache(adsContext,
@@ -1029,7 +1029,7 @@
if (!stopProcessing && (exceptionMsgs.size() > 0))
{
returnValue = confirm(
- INFO_ERROR_READING_REGISTERED_SERVERS_CONFIRM_UPDATE_REMOTE.get(
+ ERR_READING_REGISTERED_SERVERS_CONFIRM_UPDATE_REMOTE.get(
Utils.getStringFromCollection(exceptionMsgs,
Constants.LINE_SEPARATOR)));
}
diff --git a/opendj-sdk/opends/src/guitools/org/opends/guitools/uninstaller/UninstallLauncher.java b/opendj-sdk/opends/src/guitools/org/opends/guitools/uninstaller/UninstallLauncher.java
index 3398ac5..3eb6f67 100644
--- a/opendj-sdk/opends/src/guitools/org/opends/guitools/uninstaller/UninstallLauncher.java
+++ b/opendj-sdk/opends/src/guitools/org/opends/guitools/uninstaller/UninstallLauncher.java
@@ -109,7 +109,7 @@
INFO_UNINSTALL_LAUNCHER_USAGE_DESCRIPTION.get(), false);
try
{
- argParser.initializeGlobalOption(System.err);
+ argParser.initializeGlobalArguments(System.err);
}
catch (ArgumentException ae)
{
@@ -133,12 +133,12 @@
protected void guiLaunchFailed(String logFilePath) {
if (logFilePath != null)
{
- System.err.println(INFO_UNINSTALL_LAUNCHER_GUI_LAUNCHED_FAILED_DETAILS
+ System.err.println(ERR_UNINSTALL_LAUNCHER_GUI_LAUNCHED_FAILED_DETAILS
.get(logFilePath));
}
else
{
- System.err.println(INFO_UNINSTALL_LAUNCHER_GUI_LAUNCHED_FAILED.get());
+ System.err.println(ERR_UNINSTALL_LAUNCHER_GUI_LAUNCHED_FAILED.get());
}
}
diff --git a/opendj-sdk/opends/src/guitools/org/opends/guitools/uninstaller/Uninstaller.java b/opendj-sdk/opends/src/guitools/org/opends/guitools/uninstaller/Uninstaller.java
index b5fbc0b..ea62557 100644
--- a/opendj-sdk/opends/src/guitools/org/opends/guitools/uninstaller/Uninstaller.java
+++ b/opendj-sdk/opends/src/guitools/org/opends/guitools/uninstaller/Uninstaller.java
@@ -1509,7 +1509,7 @@
if (!stopProcessing && (exceptionMsgs.size() > 0))
{
Message confirmationMsg =
- INFO_ERROR_READING_REGISTERED_SERVERS_CONFIRM_UPDATE_REMOTE.get(
+ ERR_READING_REGISTERED_SERVERS_CONFIRM_UPDATE_REMOTE.get(
getStringFromCollection(exceptionMsgs, "n"));
stopProcessing = !qs.displayConfirmation(confirmationMsg,
INFO_CONFIRMATION_TITLE.get());
diff --git a/opendj-sdk/opends/src/guitools/org/opends/guitools/uninstaller/UninstallerArgumentParser.java b/opendj-sdk/opends/src/guitools/org/opends/guitools/uninstaller/UninstallerArgumentParser.java
index a693064..d00d408 100644
--- a/opendj-sdk/opends/src/guitools/org/opends/guitools/uninstaller/UninstallerArgumentParser.java
+++ b/opendj-sdk/opends/src/guitools/org/opends/guitools/uninstaller/UninstallerArgumentParser.java
@@ -32,14 +32,16 @@
import static org.opends.server.admin.client.cli.DsFrameworkCliReturnCode.*;
import java.io.OutputStream;
+import java.util.ArrayList;
+import java.util.LinkedHashSet;
import org.opends.messages.Message;
import org.opends.messages.MessageBuilder;
-import org.opends.quicksetup.CliApplicationHelper;
import org.opends.quicksetup.Constants;
import org.opends.quicksetup.UserData;
import org.opends.server.admin.client.cli.SecureConnectionCliParser;
import org.opends.server.tools.ToolConstants;
+import org.opends.server.util.args.Argument;
import org.opends.server.util.args.ArgumentException;
import org.opends.server.util.args.BooleanArgument;
import org.opends.server.util.args.StringArgument;
@@ -96,92 +98,107 @@
* If there is a problem with any of the parameters used
* to create this argument.
*/
- public void initializeGlobalOption(OutputStream outStream)
+ public void initializeGlobalArguments(OutputStream outStream)
throws ArgumentException
{
+ LinkedHashSet<Argument> args = new LinkedHashSet<Argument>();
removeAll = new BooleanArgument(
"remove-all",
'a',
"remove-all",
INFO_UNINSTALLDS_DESCRIPTION_REMOVE_ALL.get()
);
- addGlobalArgument(removeAll);
+ args.add(removeAll);
removeServerLibraries = new BooleanArgument(
"server-libraries",
'l',
"server-libraries",
INFO_UNINSTALLDS_DESCRIPTION_REMOVE_SERVER_LIBRARIES.get()
);
- addGlobalArgument(removeServerLibraries);
+ args.add(removeServerLibraries);
removeDatabases = new BooleanArgument(
"databases",
'd',
"databases",
INFO_UNINSTALLDS_DESCRIPTION_REMOVE_DATABASES.get()
);
- addGlobalArgument(removeDatabases);
+ args.add(removeDatabases);
removeLogFiles = new BooleanArgument(
"log-files",
'L',
"log-files",
INFO_UNINSTALLDS_DESCRIPTION_REMOVE_LOG_FILES.get()
);
- addGlobalArgument(removeLogFiles);
+ args.add(removeLogFiles);
removeConfigurationFiles = new BooleanArgument(
"configuration-files",
'c',
"configuration-files",
INFO_UNINSTALLDS_DESCRIPTION_REMOVE_CONFIGURATION_FILES.get()
);
- addGlobalArgument(removeConfigurationFiles);
+ args.add(removeConfigurationFiles);
removeBackupFiles = new BooleanArgument(
"backup-files",
'b',
"backup-files",
INFO_UNINSTALLDS_DESCRIPTION_REMOVE_BACKUP_FILES.get()
);
- addGlobalArgument(removeBackupFiles);
+ args.add(removeBackupFiles);
removeLDIFFiles = new BooleanArgument(
"ldif-files",
'e',
"ldif-files",
INFO_UNINSTALLDS_DESCRIPTION_REMOVE_LDIF_FILES.get()
);
- addGlobalArgument(removeLDIFFiles);
+ args.add(removeLDIFFiles);
interactive = new BooleanArgument(
- CliApplicationHelper.INTERACTIVE_OPTION_LONG,
- CliApplicationHelper.INTERACTIVE_OPTION_SHORT,
- CliApplicationHelper.INTERACTIVE_OPTION_LONG,
+ INTERACTIVE_OPTION_LONG,
+ INTERACTIVE_OPTION_SHORT,
+ INTERACTIVE_OPTION_LONG,
INFO_DESCRIPTION_INTERACTIVE.get());
- addGlobalArgument(interactive);
+ args.add(interactive);
forceOnError = new BooleanArgument(
"forceOnError",
'f',
"forceOnError",
INFO_UNINSTALLDS_DESCRIPTION_FORCE.get());
- addGlobalArgument(forceOnError);
+ args.add(forceOnError);
silent = new BooleanArgument(
- CliApplicationHelper.SILENT_OPTION_LONG,
- CliApplicationHelper.SILENT_OPTION_SHORT,
- CliApplicationHelper.SILENT_OPTION_LONG,
+ SecureConnectionCliParser.SILENT_OPTION_LONG,
+ SecureConnectionCliParser.SILENT_OPTION_SHORT,
+ SecureConnectionCliParser.SILENT_OPTION_LONG,
INFO_UNINSTALLDS_DESCRIPTION_SILENT.get());
- addGlobalArgument(silent);
+ args.add(silent);
+
adminUidArg = new StringArgument("adminUID", 'I',
"adminUID", false, false, true, "adminUID",
- Constants.GLOBAL_ADMIN_UID, null, INFO_DESCRIPTION_ADMINUID.get());
- addGlobalArgument(adminUidArg);
- super.initializeGlobalOption(outStream);
- removeGlobalArgument(bindDnArg);
- removeGlobalArgument(hostNameArg);
- removeGlobalArgument(portArg);
- removeGlobalArgument(verboseArg);
+ Constants.GLOBAL_ADMIN_UID, null, INFO_DESCRIPTION_ADMIN_UID.get());
+
+ ArrayList<Argument> defaultArgs =
+ new ArrayList<Argument>(createGlobalArguments(System.err));
+ int index = defaultArgs.indexOf(bindDnArg);
+ if (index != -1)
+ {
+ defaultArgs.add(index, adminUidArg);
+ defaultArgs.remove(bindDnArg);
+ }
+ else
+ {
+ defaultArgs.add(adminUidArg);
+ }
+ defaultArgs.remove(hostNameArg);
+ defaultArgs.remove(portArg);
+ defaultArgs.remove(verboseArg);
UserData uData = new UserData();
referencedHostNameArg = new StringArgument("referencedHostName",
ToolConstants.OPTION_SHORT_HOST,
"referencedHostName", false, false, true,
ToolConstants.OPTION_VALUE_HOST,
uData.getHostName(), null, INFO_DESCRIPTION_REFERENCED_HOST.get());
- addGlobalArgument(referencedHostNameArg);
+ defaultArgs.add(referencedHostNameArg);
+
+ args.addAll(defaultArgs);
+ initializeGlobalArguments(args);
}
/**
@@ -350,7 +367,7 @@
* @param buf the MessageBuilder to write the error messages.
* @return return code.
*/
- public int validateGlobalOption(MessageBuilder buf)
+ public int validateGlobalOptions(MessageBuilder buf)
{
int returnValue;
if (interactive.isPresent() && forceOnError.isPresent())
diff --git a/opendj-sdk/opends/src/guitools/org/opends/guitools/uninstaller/ui/LoginDialog.java b/opendj-sdk/opends/src/guitools/org/opends/guitools/uninstaller/ui/LoginDialog.java
index 380c332..a79d6bb 100644
--- a/opendj-sdk/opends/src/guitools/org/opends/guitools/uninstaller/ui/LoginDialog.java
+++ b/opendj-sdk/opends/src/guitools/org/opends/guitools/uninstaller/ui/LoginDialog.java
@@ -410,7 +410,7 @@
else
{
throw new ApplicationException(ReturnCode.APPLICATION_ERROR,
- INFO_COULD_NOT_FIND_VALID_LDAPURL.get(), null);
+ ERR_COULD_NOT_FIND_VALID_LDAPURL.get(), null);
}
} catch (NamingException ne)
{
@@ -532,7 +532,7 @@
{
// Message with causes
displayError(
- INFO_CANNOT_CONNECT_TO_LOGIN_WITH_CAUSE.get(
+ ERR_CANNOT_CONNECT_TO_LOGIN_WITH_CAUSE.get(
Utils.getMessageFromCollection(possibleCauses, "\n")),
INFO_ERROR_TITLE.get());
}
@@ -540,7 +540,7 @@
{
// Generic message
displayError(
- INFO_CANNOT_CONNECT_TO_LOGIN_WITHOUT_CAUSE.get(),
+ ERR_CANNOT_CONNECT_TO_LOGIN_WITHOUT_CAUSE.get(),
INFO_ERROR_TITLE.get());
}
}
diff --git a/opendj-sdk/opends/src/messages/messages/admin_tool.properties b/opendj-sdk/opends/src/messages/messages/admin_tool.properties
index e2ff970..d207859 100644
--- a/opendj-sdk/opends/src/messages/messages/admin_tool.properties
+++ b/opendj-sdk/opends/src/messages/messages/admin_tool.properties
@@ -58,12 +58,12 @@
INFO_BACKENDID_COLUMN=Backend ID
INFO_BASEDN_COLUMN=Base DN
INFO_CANCEL_BUTTON_UNINSTALL_TOOLTIP=Cancel Uninstall
-INFO_CANNOT_CONNECT_TO_LOGIN_WITH_CAUSE=Could not connect to the Directory \
+MILD_ERR_CANNOT_CONNECT_TO_LOGIN_WITH_CAUSE=Could not connect to the Directory \
Server with the provided credentials. The possible causes for this are:%n%s
-INFO_CANNOT_CONNECT_TO_LOGIN_WITHOUT_CAUSE=Could not connect to the Directory \
+MILD_ERR_CANNOT_CONNECT_TO_LOGIN_WITHOUT_CAUSE=Could not connect to the Directory \
Server with the provided credentials.%nCheck that the Administrative User DN \
and password are valid.
-INFO_CANNOT_CONNECT_WITH_ADS_CREDENTIALS_WITHOUT_CAUSE=Could not connect to \
+MILD_ERR_CANNOT_CONNECT_WITH_ADS_CREDENTIALS_WITHOUT_CAUSE=Could not connect to \
the Directory Server with the provided credentials.%nCheck that the \
Administrative User ID and password are valid.
INFO_CLI_UNINSTALL_CONFIRM_BACKUPS=Remove Backup Files Contained in bak \
@@ -88,11 +88,11 @@
INFO_CLI_UNINSTALL_CONFIRM_STOP=The OpenDS server is currently running and \
must be stopped before uninstallation can continue.%nStop the Server and \
permanently delete the files?
-INFO_CLI_UNINSTALL_NOTHING_TO_BE_UNINSTALLED_NON_INTERACTIVE=You must select \
- the elements to uninstall. Use the options described in the usage to specify \
- what must be uninstalled.
-INFO_CLI_UNINSTALL_NOTHING_TO_BE_UNINSTALLED=You must select something to be \
- uninstalled.
+SEVERE_ERR_CLI_UNINSTALL_NOTHING_TO_BE_UNINSTALLED_NON_INTERACTIVE=You must \
+ select the elements to uninstall. Use the options described in the usage to \
+ specify what must be uninstalled.
+SEVERE_ERR_CLI_UNINSTALL_NOTHING_TO_BE_UNINSTALLED=You must select something \
+ to be uninstalled.
INFO_CLI_UNINSTALL_SERVER_STOPPED=The Server is Stopped.
INFO_CLI_UNINSTALL_CONFIRM_UPDATE_REMOTE=This server is configured \
to do replication. In order to remove references to this server in other \
@@ -159,15 +159,15 @@
continue. Do you want the uninstaller to stop the server for you and continue \
with the uninstall? If you click No, you will need to stop the server \
manually to continue.
-INFO_ERROR_READING_REGISTERED_SERVERS_CONFIRM_UPDATE_REMOTE=The following \
+MILD_ERR_READING_REGISTERED_SERVERS_CONFIRM_UPDATE_REMOTE=The following \
errors were encountered reading the configuration of the existing \
servers:\n%s\nDo you want the uninstaller to try to remove the references to \
this server in a best-effort mode?
INFO_CONFIRM_UNINSTALL_SERVER_RUNNING_TITLE=Server is Running
INFO_CONNECTIONS_LABEL=Open Connections:
-INFO_COULD_NOT_FIND_VALID_LDAPURL=Error reading the configuration file.%nThis \
- could be caused because there is not an enabled LDAP port for the specified \
- connection parameters or because you do not have read rights on the \
+MILD_ERR_COULD_NOT_FIND_VALID_LDAPURL=Error reading the configuration file.%n\
+ This could be caused because there is not an enabled LDAP port for the \
+ specified connection parameters or because you do not have read rights on the \
configuration file.
INFO_DATABASES_TITLE=Data Sources
INFO_DELETE_OUTSIDE_DBS_LABEL=Delete these Database Files
@@ -182,10 +182,10 @@
located outside the install directory
INFO_DISABLED_LABEL=Disabled
INFO_ENABLED_LABEL=Enabled
-INFO_ERROR_READING_CONFIG_FILE=Error reading the configuration file.
-INFO_ERROR_READING_CONFIG_LDAP=Error reading data from server. Verify the \
+MILD_ERR_READING_CONFIG_FILE=Error reading the configuration file.
+MILD_ERR_READING_CONFIG_LDAP=Error reading data from server. Verify the \
authentication information provided.%nDetails: %s
-INFO_ERROR_STARTING_SERVER_GENERIC=Could not Start server.
+SEVERE_ERR_STARTING_SERVER_GENERIC=Could not Start server.
INFO_FINISH_BUTTON_UNINSTALL_LABEL=Uninstall
INFO_FINISH_BUTTON_UNINSTALL_TOOLTIP=Finish Uninstall
INFO_FRAME_UNINSTALL_TITLE=OpenDS Uninstall
@@ -268,10 +268,10 @@
INFO_STATE_COLUMN=State
INFO_STATUS_CLI_USAGE_DESCRIPTION=This utility may be used to display basic \
server information
-INFO_STATUS_PANEL_LAUNCHER_GUI_LAUNCH_FAILED=Could not launch Status Panel. \
- Check that you have access to the display.
-INFO_STATUS_PANEL_LAUNCHER_GUI_LAUNCH_FAILED_DETAILS=Could not launch Status \
- Panel. Check that you have access to the display. Check file %s for \
+SEVERE_ERR_STATUS_PANEL_LAUNCHER_GUI_LAUNCH_FAILED=Could not launch Status \
+Panel. Check that you have access to the display.
+SEVERE_ERR_STATUS_PANEL_LAUNCHER_GUI_LAUNCH_FAILED_DETAILS=Could not launch \
+Status Panel. Check that you have access to the display. Check file %s for \
details.
INFO_STATUS_PANEL_LAUNCHER_USAGE_DESCRIPTION=This utility may be used to \
display the Status Panel window which displays basic server information and \
@@ -312,9 +312,9 @@
updating remote servers.
INFO_SUMMARY_UNINSTALL_NOT_STARTED=Starting Uninstallation...
INFO_UNDEFINED_PROTOCOL_LABEL=-Unknown-
-INFO_UNINSTALL_LAUNCHER_GUI_LAUNCHED_FAILED=%n%nThe graphical Uninstall \
+SEVERE_ERR_UNINSTALL_LAUNCHER_GUI_LAUNCHED_FAILED=%n%nThe graphical Uninstall \
launch failed.%n%nLaunching command line Uninstall...
-INFO_UNINSTALL_LAUNCHER_GUI_LAUNCHED_FAILED_DETAILS=%n%nThe graphical \
+SEVERE_ERR_UNINSTALL_LAUNCHER_GUI_LAUNCHED_FAILED_DETAILS=%n%nThe graphical \
Uninstall launch failed. Check file %s for more details.%n%nLaunching \
command line Uninstall...
INFO_UNINSTALL_LAUNCHER_LAUNCHING_CLI=Launching command line uninstall...
@@ -348,16 +348,115 @@
rest of the options (excluding help and version) will only be taken into \
account if this option is specified
INFO_UNINSTALLDS_DESCRIPTION_SILENT=Perform a silent uninstall (no \
-progress information is written to the standard output)
+ progress information is written to the standard output)
INFO_UNINSTALLDS_DESCRIPTION_REMOVE_ALL=Remove all components of \
OpenDS (this option is not compatible with the rest of remove options)
INFO_UNINSTALLDS_DESCRIPTION_REMOVE_SERVER_LIBRARIES=Remove Server Libraries \
-and Administrative Tools
+ and Administrative Tools
INFO_UNINSTALLDS_DESCRIPTION_REMOVE_DATABASES=Remove database contents
INFO_UNINSTALLDS_DESCRIPTION_REMOVE_LOG_FILES=Remove log files
INFO_UNINSTALLDS_DESCRIPTION_REMOVE_CONFIGURATION_FILES=Remove configuration \
-files
+ files
INFO_UNINSTALLDS_DESCRIPTION_REMOVE_BACKUP_FILES=Remove backup files
INFO_UNINSTALLDS_DESCRIPTION_REMOVE_LDIF_FILES=Remove LDIF files
-INFO_DESCRIPTION_ADMINUID=Specifies the User ID of the Global Administrator to \
-use to bind to the server
+INFO_DESCRIPTION_ADMIN_UID=Specifies the User ID of the Global Administrator \
+ to use to bind to the server
+INFO_DESCRIPTION_ENABLE_REPLICATION_HOST1=Directory server hostname or IP \
+ address of the first server whose contents will be replicated
+INFO_DESCRIPTION_ENABLE_REPLICATION_SERVER_PORT1=Directory server port \
+ number of the first server whose contents will be replicated
+INFO_DESCRIPTION_ENABLE_REPLICATION_BINDDN1=Specifies the DN to use to \
+ bind to the first server whose contents will be replicated. If not specified \
+ the global administrator will be used to bind
+INFO_DESCRIPTION_ENABLE_REPLICATION_BINDPASSWORD1=Specifies the password \
+ to use to bind to the first server whose contents will be replicated. If no \
+ bind DN was specified for the first server the password of the global \
+ administrator will be used to bind
+INFO_DESCRIPTION_ENABLE_REPLICATION_BINDPASSWORDFILE1=Specifies the file \
+ containing the password to use to bind to the first server whose contents \
+ will be replicated. If no bind DN was specified for the first server the \
+ password of the global administrator will be used to bind
+INFO_DESCRIPTION_ENABLE_REPLICATION_USE_SSL1=Use SSL for secure \
+ communication with the first server
+INFO_DESCRIPTION_ENABLE_REPLICATION_STARTTLS1=Use StartTLS to secure \
+ communication with the first server
+INFO_DESCRIPTION_ENABLE_REPLICATION_PORT1=Specifies the port that will be used by \
+ the replication mechanism in the first server to communicate with the other \
+ servers. You have to specify this option only if replication was not \
+ previously configured in the first server.
+INFO_DESCRIPTION_ENABLE_REPLICATION_HOST2=Directory server hostname or IP \
+ address of the second server whose contents will be replicated
+INFO_DESCRIPTION_ENABLE_REPLICATION_SERVER_PORT2=Directory server port \
+ number of the first server whose contents will be replicated
+INFO_DESCRIPTION_ENABLE_REPLICATION_BINDDN2=Specifies the DN to use to \
+ bind to the second server whose contents will be replicated. If not \
+ specified the global administrator will be used to bind
+INFO_DESCRIPTION_ENABLE_REPLICATION_BINDPASSWORD2=Specifies the password \
+ to use to bind to the second server whose contents will be replicated. If no \
+ bind DN was specified for the first server the password of the global \
+ administrator will be used to bind
+INFO_DESCRIPTION_ENABLE_REPLICATION_BINDPASSWORDFILE2=Specifies the file \
+ containing the password to use to bind to the second server whose contents \
+ will be replicated. If no bind DN was specified for the first server the \
+ password of the global administrator will be used to bind
+INFO_DESCRIPTION_ENABLE_REPLICATION_USE_SSL2=Use SSL for secure \
+ communication with the second server
+INFO_DESCRIPTION_ENABLE_REPLICATION_PORT2=Specifies the port that will be used by \
+ the replication mechanism in the second server to communicate with the other \
+ servers. You have to specify this option only if replication was not \
+ previously configured in the second server.
+INFO_DESCRIPTION_ENABLE_REPLICATION_STARTTLS2=Use StartTLS to secure \
+ communication with the second server
+INFO_DESCRIPTION_REPLICATION_BASEDNS=Specifies the Base DN of \
+ the data to be replicated, initialized or for which we want to disable \
+ replication. Multiple base DNs may be provided by using this option multiple \
+ times
+INFO_DESCRIPTION_REPLICATION_ADMIN_UID=Specifies the User ID of the \
+ Global Administrator to use to bind to the server. For the {%s} subcommand \
+ if no Global Administrator was defined previously for none of the server one \
+ will be created using the provided data.
+INFO_DESCRIPTION_REPLICATION_ADMIN_BINDPASSWORD=The global \
+ administrator password
+INFO_DESCRIPTION_REPLICATION_ADMIN_BINDPASSWORDFILE=The file \
+ containing the password of the global administrator
+INFO_DESCRIPTION_INITIALIZE_REPLICATION_HOST_SOURCE=Directory server \
+ hostname or IP address of the source server whose contents will be used to \
+ initialize the destination server.
+INFO_DESCRIPTION_INITIALIZE_REPLICATION_SERVER_PORT_SOURCE=Directory \
+ server port number of the source server whose contents will be used to \
+ initialize the destination server.
+INFO_DESCRIPTION_INITIALIZE_REPLICATION_USE_SSL_SOURCE=Use SSL for secure \
+ communication with the source server
+INFO_DESCRIPTION_INITIALIZE_REPLICATION_STARTTLS_SOURCE=Use StartTLS to \
+ secure communication with the source server
+INFO_DESCRIPTION_INITIALIZE_REPLICATION_HOST_DESTINATION=Directory server \
+ hostname or IP address of the source server whose contents will be used to \
+ initialize the destination server.
+INFO_DESCRIPTION_INITIALIZE_REPLICATION_SERVER_PORT_DESTINATION=Directory \
+ server port number of the source server whose contents will be used to \
+ initialize the destination server.
+INFO_DESCRIPTION_INITIALIZE_REPLICATION_USE_SSL_DESTINATION=Use SSL for \
+ secure communication with the source server
+INFO_DESCRIPTION_INITIALIZE_REPLICATION_STARTTLS_DESTINATION=Use \
+ StartTLS to secure communication with the source server
+INFO_REPLICATION_TOOL_DESCRIPTION=This utility may be used to configure \
+ replication between servers so that the data of the servers is synchronized.\
+ In order replication to work you have first to enable replication between two \
+ servers using the {%s} subcommand and then initialize the contents of one of \
+ servers with the contents of the other using the {%s} subcommand.
+INFO_DESCRIPTION_SUBCMD_INITIALIZE_REPLICATION=Initialize the contents of the \
+ data under the specified Bind DN on the destination server with the contents \
+ on the source server. This operation is required after enabling replication \
+ in order replication to work.
+INFO_DESCRIPTION_SUBCMD_ENABLE_REPLICATION=Configures the two specified \
+ servers to replicate the data under the specified Bind DN.
+INFO_DESCRIPTION_SUBCMD_DISABLE_REPLICATION=Disables replication on the \
+ specified server for the provided Base DN and removes references in the other \
+ servers with which it is replicating data.
+SEVERE_ERR_REPLICATION_NO_BASE_DN_PROVIDED=You must provide at least one base \
+ DN in no interactive mode.
+SEVERE_ERR_REPLICATION_NO_ADMINISTRATOR_PASSWORD_PROVIDED=You must provide the \
+ password of the global administrator in non interactive mode. You can \
+ provide it using the {%s} or the {%s} options.
+SEVERE_ERR_REPLICATION_NOT_A_VALID_BASEDN=The provided value %s is not a valid \
+ base DN.
diff --git a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/CliApplicationHelper.java b/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/CliApplicationHelper.java
index 3ecaade..42fd65a 100644
--- a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/CliApplicationHelper.java
+++ b/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/CliApplicationHelper.java
@@ -36,6 +36,7 @@
import static org.opends.messages.QuickSetupMessages.*;
import org.opends.quicksetup.util.Utils;
+import org.opends.server.admin.client.cli.SecureConnectionCliParser;
import org.opends.server.util.args.ArgumentParser;
import org.opends.server.util.args.ArgumentException;
import org.opends.server.util.args.BooleanArgument;
@@ -64,18 +65,6 @@
/** Format string used for deriving the console prompt. */
static public final String PROMPT_FORMAT = "%s%n[%s]:";
- /** Short form of the option for specifying a noninteractive session. */
- static public final Character SILENT_OPTION_SHORT = 's';
-
- /** Long form of the option for specifying a noninteractive session. */
- static public final String SILENT_OPTION_LONG = "silent";
-
- /** Short form of the option for specifying a noninteractive session. */
- static public final Character INTERACTIVE_OPTION_SHORT = 'i';
-
- /** Long form of the option for specifying a noninteractive session. */
- static public final String INTERACTIVE_OPTION_LONG = "interactive";
-
private BooleanArgument interactiveArg = null;
private BooleanArgument silentArg = null;
@@ -368,15 +357,15 @@
try {
interactiveArg =
new BooleanArgument("noninteractive session",
- INTERACTIVE_OPTION_SHORT,
- INTERACTIVE_OPTION_LONG,
+ SecureConnectionCliParser.INTERACTIVE_OPTION_SHORT,
+ SecureConnectionCliParser.INTERACTIVE_OPTION_LONG,
null);
argParser.addArgument(interactiveArg);
silentArg =
new BooleanArgument("silent session",
- SILENT_OPTION_SHORT,
- SILENT_OPTION_LONG,
+ SecureConnectionCliParser.SILENT_OPTION_SHORT,
+ SecureConnectionCliParser.SILENT_OPTION_LONG,
null);
argParser.addArgument(silentArg);
diff --git a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/upgrader/UpgradeLauncher.java b/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/upgrader/UpgradeLauncher.java
index 794b054..c27934d 100644
--- a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/upgrader/UpgradeLauncher.java
+++ b/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/upgrader/UpgradeLauncher.java
@@ -33,13 +33,13 @@
import static org.opends.messages.ToolMessages.*;
import static org.opends.server.tools.ToolConstants.*;
-import org.opends.quicksetup.CliApplicationHelper;
import org.opends.quicksetup.Launcher;
import org.opends.quicksetup.CliApplication;
import org.opends.quicksetup.Installation;
import org.opends.quicksetup.QuickSetupLog;
import org.opends.quicksetup.util.Utils;
+import org.opends.server.admin.client.cli.SecureConnectionCliParser;
import org.opends.server.util.ServerConstants;
import org.opends.server.util.args.ArgumentParser;
import org.opends.server.util.args.BooleanArgument;
@@ -191,15 +191,15 @@
null, null, INFO_UPGRADE_DESCRIPTION_FILE.get());
argParser.addArgument(file);
interactive = new BooleanArgument(
- CliApplicationHelper.INTERACTIVE_OPTION_LONG,
- CliApplicationHelper.INTERACTIVE_OPTION_SHORT,
- CliApplicationHelper.INTERACTIVE_OPTION_LONG,
+ SecureConnectionCliParser.INTERACTIVE_OPTION_LONG,
+ SecureConnectionCliParser.INTERACTIVE_OPTION_SHORT,
+ SecureConnectionCliParser.INTERACTIVE_OPTION_LONG,
INFO_UPGRADE_DESCRIPTION_INTERACTIVE.get());
argParser.addArgument(interactive);
silent = new BooleanArgument(
- CliApplicationHelper.SILENT_OPTION_LONG,
- CliApplicationHelper.SILENT_OPTION_SHORT,
- CliApplicationHelper.SILENT_OPTION_LONG,
+ SecureConnectionCliParser.SILENT_OPTION_LONG,
+ SecureConnectionCliParser.SILENT_OPTION_SHORT,
+ SecureConnectionCliParser.SILENT_OPTION_LONG,
INFO_UPGRADE_DESCRIPTION_SILENT.get());
argParser.addArgument(silent);
showUsage = new BooleanArgument("showusage", OPTION_SHORT_HELP,
diff --git a/opendj-sdk/opends/src/server/org/opends/server/admin/client/cli/DsFrameworkCliMain.java b/opendj-sdk/opends/src/server/org/opends/server/admin/client/cli/DsFrameworkCliMain.java
index 0794fb8..b314e6e 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/admin/client/cli/DsFrameworkCliMain.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/admin/client/cli/DsFrameworkCliMain.java
@@ -211,7 +211,7 @@
}
// Validate args
- int ret = argParser.validateGlobalOption(err);
+ int ret = argParser.validateGlobalOptions(err);
if (ret != SUCCESSFUL_NOP.getReturnCode())
{
return ret;
diff --git a/opendj-sdk/opends/src/server/org/opends/server/admin/client/cli/DsFrameworkCliParser.java b/opendj-sdk/opends/src/server/org/opends/server/admin/client/cli/DsFrameworkCliParser.java
index 61f8957..8984214 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/admin/client/cli/DsFrameworkCliParser.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/admin/client/cli/DsFrameworkCliParser.java
@@ -114,7 +114,7 @@
throws ArgumentException
{
// Global parameters
- initializeGlobalOption(outStream);
+ initializeGlobalArguments(createGlobalArguments(outStream));
// ads Group cli
cliGroup.add(new DsFrameworkCliAds());
diff --git a/opendj-sdk/opends/src/server/org/opends/server/admin/client/cli/SecureConnectionCliParser.java b/opendj-sdk/opends/src/server/org/opends/server/admin/client/cli/SecureConnectionCliParser.java
index 09f6979..82f6b37 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/admin/client/cli/SecureConnectionCliParser.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/admin/client/cli/SecureConnectionCliParser.java
@@ -46,6 +46,8 @@
import java.security.NoSuchAlgorithmException;
import java.security.cert.CertificateException;
import java.util.ArrayList;
+import java.util.Collection;
+import java.util.LinkedHashSet;
import java.util.logging.Level;
import java.util.logging.Logger;
@@ -57,6 +59,7 @@
import org.opends.server.types.DebugLogLevel;
import org.opends.server.util.PasswordReader;
import org.opends.server.util.SelectableCertificateKeyManager;
+import org.opends.server.util.args.Argument;
import org.opends.server.util.args.ArgumentException;
import org.opends.server.util.args.BooleanArgument;
import org.opends.server.util.args.FileBasedArgument;
@@ -158,6 +161,18 @@
*/
protected BooleanArgument startTLSArg = null;
+ /** Short form of the option for specifying a noninteractive session. */
+ static public final Character INTERACTIVE_OPTION_SHORT = 'i';
+
+ /** Long form of the option for specifying a noninteractive session. */
+ static public final String SILENT_OPTION_LONG = "silent";
+
+ /** Long form of the option for specifying a noninteractive session. */
+ static public final String INTERACTIVE_OPTION_LONG = "interactive";
+
+ /** Short form of the option for specifying a noninteractive session. */
+ static public final Character SILENT_OPTION_SHORT = 's';
+
/**
* The tracer object for the debug logger.
*/
@@ -212,7 +227,6 @@
}
}
-
/**
* Get the password which has to be used for the command.
*
@@ -224,14 +238,20 @@
* @param err
* The error stream to used if we have to prompt to the
* user.
+ * @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 prompts it if not specified.
*/
- public String getBindPassword(String dn, OutputStream out, OutputStream err)
+ protected String getBindPassword(String dn,
+ OutputStream out, OutputStream err, StringArgument clearArg,
+ FileBasedArgument fileArg)
{
- if (bindPasswordArg.isPresent())
+ if (clearArg.isPresent())
{
- String bindPasswordValue = bindPasswordArg.getValue();
+ String bindPasswordValue = clearArg.getValue();
if(bindPasswordValue != null && bindPasswordValue.equals("-"))
{
// read the password from the stdin.
@@ -260,9 +280,9 @@
return bindPasswordValue;
}
else
- if (bindPasswordFileArg.isPresent())
+ if (fileArg.isPresent())
{
- return bindPasswordFileArg.getValue();
+ return fileArg.getValue();
}
else
{
@@ -291,6 +311,57 @@
return null;
}
}
+
+ }
+
+ /**
+ * Get the password which has to be used for the command.
+ *
+ * @param dn
+ * The user DN for which to password could be asked.
+ * @param out
+ * The input stream to used if we have to prompt to the
+ * user.
+ * @param err
+ * The error stream to used if we have to prompt to the
+ * user.
+ * @return The password stored into the specified file on by the
+ * command line argument, or prompts it if not specified.
+ */
+ public String getBindPassword(String dn, OutputStream out, OutputStream err)
+ {
+ return getBindPassword(dn, out, err, bindPasswordArg, bindPasswordFileArg);
+ }
+
+ /**
+ * 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 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;
}
/**
@@ -302,21 +373,7 @@
*/
public String getBindPassword()
{
- String pwd;
- if (bindPasswordArg.isPresent())
- {
- pwd = bindPasswordArg.getValue();
- }
- else
- if (bindPasswordFileArg.isPresent())
- {
- pwd = bindPasswordFileArg.getValue();
- }
- else
- {
- pwd = null;
- }
- return pwd;
+ return getBindPassword(bindPasswordArg, bindPasswordFileArg);
}
/**
@@ -327,98 +384,118 @@
* @throws ArgumentException
* If there is a problem with any of the parameters used
* to create this argument.
+ * @return a ArrayList with the options created.
*/
- protected void initializeGlobalOption(OutputStream outStream)
+ protected LinkedHashSet<Argument> createGlobalArguments(
+ OutputStream outStream)
throws ArgumentException
{
+ LinkedHashSet<Argument> set = new LinkedHashSet<Argument>();
showUsageArg = new BooleanArgument("showUsage", OPTION_SHORT_HELP,
OPTION_LONG_HELP, INFO_DESCRIPTION_SHOWUSAGE.get());
- addGlobalArgument(showUsageArg);
setUsageArgument(showUsageArg, outStream);
+ set.add(showUsageArg);
useSSLArg = new BooleanArgument("useSSL", OPTION_SHORT_USE_SSL,
OPTION_LONG_USE_SSL, INFO_DESCRIPTION_USE_SSL.get());
- addGlobalArgument(useSSLArg);
+ set.add(useSSLArg);
startTLSArg = new BooleanArgument("startTLS", OPTION_SHORT_START_TLS,
OPTION_LONG_START_TLS,
INFO_DESCRIPTION_START_TLS.get());
- addGlobalArgument(startTLSArg);
+ set.add(startTLSArg);
hostNameArg = new StringArgument("host", OPTION_SHORT_HOST,
OPTION_LONG_HOST, false, false, true, OPTION_VALUE_HOST, "localhost",
null, INFO_DESCRIPTION_HOST.get());
- addGlobalArgument(hostNameArg);
+ set.add(hostNameArg);
portArg = new IntegerArgument("port", OPTION_SHORT_PORT, OPTION_LONG_PORT,
false, false, true, OPTION_VALUE_PORT, 389, null,
INFO_DESCRIPTION_PORT.get());
- addGlobalArgument(portArg);
+ set.add(portArg);
bindDnArg = new StringArgument("bindDN", OPTION_SHORT_BINDDN,
OPTION_LONG_BINDDN, false, false, true, OPTION_VALUE_BINDDN,
"cn=Directory Manager", null, INFO_DESCRIPTION_BINDDN.get());
- addGlobalArgument(bindDnArg);
+ set.add(bindDnArg);
bindPasswordArg = new StringArgument("bindPassword",
OPTION_SHORT_BINDPWD, OPTION_LONG_BINDPWD, false, false, true,
OPTION_VALUE_BINDPWD, null, null, INFO_DESCRIPTION_BINDPASSWORD.get());
- addGlobalArgument(bindPasswordArg);
+ set.add(bindPasswordArg);
bindPasswordFileArg = new FileBasedArgument("bindPasswordFile",
OPTION_SHORT_BINDPWD_FILE, OPTION_LONG_BINDPWD_FILE, false, false,
OPTION_VALUE_BINDPWD_FILE, null, null,
INFO_DESCRIPTION_BINDPASSWORDFILE.get());
- addGlobalArgument(bindPasswordFileArg);
+ set.add(bindPasswordFileArg);
trustAllArg = new BooleanArgument("trustAll", 'X', "trustAll",
INFO_DESCRIPTION_TRUSTALL.get());
- addGlobalArgument(trustAllArg);
+ set.add(trustAllArg);
trustStorePathArg = new StringArgument("trustStorePath",
OPTION_SHORT_TRUSTSTOREPATH, OPTION_LONG_TRUSTSTOREPATH, false,
false, true, OPTION_VALUE_TRUSTSTOREPATH, null, null,
INFO_DESCRIPTION_TRUSTSTOREPATH.get());
- addGlobalArgument(trustStorePathArg);
+ set.add(trustStorePathArg);
trustStorePasswordArg = new StringArgument("trustStorePassword", null,
OPTION_LONG_TRUSTSTORE_PWD, false, false, true,
OPTION_VALUE_TRUSTSTORE_PWD, null, null,
INFO_DESCRIPTION_TRUSTSTOREPASSWORD.get());
- addGlobalArgument(trustStorePasswordArg);
+ set.add(trustStorePasswordArg);
trustStorePasswordFileArg = new FileBasedArgument("truststorepasswordfile",
OPTION_SHORT_TRUSTSTORE_PWD_FILE, OPTION_LONG_TRUSTSTORE_PWD_FILE,
false, false, OPTION_VALUE_TRUSTSTORE_PWD_FILE, null, null,
INFO_DESCRIPTION_TRUSTSTOREPASSWORD_FILE.get());
- addGlobalArgument(trustStorePasswordFileArg);
+ set.add(trustStorePasswordFileArg);
keyStorePathArg = new StringArgument("keyStorePath",
OPTION_SHORT_KEYSTOREPATH, OPTION_LONG_KEYSTOREPATH, false, false,
true, OPTION_VALUE_KEYSTOREPATH, null, null,
INFO_DESCRIPTION_KEYSTOREPATH.get());
- addGlobalArgument(keyStorePathArg);
+ set.add(keyStorePathArg);
keyStorePasswordArg = new StringArgument("keyStorePassword", null,
OPTION_LONG_KEYSTORE_PWD, false, false, true,
OPTION_VALUE_KEYSTORE_PWD, null, null,
INFO_DESCRIPTION_KEYSTOREPASSWORD.get());
- addGlobalArgument(keyStorePasswordArg);
+ set.add(keyStorePasswordArg);
keyStorePasswordFileArg = new FileBasedArgument("keystorepasswordfile",
OPTION_SHORT_KEYSTORE_PWD_FILE, OPTION_LONG_KEYSTORE_PWD_FILE, false,
false, OPTION_VALUE_KEYSTORE_PWD_FILE, null, null,
INFO_DESCRIPTION_KEYSTOREPASSWORD_FILE.get());
- addGlobalArgument(keyStorePasswordFileArg);
+ set.add(keyStorePasswordFileArg);
certNicknameArg = new StringArgument("certnickname", 'N', "certNickname",
false, false, true, "{nickname}", null, null,
INFO_DESCRIPTION_CERT_NICKNAME.get());
- addGlobalArgument(certNicknameArg);
+ set.add(certNicknameArg);
verboseArg = new BooleanArgument("verbose", 'v', "verbose",
INFO_DESCRIPTION_VERBOSE.get());
- addGlobalArgument(verboseArg);
+ set.add(verboseArg);
+
+ return set;
+ }
+
+ /**
+ * Initialize the global options with the provided set of arguments.
+ * @param args the arguments to use to initialize the global options.
+ * @throws ArgumentException if there is a conflict with the provided
+ * arguments.
+ */
+ protected void initializeGlobalArguments(Collection<Argument> args)
+ throws ArgumentException
+ {
+ for (Argument arg : args)
+ {
+ addGlobalArgument(arg);
+ }
}
/**
@@ -463,7 +540,7 @@
* @param buf the MessageBuilder to write the error messages.
* @return return code.
*/
- public int validateGlobalOption(MessageBuilder buf)
+ public int validateGlobalOptions(MessageBuilder buf)
{
ArrayList<Message> errors = new ArrayList<Message>();
// Couldn't have at the same time bindPassword and bindPasswordFile
@@ -536,10 +613,10 @@
* @param err the stream to be used to print error message.
* @return return code.
*/
- public int validateGlobalOption(PrintStream err)
+ public int validateGlobalOptions(PrintStream err)
{
MessageBuilder buf = new MessageBuilder();
- int returnValue = validateGlobalOption(buf);
+ int returnValue = validateGlobalOptions(buf);
if (buf.length() > 0)
{
err.println(wrapText(buf.toString(), MAX_LINE_WIDTH));
--
Gitblit v1.10.0