Package com.portal.pcm.configuration
Interface Configuration
- All Known Implementing Classes:
BaseConfiguration,PropertiesConfiguration
public interface Configuration
Configuration interface which provides a hierarchical view of the configuration values that
we need to handle.
-
Method Summary
Modifier and TypeMethodDescriptionAttempt to get a block of configuration for the key provided (raise an error if it does not exist)Gets all the lower-level keys for the current configuration that are blocks of configuration (that is, not 'leaf' values).getBlockKeys(String key) Gets all the lower-level keys for a given block in the configuration that are blocks of configuration (that is, not 'leaf' values).getBoolean(String key) Attempt to get a boolean from the configuration for the key provided.getInteger(String key) Attempt to get an integer from the configuration for the key providedAttempt to get a long from the configuration for the key providedgetOptionalBlock(String key) Attempt to get a block of configuration for the key provided (without raising an error if it does not exist)getOptionalBoolean(String key) Attempt to get a Boolean from the configuration for the key provided.getOptionalBoolean(String key, Boolean defValue) Attempt to get a Boolean from the configuration for the key provided (and default to a given value if not found)getOptionalInteger(String key) Attempt to get an integer from the configuration for the key provided.getOptionalInteger(String key, Integer defValue) Attempt to get an integer from the configuration for the key provided (and default to a given value if not found)getOptionalLong(String key) Attempt to get a long from the configuration for the key provided.getOptionalLong(String key, Long defValue) Attempt to get a long from the configuration for the key provided (and default to a given value if not found)getOptionalString(String key) Attempt to get a string from the configuration for the key provided.getOptionalString(String key, String defValue) Attempt to get a string from the configuration for the key provided (and default to a given value if not found)Attempt to get a string from the configuration for the key provided.Gets the keys for 'leaf' values for the current location in the configuration hierarchy (that is, not 'blocks').getValueKeys(String key) Gets the keys for 'leaf' values for a given location in the configuration hierarchy (that is, not 'blocks')Return a set of configuration as a Properties objecttoString()Get a pretty-printed string representation of the configuration object.
-
Method Details
-
getBlockKeys
Gets all the lower-level keys for a given block in the configuration that are blocks of configuration (that is, not 'leaf' values). If 'key' is null or empty it will refer to the main configuration.- Parameters:
key- the key to the section of the configuration we're interested in.- Returns:
- a set of String keys for the block (or an empty set if there are none)
- Throws:
ConfigurationException- if the key refers to a 'leaf' value, not a block
-
getBlockKeys
Gets all the lower-level keys for the current configuration that are blocks of configuration (that is, not 'leaf' values).- Returns:
- a set of String keys for the block (or an empty set if there are none)
- Throws:
ConfigurationException- if the key refers to a 'leaf' value, not a block
-
getValueKeys
Gets the keys for 'leaf' values for a given location in the configuration hierarchy (that is, not 'blocks')- Parameters:
key- the key to the section of the configuration we're interested in.- Returns:
- a set of String keys for the values.
- Throws:
ConfigurationException- if the key requested is not a block in the configuration.
-
getValueKeys
Gets the keys for 'leaf' values for the current location in the configuration hierarchy (that is, not 'blocks').- Returns:
- a set of String keys for the values.
- Throws:
ConfigurationException- if the key requested is not a block in the configuration.
-
getOptionalBlock
Attempt to get a block of configuration for the key provided (without raising an error if it does not exist)- Parameters:
key- the key to the section of the configuration we're interested in.- Returns:
- a pointer to the Configuration or null if it does not exist.
- Throws:
ConfigurationException- if the key requested is not a block in the configuration (i.e. it is a 'leaf value').
-
getBlock
Attempt to get a block of configuration for the key provided (raise an error if it does not exist)- Parameters:
key- the key to the section of the configuration we're interested in.- Returns:
- a pointer to the Configuration.
- Throws:
ConfigurationException- if the key requested is not a block in the configuration or does not exist.
-
getOptionalInteger
Attempt to get an integer from the configuration for the key provided (and default to a given value if not found)- Parameters:
key- the key to the configuration entity we're interested in.defValue- the default value to use if the key value is not found.- Returns:
- The integer value of the configuration parameter or the default value if not found
- Throws:
ConfigurationException- if the key requested is not a value in the configuration, or is not an integer
-
getOptionalInteger
Attempt to get an integer from the configuration for the key provided.- Parameters:
key- the key to the configuration entity we're interested in.- Returns:
- The integer value of the configuration parameter (or null if not found).
- Throws:
ConfigurationException- if the key requested is not a value in the configuration, is not an integer.
-
getInteger
Attempt to get an integer from the configuration for the key provided- Parameters:
key- the key to the configuration entity we're interested in.- Returns:
- The integer value of the configuration parameter.
- Throws:
ConfigurationException- if the key requested is not a value in the configuration, or is not an integer, or is not found
-
getOptionalLong
Attempt to get a long from the configuration for the key provided (and default to a given value if not found)- Parameters:
key- the key to the configuration entity we're interested in.defValue- the default value to use if the key value is not found.- Returns:
- The long value of the configuration parameter or the default value if not found
- Throws:
ConfigurationException- if the key requested is not a value in the configuration, or is not a long
-
getOptionalLong
Attempt to get a long from the configuration for the key provided.- Parameters:
key- the key to the configuration entity we're interested in.- Returns:
- The long value of the configuration parameter (or null if not found).
- Throws:
ConfigurationException- if the key requested is not a value in the configuration, is not a long.
-
getLong
Attempt to get a long from the configuration for the key provided- Parameters:
key- the key to the configuration entity we're interested in.- Returns:
- The long value of the configuration parameter.
- Throws:
ConfigurationException- if the key requested is not a value in the configuration, or is not a long, or is not found
-
getOptionalBoolean
Attempt to get a Boolean from the configuration for the key provided (and default to a given value if not found)- Parameters:
key- the key to the configuration entity we're interested in.- Returns:
- The boolean value of the configuration parameter or the default value (if not found)
- Throws:
ConfigurationException- if the key requested is not a value in the configuration, or is not a boolean
-
getOptionalBoolean
Attempt to get a Boolean from the configuration for the key provided.- Parameters:
key- the key to the configuration entity we're interested in.- Returns:
- The boolean value of the configuration parameter or null if not found
- Throws:
ConfigurationException- if the key requested is not a value in the configuration, or is not a boolean
-
getBoolean
Attempt to get a boolean from the configuration for the key provided.- Parameters:
key- the key to the configuration entity we're interested in.- Returns:
- The boolean value of the configuration parameter or null if not found
- Throws:
ConfigurationException- if the key requested is not a value in the configuration, or is not a boolean
-
getString
Attempt to get a string from the configuration for the key provided.- Parameters:
key- the key to the configuration entity we're interested in.- Returns:
- The string value of the configuration parameter
- Throws:
ConfigurationException- if the key requested is not a value in the configuration, or is not found
-
getOptionalString
Attempt to get a string from the configuration for the key provided (and default to a given value if not found)- Parameters:
key- the key to the configuration entity we're interested in.- Returns:
- The string value of the configuration parameter (or the default value if not found)
- Throws:
ConfigurationException- if the key requested is not a value in the configuration, or is not a string
-
getOptionalString
Attempt to get a string from the configuration for the key provided.- Parameters:
key- the key to the configuration entity we're interested in.- Returns:
- The string value of the configuration parameter (or null if not found)
- Throws:
ConfigurationException- if the key requested is not a value in the configuration, or is not a string
-
toString
String toString()Get a pretty-printed string representation of the configuration object. -
toProperties
Properties toProperties()Return a set of configuration as a Properties object- Returns:
- A Properties object for this section of configuration
-