diff options
| author | Arnaud Simon <arnaudsimon@apache.org> | 2007-08-23 12:08:44 +0000 |
|---|---|---|
| committer | Arnaud Simon <arnaudsimon@apache.org> | 2007-08-23 12:08:44 +0000 |
| commit | 04f2c58a48091b721b3ddc622f209d76b4ddbb0f (patch) | |
| tree | 4c1af88d216e75cdac3dbe1471a5ee6f7800bbde /java/common | |
| parent | f2333ea56165e4f69d9e5c5d4b7d9aa46db5da14 (diff) | |
| download | qpid-python-04f2c58a48091b721b3ddc622f209d76b4ddbb0f.tar.gz | |
updated from M2 branch
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@568950 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/common')
| -rw-r--r-- | java/common/src/main/java/org/apache/qpid/util/CommandLineParser.java | 27 |
1 files changed, 10 insertions, 17 deletions
diff --git a/java/common/src/main/java/org/apache/qpid/util/CommandLineParser.java b/java/common/src/main/java/org/apache/qpid/util/CommandLineParser.java index 9bb4a6635f..dc73bce28f 100644 --- a/java/common/src/main/java/org/apache/qpid/util/CommandLineParser.java +++ b/java/common/src/main/java/org/apache/qpid/util/CommandLineParser.java @@ -483,9 +483,9 @@ public class CommandLineParser }
/**
- * If a command line has been parsed, calling this method sets all of its parsed options as system properties.
+ * If a command line has been parsed, calling this method sets all of its parsed options into the specified properties.
*/
- public void addCommandLineToSysProperties()
+ public void addCommandLineToProperties(Properties properties)
{
if (parsedProperties != null)
{
@@ -494,7 +494,7 @@ public class CommandLineParser String name = (String) propKey;
String value = parsedProperties.getProperty(name);
- System.setProperty(name, value);
+ properties.setProperty(name, value);
}
}
}
@@ -603,23 +603,16 @@ public class CommandLineParser }
/**
- * Parses the command line arguments against the specified command line format, printing errors and usage
- * instrucitons and calling System.exit on errors. Extracts all trailing name=value pairs from the command line,
- * and sets them all as system properties and also returns a map of properties containing them.
+ * Extracts all name=value pairs from the command line, sets them all as system properties and also returns
+ * a map of properties containing them.
*
- * @param args The command line.
+ * @param args The command line.
+ * @param commandLine The command line parser.
+ * @param properties The properties object to inject all parsed properties into (optional may be <tt>null</tt>).
*
* @return A set of properties containing all name=value pairs from the command line.
- *
- * @todo Replace the call to System.exit with throwing an exception. Gives caller the option to decide how to
- * handle the error.
- *
- * @todo Pass in the location to write the usage to as an argument, instead of hard-coding System.out.
- *
- * @todo Allow the Properties to add trailing options to be specified as an argument rather than hard coding
- * system properties. Again, gives the caller the option to decide.
*/
- public static Properties processCommandLine(String[] args, CommandLineParser commandLine)
+ public static Properties processCommandLine(String[] args, CommandLineParser commandLine, Properties properties)
{
// Capture the command line arguments or display errors and correct usage and then exit.
Properties options = null;
@@ -630,7 +623,7 @@ public class CommandLineParser // Add all the trailing command line options (name=value pairs) to system properties. They may be picked up
// from there.
- commandLine.addCommandLineToSysProperties();
+ commandLine.addCommandLineToProperties(properties);
}
catch (IllegalArgumentException e)
{
|
