org.jcoderz.commons.config
Class ConfigurationCacheByDbReadOnlyImpl

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

public final class ConfigurationCacheByDbReadOnlyImpl
extends Object
implements ConfigurationCacheInterface

This ConfigurationCache implementation is based on a ReadOnly EntityBean that stores its data within a database table.


Method Summary
 void addConfigurationListener(ConfigurationListener newListener)
          
static ConfigurationCacheByDbReadOnlyImpl 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 ConfigurationCacheByDbReadOnlyImpl 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
Returns the String value that is associated with the given key. Returns the String value set for the given configuration 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.

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.