Class DeploymentConfiguration
java.lang.Object
net.sourceforge.jnlp.config.DeploymentConfiguration
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
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static enum -
Field Summary
FieldsModifier and TypeFieldDescriptionthe current deployment propertiesprivate ConfigurationExceptionstatic final Stringstatic final Stringprivate static final Loggerprivate static final SimpleDateFormatprivate URLThe system's subdirResult deployment.config fileprivate booleanis it mandatory to load the system properties?the deployment properties that cannot be changedstatic final Stringprivate Stringprivate final InfrastructureFileDescriptorSource of always right and only path to file (even if underlying path changes)private FileThe user's subdirResult deployment.config file -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate voidcheckAndFixConfiguration(Map<String, Setting> initial) Check that the configuration is valid.(package private) static booleanvoidcopyTo(Properties target) Copies the current configuration into the targetprivate static voiddumpConfiguration(Map<String, Setting> config, PrintStream out) Dumps the configuration to the PrintStreamprivate URLLooks in the following locations:getProperty(String key) Get the value for the given keygetPropertyAsList(String key) getRaw()getSetting(String key) booleanvoidload()Initialize this deployment configuration by reading configuration files.voidload(boolean fixIssues) Initialize this deployment configuration by reading configuration files.private static StringloadComments(URL path) loadProperties(DeploymentConfiguration.ConfigType type, URL file, boolean mandatory) Loads the properties from the given file into a map ofSettings.private booleanloadSystemConfiguration(URL configFile) Reads the system configuration file and sets the relevant system-properties related variablesFirst loads thedeployment.configfile to determine the URL of the system properties.voidprivate voidMerges two maps while respecting whether the values have been locked or not.parsePropertiesFile(URL propertiesFile) Reads a properties file and returns a map representing the propertiesprivate voidprocessPropertiesWithHomeDirToken(Map<String, Setting> properties) voidvoidsave()Saves all properties that are not part of default or system propertiesvoidvoidsetProperty(String key, String value) Sets the value of corresponding to the key.voidstatic Stringconvenient method to show VVPossibleBrowserValues with all four params
-
Field Details
-
LOG
-
LOCKED_POSTFIX
- See Also:
-
LOCAL_DEPLOYMENT_PROPERTIES_FILE_PATH
- See Also:
-
USER_HOME_DIR_TOKEN
- See Also:
-
userComments
-
loadingException
-
systemPropertiesMandatory
private boolean systemPropertiesMandatoryis it mandatory to load the system properties? -
systemPropertiesFile
The system's subdirResult deployment.config file -
userDeploymentFileDescriptor
Source of always right and only path to file (even if underlying path changes) -
userPropertiesFile
The user's subdirResult deployment.config file -
currentConfiguration
-
unchangeableConfiguration
-
pattern
-
-
Constructor Details
-
DeploymentConfiguration
public DeploymentConfiguration() -
DeploymentConfiguration
DeploymentConfiguration(InfrastructureFileDescriptor configFile)
-
-
Method Details
-
getSetting
-
isLocked
-
lock
-
unlock
-
setLoadingException
-
getLoadingException
-
resetToDefaults
public void resetToDefaults() -
checkUrl
-
load
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:
ConfigurationException- if it encounters a fatal error.
-
load
Initialize this deployment configuration by reading configuration files. Generally, it will try to continue and ignore errors it finds (such as file not found).- Parameters:
fixIssues- If true, fix issues that are discovered when reading configuration by resorting to the default values- Throws:
ConfigurationException- if it encounters a fatal error.MalformedURLException
-
loadSystemProperties
private Map<String,Setting> loadSystemProperties() throws MalformedURLException, ConfigurationExceptionFirst loads thedeployment.configfile to determine the URL of the system properties. The deployment config file must contain a property with the keyConfigurationConstants.KEY_SYSTEM_CONFIG. Optionally it can require the system properties to exist with the kyeConfigurationConstants.KEY_SYSTEM_CONFIG_MANDATORY.- Returns:
- the system properties
- Throws:
MalformedURLExceptionConfigurationException- See Also:
-
copyTo
Copies the current configuration into the target- Parameters:
target- properties where to copy actual ones
-
getProperty
-
getPropertyAsList
-
getAllPropertyNames
-
getRaw
-
setProperty
-
checkAndFixConfiguration
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 ValueChecker for each setting on the actual value. Fixes are made in-place.- Parameters:
initial- a map representing the initial configuration
-
processPropertiesWithHomeDirToken
-
findSystemConfigFile
Looks in the following locations:Unix: - /etc/.java/deployment.config - ${JAVA_HOME}/lib/deployment.config Windows: - ${WINDIR}\Sun\Java\deployment.config - ${JAVA_HOME}/lib/deployment.config- Returns:
- the location of system-level deployment.config file, or null if none can be found
- Throws:
MalformedURLException
-
loadSystemConfiguration
Reads the system configuration file and sets the relevant system-properties related variables- Throws:
ConfigurationException
-
loadProperties
static Map<String,Setting> loadProperties(DeploymentConfiguration.ConfigType type, URL file, boolean mandatory) throws ConfigurationException Loads the properties from the given file into a map ofSettings. If the given properties file does not exist or the URL is invalid and not mandatory, an empty Map is returned. If the file is considered to be mandatory but does not exist, a ConfigurationException is thrown.- Parameters:
type- the ConfigType to loadfile- the File to load Properties frommandatory- indicates if reading this file is mandatory- Throws:
ConfigurationException- if the file is mandatory but does not exist or cannot be read properly
-
save
Saves all properties that are not part of default or system properties- Throws:
IOException- if unable to save the fileIllegalStateException- if save() is called before load()
-
parsePropertiesFile
Reads a properties file and returns a map representing the properties- Parameters:
propertiesFile- the file to read Properties from- Throws:
IOException- if an IO problem occurs
-
mergeMaps
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- Parameters:
finalMap- the destination for putting valuessrcMap- the source for reading key value pairs
-
dumpConfiguration
Dumps the configuration to the PrintStream- Parameters:
config- a map of key,value pairs representing the configuration to dumpout- the PrintStream to write data to
-
loadComments
-
VVPossibleBrowserValues
convenient method to show VVPossibleBrowserValues with all four params- Returns:
- translation of VVPossibleBrowserValues with all params in
-