Package net.simplace.core.property
Class FWImagePropertyProvider
java.lang.Object
net.simplace.core.property.FWImagePropertyProvider
Provider for properties. It centralizes access
to properties throughout the whole application. In
addition to making direct access to property files
obsolete it also caches whole sets of properties (i.e.
property files) by keeping them in memory. A property
set is loaded into memory when any of the properties
contained in it is being accessed for the first time.
- Author:
- Andreas Enders
-
Method Summary
Modifier and TypeMethodDescriptionboolean
flushProperty
(String aPropertySet, String aKey) Flush a property set, i.e. delete it from memory and also reset the entries in the cache file.boolean
flushPropertySet
(String aPropertySet) Flush a property set, i.e. delete it from memory and also reset the entries in the cache file.static FWImagePropertyProvider
static String
getJavaRuntimeVariable
(String aKey) Get the value of for the given property or if the set doesn't exist anyway return. getOriginalProperty
(String aPropertySet, String aKey, String aDefault) Get the value of a property in a specific set.getOriginalPropertyNames
(String aPropertySet) getOriginalPropertySet
(String aPropertySetName) Get a specific property set, by replacing the System variables in the values.getProperties
(String aPropertySet) Can cause data corruption in property resource manager, so better use getPropertyNames(...) to get an enumeration of property names and then iterate over this enumeration and invoke getProperty(...) for each name.getPropertiesAsString
(String aPropertyset) Method getPropertiesAsString.getProperty
(String aPropertySet, String aKey) Get the value of a property in a specific set.getProperty
(String aPropertySet, String aKey, String aDefault) Get the value of a property in a specific set.getPropertyNames
(String aPropertySet) getPropertySetURL
(String aPropertySet) Get the value of for the given property or if the set doesn't exist anyway return. static String
Gets the value for a given registry key.replaceSystemVariables
(String aPropertyValue) boolean
setProperty
(String aPropertySet, String aKey, String aValue) Set the value for a specified key within a specified property set and make those settings persistent, so the next time the application is started the set value is still available.boolean
setProperty
(String aPropertySet, String aKey, String aValue, boolean aNewValue) Set the value for a specified key within a specified property set and make those settings persistent, so the next time the application is started the set value is still available.boolean
setPropertyToOriginalFile
(String aPropertySet, String aKey, String aValue) Set the value for a specified key within a specified property set original location and make those settings persistent.No restarting of application is required.static boolean
setSystemEnvironmentVariable
(String aKey, String aValue) Sets the value of for the given property or if the set doesn't exist anyway return.
-
Method Details
-
getInstance
- Returns:
- Singleton instance of PropertyProvider.
-
flushPropertySet
Flush a property set, i.e. delete it from memory and also reset the entries in the cache file. This allows runtime modifications of property files using external tools, because it forces the resource manager to re-read the properties from the original file. Returnsif flushing is successful and if flushing fails. - Parameters:
aPropertySet
-- Returns:
- success
-
flushProperty
Flush a property set, i.e. delete it from memory and also reset the entries in the cache file. This allows runtime modifications of property files using external tools, because it forces the resource manager to re-read the properties from the original file. Returnsif flushing is successful and if flushing fails. - Parameters:
aPropertySet
-aKey
-- Returns:
- success
-
getProperty
Get the value of a property in a specific set. If the set doesn't contain a value for the given property return the specified default value.- Parameters:
aPropertySet
-aKey
-aDefault
-- Returns:
- the property string
-
getProperty
Get the value of a property in a specific set. If the set doesn't contain a value for the given property or if the set doesn't exist anyway return. - Parameters:
aPropertySet
-aKey
-- Returns:
- the properties value string
-
getOriginalProperty
Get the value of a property in a specific set. If the set doesn't contain a value for the given property return the specified default value.- Parameters:
aPropertySet
-aKey
-aDefault
-- Returns:
- the property from specific set.
-
getOriginalPropertySet
Get a specific property set, by replacing the System variables in the values. Mostly used in the clients to cache the whole property set.- Parameters:
aPropertySetName
-- Returns:
- a specific property set
-
getSystemEnvironmentVariable
Get the value of for the given property or if the set doesn't exist anyway return. On Server side all Env-Vars are returned, on client side only non eTenderSuite-Env-Vars are Accessible - Parameters:
aKey
-- Returns:
- the system environment variable
-
getSystemRegistryVariable
Gets the value for a given registry key. A registry key is composed of a registry root key and path. If the registry key is not present or can not be found (non-Windows systems)null
is returned. Windows registry values are stored by root key and path. The parameterregistryKey
contains the following format:ROOT_KEY\PATH\VALUE
for a specific value orROOT_KEY\PATH\
to return the default value. ExampleregistryKey
values:HKEY_CURRENT_USER\Environment\JAVA_HOME
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\Search\SearchAssistant
HKEY_CLASSES_ROOT\Shell\shell\open\command\
Supported root key values are:HKEY_CLASSES_ROOT HKEY_CURRENT_CONFIG HKEY_CURRENT_USER HKEY_DYN_DATA HKEY_LOCAL_MACHINE HKEY_PERFORMANCE_DATA HKEY_USERS
CallinggetSystemRegistryVariable("HKEY_CLASSES_ROOT\Shell\shell\open\command\")
would return%SystemRoot%\Explorer.exe /idlist,%I,%L
on a typical Windows installation.- Parameters:
aKey
-- Returns:
- String regisryValue
-
getJavaRuntimeVariable
Get the value of for the given property or if the set doesn't exist anyway return. - Parameters:
aKey
-- Returns:
- java runtime environment variables value
-
setSystemEnvironmentVariable
Sets the value of for the given property or if the set doesn't exist anyway return. - Parameters:
aKey
-aValue
-- Returns:
- success
-
setProperty
Set the value for a specified key within a specified property set and make those settings persistent, so the next time the application is started the set value is still available. This is essential for adding user settings capabilities to applications. The key given as a parameter to this method must exist in the (original) property set. No new keys can be added. If the key does not exist the method will returnlike in any other case of an error. - Parameters:
aPropertySet
-aKey
-aValue
-- Returns:
- success
-
setProperty
Set the value for a specified key within a specified property set and make those settings persistent, so the next time the application is started the set value is still available. This is essential for adding user settings capabilities to applications. The key given as a parameter to this method must exist in the (original) property set. No new keys can be added. If the key does not exist the method will returnlike in any other case of an error. - Parameters:
aPropertySet
-aKey
-aValue
-aNewValue
-- Returns:
- success
-
setPropertyToOriginalFile
Set the value for a specified key within a specified property set original location and make those settings persistent.No restarting of application is required. This is essential for adding user settings capabilities to applications. The key given as a parameter to this method must exist in the (original) property set. No new keys can be added. If the key does not exist the method will returnlike in any other case of an error. Should not be used in webStart because the original file is in a jar-file. - Parameters:
aPropertySet
-aKey
-aValue
-- Returns:
- success
-
getProperties
Can cause data corruption in property resource manager, so better use getPropertyNames(...) to get an enumeration of property names and then iterate over this enumeration and invoke getProperty(...) for each name.- Parameters:
aPropertySet
-- Returns:
- the complete Properties object.
-
getPropertyNames
- Parameters:
aPropertySet
-- Returns:
- an Enumeration of the property names
contained in the specified property set.
Return
if the property set can't be found.
-
getOriginalPropertyNames
- Parameters:
aPropertySet
-- Returns:
- an Enumeration of the property names
contained in the specified property set from the original location.
Return
if the property set can't be found.
-
getPropertySetURL
- Parameters:
aPropertySet
-- Returns:
- the URL the specified property set has been loaded from.
Return
if the property set can't be found.
-
getEnvVars
- Returns:
- the environment-variables.
-
replaceSystemVariables
- Parameters:
aPropertyValue
-- Returns:
- the value of a property in a specific set. If the set
doesn't contain a value for the given property or if the
set doesn't exist anyway return
.
-
getPropertiesAsString
Method getPropertiesAsString.- Parameters:
aPropertyset
-- Returns:
- String
-