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
ModifierConstructorDescriptionprotected
AbstractApacheConfiguration
(org.apache.commons.configuration.Configuration config) -
Method Summary
Modifier and TypeMethodDescriptionvoid
addProperty
(String key, String string) boolean
containsKey
(String key) Check if the configuration contains the specified key.boolean
getBoolean
(String key) Get a boolean associated with the given configuration key.boolean
getBoolean
(String key, boolean defaultValue) Get a boolean associated with the given configuration key.protected org.apache.commons.configuration.Configuration
org.apache.commons.configuration.Configuration
int
Get a int associated with the given configuration key.int
Get 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.boolean
isEmpty()
Check if the configuration is empty.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods 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:Configuration
Check if the configuration is empty.- Specified by:
isEmpty
in interfaceConfiguration
- Returns:
true
if the configuration contains no property,false
otherwise
-
containsKey
Description copied from interface:Configuration
Check if the configuration contains the specified key.- Specified by:
containsKey
in 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:Configuration
Get a string associated with the given configuration key.- Specified by:
getString
in interfaceConfiguration
- Parameters:
key
- The configuration key- Returns:
- The associated string
-
getString
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 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: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 interfaceConfiguration
- Parameters:
key
- The configuration key- Returns:
- The associated string array if key is found
-
getPath
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 interfaceConfiguration
- Parameters:
key
- The configuration key- Returns:
- The associated path
-
getPaths
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 interfaceConfiguration
- Parameters:
key
- The configuration key- Returns:
- A List of the associated paths
-
getPath
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 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:Configuration
Get a boolean associated with the given configuration key.- Specified by:
getBoolean
in interfaceConfiguration
- Parameters:
key
- The configuration key- Returns:
- The associated boolean
-
getBoolean
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 interfaceConfiguration
- Parameters:
key
- The configuration keydefaultValue
- The default value- Returns:
- The associated boolean
-
getInt
Description copied from interface:Configuration
Get a int associated with the given configuration key.- Specified by:
getInt
in interfaceConfiguration
- Parameters:
key
- The configuration key- Returns:
- The associated int
-
getInt
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 interfaceConfiguration
- Parameters:
key
- The configuration keydefaultValue
- The default value- Returns:
- The associated int
-
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'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:
getKeys
in interfaceConfiguration
- Returns:
- An Iterator.
-
addProperty
- Specified by:
addProperty
in interfaceConfiguration
-