From 3c92b8a089bdbe50943c1fdfcc8eee46f2948054 Mon Sep 17 00:00:00 2001 From: Omair Majid Date: Mon, 20 Dec 2010 09:26:16 -0500 Subject: add command line interface to the control panel 2010-12-20 Omair Majid * Makefile.am ($(NETX_DIR)/launcher/controlpanel/%.o): Set program name, and launch net.sourceforge.jnlp.controlpanel.CommandLine. * netx/net/sourceforge/jnlp/config/Defaults.java (getDefaults): Set descriptions to Unknown rather than the name. Set source to localized form of internal. * netx/net/sourceforge/jnlp/config/DeploymentConfiguration.java (getProperty): Check for nulls. (setProperty): Add unknown as description and source for new properties. (checkAndFixConfiguration): Fix translation constants. (parsePropertiesFile): Use unknown as description. * netx/net/sourceforge/jnlp/controlpanel/CommandLine.java: New file (CommandLine): New method. (handleHelpCommand): Likewise. (printListHelp): Likewise. (handleListCommand): Likewise. (printGetHelp): Likewise. (handleGetCommand): Likewise. (printSetHelp): Likewise. (handleSetCommand): Likewise. (printResetHelp): Likewise. (handleResetCommand): Likewise. (printInfoHelp): Likewise. (handleInfoCommand): Likewise. (printCheckHelp): Likewise. (handleCheckCommand): Likewise. (handle): Likewise. (main): Likewise. * netx/net/sourceforge/jnlp/resources/Messages.properties: Add Usage, Unknown, RConfigurationFatal, DCIncorrectValue, DCSourceInternal, DCUnknownSettingWithName, VVPossibleValues, CLNoInfo, CLValue, CLValueSource, CLDescription, CLUnknownCommand CLUnknownProperty, CLNoIssuesFound, CLIncorrectValue, CLListDescription, CLGetDescription, CLSetDescription, CLResetDescription, CLInfoDescription, CLCheckDescription and CLHelpDescription. Remove DCErrorInSetting and DCUnknownSettingWithVal. --- .../sourceforge/jnlp/config/DeploymentConfiguration.java | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'netx/net/sourceforge/jnlp/config/DeploymentConfiguration.java') diff --git a/netx/net/sourceforge/jnlp/config/DeploymentConfiguration.java b/netx/net/sourceforge/jnlp/config/DeploymentConfiguration.java index dd329aa..a07df1f 100644 --- a/netx/net/sourceforge/jnlp/config/DeploymentConfiguration.java +++ b/netx/net/sourceforge/jnlp/config/DeploymentConfiguration.java @@ -267,7 +267,11 @@ public final class DeploymentConfiguration { } } - return currentConfiguration.get(key).getValue(); + String value = null; + if (currentConfiguration.get(key) != null) { + value = currentConfiguration.get(key).getValue(); + } + return value; } /** @@ -319,7 +323,7 @@ public final class DeploymentConfiguration { currentValue.setValue(value); } } else { - currentValue = new Setting(key, key, false, null, null, value, ""); + currentValue = new Setting(key, R("Unknown"), false, null, null, value, R("Unknown")); currentConfiguration.put(key, currentValue); } } @@ -341,7 +345,7 @@ public final class DeploymentConfiguration { if (!(s.getName().equals(key))) { System.out.println(R("DCInternal", "key " + key + " does not match setting name " + s.getName())); } else if (!defaults.containsKey(key)) { - System.out.println(R("DCUnknownSettingWithVal", key)); + System.out.println(R("DCUnknownSettingWithName", key)); } else { ValueValidator checker = defaults.get(key).getValidator(); if (checker == null) { @@ -351,7 +355,7 @@ public final class DeploymentConfiguration { try { checker.validate(s.getValue()); } catch (IllegalArgumentException e) { - System.out.println(R("DCErrorInSetting", key, s.getValue(), s.getDefaultValue(), checker.getPossibleValues())); + System.out.println(R("DCIncorrectValue", key, s.getValue(), checker.getPossibleValues())); s.setValue(s.getDefaultValue()); } } @@ -546,7 +550,7 @@ public final class DeploymentConfiguration { String realKey = key.substring(0, key.length() - ".locked".length()); Setting configValue = result.get(realKey); if (configValue == null) { - configValue = new Setting(realKey, realKey, true, null, null, null, propertiesFile.toString()); + configValue = new Setting(realKey, R("Unknown"), true, null, null, null, propertiesFile.toString()); result.put(realKey, configValue); } else { configValue.setLocked(true); @@ -556,7 +560,7 @@ public final class DeploymentConfiguration { String newValue = properties.getProperty(key); Setting configValue = result.get(key); if (configValue == null) { - configValue = new Setting(key, key, false, null, null, newValue, propertiesFile.toString()); + configValue = new Setting(key, R("Unknown"), false, null, null, newValue, propertiesFile.toString()); result.put(key, configValue); } else { configValue.setValue(newValue); -- cgit v1.2.3