Class Vault
- java.lang.Object
-
- org.opennms.core.resource.Vault
-
public abstract class Vault extends java.lang.Object
The Vault stores application configuration properties.Since our code might be deployed in different environments, this class provides a deployment-neutral way of retrieving configuration properties.
- Author:
- Lawrence Karnowski , Brian Weaver
-
-
Constructor Summary
Constructors Constructor Description Vault()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.util.Properties
getProperties()
Return the entire set of application configuration properties.static java.lang.String
getProperty(java.lang.String key)
Return property from the configuration parameter list.static void
setProperties(java.util.Properties properties)
Set the application configuration properties.static boolean
supplementSystemPropertiesFromKey(java.lang.String key)
Adds new keys to the system properties using the passed key name a the properties location instance.
-
-
-
Method Detail
-
setProperties
public static void setProperties(java.util.Properties properties)
Set the application configuration properties.- Parameters:
properties
- aProperties
object.
-
getProperties
public static java.util.Properties getProperties()
Return the entire set of application configuration properties.- Returns:
- a
Properties
object.
-
getProperty
public static java.lang.String getProperty(java.lang.String key)
Return property from the configuration parameter list.- Parameters:
key
- aString
object.- Returns:
- a
String
object.
-
supplementSystemPropertiesFromKey
public static boolean supplementSystemPropertiesFromKey(java.lang.String key)
Adds new keys to the system properties using the passed key name a the properties location instance. The passed key is used as a key to the system
Properties.getProperty(java.lang.String)
to find the supplementary property information. The returned value should be in the form of a list of file names, each separated by the systemFile.pathSeparator
character.Once the list of files is recovered, each file is visited and loaded into the system properties. If any file cannot be loaded due to an I/O error then it is skipped as a whole. No partial key sets are loaded into the system properties. Also, this method will not overwrite an existing key in the currently loaded properties.
- Parameters:
key
- The key name used to lookup the property path values.- Returns:
- True if all properties loaded correctly, false if any property file failed to load.
-
-