nl.toolforge.karma.core.bundle
Class BundleCache

java.lang.Object
  extended bynl.toolforge.karma.core.bundle.BundleCache

public class BundleCache
extends java.lang.Object

Helper class initializing ResourceBundle and caching instances to enable localized messages. Interface applications can extend this class to add and retrieve cached bundle.

Version:
$Id: BundleCache.java,v 1.14 2004/08/29 18:00:31 hippe Exp $
Author:
D.A. Smedes

Field Summary
static java.lang.String ERROR_MESSAGES_KEY
           
static java.lang.String FRONTEND_MESSAGES_KEY
           
 
Method Summary
 void flush()
          Flushes this cache.
 java.util.ResourceBundle getBundle(java.lang.String bundleKey)
          Retrieves a bundle from the cache by bundleKey.
static BundleCache getInstance()
          Initializes the cache or returns the cache.
 void register(java.lang.String bundleKey, java.util.ResourceBundle bundle)
          Registers a resource bundle in the cache.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ERROR_MESSAGES_KEY

public static final java.lang.String ERROR_MESSAGES_KEY
See Also:
Constant Field Values

FRONTEND_MESSAGES_KEY

public static final java.lang.String FRONTEND_MESSAGES_KEY
See Also:
Constant Field Values
Method Detail

getInstance

public static BundleCache getInstance()
Initializes the cache or returns the cache.

Returns:
The cache instance.

register

public final void register(java.lang.String bundleKey,
                           java.util.ResourceBundle bundle)
Registers a resource bundle in the cache.

Parameters:
bundleKey - The unique key to the bundle. All keys are transformed into uppercase.
bundle - The resource bundle to register in this cache.

getBundle

public final java.util.ResourceBundle getBundle(java.lang.String bundleKey)
Retrieves a bundle from the cache by bundleKey.

Parameters:
bundleKey - The unique key to this bundle.
Returns:
The resource bundle as identified by bundleKey in the cache.

flush

public final void flush()
Flushes this cache.



Copyright © 2002-2004 Toolforge. All Rights Reserved.