Package org.opennms.pris.config
Class AbstractApacheConfiguration
java.lang.Object
org.opennms.pris.config.AbstractApacheConfiguration
- All Implemented Interfaces:
Configuration
- Direct Known Subclasses:
GlobalApacheConfiguration,InstanceApacheConfiguration
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractApacheConfiguration(org.apache.commons.configuration.Configuration config) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddProperty(String key, String string) booleancontainsKey(String key) Check if the configuration contains the specified key.booleangetBoolean(String key) Get a boolean associated with the given configuration key.booleangetBoolean(String key, boolean defaultValue) Get a boolean associated with the given configuration key.protected org.apache.commons.configuration.Configurationorg.apache.commons.configuration.ConfigurationintGet a int associated with the given configuration key.intGet a int associated with the given configuration key.getKeys()Get the list of the keys contained in the configuration.Get a path associated with the given configuration key.Get a path associated with the given configuration key.Get all paths associated with the given configuration key.Get a string associated with the given configuration key.Get a string associated with the given configuration key.String[]getStringArray(String key) Get an array of strings associated with the given configuration key.booleanisEmpty()Check if the configuration is empty.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.opennms.pris.api.Configuration
getBasePath
-
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:ConfigurationCheck if the configuration is empty.- Specified by:
isEmptyin interfaceConfiguration- Returns:
trueif the configuration contains no property,falseotherwise
-
containsKey
Description copied from interface:ConfigurationCheck if the configuration contains the specified key.- Specified by:
containsKeyin interfaceConfiguration- 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
Description copied from interface:ConfigurationGet a string associated with the given configuration key.- Specified by:
getStringin interfaceConfiguration- Parameters:
key- The configuration key- Returns:
- The associated string
-
getString
Description copied from interface:ConfigurationGet 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:
getStringin interfaceConfiguration- Parameters:
key- The configuration keydefaultValue- The default value- Returns:
- The associated string if key is found and has valid format, default value otherwise
-
getStringArray
Description copied from interface:ConfigurationGet 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:
getStringArrayin interfaceConfiguration- Parameters:
key- The configuration key- Returns:
- The associated string array if key is found
-
getPath
Description copied from interface:ConfigurationGet a path associated with the given configuration key. The returned path is resolved to the base directory of the instance configuration.- Specified by:
getPathin interfaceConfiguration- Parameters:
key- The configuration key- Returns:
- The associated path
-
getPaths
Description copied from interface:ConfigurationGet all paths associated with the given configuration key. The returned paths are resolved to the base directory of the instance configuration.- Specified by:
getPathsin interfaceConfiguration- Parameters:
key- The configuration key- Returns:
- A List of the associated paths
-
getPath
Description copied from interface:ConfigurationGet 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:
getPathin interfaceConfiguration- Parameters:
key- The configuration keydefaultValue- The default value- Returns:
- The associated path if key is found and has valid format, default value otherwise
-
getBoolean
Description copied from interface:ConfigurationGet a boolean associated with the given configuration key.- Specified by:
getBooleanin interfaceConfiguration- Parameters:
key- The configuration key- Returns:
- The associated boolean
-
getBoolean
Description copied from interface:ConfigurationGet 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:
getBooleanin interfaceConfiguration- Parameters:
key- The configuration keydefaultValue- The default value- Returns:
- The associated boolean
-
getInt
Description copied from interface:ConfigurationGet a int associated with the given configuration key.- Specified by:
getIntin interfaceConfiguration- Parameters:
key- The configuration key- Returns:
- The associated int
-
getInt
Description copied from interface:ConfigurationGet 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:
getIntin interfaceConfiguration- Parameters:
key- The configuration keydefaultValue- The default value- Returns:
- The associated int
-
getKeys
Description copied from interface:ConfigurationGet 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'sremove()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 callingclearProperty(String)for this property. So it is highly recommended to avoid using the iterator'sremove()method.- Specified by:
getKeysin interfaceConfiguration- Returns:
- An Iterator.
-
addProperty
- Specified by:
addPropertyin interfaceConfiguration
-