Class StaticConfiguration

java.lang.Object
org.jolokia.server.core.config.StaticConfiguration
All Implemented Interfaces:
Configuration

public class StaticConfiguration extends Object implements Configuration
Class encapsulating all Agent configuration, global config and processing parameters
Since:
07.02.13
Author:
roland
  • Constructor Details

    • StaticConfiguration

      public StaticConfiguration(Object... keyAndValues)
      Convenience constructor for setting up base configuration with key values pairs. This constructor is especially suited for unit tests.
      Parameters:
      keyAndValues - an array with even number of elements and ConfigKey and String alternating.
    • StaticConfiguration

      public StaticConfiguration(Map<String,String> pConfig)
      Initialise this configuration from a string-string map. Only the known keys are taken from the given map
      Parameters:
      pConfig - config map from where to take the configuration
  • Method Details

    • update

      public void update(ConfigExtractor pExtractor)
      Update the configuration hold by this object
      Parameters:
      pExtractor - an extractor for retrieving the configuration from some external object
    • update

      public void update(Configuration pConfig)
      Update from another configuration object whose values take precedence
      Parameters:
      pConfig - update configuration from the given config
    • getConfig

      public String getConfig(ConfigKey pKey)
      Get a configuration value if set as configuration or the default value if not
      Specified by:
      getConfig in interface Configuration
      Parameters:
      pKey - the configuration key to lookup
      Returns:
      the configuration value or the default value if no configuration was given.
    • getConfig

      public String getConfig(ConfigKey pKey, boolean checkSysOrEnv)
      Get a configuration value if set as configuration or the default value if not
      Specified by:
      getConfig in interface Configuration
      Parameters:
      pKey - the configuration key to lookup
      checkSysOrEnv - whether system property or environment variable should be checked first
      Returns:
      the configuration value or the default value if no configuration was given.
    • getConfigKeys

      public Set<ConfigKey> getConfigKeys()
      Get all keys stored in this configuration
      Specified by:
      getConfigKeys in interface Configuration
    • containsKey

      public boolean containsKey(ConfigKey pKey)
      Check whether the given configuration holds a value for the given key
      Specified by:
      containsKey in interface Configuration
      Parameters:
      pKey - key to check
      Returns:
      true if the configuration has this key