org.jcoderz.commons.config
Class ConfigurationCacheByPropertiesImpl

java.lang.Object
  extended by org.jcoderz.commons.config.ConfigurationCacheByPropertiesImpl
All Implemented Interfaces:
ConfigurationCacheInterface

public final class ConfigurationCacheByPropertiesImpl
extends Object
implements ConfigurationCacheInterface

This ConfigurationCache implementation is based on a property file.


Method Summary
 void addConfigurationListener(ConfigurationListener newListener)
          
static ConfigurationCacheByPropertiesImpl current()
          Returns a reference to the one and only object instance of this class.
 Set getKeys()
          Returns an immutable Set containing all keys present in the configuration.
 String getString(String key)
          Returns the String value that is associated with the given key.
 void reloadCache()
          Reloads the internal configuration cache from resource bundle.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

current

public static ConfigurationCacheByPropertiesImpl current()
Returns a reference to the one and only object instance of this class. Use this method to access the object's methods.

Returns:
a reference to the one and only object instance of this class.

getString

public String getString(String key)
                 throws ConfigurationValueNotFoundException
Description copied from interface: ConfigurationCacheInterface
Returns the String value that is associated with the given key.

Specified by:
getString in interface ConfigurationCacheInterface
Parameters:
key - the key to look up.
Returns:
the value as string.
Throws:
ConfigurationValueNotFoundException - if the key is not set or the resource was not found.
See Also:
Returns the String value set for the given configuration key.

getKeys

public Set getKeys()
Returns an immutable Set containing all keys present in the configuration. The keys are ConfigurationKey objects. In case there are no keys, the Set is empty.

Specified by:
getKeys in interface ConfigurationCacheInterface
Returns:
the Set of all existing ConfigurationKey objects.

addConfigurationListener

public void addConfigurationListener(ConfigurationListener newListener)

Specified by:
addConfigurationListener in interface ConfigurationCacheInterface
See Also:
ConfigurationServiceInterface.addConfigurationListener(ConfigurationListener)

reloadCache

public void reloadCache()
Reloads the internal configuration cache from resource bundle. If an exception occurs during, the old cached properties are returned.

Specified by:
reloadCache in interface ConfigurationCacheInterface


Copyright 2007 The jCoderZ Project.