Class Vault


  • public abstract class Vault
    extends 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 Detail

      • Vault

        public Vault()
    • Method Detail

      • setProperties

        public static void setProperties​(Properties properties)
        Set the application configuration properties.
        Parameters:
        properties - a Properties object.
      • getProperties

        public static Properties getProperties()
        Return the entire set of application configuration properties.
        Returns:
        a Properties object.
      • getProperty

        public static String getProperty​(String key)
        Return property from the configuration parameter list.
        Parameters:
        key - a String object.
        Returns:
        a String object.
      • supplementSystemPropertiesFromKey

        public static boolean supplementSystemPropertiesFromKey​(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 system File.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.