Class HierarchicalConfiguration

java.lang.Object
org.pentaho.reporting.libraries.base.config.HierarchicalConfiguration
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, Configuration, ModifiableConfiguration
Direct Known Subclasses:
PropertyFileConfiguration, SystemPropertyConfiguration

public class HierarchicalConfiguration extends java.lang.Object implements ModifiableConfiguration
A hierarchical configuration. Such a configuration can have one or more parent configurations providing usefull default values.
Author:
Thomas Morgner
See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a new configuration.
    HierarchicalConfiguration(java.lang.Class booterClass)
    Creates a new configuration, that is able to reconnect itself to the global configuration after deserialization.
    Creates a new configuration.
  • Method Summary

    Modifier and Type
    Method
    Description
    java.lang.Object
    Clones this configuration.
    java.util.Iterator
    findPropertyKeys(java.lang.String prefix)
    Searches all property keys that start with a given prefix.
    java.util.Enumeration
    Returns all defined configuration properties for the report.
    java.lang.String
    getConfigProperty(java.lang.String key)
    Returns the configuration property with the specified key.
    java.lang.String
    getConfigProperty(java.lang.String key, java.lang.String defaultValue)
    Returns the configuration property with the specified key (or the specified default value if there is no such property).
    void
    The new configuartion will be inserted into the list of report configuration, so that this configuration has the given report configuration instance as parent.
    boolean
    isLocallyDefined(java.lang.String key)
    Checks, whether the given key is localy defined in this instance or whether the key's value is inherited.
    void
    setConfigProperty(java.lang.String key, java.lang.String value)
    Sets a configuration property.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • HierarchicalConfiguration

      public HierarchicalConfiguration()
      Creates a new configuration.
    • HierarchicalConfiguration

      public HierarchicalConfiguration(Configuration parentConfiguration)
      Creates a new configuration.
      Parameters:
      parentConfiguration - the parent configuration.
    • HierarchicalConfiguration

      public HierarchicalConfiguration(java.lang.Class booterClass)
      Creates a new configuration, that is able to reconnect itself to the global configuration after deserialization.
      Parameters:
      booterClass - the booter class that holds the global configuration.
  • Method Details

    • getConfigProperty

      public java.lang.String getConfigProperty(java.lang.String key)
      Returns the configuration property with the specified key.
      Specified by:
      getConfigProperty in interface Configuration
      Parameters:
      key - the property key.
      Returns:
      the property value.
    • getConfigProperty

      public java.lang.String getConfigProperty(java.lang.String key, java.lang.String defaultValue)
      Returns the configuration property with the specified key (or the specified default value if there is no such property).

      If the property is not defined in this configuration, the code will lookup the property in the parent configuration.

      Specified by:
      getConfigProperty in interface Configuration
      Parameters:
      key - the property key.
      defaultValue - the default value.
      Returns:
      the property value.
    • setConfigProperty

      public void setConfigProperty(java.lang.String key, java.lang.String value)
      Sets a configuration property.
      Specified by:
      setConfigProperty in interface ModifiableConfiguration
      Parameters:
      key - the property key.
      value - the property value.
    • isLocallyDefined

      public boolean isLocallyDefined(java.lang.String key)
      Checks, whether the given key is localy defined in this instance or whether the key's value is inherited.
      Parameters:
      key - the key that should be checked.
      Returns:
      true, if the key is defined locally, false otherwise.
    • insertConfiguration

      public void insertConfiguration(HierarchicalConfiguration config)
      The new configuartion will be inserted into the list of report configuration, so that this configuration has the given report configuration instance as parent.
      Parameters:
      config - the new report configuration.
    • getConfigProperties

      public java.util.Enumeration getConfigProperties()
      Returns all defined configuration properties for the report. The enumeration contains all keys of the changed properties, properties set from files or the system properties are not included.
      Specified by:
      getConfigProperties in interface Configuration
      Specified by:
      getConfigProperties in interface ModifiableConfiguration
      Returns:
      all defined configuration properties for the report.
    • findPropertyKeys

      public java.util.Iterator findPropertyKeys(java.lang.String prefix)
      Searches all property keys that start with a given prefix.
      Specified by:
      findPropertyKeys in interface Configuration
      Specified by:
      findPropertyKeys in interface ModifiableConfiguration
      Parameters:
      prefix - the prefix that all selected property keys should share
      Returns:
      the properties as iterator.
    • clone

      public java.lang.Object clone() throws java.lang.CloneNotSupportedException
      Clones this configuration.
      Specified by:
      clone in interface Configuration
      Returns:
      a clone of this configuration.
      Throws:
      java.lang.CloneNotSupportedException