Class AbstractApacheConfiguration

java.lang.Object
org.opennms.pris.config.AbstractApacheConfiguration
All Implemented Interfaces:
Configuration
Direct Known Subclasses:
GlobalApacheConfiguration, InstanceApacheConfiguration

public abstract class AbstractApacheConfiguration extends Object implements Configuration
  • Constructor Details

    • AbstractApacheConfiguration

      protected AbstractApacheConfiguration(org.apache.commons.configuration.Configuration config)
  • Method Details

    • getConfiguration

      public org.apache.commons.configuration.Configuration getConfiguration()
    • getConfig

      protected org.apache.commons.configuration.Configuration getConfig()
    • isEmpty

      public boolean isEmpty()
      Description copied from interface: Configuration
      Check if the configuration is empty.
      Specified by:
      isEmpty in interface Configuration
      Returns:
      true if the configuration contains no property, false otherwise
    • containsKey

      public boolean containsKey(String key)
      Description copied from interface: Configuration
      Check if the configuration contains the specified key.
      Specified by:
      containsKey in interface Configuration
      Parameters:
      key - the key whose presence in this configuration is to be tested
      Returns:
      true if the configuration contains a value for this key, false otherwise
    • getString

      public String getString(String key)
      Description copied from interface: Configuration
      Get a string associated with the given configuration key.
      Specified by:
      getString in interface Configuration
      Parameters:
      key - The configuration key
      Returns:
      The associated string
    • getString

      public String getString(String key, String defaultValue)
      Description copied from interface: Configuration
      Get a string associated with the given configuration key. If the key doesn't map to an existing object, the default value is returned.
      Specified by:
      getString in interface Configuration
      Parameters:
      key - The configuration key
      defaultValue - The default value
      Returns:
      The associated string if key is found and has valid format, default value otherwise
    • getStringArray

      public String[] getStringArray(String key)
      Description copied from interface: Configuration
      Get an array of strings associated with the given configuration key. If the key doesn't map to an existing object an empty array is returned.
      Specified by:
      getStringArray in interface Configuration
      Parameters:
      key - The configuration key
      Returns:
      The associated string array if key is found
    • getPath

      public Path getPath(String key)
      Description copied from interface: Configuration
      Get a path associated with the given configuration key. The returned path is resolved to the base directory of the instance configuration.
      Specified by:
      getPath in interface Configuration
      Parameters:
      key - The configuration key
      Returns:
      The associated path
    • getPaths

      public List<Path> getPaths(String key)
      Description copied from interface: Configuration
      Get all paths associated with the given configuration key. The returned paths are resolved to the base directory of the instance configuration.
      Specified by:
      getPaths in interface Configuration
      Parameters:
      key - The configuration key
      Returns:
      A List of the associated paths
    • getPath

      public Path getPath(String key, Path defaultValue)
      Description copied from interface: Configuration
      Get a path associated with the given configuration key. If the key doesn't map to an existing object, the default value is returned. The returned path is resolved to the base directory if the instance configuration.
      Specified by:
      getPath in interface Configuration
      Parameters:
      key - The configuration key
      defaultValue - The default value
      Returns:
      The associated path if key is found and has valid format, default value otherwise
    • getBoolean

      public boolean getBoolean(String key)
      Description copied from interface: Configuration
      Get a boolean associated with the given configuration key.
      Specified by:
      getBoolean in interface Configuration
      Parameters:
      key - The configuration key
      Returns:
      The associated boolean
    • getBoolean

      public boolean getBoolean(String key, boolean defaultValue)
      Description copied from interface: Configuration
      Get a boolean associated with the given configuration key. If the key doesn't map to an existing object, the default value is returned.
      Specified by:
      getBoolean in interface Configuration
      Parameters:
      key - The configuration key
      defaultValue - The default value
      Returns:
      The associated boolean
    • getInt

      public int getInt(String key)
      Description copied from interface: Configuration
      Get a int associated with the given configuration key.
      Specified by:
      getInt in interface Configuration
      Parameters:
      key - The configuration key
      Returns:
      The associated int
    • getInt

      public int getInt(String key, int defaultValue)
      Description copied from interface: Configuration
      Get a int associated with the given configuration key. If the key doesn't map to an existing object, the default value is returned.
      Specified by:
      getInt in interface Configuration
      Parameters:
      key - The configuration key
      defaultValue - The default value
      Returns:
      The associated int
    • getKeys

      public Iterator<String> getKeys()
      Description copied from interface: Configuration
      Get the list of the keys contained in the configuration. The returned iterator can be used to obtain all defined keys. Note that the exact behavior of the iterator's remove() method is specific to a concrete implementation. It may remove the corresponding property from the configuration, but this is not guaranteed. In any case it is no replacement for calling clearProperty(String) for this property. So it is highly recommended to avoid using the iterator's remove() method.
      Specified by:
      getKeys in interface Configuration
      Returns:
      An Iterator.
    • addProperty

      public void addProperty(String key, String string)
      Specified by:
      addProperty in interface Configuration