Mercurial > hg > release > icedtea-web-1.2
changeset 81:adef5d4159ee
add support for validating configuration
2010-12-13 Omair Majid <omajid@redhat.com>
* netx/net/sourceforge/jnlp/config/ValueValidator.java: New file.
* netx/net/sourceforge/jnlp/config/BasicValueValidators.java: New
file. Provides methods to get some common validators.
* netx/net/sourceforge/jnlp/config/ConfiguratonValidator.java: New
file. Provides methods to validate a configuration.
* netx/net/sourceforge/jnlp/runtime/DeploymentConfiguration.java:
Moved to config subpackage instead and split off into Setting.java,
DeploymentConfiguration.java and Defaults.java.
* netx/net/sourceforge/jnlp/config/DeploymentConfiguration.java:
Renamed version of original DeploymentConfiguration.
(load): Delegate to load.
(load(boolean)): Load configuration and optionally fix any issues
found.
(checkAndFixConfiguration): New method. Validate all settings and
set them to default values if problems found.
* netx/net/sourceforge/jnlp/config/Setting.java: New file. Based on
ConfigValue which was originally a part of DeploymentConfiguration.
* netx/net/sourceforge/jnlp/config/Defaults.java: New file.
Contains the default configuration settings. Originally from
DeploymentConfiguration.java's loadDefaultProperties.
* netx/net/sourceforge/jnlp/resources/Messages.properties: Add new
messages.
* netx/net/sourceforge/jnlp/Launcher.java: Fix imports.
* netx/net/sourceforge/jnlp/SecurityDesc.java: Likewise.
* netx/net/sourceforge/jnlp/cache/CacheUtil.java: Likewise.
* netx/net/sourceforge/jnlp/controlpanel
/AdvancedProxySettingsDialog.java: Likewise
* netx/net/sourceforge/jnlp/controlpanel
/AdvancedProxySettingsPane.java: Likewise.
* netx/net/sourceforge/jnlp/controlpanel/ControlPanel.java: Likewise
* netx/net/sourceforge/jnlp/controlpanel/DebuggingPanel.java:
Likewise.
* netx/net/sourceforge/jnlp/controlpanel/DesktopShortcutPanel.java:
Likewise.
* netx/net/sourceforge/jnlp/controlpanel/MiddleClickListener.java:
Likewise
* netx/net/sourceforge/jnlp/controlpanel/NetworkSettingsPanel.java:
Likewise.
* netx/net/sourceforge/jnlp/controlpanel/SecuritySettingsPanel.java:
Likewise.
* netx/net/sourceforge/jnlp/controlpanel
/TemporaryInternetFilesPanel.java:Likewise.
* netx/net/sourceforge/jnlp/runtime/ApplicationInstance.java:
Likewise.
* netx/net/sourceforge/jnlp/runtime/JNLPProxySelector.java:
Likewise.
* netx/net/sourceforge/jnlp/runtime/JNLPRuntime.java: Likewise.
* netx/net/sourceforge/jnlp/security/KeyStores.java: Likewise.
* netx/net/sourceforge/jnlp/security/SecurityWarning.java: Likewise.
* netx/net/sourceforge/jnlp/services/ServiceUtil.java: Likewise.
* netx/net/sourceforge/jnlp/services/SingleInstanceLock.java:
Likewise.
* netx/net/sourceforge/jnlp/services/XBasicService.java: Likewise
* netx/net/sourceforge/jnlp/services/XPersistenceService.java:
Likewise.
* netx/net/sourceforge/jnlp/util/XDesktopEntry.java: Likewise.
* plugin/icedteanp/java/sun/applet/JavaConsole.java: Likewise.
* plugin/icedteanp/java/sun/applet/PluginMain.java: Likewise.
line wrap: on
line diff
--- a/ChangeLog Mon Dec 13 16:12:06 2010 -0500 +++ b/ChangeLog Mon Dec 13 17:28:01 2010 -0500 @@ -1,3 +1,64 @@ +2010-12-13 Omair Majid <omajid@redhat.com> + + * netx/net/sourceforge/jnlp/config/ValueValidator.java: New file. + * netx/net/sourceforge/jnlp/config/BasicValueValidators.java: New + file. Provides methods to get some common validators. + * netx/net/sourceforge/jnlp/config/ConfiguratonValidator.java: New + file. Provides methods to validate a configuration. + * netx/net/sourceforge/jnlp/runtime/DeploymentConfiguration.java: + Moved to config subpackage instead and split off into Setting.java, + DeploymentConfiguration.java and Defaults.java. + * netx/net/sourceforge/jnlp/config/DeploymentConfiguration.java: + Renamed version of original DeploymentConfiguration. + (load): Delegate to load. + (load(boolean)): Load configuration and optionally fix any issues + found. + (checkAndFixConfiguration): New method. Validate all settings and + set them to default values if problems found. + * netx/net/sourceforge/jnlp/config/Setting.java: New file. Based on + ConfigValue which was originally a part of DeploymentConfiguration. + * netx/net/sourceforge/jnlp/config/Defaults.java: New file. + Contains the default configuration settings. Originally from + DeploymentConfiguration.java's loadDefaultProperties. + * netx/net/sourceforge/jnlp/resources/Messages.properties: Add new + messages. + * netx/net/sourceforge/jnlp/Launcher.java: Fix imports. + * netx/net/sourceforge/jnlp/SecurityDesc.java: Likewise. + * netx/net/sourceforge/jnlp/cache/CacheUtil.java: Likewise. + * netx/net/sourceforge/jnlp/controlpanel + /AdvancedProxySettingsDialog.java: Likewise + * netx/net/sourceforge/jnlp/controlpanel + /AdvancedProxySettingsPane.java: Likewise. + * netx/net/sourceforge/jnlp/controlpanel/ControlPanel.java: Likewise + * netx/net/sourceforge/jnlp/controlpanel/DebuggingPanel.java: + Likewise. + * netx/net/sourceforge/jnlp/controlpanel/DesktopShortcutPanel.java: + Likewise. + * netx/net/sourceforge/jnlp/controlpanel/MiddleClickListener.java: + Likewise + * netx/net/sourceforge/jnlp/controlpanel/NetworkSettingsPanel.java: + Likewise. + * netx/net/sourceforge/jnlp/controlpanel/SecuritySettingsPanel.java: + Likewise. + * netx/net/sourceforge/jnlp/controlpanel + /TemporaryInternetFilesPanel.java:Likewise. + * netx/net/sourceforge/jnlp/runtime/ApplicationInstance.java: + Likewise. + * netx/net/sourceforge/jnlp/runtime/JNLPProxySelector.java: + Likewise. + * netx/net/sourceforge/jnlp/runtime/JNLPRuntime.java: Likewise. + * netx/net/sourceforge/jnlp/security/KeyStores.java: Likewise. + * netx/net/sourceforge/jnlp/security/SecurityWarning.java: Likewise. + * netx/net/sourceforge/jnlp/services/ServiceUtil.java: Likewise. + * netx/net/sourceforge/jnlp/services/SingleInstanceLock.java: + Likewise. + * netx/net/sourceforge/jnlp/services/XBasicService.java: Likewise + * netx/net/sourceforge/jnlp/services/XPersistenceService.java: + Likewise. + * netx/net/sourceforge/jnlp/util/XDesktopEntry.java: Likewise. + * plugin/icedteanp/java/sun/applet/JavaConsole.java: Likewise. + * plugin/icedteanp/java/sun/applet/PluginMain.java: Likewise. + 2010-12-13 Omair Majid <omajid@redhat.com> * netx/net/sourceforge/jnlp/Parser.java
--- a/netx/net/sourceforge/jnlp/Launcher.java Mon Dec 13 16:12:06 2010 -0500 +++ b/netx/net/sourceforge/jnlp/Launcher.java Mon Dec 13 17:28:01 2010 -0500 @@ -39,10 +39,10 @@ import net.sourceforge.jnlp.cache.CacheUtil; import net.sourceforge.jnlp.cache.ResourceTracker; import net.sourceforge.jnlp.cache.UpdatePolicy; +import net.sourceforge.jnlp.config.DeploymentConfiguration; import net.sourceforge.jnlp.runtime.AppThreadGroup; import net.sourceforge.jnlp.runtime.AppletInstance; import net.sourceforge.jnlp.runtime.ApplicationInstance; -import net.sourceforge.jnlp.runtime.DeploymentConfiguration; import net.sourceforge.jnlp.runtime.JNLPClassLoader; import net.sourceforge.jnlp.runtime.JNLPRuntime; import net.sourceforge.jnlp.services.InstanceExistsException;
--- a/netx/net/sourceforge/jnlp/SecurityDesc.java Mon Dec 13 16:12:06 2010 -0500 +++ b/netx/net/sourceforge/jnlp/SecurityDesc.java Mon Dec 13 17:28:01 2010 -0500 @@ -22,7 +22,7 @@ import java.security.*; import java.awt.AWTPermission; -import net.sourceforge.jnlp.runtime.DeploymentConfiguration; +import net.sourceforge.jnlp.config.DeploymentConfiguration; import net.sourceforge.jnlp.runtime.JNLPRuntime; /**
--- a/netx/net/sourceforge/jnlp/cache/CacheUtil.java Mon Dec 13 16:12:06 2010 -0500 +++ b/netx/net/sourceforge/jnlp/cache/CacheUtil.java Mon Dec 13 17:28:01 2010 -0500 @@ -27,6 +27,7 @@ import javax.jnlp.*; import net.sourceforge.jnlp.*; +import net.sourceforge.jnlp.config.DeploymentConfiguration; import net.sourceforge.jnlp.runtime.*; import net.sourceforge.jnlp.util.FileUtils;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/netx/net/sourceforge/jnlp/config/BasicValueValidators.java Mon Dec 13 17:28:01 2010 -0500 @@ -0,0 +1,268 @@ +/* BasicValueCheckers.java + Copyright (C) 2010 Red Hat, Inc. + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License as published by +the Free Software Foundation, version 2. + +IcedTea is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to +the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. +*/ + +package net.sourceforge.jnlp.config; + +import static net.sourceforge.jnlp.runtime.Translator.R; + +import java.net.URL; +import java.util.Arrays; +import java.util.Locale; + +/** + * Provides {@link ValueValidator} implementations for some common value types + * + * @see #getBooleanValidator() + * @see #getFilePathValidator() + * @see #getRangedIntegerValidator(int, int) + * @see #getStringValidator(String[]) + * @see #getUrlValidator() + */ +public class BasicValueValidators { + + /** + * Checks if a value is a valid boolean + */ + private static class BooleanValidator implements ValueValidator { + + @Override + public void validate(Object value) throws IllegalArgumentException { + Object possibleValue = value; + + if (possibleValue instanceof String) { + String lower = ((String) possibleValue).toLowerCase(Locale.ENGLISH); + if (lower.equals(Boolean.TRUE.toString()) + || (lower.equals(Boolean.FALSE.toString()))) { + possibleValue = Boolean.valueOf(lower); + } + } + + if (!(possibleValue instanceof Boolean)) { + throw new IllegalArgumentException(); + } + } + + @Override + public String getPossibleValues() { + return R("VVPossibleBooleanValues", Boolean.TRUE.toString(), Boolean.FALSE.toString()); + } + }; + + /** + * Checks if a value is a valid file path (not a valid file!). The actual + * file may or may not exist + */ + private static class FilePathValidator implements ValueValidator { + + @Override + public void validate(Object value) throws IllegalArgumentException { + if (value == null) { + return; + } + + Object possibleValue = value; + + if (!(possibleValue instanceof String)) { + throw new IllegalArgumentException(); + } + + String possibleFile = (String) possibleValue; + if (!(possibleFile.startsWith("/"))) { + throw new IllegalArgumentException(); + } + + } + + @Override + public String getPossibleValues() { + return R("VVPossibleFileValues"); + } + + } + + /** + * Checks that the value is an Integer or Long (or a String representation + * of one) that is within a desired range). + */ + private static class RangedIntegerValidator implements ValueValidator { + private int low = 0; + private int high = 0; + + public RangedIntegerValidator(int low, int high) { + this.low = low; + this.high = high; + } + + @Override + public void validate(Object value) throws IllegalArgumentException { + Object possibleValue = value; + + long actualValue = 0; + try { + if (possibleValue instanceof String) { + actualValue = Long.valueOf((String) possibleValue); + } else if (possibleValue instanceof Integer) { + actualValue = (Integer) possibleValue; + } else if (possibleValue instanceof Long) { + actualValue = (Long) possibleValue; + } else { + throw new IllegalArgumentException("Must be an integer"); + } + } catch (NumberFormatException e) { + throw new IllegalArgumentException("Must be an integer"); + + } + + if (actualValue < low || actualValue > high) { + throw new IllegalArgumentException("Not in range from " + low + " to " + high); + } + } + + @Override + public String getPossibleValues() { + return R("VVPossibleRangedIntegerValues", low, high); + } + + }; + + /** + * Checks that the value is one of the acceptable String values + */ + private static class StringValueValidator implements ValueValidator { + String[] options = null; + + public StringValueValidator(String[] acceptableOptions) { + options = acceptableOptions; + } + + @Override + public void validate(Object value) throws IllegalArgumentException { + Object possibleValue = value; + if (!(possibleValue instanceof String)) { + throw new IllegalArgumentException("Must be a string"); + } + + String stringVal = (String) possibleValue; + boolean found = false; + for (String knownVal : options) { + if (knownVal.equals(stringVal)) { + found = true; + break; + } + } + + if (!found) { + throw new IllegalArgumentException(); + } + } + + @Override + public String getPossibleValues() { + return Arrays.toString(options); + } + + } + + /** + * Checks that the value is a URL + */ + private static class UrlValidator implements ValueValidator { + + @Override + public void validate(Object value) throws IllegalArgumentException { + if (value == null) { + return; + } + try { + new URL((String) value); + } catch (Exception e) { + throw new IllegalArgumentException(); + } + } + + @Override + public String getPossibleValues() { + return R("VVPossibleUrlValues"); + } + + } + + /** + * @return a {@link ValueValidator} that can be used to check if an object is + * a valid Boolean + */ + public static ValueValidator getBooleanValidator() { + return new BooleanValidator(); + } + + /** + * @return a {@link ValueValidator} that can be used to check if an object is + * a String containing a valid file path or not + */ + public static ValueValidator getFilePathValidator() { + return new FilePathValidator(); + } + + /** + * Returns a {@link ValueValidator} that checks if an object represents a + * valid integer (it is a Integer or Long or a String representation of + * one), within the given range. The values are inclusive. + * @param low the lowest valid value + * @param high the highest valid value + */ + public static ValueValidator getRangedIntegerValidator(int low, int high) { + return new RangedIntegerValidator(low, high); + } + + /** + * Returns a {@link ValueValidator} that checks if an object is a string from + * one of the provided Strings. + * @param validValues an array of Strings which are considered valid + */ + public static ValueValidator getStringValidator(String[] validValues) { + return new StringValueValidator(validValues); + } + + /** + * @return a {@link ValueValidator} that checks if an object represents a + * valid url + */ + public static ValueValidator getUrlValidator() { + return new UrlValidator(); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/netx/net/sourceforge/jnlp/config/ConfiguratonValidator.java Mon Dec 13 17:28:01 2010 -0500 @@ -0,0 +1,120 @@ +/* Validator.java + Copyright (C) 2010 Red Hat, Inc. + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License as published by +the Free Software Foundation, version 2. + +IcedTea is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to +the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. +*/ + +package net.sourceforge.jnlp.config; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +/** + * Validates a DeploymentConfiguration by identifying settings with + * unrecognized names or incorrect values. + */ +public class ConfiguratonValidator { + + private List<Setting<String>> incorrectEntries; + private List<Setting<String>> unrecognizedEntries; + private Map<String, Setting<String>> toValidate = null; + + private boolean validated = false; + + /** + * @param toValidate the settings to validate + */ + public ConfiguratonValidator(Map<String, Setting<String>> toValidate) { + this.toValidate = toValidate; + } + + /** + * Validates the settings used in the constructor. Use + * {@link #getIncorrectSetting()} and {@link #getUnrecognizedSetting()} to + * get the list of incorrect or unrecognized settings. + */ + public void validate() { + incorrectEntries = new ArrayList<Setting<String>>(); + unrecognizedEntries = new ArrayList<Setting<String>>(); + + Map<String, Setting<String>> knownGood = Defaults.getDefaults(); + + for (String key : toValidate.keySet()) { + // check for known incorrect settings + if (knownGood.containsKey(key)) { + Setting<String> good = knownGood.get(key); + Setting<String> unknown = toValidate.get(key); + ValueValidator checker = good.getValidator(); + if (checker != null) { + try { + checker.validate(unknown.getValue()); + } catch (IllegalArgumentException e) { + Setting<String> strange = new Setting<String>(unknown); + strange.setValue(unknown.getValue()); + incorrectEntries.add(strange); + } + } + } else { + // check for unknown settings + Setting<String> strange = new Setting<String>(toValidate.get(key)); + unrecognizedEntries.add(strange); + } + } + + validated = true; + } + + /** + * @return a list of settings which have incorrect values + */ + public List<Setting<String>> getIncorrectSetting() { + if (!validated) { + throw new IllegalStateException(); + } + + return new ArrayList<Setting<String>>(incorrectEntries); + } + + /** + * @return a list of settings which are not recognized + */ + public List<Setting<String>> getUnrecognizedSetting() { + if (!validated) { + throw new IllegalStateException(); + } + return new ArrayList<Setting<String>>(unrecognizedEntries); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/netx/net/sourceforge/jnlp/config/Defaults.java Mon Dec 13 17:28:01 2010 -0500 @@ -0,0 +1,394 @@ +/* Defaults.java + Copyright (C) 2010 Red Hat, Inc. + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License as published by +the Free Software Foundation, version 2. + +IcedTea is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to +the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. +*/ + +package net.sourceforge.jnlp.config; + +import java.io.File; +import java.util.HashMap; +import java.util.Map; + +import net.sourceforge.jnlp.ShortcutDesc; +import net.sourceforge.jnlp.runtime.JNLPProxySelector; + +/** + * This class stores the default configuration + */ +public class Defaults { + + /** + * Get the default settings for deployment + */ + public static Map<String, Setting<String>> getDefaults() { + File userFile = new File(System.getProperty("user.home") + File.separator + DeploymentConfiguration.DEPLOYMENT_DIR + + File.separator + DeploymentConfiguration.DEPLOYMENT_PROPERTIES); + + SecurityManager sm = System.getSecurityManager(); + if (sm != null) { + sm.checkRead(userFile.toString()); + } + + final String SYSTEM_HOME = System.getProperty("java.home"); + final String SYSTEM_SECURITY = SYSTEM_HOME + File.separator + "lib" + File.separator + "security"; + + final String USER_HOME = System.getProperty("user.home") + File.separator + DeploymentConfiguration.DEPLOYMENT_DIR; + final String USER_SECURITY = USER_HOME + File.separator + "security"; + + final String LOCKS_DIR = System.getProperty("java.io.tmpdir") + File.separator + + System.getProperty("user.name") + File.separator + "netx" + File.separator + + "locks"; + + /* + * This is more or less a straight copy from the deployment + * configuration page, with occasional replacements of "" or no-defaults + * with null + * + * The format of this is: + * name + * checker (can be null or a ValueChecker) + * value (can be null or a String) + */ + + Object[][] defaults = new Object[][] { + /* infrastructure */ + { + DeploymentConfiguration.KEY_USER_CACHE_DIR, + BasicValueValidators.getFilePathValidator(), + USER_HOME + File.separator + "cache" + }, + { + DeploymentConfiguration.KEY_USER_PERSISTENCE_CACHE_DIR, + BasicValueValidators.getFilePathValidator(), + USER_HOME + File.separator + "pcache" + }, + { + DeploymentConfiguration.KEY_SYSTEM_CACHE_DIR, + BasicValueValidators.getFilePathValidator(), + null + }, + { + DeploymentConfiguration.KEY_USER_LOG_DIR, + BasicValueValidators.getFilePathValidator(), + USER_HOME + File.separator + "log" + }, + { + DeploymentConfiguration.KEY_USER_TMP_DIR, + BasicValueValidators.getFilePathValidator(), + USER_HOME + File.separator + "tmp" + }, + { + DeploymentConfiguration.KEY_USER_LOCKS_DIR, + BasicValueValidators.getFilePathValidator(), + LOCKS_DIR + }, + { + DeploymentConfiguration.KEY_USER_NETX_RUNNING_FILE, + BasicValueValidators.getFilePathValidator(), + LOCKS_DIR + File.separator + "netx_running" + }, + /* certificates and policy files */ + { + DeploymentConfiguration.KEY_USER_SECURITY_POLICY, + BasicValueValidators.getUrlValidator(), + "file://" + USER_SECURITY + File.separator + "java.policy" + }, + { + DeploymentConfiguration.KEY_USER_TRUSTED_CA_CERTS, + BasicValueValidators.getFilePathValidator(), + USER_SECURITY + File.separator + "trusted.cacerts" + }, + { + DeploymentConfiguration.KEY_USER_TRUSTED_JSSE_CA_CERTS, + BasicValueValidators.getFilePathValidator(), + USER_SECURITY + File.separator + "trusted.jssecacerts" + }, + { + DeploymentConfiguration.KEY_USER_TRUSTED_CERTS, + BasicValueValidators.getFilePathValidator(), + USER_SECURITY + File.separator + "trusted.certs" + }, + { + DeploymentConfiguration.KEY_USER_TRUSTED_JSSE_CERTS, + BasicValueValidators.getFilePathValidator(), + USER_SECURITY + File.separator + "trusted.jssecerts" + }, + { + DeploymentConfiguration.KEY_USER_TRUSTED_CLIENT_CERTS, + BasicValueValidators.getFilePathValidator(), + USER_SECURITY + File.separator + "trusted.clientcerts" + }, + { + DeploymentConfiguration.KEY_SYSTEM_SECURITY_POLICY, + BasicValueValidators.getUrlValidator(), + null + }, + { + DeploymentConfiguration.KEY_SYSTEM_TRUSTED_CA_CERTS, + BasicValueValidators.getFilePathValidator(), + SYSTEM_SECURITY + File.separator + "cacerts" + }, + { + DeploymentConfiguration.KEY_SYSTEM_TRUSTED_JSSE_CA_CERTS, + BasicValueValidators.getFilePathValidator(), + SYSTEM_SECURITY + File.separator + "jssecacerts" + }, + { + DeploymentConfiguration.KEY_SYSTEM_TRUSTED_CERTS, + BasicValueValidators.getFilePathValidator(), + SYSTEM_SECURITY + File.separator + "trusted.certs" + }, + { + DeploymentConfiguration.KEY_SYSTEM_TRUSTED_JSSE_CERTS, + BasicValueValidators.getFilePathValidator(), + SYSTEM_SECURITY + File.separator + "trusted.jssecerts" + }, + { + DeploymentConfiguration.KEY_SYSTEM_TRUSTED_CLIENT_CERTS, + BasicValueValidators.getFilePathValidator(), + SYSTEM_SECURITY + File.separator + "trusted.clientcerts" + }, + /* security access and control */ + { + DeploymentConfiguration.KEY_SECURITY_PROMPT_USER, + BasicValueValidators.getBooleanValidator(), + String.valueOf(true) + }, + { + "deployment.security.askgrantdialog.notinca", + BasicValueValidators.getBooleanValidator(), + String.valueOf(true) + }, + { + "deployment.security.notinca.warning", + BasicValueValidators.getBooleanValidator(), + String.valueOf(true) + }, + { + "deployment.security.expired.warning", + BasicValueValidators.getBooleanValidator(), + String.valueOf(true) + }, + { + "deployment.security.jsse.hostmismatch.warning", + BasicValueValidators.getBooleanValidator(), + String.valueOf(true) + }, + { + "deployment.security.trusted.policy", + BasicValueValidators.getFilePathValidator(), + null + }, + { + DeploymentConfiguration.KEY_SECURITY_ALLOW_HIDE_WINDOW_WARNING, + BasicValueValidators.getBooleanValidator(), + String.valueOf(true) + }, + { + DeploymentConfiguration.KEY_SECURITY_PROMPT_USER_FOR_JNLP, + BasicValueValidators.getBooleanValidator(), + String.valueOf(true) + }, + { + DeploymentConfiguration.KEY_SECURITY_INSTALL_AUTHENTICATOR, + BasicValueValidators.getBooleanValidator(), + String.valueOf(true) + }, + /* networking */ + { + DeploymentConfiguration.KEY_PROXY_TYPE, + BasicValueValidators.getRangedIntegerValidator(JNLPProxySelector.PROXY_TYPE_UNKNOWN, JNLPProxySelector.PROXY_TYPE_BROWSER), + String.valueOf(JNLPProxySelector.PROXY_TYPE_BROWSER) + }, + { + DeploymentConfiguration.KEY_PROXY_SAME, + BasicValueValidators.getBooleanValidator(), + String.valueOf(false) + }, + { + DeploymentConfiguration.KEY_PROXY_AUTO_CONFIG_URL, + BasicValueValidators.getUrlValidator(), + null + }, + { + DeploymentConfiguration.KEY_PROXY_BYPASS_LIST, + null, + null + }, + { + DeploymentConfiguration.KEY_PROXY_BYPASS_LOCAL, + null, + null + }, + { + DeploymentConfiguration.KEY_PROXY_HTTP_HOST, + null, + null + }, + { + DeploymentConfiguration.KEY_PROXY_HTTP_PORT, + null, + null + }, + { + DeploymentConfiguration.KEY_PROXY_HTTPS_HOST, + null, + null + }, + { + DeploymentConfiguration.KEY_PROXY_HTTPS_PORT, + null, + null + }, + { + DeploymentConfiguration.KEY_PROXY_FTP_HOST, + null, + null + }, + { + DeploymentConfiguration.KEY_PROXY_FTP_PORT, + null, + null + }, + { + DeploymentConfiguration.KEY_PROXY_SOCKS4_HOST, + null, + null + }, + { + DeploymentConfiguration.KEY_PROXY_SOCKS4_PORT, + null, + null + }, + { + DeploymentConfiguration.KEY_PROXY_OVERRIDE_HOSTS, + null, + null + }, + /* cache and optional package repository */ + { + "deployment.cache.max.size", + BasicValueValidators.getRangedIntegerValidator(-1, Integer.MAX_VALUE), + String.valueOf("-1") + }, + { + "deployment.cache.jarcompression", + BasicValueValidators.getRangedIntegerValidator(0, 10), + String.valueOf(0) + }, + { + "deployment.javapi.cache.enabled", + BasicValueValidators.getBooleanValidator(), + String.valueOf(false) + }, + /* java console */ + { + DeploymentConfiguration.KEY_CONSOLE_STARTUP_MODE, + BasicValueValidators.getStringValidator(new String[] { + DeploymentConfiguration.CONSOLE_DISABLE, + DeploymentConfiguration.CONSOLE_HIDE, + DeploymentConfiguration.CONSOLE_SHOW + }), + DeploymentConfiguration.CONSOLE_HIDE + }, + /* tracing and logging */ + { + DeploymentConfiguration.KEY_ENABLE_TRACING, + BasicValueValidators.getBooleanValidator(), + String.valueOf(false) + }, + { + DeploymentConfiguration.KEY_ENABLE_LOGGING, + BasicValueValidators.getBooleanValidator(), + String.valueOf(false) + }, + /* JNLP association */ + { + DeploymentConfiguration.KEY_JNLP_ASSOCIATIONS, + BasicValueValidators.getRangedIntegerValidator(DeploymentConfiguration.JNLP_ASSOCIATION_NEVER, + DeploymentConfiguration.JNLP_ASSOCIATION_REPLACE_ASK), + String.valueOf(DeploymentConfiguration.JNLP_ASSOCIATION_ASK_USER) + }, + /* desktop integration */ + { + DeploymentConfiguration.KEY_CREATE_DESKTOP_SHORTCUT, + BasicValueValidators.getStringValidator(new String[] { + ShortcutDesc.CREATE_ALWAYS, + ShortcutDesc.CREATE_ALWAYS_IF_HINTED, + ShortcutDesc.CREATE_ASK_USER, + ShortcutDesc.CREATE_ASK_USER_IF_HINTED, + ShortcutDesc.CREATE_NEVER + }), + ShortcutDesc.CREATE_ASK_USER_IF_HINTED + }, + /* jre selection */ + { + DeploymentConfiguration.KEY_JRE_INTSTALL_URL, + BasicValueValidators.getUrlValidator(), + null + }, + /* jre management */ + { + DeploymentConfiguration.KEY_AUTO_DOWNLOAD_JRE, + BasicValueValidators.getBooleanValidator(), + String.valueOf(false) + }, + /* browser selection */ + { + DeploymentConfiguration.KEY_BROWSER_PATH, + BasicValueValidators.getFilePathValidator(), + null + }, + /* check for update timeout */ + { + DeploymentConfiguration.KEY_UPDATE_TIMEOUT, + BasicValueValidators.getRangedIntegerValidator(0, 10000), + String.valueOf(500) + } + }; + + HashMap<String, Setting<String>> result = new HashMap<String, Setting<String>>(); + for (int i = 0; i < defaults.length; i++) { + String name = (String) defaults[i][0]; + ValueValidator checker = (ValueValidator) defaults[i][1]; + String actualValue = (String) defaults[i][2]; + boolean locked = false; + Setting<String> value = new Setting<String>(name, name, locked, checker, actualValue, actualValue, "<internal>"); + result.put(name, value); + } + + return result; + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/netx/net/sourceforge/jnlp/config/DeploymentConfiguration.java Mon Dec 13 17:28:01 2010 -0500 @@ -0,0 +1,611 @@ +// Copyright (C) 2010 Red Hat, Inc. +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +package net.sourceforge.jnlp.config; + +import static net.sourceforge.jnlp.runtime.Translator.R; + +import java.io.BufferedOutputStream; +import java.io.BufferedReader; +import java.io.File; +import java.io.FileOutputStream; +import java.io.FileReader; +import java.io.IOException; +import java.io.OutputStream; +import java.io.PrintStream; +import java.io.Reader; +import java.net.MalformedURLException; +import java.net.URL; +import java.nio.channels.FileLock; +import java.util.HashMap; +import java.util.Map; +import java.util.Properties; +import java.util.Set; + +import javax.naming.ConfigurationException; + +import net.sourceforge.jnlp.runtime.JNLPRuntime; + +/** + * Manages the various properties and configuration related to deployment. + * + * See: + * http://download.oracle.com/javase/1.5.0/docs/guide/deployment/deployment-guide/properties.html + */ +public final class DeploymentConfiguration { + + public static final String DEPLOYMENT_DIR = ".icedtea"; + public static final String DEPLOYMENT_CONFIG = "deployment.config"; + public static final String DEPLOYMENT_PROPERTIES = "deployment.properties"; + + public static final String DEPLOYMENT_COMMENT = "Netx deployment configuration"; + + public static final int JNLP_ASSOCIATION_NEVER = 0; + public static final int JNLP_ASSOCIATION_NEW_ONLY = 1; + public static final int JNLP_ASSOCIATION_ASK_USER = 2; + public static final int JNLP_ASSOCIATION_REPLACE_ASK = 3; + + /* + * FIXME these should be moved into JavaConsole, but there is a strange + * dependency in the build system. First all of netx is built. Then the + * plugin is built. So we cannot refer to plugin code in here :( + */ + public static final String CONSOLE_HIDE = "HIDE"; + public static final String CONSOLE_SHOW = "SHOW"; + public static final String CONSOLE_DISABLE = "DISABLE"; + + public static final String KEY_USER_CACHE_DIR = "deployment.user.cachedir"; + public static final String KEY_USER_PERSISTENCE_CACHE_DIR = "deployment.user.pcachedir"; + public static final String KEY_SYSTEM_CACHE_DIR = "deployment.system.cachedir"; + public static final String KEY_USER_LOG_DIR = "deployment.user.logdir"; + public static final String KEY_USER_TMP_DIR = "deployment.user.tmp"; + /** the directory containing locks for single instance applications */ + public static final String KEY_USER_LOCKS_DIR = "deployment.user.locksdir"; + /** + * The netx_running file is used to indicate if any instances of netx are + * running (this file may exist even if no instances are running). All netx + * instances acquire a shared lock on this file. If this file can be locked + * (using a {@link FileLock}) in exclusive mode, then other netx instances + * are not running + */ + public static final String KEY_USER_NETX_RUNNING_FILE = "deployment.user.runningfile"; + + public static final String KEY_USER_SECURITY_POLICY = "deployment.user.security.policy"; + public static final String KEY_USER_TRUSTED_CA_CERTS = "deployment.user.security.trusted.cacerts"; + public static final String KEY_USER_TRUSTED_JSSE_CA_CERTS = "deployment.user.security.trusted.jssecacerts"; + public static final String KEY_USER_TRUSTED_CERTS = "deployment.user.security.trusted.certs"; + public static final String KEY_USER_TRUSTED_JSSE_CERTS = "deployment.user.security.trusted.jssecerts"; + public static final String KEY_USER_TRUSTED_CLIENT_CERTS = "deployment.user.security.trusted.clientauthcerts"; + + public static final String KEY_SYSTEM_SECURITY_POLICY = "deployment.system.security.policy"; + public static final String KEY_SYSTEM_TRUSTED_CA_CERTS = "deployment.system.security.cacerts"; + public static final String KEY_SYSTEM_TRUSTED_JSSE_CA_CERTS = "deployment.system.security.jssecacerts"; + public static final String KEY_SYSTEM_TRUSTED_CERTS = "deployment.system.security.trusted.certs"; + public static final String KEY_SYSTEM_TRUSTED_JSSE_CERTS = "deployment.system.security.trusted.jssecerts"; + public static final String KEY_SYSTEM_TRUSTED_CLIENT_CERTS = "deployment.system.security.trusted.clientautcerts"; + + /* + * Security and access control + */ + + /** Boolean. Only show security prompts to user if true */ + public static final String KEY_SECURITY_PROMPT_USER = "deployment.security.askgrantdialog.show"; + + /** Boolean. Only give AWTPermission("showWindowWithoutWarningBanner") if true */ + public static final String KEY_SECURITY_ALLOW_HIDE_WINDOW_WARNING = "deployment.security.sandbox.awtwarningwindow"; + + /** Boolean. Only prompt user for granting any JNLP permissions if true */ + public static final String KEY_SECURITY_PROMPT_USER_FOR_JNLP = "deployment.security.sandbox.jnlp.enhanced"; + + /** Boolean. Only install the custom authenticator if true */ + public static final String KEY_SECURITY_INSTALL_AUTHENTICATOR = "deployment.security.authenticator"; + + /* + * Networking + */ + public static final String KEY_PROXY_TYPE = "deployment.proxy.type"; + public static final String KEY_PROXY_SAME = "deployment.proxy.same"; + public static final String KEY_PROXY_AUTO_CONFIG_URL = "deployment.proxy.auto.config.url"; + public static final String KEY_PROXY_BYPASS_LIST = "deployment.proxy.bypass.list"; + public static final String KEY_PROXY_BYPASS_LOCAL = "deployment.proxy.bypass.local"; + public static final String KEY_PROXY_HTTP_HOST = "deployment.proxy.http.host"; + public static final String KEY_PROXY_HTTP_PORT = "deployment.proxy.http.port"; + public static final String KEY_PROXY_HTTPS_HOST = "deployment.proxy.https.host"; + public static final String KEY_PROXY_HTTPS_PORT = "deployment.proxy.https.port"; + public static final String KEY_PROXY_FTP_HOST = "deployment.proxy.ftp.host"; + public static final String KEY_PROXY_FTP_PORT = "deployment.proxy.ftp.port"; + public static final String KEY_PROXY_SOCKS4_HOST = "deployment.proxy.socks.host"; + public static final String KEY_PROXY_SOCKS4_PORT = "deployment.proxy.socks.port"; + public static final String KEY_PROXY_OVERRIDE_HOSTS = "deployment.proxy.override.hosts"; + + /* + * Tracing and Logging + */ + public static final String KEY_ENABLE_TRACING = "deployment.trace"; + public static final String KEY_ENABLE_LOGGING = "deployment.log"; + + /* + * Console + */ + public static final String KEY_CONSOLE_STARTUP_MODE = "deployment.console.startup.mode"; + + /* + * Desktop Integration + */ + + public static final String KEY_JNLP_ASSOCIATIONS = "deployment.javaws.associations"; + public static final String KEY_CREATE_DESKTOP_SHORTCUT = "deployment.javaws.shortcut"; + + public static final String KEY_JRE_INTSTALL_URL = "deployment.javaws.installURL"; + public static final String KEY_AUTO_DOWNLOAD_JRE = "deployment.javaws.autodownload"; + + public static final String KEY_BROWSER_PATH = "deployment.browser.path"; + public static final String KEY_UPDATE_TIMEOUT = "deployment.javaws.update.timeout"; + + public enum ConfigType { + System, User + } + + /** is it mandatory to load the system properties? */ + private boolean systemPropertiesMandatory = false; + + /** The system's deployment.config file */ + private File systemPropertiesFile = null; + /** The user's deployment.config file */ + private File userPropertiesFile = null; + + /** the current deployment properties */ + private Map<String, Setting<String>> currentConfiguration; + + /** the deployment properties that cannot be changed */ + private Map<String, Setting<String>> unchangeableConfiguration; + + public DeploymentConfiguration() { + currentConfiguration = new HashMap<String, Setting<String>>(); + unchangeableConfiguration = new HashMap<String, Setting<String>>(); + } + + /** + * Initialize this deployment configuration by reading configuration files. + * Generally, it will try to continue and ignore errors it finds (such as file not found). + * + * @throws DeploymentException if it encounters a fatal error. + */ + public void load() throws ConfigurationException { + load(true); + } + + /** + * Initialize this deployment configuration by reading configuration files. + * Generally, it will try to continue and ignore errors it finds (such as file not found). + * + * @param fixIssues If true, fix issues that are discovered when reading configuration by + * resorting to the default values + * @throws DeploymentException if it encounters a fatal error. + */ + public void load(boolean fixIssues) throws ConfigurationException { + // make sure no state leaks if security check fails later on + File userFile = new File(System.getProperty("user.home") + File.separator + DEPLOYMENT_DIR + + File.separator + DEPLOYMENT_PROPERTIES); + + SecurityManager sm = System.getSecurityManager(); + if (sm != null) { + sm.checkRead(userFile.toString()); + } + + Map<String, Setting<String>> initialProperties = Defaults.getDefaults(); + + Map<String, Setting<String>> systemProperties = null; + + /* + * First, try to read the system's deployment.config file to find if + * there is a system-level deployment.poperties file + */ + + File systemConfigFile = findSystemConfigFile(); + if (systemConfigFile != null) { + if (loadSystemConfiguration(systemConfigFile)) { + if (JNLPRuntime.isDebug()) { + System.out.println("System level " + DEPLOYMENT_CONFIG + " is mandatory: " + systemPropertiesMandatory); + } + /* Second, read the System level deployment.properties file */ + systemProperties = loadProperties(ConfigType.System, systemPropertiesFile, + systemPropertiesMandatory); + } + if (systemProperties != null) { + mergeMaps(initialProperties, systemProperties); + } + } + + /* need a copy of the original when we have to save */ + unchangeableConfiguration = new HashMap<String, Setting<String>>(); + Set<String> keys = initialProperties.keySet(); + for (String key : keys) { + unchangeableConfiguration.put(key, new Setting<String>(initialProperties.get(key))); + } + + /* + * Third, read the user's deployment.properties file + */ + userPropertiesFile = userFile; + Map<String, Setting<String>> userProperties = loadProperties(ConfigType.User, userPropertiesFile, false); + if (userProperties != null) { + mergeMaps(initialProperties, userProperties); + } + + if (fixIssues) { + checkAndFixConfiguration(initialProperties); + } + + currentConfiguration = initialProperties; + } + + /** + * Get the value for the given key + * + * @param key the property key + * @return the value for the key, or null if it can not be found + */ + public String getProperty(String key) { + SecurityManager sm = System.getSecurityManager(); + if (sm != null) { + if (userPropertiesFile != null) { + sm.checkRead(userPropertiesFile.toString()); + } + } + + return currentConfiguration.get(key).getValue(); + } + + /** + * @return a Set containing all the property names + */ + public Set<String> getAllPropertyNames() { + SecurityManager sm = System.getSecurityManager(); + if (sm != null) { + if (userPropertiesFile != null) { + sm.checkRead(userPropertiesFile.toString()); + } + } + + return currentConfiguration.keySet(); + } + + /** + * @return a map containing property names and the corresponding settings + */ + public Map<String, Setting<String>> getRaw() { + SecurityManager sm = System.getSecurityManager(); + if (sm != null) { + if (userPropertiesFile != null) { + sm.checkRead(userPropertiesFile.toString()); + } + } + + return currentConfiguration; + } + + /** + * Sets the value of corresponding to the key. If the value has been marked + * as locked, it is not changed + * + * @param key the key + * @param value the value to be associated with the key + */ + public void setProperty(String key, String value) { + SecurityManager sm = System.getSecurityManager(); + if (sm != null) { + if (userPropertiesFile != null) { + sm.checkWrite(userPropertiesFile.toString()); + } + } + + Setting<String> currentValue = currentConfiguration.get(key); + if (currentValue != null) { + if (!currentValue.isLocked()) { + currentValue.setValue(value); + } + } else { + currentValue = new Setting<String>(key, key, false, null, null, value, "<unknown>"); + currentConfiguration.put(key, currentValue); + } + } + + /** + * Check that the configuration is valid. If there are invalid values,set + * those values to the default values. This is done by using check() + * method of the ValueCheker for each setting on the actual value. Fixes + * are made in-place. + * + * @param initial a map representing the initial configuration + */ + public void checkAndFixConfiguration(Map<String, Setting<String>> initial) { + + Map<String, Setting<String>> defaults = Defaults.getDefaults(); + + for (String key : initial.keySet()) { + Setting<String> s = initial.get(key); + 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)); + } else { + ValueValidator checker = defaults.get(key).getValidator(); + if (checker == null) { + continue; + } + + try { + checker.validate(s.getValue()); + } catch (IllegalArgumentException e) { + System.out.println(R("DCErrorInSetting", key, s.getValue(), s.getDefaultValue(), checker.getPossibleValues())); + s.setValue(s.getDefaultValue()); + } + } + } + } + + /** + * @return the location of system-level deployment.config file, or null if none can be found + */ + private File findSystemConfigFile() { + File etcFile = new File(File.separator + "etc" + File.separator + ".java" + File.separator + + "deployment" + File.separator + DEPLOYMENT_CONFIG); + if (etcFile.isFile()) { + return etcFile; + } + + File jreFile = new File(System.getProperty("java.home") + File.separator + "lib" + + File.separator + DEPLOYMENT_CONFIG); + if (jreFile.isFile()) { + return jreFile; + } + + return null; + } + + /** + * Reads the system configuration file and sets the relevant + * system-properties related variables + */ + private boolean loadSystemConfiguration(File configFile) { + + if (JNLPRuntime.isDebug()) { + System.out.println("Loading system configuation from: " + configFile); + } + + Map<String, Setting<String>> systemConfiguration = new HashMap<String, Setting<String>>(); + try { + systemConfiguration = parsePropertiesFile(configFile); + } catch (IOException e) { + if (JNLPRuntime.isDebug()) { + System.out.println("No System level " + DEPLOYMENT_PROPERTIES + " found."); + } + return false; + } + + /* + * at this point, we have read the system deployment.config file + * completely + */ + + try { + String urlString = systemConfiguration.get("deployment.system.config").getValue(); + if (urlString == null) { + if (JNLPRuntime.isDebug()) { + System.out.println("No System level " + DEPLOYMENT_PROPERTIES + " found."); + } + return false; + } + URL url = new URL(urlString); + if (url.getProtocol().equals("file")) { + systemPropertiesFile = new File(url.getFile()); + if (JNLPRuntime.isDebug()) { + System.out.println("Using System level" + DEPLOYMENT_PROPERTIES + ": " + + systemPropertiesFile); + } + Setting<String> mandatory = systemConfiguration.get("deployment.system.config.mandatory"); + systemPropertiesMandatory = Boolean.valueOf(mandatory == null ? null : (String) mandatory.getValue()); + return true; + } else { + if (JNLPRuntime.isDebug()) { + System.out.println("Remote + " + DEPLOYMENT_PROPERTIES + " not supported"); + } + return false; + } + } catch (MalformedURLException e) { + if (JNLPRuntime.isDebug()) { + System.out.println("Invalid url for " + DEPLOYMENT_PROPERTIES); + } + return false; + } + } + + /** + * Loads the properties file, if one exists + * + * @param type the ConfigType to load + * @param file the File to load Properties from + * @param mandatory indicates if reading this file is mandatory + * + * @throws ConfigurationException if the file is mandatory but cannot be read + */ + private Map<String, Setting<String>> loadProperties(ConfigType type, File file, boolean mandatory) + throws ConfigurationException { + if (file == null || !file.isFile()) { + if (JNLPRuntime.isDebug()) { + System.out.println("No " + type.toString() + " level " + DEPLOYMENT_PROPERTIES + " found."); + } + if (!mandatory) { + return null; + } else { + throw new ConfigurationException(); + } + } + + if (JNLPRuntime.isDebug()) { + System.out.println("Loading " + type.toString() + " level properties from: " + file); + } + try { + return parsePropertiesFile(file); + } catch (IOException e) { + return null; + } + } + + /** + * Saves all properties that are not part of default or system properties + * + * @throws IOException if unable to save the file + * @throws IllegalStateException if save() is called before load() + */ + public void save() throws IOException { + if (userPropertiesFile == null) { + throw new IllegalStateException("must load() before save()"); + } + + SecurityManager sm = System.getSecurityManager(); + if (sm != null) { + sm.checkWrite(userPropertiesFile.toString()); + } + + if (JNLPRuntime.isDebug()) { + System.out.println("Saving properties into " + userPropertiesFile.toString()); + } + Properties toSave = new Properties(); + + for (String key : currentConfiguration.keySet()) { + String oldValue = unchangeableConfiguration.get(key) == null ? null + : (String) unchangeableConfiguration.get(key).getValue(); + String newValue = currentConfiguration.get(key) == null ? null : (String) currentConfiguration + .get(key).getValue(); + if (oldValue == null && newValue == null) { + continue; + } else if (oldValue == null && newValue != null) { + toSave.setProperty(key, newValue); + } else if (oldValue != null && newValue == null) { + toSave.setProperty(key, newValue); + } else { // oldValue != null && newValue != null + if (!oldValue.equals(newValue)) { + toSave.setProperty(key, newValue); + } + } + } + + File backupPropertiesFile = new File(userPropertiesFile.toString() + ".old"); + if (userPropertiesFile.isFile()) { + if (!userPropertiesFile.renameTo(backupPropertiesFile)) { + throw new IOException("Error saving backup copy of " + userPropertiesFile); + } + } + + userPropertiesFile.getParentFile().mkdirs(); + OutputStream out = new BufferedOutputStream(new FileOutputStream(userPropertiesFile)); + try { + toSave.store(out, DEPLOYMENT_COMMENT); + } finally { + out.close(); + } + } + + /** + * Reads a properties file and returns a map representing the properties + * + * @param propertiesFile the file to read Properties from + * @param destination the map to which all the properties should be added + * @throws IOException if an IO problem occurs + */ + private Map<String, Setting<String>> parsePropertiesFile(File propertiesFile) throws IOException { + Map<String, Setting<String>> result = new HashMap<String, Setting<String>>(); + + Properties properties = new Properties(); + + Reader reader = new BufferedReader(new FileReader(propertiesFile)); + try { + properties.load(reader); + } finally { + reader.close(); + } + + Set<String> keys = properties.stringPropertyNames(); + for (String key : keys) { + if (key.endsWith(".locked")) { + String realKey = key.substring(0, key.length() - ".locked".length()); + Setting<String> configValue = result.get(realKey); + if (configValue == null) { + configValue = new Setting<String>(realKey, realKey, true, null, null, null, propertiesFile.toString()); + result.put(realKey, configValue); + } else { + configValue.setLocked(true); + } + } else { + /* when parsing a properties we set value without checking if it is locked or not */ + String newValue = properties.getProperty(key); + Setting<String> configValue = result.get(key); + if (configValue == null) { + configValue = new Setting<String>(key, key, false, null, null, newValue, propertiesFile.toString()); + result.put(key, configValue); + } else { + configValue.setValue(newValue); + configValue.setSource(propertiesFile.toString()); + } + } + } + return result; + } + + /** + * Merges two maps while respecting whether the values have been locked or + * not. All values from srcMap are put into finalMap, replacing values in + * finalMap if necessary, unless the value is present and marked as locked + * in finalMap + * + * @param finalMap the destination for putting values + * @param srcMap the source for reading key value pairs + */ + private void mergeMaps(Map<String, Setting<String>> finalMap, Map<String, Setting<String>> srcMap) { + for (String key : srcMap.keySet()) { + Setting<String> destValue = finalMap.get(key); + Setting<String> srcValue = srcMap.get(key); + if (destValue == null) { + finalMap.put(key, srcValue); + } else { + if (!destValue.isLocked()) { + destValue.setSource(srcValue.getSource()); + destValue.setValue(srcValue.getValue()); + } + } + } + } + + /** + * Dumps the configuration to the PrintStream + * + * @param config a map of key,value pairs representing the configuration to + * dump + * @param out the PrintStream to write data to + */ + @SuppressWarnings("unused") + private static void dumpConfiguration(Map<String, Setting<String>> config, PrintStream out) { + System.out.println("KEY: VALUE [Locked]"); + + for (String key : config.keySet()) { + Setting<String> value = config.get(key); + out.println("'" + key + "': '" + value.getValue() + "'" + + (value.isLocked() ? " [LOCKED]" : "")); + } + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/netx/net/sourceforge/jnlp/config/Setting.java Mon Dec 13 17:28:01 2010 -0500 @@ -0,0 +1,176 @@ +/* Setting.java + Copyright (C) 2010 Red Hat, Inc. + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License as published by +the Free Software Foundation, version 2. + +IcedTea is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to +the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. +*/ + +package net.sourceforge.jnlp.config; + +/** + * Represents a value for a configuration. Provides methods to get the value + * as well as marking the value as locked. + * + * Each instance of this class has an associated ValueChecker. This checker + * can be used to check if the current value is valid. The default value + * _must_ be valid. Null values can not originate externally so are (mostly) + * considered valid. + */ +public class Setting<T> { + + private String name = null; + private String description = null; + private boolean locked = false; + private ValueValidator validator = null; + private T defaultValue = null; + private T value = null; + private String source = null; + + /** + * Creates a new Settings object + * + * @param name the name of this setting + * @param description a human readable description of this setting + * @param locked whether this setting is currently locked + * @param validator the {@link ValueValidator} that can be used to validate + * the value + * @param defaultValue the default value of this setting. If this is not a + * recognized setting, use null. + * @param value the initial value of this setting + * @param source the origin of the value (a file, or perhaps "<internal>") + */ + public Setting(String name, String description, boolean locked, + ValueValidator validator, T defaultValue, T value, String source) { + this.name = name; + this.description = description; + this.locked = locked; + this.validator = validator; + this.source = source; + this.defaultValue = defaultValue; + this.value = value; + } + + /** + * Creates a new Settings object by cloning the values from another + * Settings object + * @param other a Settings object to initialize settings from + */ + public Setting(Setting<T> other) { + this(other.name, other.description, other.locked, other.validator, + other.defaultValue, other.value, other.source); + } + + /** + * @return the {@link ValueValidator} that can be used to check if + * the current value is valid + */ + public ValueValidator getValidator() { + return validator; + } + + /** + * @return the default value for this setting. May be null if this is not + * one of the supported settings + */ + public T getDefaultValue() { + return defaultValue; + } + + /** + * @return a human readable description of this setting + */ + public String getDescription() { + return description; + } + + /** + * @return the name (like foo.bar.baz) of this setting + */ + public String getName() { + return name; + } + + /** + * @return the source of the current value of this setting. May be a string + * like "internal" or it may be the location of the properties file + */ + public String getSource() { + return source; + } + + /** + * @return the current value of this setting + */ + public T getValue() { + return value; + } + + /** + * @return true if this setting is locked + */ + public boolean isLocked() { + return locked; + } + + /** + * Marks this setting as locked or unlocked. Setting the value is not + * enforced by this class. + * + * @param locked whether to mark this setting as locked or not locked. + */ + public void setLocked(boolean locked) { + this.locked = locked; + } + + /** + * Sets the source of the current value of this Setting. Maybe a string + * like "internal" or the location of the properties file + * + * @param source the source of the value + */ + public void setSource(String source) { + this.source = source; + } + + /** + * Note that setting the value is not enforced - it is the caller's + * responsibility to check if a value is locked or not before setting a + * new value + * + * @param value the new value + */ + public void setValue(T value) { + this.value = value; + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/netx/net/sourceforge/jnlp/config/ValueValidator.java Mon Dec 13 17:28:01 2010 -0500 @@ -0,0 +1,66 @@ +/* ValueChecker.java + Copyright (C) 2010 Red Hat, Inc. + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License as published by +the Free Software Foundation, version 2. + +IcedTea is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to +the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. +*/ + +package net.sourceforge.jnlp.config; + +/** + * A class implements the ValueValidator interface to indicate that it can validate + * values. + * + * @see BasicValueValidators + */ +public interface ValueValidator { + + /** + * This method checks if the given object is a valid value for this + * specific {@link ValueValidator}. Any arbitrary operation can be + * performed to ensure that the value is valid. + * + * @param value The object to validate + * @throws IllegalArgumentException if the value is invalid + */ + public void validate(Object value) throws IllegalArgumentException; + + /** + * Returns a string describing possible values in human-readable form that + * this {@link ValueValidator} accepts + * + * @return a string describing possible values that this + * {@link ValueValidator} accepts + */ + public String getPossibleValues(); +}
--- a/netx/net/sourceforge/jnlp/controlpanel/AdvancedProxySettingsDialog.java Mon Dec 13 16:12:06 2010 -0500 +++ b/netx/net/sourceforge/jnlp/controlpanel/AdvancedProxySettingsDialog.java Mon Dec 13 17:28:01 2010 -0500 @@ -31,7 +31,7 @@ import javax.swing.SwingUtilities; import javax.swing.UIManager; -import net.sourceforge.jnlp.runtime.DeploymentConfiguration; +import net.sourceforge.jnlp.config.DeploymentConfiguration; import net.sourceforge.jnlp.runtime.Translator; /**
--- a/netx/net/sourceforge/jnlp/controlpanel/AdvancedProxySettingsPane.java Mon Dec 13 16:12:06 2010 -0500 +++ b/netx/net/sourceforge/jnlp/controlpanel/AdvancedProxySettingsPane.java Mon Dec 13 17:28:01 2010 -0500 @@ -43,7 +43,7 @@ import javax.swing.JTextArea; import javax.swing.JTextField; -import net.sourceforge.jnlp.runtime.DeploymentConfiguration; +import net.sourceforge.jnlp.config.DeploymentConfiguration; import net.sourceforge.jnlp.runtime.Translator; /**
--- a/netx/net/sourceforge/jnlp/controlpanel/ControlPanel.java Mon Dec 13 16:12:06 2010 -0500 +++ b/netx/net/sourceforge/jnlp/controlpanel/ControlPanel.java Mon Dec 13 17:28:01 2010 -0500 @@ -46,7 +46,7 @@ import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionListener; -import net.sourceforge.jnlp.runtime.DeploymentConfiguration; +import net.sourceforge.jnlp.config.DeploymentConfiguration; import net.sourceforge.jnlp.runtime.JNLPRuntime; import net.sourceforge.jnlp.runtime.Translator; import net.sourceforge.jnlp.security.viewer.CertificatePane;
--- a/netx/net/sourceforge/jnlp/controlpanel/DebuggingPanel.java Mon Dec 13 16:12:06 2010 -0500 +++ b/netx/net/sourceforge/jnlp/controlpanel/DebuggingPanel.java Mon Dec 13 17:28:01 2010 -0500 @@ -32,7 +32,7 @@ import javax.swing.JLabel; import javax.swing.JPanel; -import net.sourceforge.jnlp.runtime.DeploymentConfiguration; +import net.sourceforge.jnlp.config.DeploymentConfiguration; import net.sourceforge.jnlp.runtime.Translator; /**
--- a/netx/net/sourceforge/jnlp/controlpanel/DesktopShortcutPanel.java Mon Dec 13 16:12:06 2010 -0500 +++ b/netx/net/sourceforge/jnlp/controlpanel/DesktopShortcutPanel.java Mon Dec 13 17:28:01 2010 -0500 @@ -29,7 +29,7 @@ import javax.swing.JComboBox; import javax.swing.JLabel; -import net.sourceforge.jnlp.runtime.DeploymentConfiguration; +import net.sourceforge.jnlp.config.DeploymentConfiguration; import net.sourceforge.jnlp.runtime.Translator; /**
--- a/netx/net/sourceforge/jnlp/controlpanel/MiddleClickListener.java Mon Dec 13 16:12:06 2010 -0500 +++ b/netx/net/sourceforge/jnlp/controlpanel/MiddleClickListener.java Mon Dec 13 17:28:01 2010 -0500 @@ -23,7 +23,7 @@ import javax.swing.JTextArea; import javax.swing.JTextField; -import net.sourceforge.jnlp.runtime.DeploymentConfiguration; +import net.sourceforge.jnlp.config.DeploymentConfiguration; /** * When middle click pastes to the textboxes it doesn't register it... This is
--- a/netx/net/sourceforge/jnlp/controlpanel/NetworkSettingsPanel.java Mon Dec 13 16:12:06 2010 -0500 +++ b/netx/net/sourceforge/jnlp/controlpanel/NetworkSettingsPanel.java Mon Dec 13 17:28:01 2010 -0500 @@ -43,7 +43,7 @@ import javax.swing.JRadioButton; import javax.swing.JTextField; -import net.sourceforge.jnlp.runtime.DeploymentConfiguration; +import net.sourceforge.jnlp.config.DeploymentConfiguration; import net.sourceforge.jnlp.runtime.Translator; /**
--- a/netx/net/sourceforge/jnlp/controlpanel/SecuritySettingsPanel.java Mon Dec 13 16:12:06 2010 -0500 +++ b/netx/net/sourceforge/jnlp/controlpanel/SecuritySettingsPanel.java Mon Dec 13 17:28:01 2010 -0500 @@ -30,7 +30,7 @@ import javax.swing.JLabel; import javax.swing.JPanel; -import net.sourceforge.jnlp.runtime.DeploymentConfiguration; +import net.sourceforge.jnlp.config.DeploymentConfiguration; import net.sourceforge.jnlp.runtime.Translator; /**
--- a/netx/net/sourceforge/jnlp/controlpanel/TemporaryInternetFilesPanel.java Mon Dec 13 16:12:06 2010 -0500 +++ b/netx/net/sourceforge/jnlp/controlpanel/TemporaryInternetFilesPanel.java Mon Dec 13 17:28:01 2010 -0500 @@ -46,7 +46,7 @@ import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; -import net.sourceforge.jnlp.runtime.DeploymentConfiguration; +import net.sourceforge.jnlp.config.DeploymentConfiguration; import net.sourceforge.jnlp.runtime.Translator; /**
--- a/netx/net/sourceforge/jnlp/resources/Messages.properties Mon Dec 13 16:12:06 2010 -0500 +++ b/netx/net/sourceforge/jnlp/resources/Messages.properties Mon Dec 13 17:28:01 2010 -0500 @@ -232,6 +232,17 @@ KSCaCerts=Trusted Root CA Certificates KSJsseCaCerts=Trusted JSSE Root CA Certificates, KSClientCerts=Client Authentication Certificates + +# Deployment Configuration messages +DCErrorInSetting=Error: setting "{0}" has incorrect value "{1}". Using the default value "{2}" instead. Possible values {3}. +DCInternal=Internal error: {0} +DCUnknownSettingWithVal=Unknown setting "{0}" + +# Value Validator messages. Messages should follow "Possible values ..." +VVPossibleBooleanValues=are {0} or {1} +VVPossibleFileValues=include the absolute location of a file - it must begin with a / +VVPossibleRangedIntegerValues=are in range {0} to {1} (inclusive) +VVPossibleUrlValues=include any valid url (eg http://icedtea.classpath.org/hg/) # Control Panel - Tab Descriptions CPAboutDescription=View version information about Icedtea Control Panel.
--- a/netx/net/sourceforge/jnlp/runtime/ApplicationInstance.java Mon Dec 13 16:12:06 2010 -0500 +++ b/netx/net/sourceforge/jnlp/runtime/ApplicationInstance.java Mon Dec 13 17:28:01 2010 -0500 @@ -32,6 +32,7 @@ import net.sourceforge.jnlp.PropertyDesc; import net.sourceforge.jnlp.SecurityDesc; import net.sourceforge.jnlp.ShortcutDesc; +import net.sourceforge.jnlp.config.DeploymentConfiguration; import net.sourceforge.jnlp.event.ApplicationEvent; import net.sourceforge.jnlp.event.ApplicationListener; import net.sourceforge.jnlp.security.SecurityWarning;
--- a/netx/net/sourceforge/jnlp/runtime/DeploymentConfiguration.java Mon Dec 13 16:12:06 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,690 +0,0 @@ -// Copyright (C) 2010 Red Hat, Inc. -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -package net.sourceforge.jnlp.runtime; - -import java.awt.AWTPermission; -import java.io.BufferedOutputStream; -import java.io.BufferedReader; -import java.io.File; -import java.io.FileOutputStream; -import java.io.FileReader; -import java.io.IOException; -import java.io.OutputStream; -import java.io.PrintStream; -import java.io.Reader; -import java.net.MalformedURLException; -import java.net.URL; -import java.nio.channels.FileLock; -import java.util.HashMap; -import java.util.Map; -import java.util.Properties; -import java.util.Set; - -import javax.naming.ConfigurationException; - -import net.sourceforge.jnlp.ShortcutDesc; - -/** - * Manages the various properties and configuration related to deployment. - * - * See: - * http://download.oracle.com/javase/1.5.0/docs/guide/deployment/deployment-guide/properties.html - */ -public final class DeploymentConfiguration { - - /** - * Represents a value for a configuration. Provides methods to get the value - * as well as marking the value as locked. - */ - private final class ConfigValue { - - private String value; - private boolean locked; - - ConfigValue(String value) { - this(value, false); - } - - ConfigValue(String value, boolean locked) { - this.value = value; - this.locked = locked; - } - - ConfigValue(ConfigValue other) { - this(other.value, other.locked); - } - - String get() { - return value; - } - - /** - * Note that setting the value is not enforced - it is the caller's - * responsibility to check if a value is locked or not before setting a - * new value - * - * @param value the new value - */ - void set(String value) { - this.value = value; - } - - /** - * @return true if the value has been marked as locked - */ - boolean isLocked() { - return locked; - } - - /** - * Mark a value as locked - * @param locked - */ - void setLocked(boolean locked) { - this.locked = locked; - } - } - - public static final String DEPLOYMENT_DIR = ".icedtea"; - public static final String DEPLOYMENT_CONFIG = "deployment.config"; - public static final String DEPLOYMENT_PROPERTIES = "deployment.properties"; - - public static final String DEPLOYMENT_COMMENT = "Netx deployment configuration"; - - public static final int JNLP_ASSOCIATION_NEVER = 0; - public static final int JNLP_ASSOCIATION_NEW_ONLY = 1; - public static final int JNLP_ASSOCIATION_ASK_USER = 2; - public static final int JNLP_ASSOCIATION_REPLACE_ASK = 3; - - /* - * FIXME these should be moved into JavaConsole, but there is a strange - * dependency in the build system. First all of netx is built. Then the - * plugin is built. So we cannot refer to plugin code in here :( - */ - public static final String CONSOLE_HIDE = "HIDE"; - public static final String CONSOLE_SHOW = "SHOW"; - public static final String CONSOLE_DISABLE = "DISABLE"; - - public static final String KEY_USER_CACHE_DIR = "deployment.user.cachedir"; - public static final String KEY_USER_PERSISTENCE_CACHE_DIR = "deployment.user.pcachedir"; - public static final String KEY_SYSTEM_CACHE_DIR = "deployment.system.cachedir"; - public static final String KEY_USER_LOG_DIR = "deployment.user.logdir"; - public static final String KEY_USER_TMP_DIR = "deployment.user.tmp"; - /** the directory containing locks for single instance applications */ - public static final String KEY_USER_LOCKS_DIR = "deployment.user.locksdir"; - /** - * The netx_running file is used to indicate if any instances of netx are - * running (this file may exist even if no instances are running). All netx - * instances acquire a shared lock on this file. If this file can be locked - * (using a {@link FileLock}) in exclusive mode, then other netx instances - * are not running - */ - public static final String KEY_USER_NETX_RUNNING_FILE = "deployment.user.runningfile"; - - public static final String KEY_USER_TRUSTED_CA_CERTS = "deployment.user.security.trusted.cacerts"; - public static final String KEY_USER_TRUSTED_JSSE_CA_CERTS = "deployment.user.security.trusted.jssecacerts"; - public static final String KEY_USER_TRUSTED_CERTS = "deployment.user.security.trusted.certs"; - public static final String KEY_USER_TRUSTED_JSSE_CERTS = "deployment.user.security.trusted.jssecerts"; - public static final String KEY_USER_TRUSTED_CLIENT_CERTS = "deployment.user.security.trusted.clientauthcerts"; - - public static final String KEY_SYSTEM_TRUSTED_CA_CERTS = "deployment.system.security.cacerts"; - public static final String KEY_SYSTEM_TRUSTED_JSSE_CA_CERTS = "deployment.system.security.jssecacerts"; - public static final String KEY_SYSTEM_TRUSTED_CERTS = "deployment.system.security.trusted.certs"; - public static final String KEY_SYSTEM_TRUSTED_JSSE_CERTS = "deployment.system.security.trusted.jssecerts"; - public static final String KEY_SYSTEM_TRUSTED_CLIENT_CERTS = "deployment.system.security.trusted.clientautcerts"; - - /* - * Security and access control - */ - - /** Boolean. Only show security prompts to user if true */ - public static final String KEY_SECURITY_PROMPT_USER = "deployment.security.askgrantdialog.show"; - - /** Boolean. Only give AWTPermission("showWindowWithoutWarningBanner") if true */ - public static final String KEY_SECURITY_ALLOW_HIDE_WINDOW_WARNING = "deployment.security.sandbox.awtwarningwindow"; - - /** Boolean. Only prompt user for granting any JNLP permissions if true */ - public static final String KEY_SECURITY_PROMPT_USER_FOR_JNLP = "deployment.security.sandbox.jnlp.enhanced"; - - /** Boolean. Only install the custom authenticator if true */ - public static final String KEY_SECURITY_INSTALL_AUTHENTICATOR = "deployment.security.authenticator"; - - /* - * Networking - */ - public static final String KEY_PROXY_TYPE = "deployment.proxy.type"; - public static final String KEY_PROXY_SAME = "deployment.proxy.same"; - public static final String KEY_PROXY_AUTO_CONFIG_URL = "deployment.proxy.auto.config.url"; - public static final String KEY_PROXY_BYPASS_LIST = "deployment.proxy.bypass.list"; - public static final String KEY_PROXY_BYPASS_LOCAL = "deployment.proxy.bypass.local"; - public static final String KEY_PROXY_HTTP_HOST = "deployment.proxy.http.host"; - public static final String KEY_PROXY_HTTP_PORT = "deployment.proxy.http.port"; - public static final String KEY_PROXY_HTTPS_HOST = "deployment.proxy.https.host"; - public static final String KEY_PROXY_HTTPS_PORT = "deployment.proxy.https.port"; - public static final String KEY_PROXY_FTP_HOST = "deployment.proxy.ftp.host"; - public static final String KEY_PROXY_FTP_PORT = "deployment.proxy.ftp.port"; - public static final String KEY_PROXY_SOCKS4_HOST = "deployment.proxy.socks.host"; - public static final String KEY_PROXY_SOCKS4_PORT = "deployment.proxy.socks.port"; - public static final String KEY_PROXY_OVERRIDE_HOSTS = "deployment.proxy.override.hosts"; - - /* - * Tracing and Logging - */ - - public static final String KEY_ENABLE_LOGGING = "deployment.log"; - - /* - * Desktop Integration - */ - - public static final String KEY_CREATE_DESKTOP_SHORTCUT = "deployment.javaws.shortcut"; - - public static final String KEY_BROWSER_PATH = "deployment.browser.path"; - - public enum ConfigType { - System, User - } - - /** is it mandatory to load the system properties? */ - private boolean systemPropertiesMandatory = false; - - /** The system's deployment.config file */ - private File systemPropertiesFile = null; - /** The user's deployment.config file */ - private File userPropertiesFile = null; - - /** the current deployment properties */ - private Map<String, ConfigValue> currentConfiguration; - - /** the deployment properties that cannot be changed */ - private Map<String, ConfigValue> unchangeableConfiguration; - - public DeploymentConfiguration() { - currentConfiguration = new HashMap<String, ConfigValue>(); - unchangeableConfiguration = new HashMap<String, ConfigValue>(); - } - - /** - * Initialize this deployment configuration by reading configuration files. - * Generally, it will try to continue and ignore errors it finds (such as file not found). - * - * @throws DeploymentException if it encounters a fatal error. - */ - public void load() throws ConfigurationException { - // make sure no state leaks if security check fails later on - File userFile = new File(System.getProperty("user.home") + File.separator + DEPLOYMENT_DIR - + File.separator + DEPLOYMENT_PROPERTIES); - - SecurityManager sm = System.getSecurityManager(); - if (sm != null) { - sm.checkRead(userFile.toString()); - } - - Map<String, ConfigValue> initialProperties = loadDefaultProperties(); - - Map<String, ConfigValue> systemProperties = null; - - /* - * First, try to read the system's deployment.config file to find if - * there is a system-level deployment.poperties file - */ - - File systemConfigFile = findSystemConfigFile(); - if (systemConfigFile != null) { - if (loadSystemConfiguration(systemConfigFile)) { - if (JNLPRuntime.isDebug()) { - System.out.println("System level " + DEPLOYMENT_CONFIG + " is mandatory: " + systemPropertiesMandatory); - } - /* Second, read the System level deployment.properties file */ - systemProperties = loadProperties(ConfigType.System, systemPropertiesFile, - systemPropertiesMandatory); - } - if (systemProperties != null) { - mergeMaps(initialProperties, systemProperties); - } - } - - /* need a copy of the original when we have to save */ - unchangeableConfiguration = new HashMap<String, ConfigValue>(); - Set<String> keys = initialProperties.keySet(); - for (String key : keys) { - unchangeableConfiguration.put(key, new ConfigValue(initialProperties.get(key))); - } - - /* - * Third, read the user's deployment.properties file - */ - userPropertiesFile = userFile; - Map<String, ConfigValue> userProperties = loadProperties(ConfigType.User, userPropertiesFile, - false); - if (userProperties != null) { - mergeMaps(initialProperties, userProperties); - } - - currentConfiguration = initialProperties; - } - - /** - * Get the value for the given key - * - * @param key the property key - * @return the value for the key, or null if it can not be found - */ - public String getProperty(String key) { - SecurityManager sm = System.getSecurityManager(); - if (sm != null) { - if (userPropertiesFile != null) { - sm.checkRead(userPropertiesFile.toString()); - } - } - - return currentConfiguration.get(key).get(); - } - - /** - * @return a Set containing all the property names - */ - public Set<String> getAllPropertyNames() { - SecurityManager sm = System.getSecurityManager(); - if (sm != null) { - if (userPropertiesFile != null) { - sm.checkRead(userPropertiesFile.toString()); - } - } - - return currentConfiguration.keySet(); - } - - /** - * Sets the value of corresponding to the key. If the value has been marked - * as locked, it is not changed - * - * @param key the key - * @param value the value to be associated with the key - */ - public void setProperty(String key, String value) { - SecurityManager sm = System.getSecurityManager(); - if (sm != null) { - if (userPropertiesFile != null) { - sm.checkWrite(userPropertiesFile.toString()); - } - } - - ConfigValue currentValue = currentConfiguration.get(key); - if (currentValue != null) { - if (!currentValue.isLocked()) { - currentValue.set(value); - } - } else { - currentValue = new ConfigValue(value); - currentConfiguration.put(key, currentValue); - } - } - - /** - * Loads the default properties for deployment - */ - private Map<String, ConfigValue> loadDefaultProperties() { - - final String SYSTEM_HOME = System.getProperty("java.home"); - final String SYSTEM_SECURITY = SYSTEM_HOME + File.separator + "lib" + File.separator - + "security"; - - final String USER_HOME = System.getProperty("user.home") + File.separator + DEPLOYMENT_DIR; - final String USER_SECURITY = USER_HOME + File.separator + "security"; - - final String LOCKS_DIR = System.getProperty("java.io.tmpdir") + File.separator - + System.getProperty("user.name") + File.separator + "netx" + File.separator - + "locks"; - - /* - * This is more or less a straight copy from the deployment - * configuration page, with occasional replacements of "" or no-defaults - * with null - */ - - String[][] defaults = new String[][] { - /* infrastructure */ - { KEY_USER_CACHE_DIR, USER_HOME + File.separator + "cache" }, - { KEY_USER_PERSISTENCE_CACHE_DIR, USER_HOME + File.separator + "pcache" }, - { KEY_SYSTEM_CACHE_DIR, null }, - { KEY_USER_LOG_DIR, USER_HOME + File.separator + "log" }, - { KEY_USER_TMP_DIR, USER_HOME + File.separator + "tmp" }, - { KEY_USER_LOCKS_DIR, LOCKS_DIR }, - { KEY_USER_NETX_RUNNING_FILE, LOCKS_DIR + File.separator + "netx_running" }, - /* certificates and policy files */ - { "deployment.user.security.policy", "file://" + USER_SECURITY + File.separator + "java.policy" }, - { KEY_USER_TRUSTED_CA_CERTS, USER_SECURITY + File.separator + "trusted.cacerts" }, - { KEY_USER_TRUSTED_JSSE_CA_CERTS, USER_SECURITY + File.separator + "trusted.jssecacerts" }, - { KEY_USER_TRUSTED_CERTS, USER_SECURITY + File.separator + "trusted.certs" }, - { KEY_USER_TRUSTED_JSSE_CERTS, USER_SECURITY + File.separator + "trusted.jssecerts" }, - { KEY_USER_TRUSTED_CLIENT_CERTS, USER_SECURITY + File.separator + "trusted.clientcerts" }, - { "deployment.system.security.policy", null }, - { KEY_SYSTEM_TRUSTED_CA_CERTS, SYSTEM_SECURITY + File.separator + "cacerts" }, - { KEY_SYSTEM_TRUSTED_JSSE_CA_CERTS, SYSTEM_SECURITY + File.separator + "jssecacerts" }, - { KEY_SYSTEM_TRUSTED_CERTS, SYSTEM_SECURITY + File.separator + "trusted.certs" }, - { KEY_SYSTEM_TRUSTED_JSSE_CERTS, SYSTEM_SECURITY + File.separator + "trusted.jssecerts" }, - { KEY_SYSTEM_TRUSTED_CLIENT_CERTS, SYSTEM_SECURITY + File.separator + "trusted.clientcerts" }, - /* security access and control */ - { KEY_SECURITY_PROMPT_USER, String.valueOf(true) }, - { "deployment.security.askgrantdialog.notinca", String.valueOf(true) }, - { "deployment.security.notinca.warning", String.valueOf(true) }, - { "deployment.security.expired.warning", String.valueOf(true) }, - { "deployment.security.jsse.hostmismatch.warning", String.valueOf(true) }, - { "deployment.security.trusted.policy", null }, - { KEY_SECURITY_ALLOW_HIDE_WINDOW_WARNING, String.valueOf(true) }, - { KEY_SECURITY_PROMPT_USER_FOR_JNLP, String.valueOf(true) }, - { KEY_SECURITY_INSTALL_AUTHENTICATOR, String.valueOf(true) }, - /* networking */ - { KEY_PROXY_TYPE, String.valueOf(JNLPProxySelector.PROXY_TYPE_BROWSER) }, - { KEY_PROXY_SAME, String.valueOf(false) }, - { KEY_PROXY_AUTO_CONFIG_URL, null }, - { KEY_PROXY_BYPASS_LIST, null }, - { KEY_PROXY_BYPASS_LOCAL, null }, - { KEY_PROXY_HTTP_HOST, null }, - { KEY_PROXY_HTTP_PORT, null }, - { KEY_PROXY_HTTPS_HOST, null }, - { KEY_PROXY_HTTPS_PORT, null }, - { KEY_PROXY_FTP_HOST, null }, - { KEY_PROXY_FTP_PORT, null }, - { KEY_PROXY_SOCKS4_HOST, null }, - { KEY_PROXY_SOCKS4_PORT, null }, - { KEY_PROXY_OVERRIDE_HOSTS, null }, - /* cache and optional package repository */ - { "deployment.cache.max.size", String.valueOf("-1") }, - { "deployment.cache.jarcompression", String.valueOf(0) }, - { "deployment.javapi.cache.enabled", String.valueOf(false) }, - /* java console */ - { "deployment.console.startup.mode", CONSOLE_HIDE }, - /* tracing and logging */ - { "deployment.trace", String.valueOf(false) }, - { KEY_ENABLE_LOGGING, String.valueOf(false) }, - /* JNLP association */ - { "deployment.javaws.associations", String.valueOf(JNLP_ASSOCIATION_ASK_USER) }, - /* desktop integration */ - { KEY_CREATE_DESKTOP_SHORTCUT, ShortcutDesc.CREATE_ASK_USER_IF_HINTED }, - /* jre selection */ - { "deployment.javaws.installURL", null }, - /* jre management */ - { "deployment.javaws.autodownload", null }, - /* browser selection */ - { KEY_BROWSER_PATH, null }, - /* check for update timeout */ - { "deployment.javaws.update.timeout", String.valueOf(500) } - }; - - HashMap<String, ConfigValue> result = new HashMap<String, ConfigValue>(); - for (int i = 0; i < defaults.length; i++) { - String key = defaults[i][0]; - String actualValue = defaults[i][1]; - boolean locked = false; - ConfigValue value = new ConfigValue(actualValue, locked); - result.put(key, value); - } - - return result; - } - - /** - * @return the location of system-level deployment.config file, or null if none can be found - */ - private File findSystemConfigFile() { - File etcFile = new File(File.separator + "etc" + File.separator + ".java" + File.separator - + "deployment" + File.separator + DEPLOYMENT_CONFIG); - if (etcFile.isFile()) { - return etcFile; - } - - File jreFile = new File(System.getProperty("java.home") + File.separator + "lib" - + File.separator + DEPLOYMENT_CONFIG); - if (jreFile.isFile()) { - return jreFile; - } - - return null; - } - - /** - * Reads the system configuration file and sets the relevant - * system-properties related variables - */ - private boolean loadSystemConfiguration(File configFile) { - - if (JNLPRuntime.isDebug()) { - System.out.println("Loading system configuation from: " + configFile); - } - - Map<String, ConfigValue> systemConfiguration = new HashMap<String, ConfigValue>(); - try { - systemConfiguration = parsePropertiesFile(configFile); - } catch (IOException e) { - if (JNLPRuntime.isDebug()) { - System.out.println("No System level " + DEPLOYMENT_PROPERTIES + " found."); - } - return false; - } - - /* - * at this point, we have read the system deployment.config file - * completely - */ - - try { - String urlString = systemConfiguration.get("deployment.system.config").get(); - if (urlString == null) { - if (JNLPRuntime.isDebug()) { - System.out.println("No System level " + DEPLOYMENT_PROPERTIES + " found."); - } - return false; - } - URL url = new URL(urlString); - if (url.getProtocol().equals("file")) { - systemPropertiesFile = new File(url.getFile()); - if (JNLPRuntime.isDebug()) { - System.out.println("Using System level" + DEPLOYMENT_PROPERTIES + ": " - + systemPropertiesFile); - } - ConfigValue mandatory = systemConfiguration.get("deployment.system.config.mandatory"); - systemPropertiesMandatory = Boolean.valueOf(mandatory == null ? null : mandatory.get()); - return true; - } else { - if (JNLPRuntime.isDebug()) { - System.out.println("Remote + " + DEPLOYMENT_PROPERTIES + " not supported"); - } - return false; - } - } catch (MalformedURLException e) { - if (JNLPRuntime.isDebug()) { - System.out.println("Invalid url for " + DEPLOYMENT_PROPERTIES); - } - return false; - } - } - - /** - * Loads the properties file, if one exists - * - * @param type the ConfigType to load - * @param file the File to load Properties from - * @param mandatory indicates if reading this file is mandatory - * - * @throws ConfigurationException if the file is mandatory but cannot be read - */ - private Map<String, ConfigValue> loadProperties(ConfigType type, File file, boolean mandatory) - throws ConfigurationException { - if (file == null || !file.isFile()) { - if (JNLPRuntime.isDebug()) { - System.out.println("No " + type.toString() + " level " + DEPLOYMENT_PROPERTIES + " found."); - } - if (!mandatory) { - return null; - } else { - throw new ConfigurationException(); - } - } - - if (JNLPRuntime.isDebug()) { - System.out.println("Loading " + type.toString() + " level properties from: " + file); - } - try { - return parsePropertiesFile(file); - } catch (IOException e) { - return null; - } - } - - /** - * Saves all properties that are not part of default or system properties - * - * @throws IOException if unable to save the file - * @throws IllegalStateException if save() is called before load() - */ - public void save() throws IOException { - if (userPropertiesFile == null) { - throw new IllegalStateException("must load() before save()"); - } - - SecurityManager sm = System.getSecurityManager(); - if (sm != null) { - sm.checkWrite(userPropertiesFile.toString()); - } - - if (JNLPRuntime.isDebug()) { - System.out.println("Saving properties into " + userPropertiesFile.toString()); - } - Properties toSave = new Properties(); - - for (String key : currentConfiguration.keySet()) { - String oldValue = unchangeableConfiguration.get(key) == null ? null - : unchangeableConfiguration.get(key).get(); - String newValue = currentConfiguration.get(key) == null ? null : currentConfiguration - .get(key).get(); - if (oldValue == null && newValue == null) { - continue; - } else if (oldValue == null && newValue != null) { - toSave.setProperty(key, newValue); - } else if (oldValue != null && newValue == null) { - toSave.setProperty(key, newValue); - } else { // oldValue != null && newValue != null - if (!oldValue.equals(newValue)) { - toSave.setProperty(key, newValue); - } - } - } - - File backupPropertiesFile = new File(userPropertiesFile.toString() + ".old"); - if (userPropertiesFile.isFile()) { - if (!userPropertiesFile.renameTo(backupPropertiesFile)) { - throw new IOException("Error saving backup copy of " + userPropertiesFile); - } - } - - userPropertiesFile.getParentFile().mkdirs(); - OutputStream out = new BufferedOutputStream(new FileOutputStream(userPropertiesFile)); - try { - toSave.store(out, DEPLOYMENT_COMMENT); - } finally { - out.close(); - } - } - - /** - * Reads a properties file and returns a map representing the properties - * - * @param propertiesFile the file to read Properties from - * @param destination the map to which all the properties should be added - * @throws IOException if an IO problem occurs - */ - private Map<String, ConfigValue> parsePropertiesFile(File propertiesFile) throws IOException { - Map<String, ConfigValue> result = new HashMap<String, ConfigValue>(); - - Properties properties = new Properties(); - - Reader reader = new BufferedReader(new FileReader(propertiesFile)); - try { - properties.load(reader); - } finally { - reader.close(); - } - - Set<String> keys = properties.stringPropertyNames(); - for (String key : keys) { - if (key.endsWith(".locked")) { - String realKey = key.substring(0, key.length() - ".locked".length()); - ConfigValue configValue = result.get(realKey); - if (configValue == null) { - configValue = new ConfigValue(null, true); - result.put(realKey, configValue); - } else { - configValue.setLocked(true); - } - } else { - /* when parsing a properties we set value without checking if it is locked or not */ - String newValue = properties.getProperty(key); - ConfigValue configValue = result.get(key); - if (configValue == null) { - configValue = new ConfigValue(newValue); - result.put(key, configValue); - } else { - configValue.set(newValue); - } - } - } - return result; - } - - /** - * Merges two maps while respecting whether the values have been locked or - * not. All values from srcMap are put into finalMap, replacing values in - * finalMap if necessary, unless the value is present and marked as locked - * in finalMap - * - * @param finalMap the destination for putting values - * @param srcMap the source for reading key value pairs - */ - private void mergeMaps(Map<String, ConfigValue> finalMap, Map<String, ConfigValue> srcMap) { - for (String key : srcMap.keySet()) { - ConfigValue configValue = finalMap.get(key); - if (configValue == null) { - configValue = srcMap.get(key); - finalMap.put(key, configValue); - } else { - if (!configValue.isLocked()) { - configValue.set(srcMap.get(key).get()); - } - } - } - } - - /** - * Dumps the configuration to the PrintStream - * - * @param config a map of key,value pairs representing the configuration to - * dump - * @param out the PrintStream to write data to - */ - @SuppressWarnings("unused") - private static void dumpConfiguration(Map<String, ConfigValue> config, PrintStream out) { - System.out.println("KEY: VALUE [Locked]"); - - for (String key : config.keySet()) { - ConfigValue value = config.get(key); - out.println("'" + key + "': '" + value.get() + "'" - + (value.isLocked() ? " [LOCKED]" : "")); - } - } -}
--- a/netx/net/sourceforge/jnlp/runtime/JNLPProxySelector.java Mon Dec 13 16:12:06 2010 -0500 +++ b/netx/net/sourceforge/jnlp/runtime/JNLPProxySelector.java Mon Dec 13 17:28:01 2010 -0500 @@ -32,6 +32,8 @@ import java.util.List; import java.util.StringTokenizer; +import net.sourceforge.jnlp.config.DeploymentConfiguration; + /** * A ProxySelector specific to JNLPs. This proxy uses the deployment * configuration to determine what to do.
--- a/netx/net/sourceforge/jnlp/runtime/JNLPRuntime.java Mon Dec 13 16:12:06 2010 -0500 +++ b/netx/net/sourceforge/jnlp/runtime/JNLPRuntime.java Mon Dec 13 17:28:01 2010 -0500 @@ -36,6 +36,7 @@ import net.sourceforge.jnlp.*; import net.sourceforge.jnlp.cache.*; +import net.sourceforge.jnlp.config.DeploymentConfiguration; import net.sourceforge.jnlp.security.JNLPAuthenticator; import net.sourceforge.jnlp.security.SecurityDialogMessageHandler; import net.sourceforge.jnlp.security.VariableX509TrustManager; @@ -103,7 +104,7 @@ private static boolean securityEnabled = true; /** whether debug mode is on */ - private static boolean debug = false; // package access by Boot + private static boolean debug = false; /** whether streams should be redirected */ private static boolean redirectStreams = false;
--- a/netx/net/sourceforge/jnlp/security/KeyStores.java Mon Dec 13 16:12:06 2010 -0500 +++ b/netx/net/sourceforge/jnlp/security/KeyStores.java Mon Dec 13 17:28:01 2010 -0500 @@ -50,7 +50,7 @@ import java.util.List; import java.util.StringTokenizer; -import net.sourceforge.jnlp.runtime.DeploymentConfiguration; +import net.sourceforge.jnlp.config.DeploymentConfiguration; import net.sourceforge.jnlp.runtime.JNLPRuntime; import net.sourceforge.jnlp.runtime.Translator; import net.sourceforge.jnlp.util.FileUtils;
--- a/netx/net/sourceforge/jnlp/security/SecurityWarning.java Mon Dec 13 16:12:06 2010 -0500 +++ b/netx/net/sourceforge/jnlp/security/SecurityWarning.java Mon Dec 13 17:28:01 2010 -0500 @@ -48,7 +48,7 @@ import javax.swing.SwingUtilities; import net.sourceforge.jnlp.JNLPFile; -import net.sourceforge.jnlp.runtime.DeploymentConfiguration; +import net.sourceforge.jnlp.config.DeploymentConfiguration; import net.sourceforge.jnlp.runtime.JNLPRuntime; /**
--- a/netx/net/sourceforge/jnlp/services/ServiceUtil.java Mon Dec 13 16:12:06 2010 -0500 +++ b/netx/net/sourceforge/jnlp/services/ServiceUtil.java Mon Dec 13 17:28:01 2010 -0500 @@ -37,8 +37,8 @@ import javax.jnlp.UnavailableServiceException; import net.sourceforge.jnlp.JNLPFile; +import net.sourceforge.jnlp.config.DeploymentConfiguration; import net.sourceforge.jnlp.runtime.ApplicationInstance; -import net.sourceforge.jnlp.runtime.DeploymentConfiguration; import net.sourceforge.jnlp.runtime.JNLPRuntime; import net.sourceforge.jnlp.security.SecurityWarning; import net.sourceforge.jnlp.security.SecurityWarning.AccessType;
--- a/netx/net/sourceforge/jnlp/services/SingleInstanceLock.java Mon Dec 13 16:12:06 2010 -0500 +++ b/netx/net/sourceforge/jnlp/services/SingleInstanceLock.java Mon Dec 13 17:28:01 2010 -0500 @@ -28,7 +28,7 @@ import java.net.ServerSocket; import net.sourceforge.jnlp.JNLPFile; -import net.sourceforge.jnlp.runtime.DeploymentConfiguration; +import net.sourceforge.jnlp.config.DeploymentConfiguration; import net.sourceforge.jnlp.runtime.JNLPRuntime; import net.sourceforge.jnlp.util.FileUtils;
--- a/netx/net/sourceforge/jnlp/services/XBasicService.java Mon Dec 13 16:12:06 2010 -0500 +++ b/netx/net/sourceforge/jnlp/services/XBasicService.java Mon Dec 13 17:28:01 2010 -0500 @@ -28,8 +28,8 @@ import net.sourceforge.jnlp.JARDesc; import net.sourceforge.jnlp.JNLPFile; import net.sourceforge.jnlp.Launcher; +import net.sourceforge.jnlp.config.DeploymentConfiguration; import net.sourceforge.jnlp.runtime.ApplicationInstance; -import net.sourceforge.jnlp.runtime.DeploymentConfiguration; import net.sourceforge.jnlp.runtime.JNLPRuntime; import net.sourceforge.jnlp.util.PropertiesFile;
--- a/netx/net/sourceforge/jnlp/services/XPersistenceService.java Mon Dec 13 16:12:06 2010 -0500 +++ b/netx/net/sourceforge/jnlp/services/XPersistenceService.java Mon Dec 13 17:28:01 2010 -0500 @@ -24,6 +24,7 @@ import net.sourceforge.jnlp.*; import net.sourceforge.jnlp.cache.*; +import net.sourceforge.jnlp.config.DeploymentConfiguration; import net.sourceforge.jnlp.runtime.*; import net.sourceforge.jnlp.util.FileUtils;
--- a/netx/net/sourceforge/jnlp/util/XDesktopEntry.java Mon Dec 13 16:12:06 2010 -0500 +++ b/netx/net/sourceforge/jnlp/util/XDesktopEntry.java Mon Dec 13 17:28:01 2010 -0500 @@ -32,7 +32,7 @@ import net.sourceforge.jnlp.StreamEater; import net.sourceforge.jnlp.cache.CacheUtil; import net.sourceforge.jnlp.cache.UpdatePolicy; -import net.sourceforge.jnlp.runtime.DeploymentConfiguration; +import net.sourceforge.jnlp.config.DeploymentConfiguration; import net.sourceforge.jnlp.runtime.JNLPRuntime; /**
--- a/plugin/icedteanp/java/sun/applet/JavaConsole.java Mon Dec 13 16:12:06 2010 -0500 +++ b/plugin/icedteanp/java/sun/applet/JavaConsole.java Mon Dec 13 17:28:01 2010 -0500 @@ -63,7 +63,7 @@ import javax.swing.border.EmptyBorder; import javax.swing.border.TitledBorder; -import net.sourceforge.jnlp.runtime.DeploymentConfiguration; +import net.sourceforge.jnlp.config.DeploymentConfiguration; import net.sourceforge.jnlp.runtime.JNLPRuntime; /**
--- a/plugin/icedteanp/java/sun/applet/PluginMain.java Mon Dec 13 16:12:06 2010 -0500 +++ b/plugin/icedteanp/java/sun/applet/PluginMain.java Mon Dec 13 17:28:01 2010 -0500 @@ -66,16 +66,14 @@ import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; -import java.io.PrintStream; import java.net.Authenticator; import java.net.CookieHandler; import java.net.CookieManager; -import java.net.PasswordAuthentication; import java.net.ProxySelector; import java.util.Enumeration; import java.util.Properties; -import net.sourceforge.jnlp.runtime.DeploymentConfiguration; +import net.sourceforge.jnlp.config.DeploymentConfiguration; import net.sourceforge.jnlp.runtime.JNLPRuntime; import net.sourceforge.jnlp.security.JNLPAuthenticator;