net.simplace.util.property.FWPropertyProvider
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.
public final class FWPropertyProvider {
// Class Methods public static synchronized
FWPropertyProvider getInstance();
Get Singleton instance of PropertyResourceManager.
returns the Instance of PropertyProvider (singleton)
public static String
getSystemRegistryVariable(String aKey);
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 parameter
registryKey
contains the following format:
ROOT_KEY\PATH\VALUE
for a specific value or
ROOT_KEY\PATH\
to return the default value. Example
registryKey
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
Calling
getSystemRegistryVariable("HKEY_CLASSES_ROOT\Shell\shell\open\command\")
would return
%SystemRoot%\Explorer.exe /idlist,%I,%L
on a typical Windows installation.
returns the system registry variable value
public static synchronized String
getJavaRuntimeVariable(String aKey);
Get the value of for the given property or if the set doesn't exist anyway return
.
returns the java environment variable value public static synchronized boolean
setSystemEnvironmentVariable(String aKey,
String aValue);
Sets the value of for the given property or if the set doesnt exist anyway return
.
returns true if successful
// Public Instance Methods public synchronized String
getProperty(String aPropertySet, String aKey,
String aDefault);
Get the value of a property in a specific set. If the set doesnt contain a value for the given property return the specified default value.
- aPropertySet
- aKey
- aDefault
returns the property value
public synchronized String
getProperty(String aPropertySet, String aKey);
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
.
returns the property value public synchronized String
getSystemEnvironmentVariable(String aKey);
Get the value of for the given property or if the set doesnt exist anyway return
. On Serverside all Env-Vars are returned, on client side only non eTenderSuite-env-vars are Accessible
returns the system environment variable value public synchronized 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. 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 return
like in any other case of an error.
returns true if successful public synchronized 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. 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 return
like in any other case of an error.
- aPropertySet
- aKey
- aValue
- aNewValue
returns true if successful public synchronized
FWPropertyContainer getPropertyContainer(String
aPropertySet);
Return the complete Properties object. 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.
returns the property container for this property set.
public synchronized
FWPropertyContainer getSystemPropertyContainer();
Return the complete Properties object. 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.
returns the system property container
public synchronized Set
getPropertyNames(String aPropertySet);
Return an Enumeration of the property names contained in the specified property set. Return
if the property set cant be found.
returns the property keys public synchronized URL
getPropertySetURL(String aPropertySet);
Get the URL the specified property set has been loaded from. Return
if the property set can't be found.
returns URL of the property set public
FWPropertyContainer getEnvVars();
Returns the environment-variables.
returns the property container of the EnvVars
public synchronized String
replaceSystemVariables(String aPropertyValue);
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
.
returns the replaced variable public String
getPropertiesAsString(String aPropertyset);
Method getPropertiesAsString.
returns String
}
Returned by: getInstance()