org.naftulin.configmgr
Class ConfigurationUtility

java.lang.Object
  extended by org.naftulin.configmgr.ConfigurationUtility

public class ConfigurationUtility
extends java.lang.Object


Constructor Summary
ConfigurationUtility()
           
 
Method Summary
static java.lang.Boolean getBoolean(java.lang.String configurationKey, java.lang.String propertyKey)
          Looks up configuration by configuration key.
static java.lang.Character getCharacter(java.lang.String configurationKey, java.lang.String propertyKey)
          Looks up configuration by configuration key.
static ConfigurationManagement getConfigurationManagement()
          Returns configuration management engine object.
static ConfigurationManager getConfigurationManager()
          Returns configuration manager.
static java.lang.Double getDouble(java.lang.String configurationKey, java.lang.String propertyKey)
          Looks up configuration by configuration key.
static java.lang.Float getFloat(java.lang.String configurationKey, java.lang.String propertyKey)
          Looks up configuration by configuration key.
static java.lang.Integer getInteger(java.lang.String configurationKey, java.lang.String propertyKey)
          Looks up configuration by configuration key.
static java.lang.Long getLong(java.lang.String configurationKey, java.lang.String propertyKey)
          Looks up configuration by configuration key.
static java.lang.Object getObject(java.lang.String configurationKey)
          Looks up configuration by configuration key, and returns value stored under that configuration.
static java.lang.Object getObject(java.lang.String configurationKey, java.lang.String propertyKey)
          Looks up configuration by configuration key.
static java.lang.Short getShort(java.lang.String configurationKey, java.lang.String propertyKey)
          Looks up configuration by configuration key.
static java.lang.String getString(java.lang.String configurationKey, java.lang.String propertyKey)
          Looks up configuration by configuration key.
static void reload()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConfigurationUtility

public ConfigurationUtility()
Method Detail

getBoolean

public static java.lang.Boolean getBoolean(java.lang.String configurationKey,
                                           java.lang.String propertyKey)
Looks up configuration by configuration key. Assumes that configuration is of type Map (property file, database key/value pairs, external configuration stored as Map) and looks at value in the map based on property key. Returns value found as Boolean.

Parameters:
configurationKey -
propertyKey -
Returns:
value in configuration map based on configuration key and property key.
Throws:
java.lang.IllegalArgumentException - if configuration based on configuration key is not found; or if configuration is found, but is not of type Map, or if Map found does not contain value under property key.

getCharacter

public static java.lang.Character getCharacter(java.lang.String configurationKey,
                                               java.lang.String propertyKey)
Looks up configuration by configuration key. Assumes that configuration is of type Map (property file, database key/value pairs, external configuration stored as Map) and looks at value in the map based on property key. Returns value found as Character.

Parameters:
configurationKey -
propertyKey -
Returns:
value in configuration map based on configuration key and property key.
Throws:
java.lang.IllegalArgumentException - if configuration based on configuration key is not found; or if configuration is found, but is not of type Map, or if Map found does not contain value under property key, or if value stored is cannot be parsed to specified type.

getDouble

public static java.lang.Double getDouble(java.lang.String configurationKey,
                                         java.lang.String propertyKey)
Looks up configuration by configuration key. Assumes that configuration is of type Map (property file, database key/value pairs, external configuration stored as Map) and looks at value in the map based on property key. Returns value found as Double.

Parameters:
configurationKey -
propertyKey -
Returns:
value in configuration map based on configuration key and property key.
Throws:
java.lang.IllegalArgumentException - if configuration based on configuration key is not found; or if configuration is found, but is not of type Map, or if Map found does not contain value under property key, or if value stored is cannot be parsed to specified type.

getFloat

public static java.lang.Float getFloat(java.lang.String configurationKey,
                                       java.lang.String propertyKey)
Looks up configuration by configuration key. Assumes that configuration is of type Map (property file, database key/value pairs, external configuration stored as Map) and looks at value in the map based on property key. Returns value found as Float.

Parameters:
configurationKey -
propertyKey -
Returns:
value in configuration map based on configuration key and property key.
Throws:
java.lang.IllegalArgumentException - if configuration based on configuration key is not found; or if configuration is found, but is not of type Map, or if Map found does not contain value under property key, or if value stored is cannot be parsed to specified type.

getInteger

public static java.lang.Integer getInteger(java.lang.String configurationKey,
                                           java.lang.String propertyKey)
Looks up configuration by configuration key. Assumes that configuration is of type Map (property file, database key/value pairs, external configuration stored as Map) and looks at value in the map based on property key. Returns value found as Integer.

Parameters:
configurationKey -
propertyKey -
Returns:
value in configuration map based on configuration key and property key.
Throws:
java.lang.IllegalArgumentException - if configuration based on configuration key is not found; or if configuration is found, but is not of type Map, or if Map found does not contain value under property key, or if value stored is cannot be parsed to specified type.

getLong

public static java.lang.Long getLong(java.lang.String configurationKey,
                                     java.lang.String propertyKey)
Looks up configuration by configuration key. Assumes that configuration is of type Map (property file, database key/value pairs, external configuration stored as Map) and looks at value in the map based on property key. Returns value found as Long.

Parameters:
configurationKey -
propertyKey -
Returns:
value in configuration map based on configuration key and property key.
Throws:
java.lang.IllegalArgumentException - if configuration based on configuration key is not found; or if configuration is found, but is not of type Map, or if Map found does not contain value under property key, or if value stored is cannot be parsed to specified type.

getShort

public static java.lang.Short getShort(java.lang.String configurationKey,
                                       java.lang.String propertyKey)
Looks up configuration by configuration key. Assumes that configuration is of type Map (property file, database key/value pairs, external configuration stored as Map) and looks at value in the map based on property key. Returns value found as Short.

Parameters:
configurationKey -
propertyKey -
Returns:
value in configuration map based on configuration key and property key.
Throws:
java.lang.IllegalArgumentException - if configuration based on configuration key is not found; or if configuration is found, but is not of type Map, or if Map found does not contain value under property key, or if value stored is cannot be parsed to specified type.

getString

public static java.lang.String getString(java.lang.String configurationKey,
                                         java.lang.String propertyKey)
Looks up configuration by configuration key. Assumes that configuration is of type Map (property file, database key/value pairs, external configuration stored as Map) and looks at value in the map based on property key. Returns value found as String.

Parameters:
configurationKey -
propertyKey -
Returns:
value in configuration map based on configuration key and property key.
Throws:
java.lang.IllegalArgumentException - if configuration based on configuration key is not found; or if configuration is found, but is not of type Map, or if Map found does not contain value under property key.

getObject

public static java.lang.Object getObject(java.lang.String configurationKey,
                                         java.lang.String propertyKey)
Looks up configuration by configuration key. Assumes that configuration is of type Map (property file, database key/value pairs, external configuration stored as Map) and looks at value in the map based on property key. Returns value found as Object.

Parameters:
configurationKey -
propertyKey -
Returns:
value in configuration map based on configuration key and property key.
Throws:
java.lang.IllegalArgumentException - if configuration based on configuration key is not found; or if configuration is found, but is not of type Map, or if Map found does not contain value under property key.

getObject

public static java.lang.Object getObject(java.lang.String configurationKey)
Looks up configuration by configuration key, and returns value stored under that configuration. For example, for property file, Properties would be returned; for XML - parsed and typed xml object would be returned; for LDAP - the object that was stored in LDAP would be returned.

Parameters:
configurationKey -
propertyKey -
Returns:
value in configuration map based on configuration key and property key.
Throws:
java.lang.IllegalArgumentException - if configuration based on configuration key is not found.

getConfigurationManagement

public static ConfigurationManagement getConfigurationManagement()
Returns configuration management engine object. If the object was not created yet, this call will create it.

Returns:
configuration management engine object.
Throws:
ConfigurationManagerRuntimeException - if an error occurred while creating a configuration management object.

reload

public static void reload()

getConfigurationManager

public static ConfigurationManager getConfigurationManager()
Returns configuration manager. If the manager was not created yet, this call will create it.

Returns:
configuration manager.
Throws:
ConfigurationManagerRuntimeException - if an error occurs while creating a configuration manager.


Copyright © 2009. All Rights Reserved.