org.pentaho.reporting.libraries.base.config

Class HierarchicalConfiguration

public class HierarchicalConfiguration extends Object implements ModifiableConfiguration

A hierarchical configuration. Such a configuration can have one or more parent configurations providing usefull default values.

Author: Thomas Morgner

Constructor Summary
HierarchicalConfiguration()
Creates a new configuration.
HierarchicalConfiguration(Configuration parentConfiguration)
Creates a new configuration.
HierarchicalConfiguration(Class booterClass)
Method Summary
Objectclone()
IteratorfindPropertyKeys(String prefix)
Searches all property keys that start with a given prefix.
EnumerationgetConfigProperties()
Returns all defined configuration properties for the report.
StringgetConfigProperty(String key)
Returns the configuration property with the specified key.
StringgetConfigProperty(String key, String defaultValue)
Returns the configuration property with the specified key (or the specified default value if there is no such property).
protected PropertiesgetConfiguration()
Returns the collection of properties for the configuration.
protected ConfigurationgetParentConfig()
Returns the parent configuration.
voidinsertConfiguration(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.
booleanisLocallyDefined(String key)
Checks, whether the given key is localy defined in this instance or whether the key's value is inherited.
voidsetConfigProperty(String key, String value)
Sets a configuration property.
protected voidsetParentConfig(Configuration config)
Set the parent configuration.

Constructor Detail

HierarchicalConfiguration

public HierarchicalConfiguration()
Creates a new configuration.

HierarchicalConfiguration

public HierarchicalConfiguration(Configuration parentConfiguration)
Creates a new configuration.

Parameters: parentConfiguration the parent configuration.

HierarchicalConfiguration

public HierarchicalConfiguration(Class booterClass)

Method Detail

clone

public Object clone()

findPropertyKeys

public Iterator findPropertyKeys(String prefix)
Searches all property keys that start with a given prefix.

Parameters: prefix the prefix that all selected property keys should share

Returns: the properties as iterator.

getConfigProperties

public 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.

Returns: all defined configuration properties for the report.

getConfigProperty

public String getConfigProperty(String key)
Returns the configuration property with the specified key.

Parameters: key the property key.

Returns: the property value.

getConfigProperty

public String getConfigProperty(String key, 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.

Parameters: key the property key. defaultValue the default value.

Returns: the property value.

getConfiguration

protected Properties getConfiguration()
Returns the collection of properties for the configuration.

Returns: the properties.

getParentConfig

protected Configuration getParentConfig()
Returns the parent configuration. The parent configuration is queried, if the requested configuration values was not found in this report configuration.

Returns: the parent configuration.

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.

isLocallyDefined

public boolean isLocallyDefined(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.

setConfigProperty

public void setConfigProperty(String key, String value)
Sets a configuration property.

Parameters: key the property key. value the property value.

setParentConfig

protected void setParentConfig(Configuration config)
Set the parent configuration. The parent configuration is queried, if the requested configuration values was not found in this report configuration.

Parameters: config the parent configuration.