org.apache.felix.webconsole.internal.i18n
Class ResourceBundleManager

java.lang.Object
  extended by org.apache.felix.webconsole.internal.i18n.ResourceBundleManager
All Implemented Interfaces:
EventListener, BundleListener

public class ResourceBundleManager
extends Object
implements BundleListener

The ResourceBundleManager manages resource bundle instance per OSGi Bundle. It contains a local cache, for bundles, but when a bundle is being unistalled, its resources stored in the cache are cleaned up.


Constructor Summary
ResourceBundleManager(BundleContext bundleContext)
          Creates a new object and adds self as a bundle listener
 
Method Summary
 void bundleChanged(BundleEvent event)
          Receives notification that a bundle has had a lifecycle change.
 void dispose()
          Removes the bundle lister.
 ResourceBundle getResourceBundle(Bundle provider, Locale locale)
          This method is used to retrieve a /cached/ instance of the i18n resource associated with a given bundle.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ResourceBundleManager

public ResourceBundleManager(BundleContext bundleContext)
Creates a new object and adds self as a bundle listener

Parameters:
bundleContext - the bundle context of the Web Console.
Method Detail

dispose

public void dispose()
Removes the bundle lister.


getResourceBundle

public ResourceBundle getResourceBundle(Bundle provider,
                                        Locale locale)
This method is used to retrieve a /cached/ instance of the i18n resource associated with a given bundle.

Parameters:
provider - the bundle, provider of the resources
locale - the requested locale.
Returns:
the resource bundle - if not bundle with the requested locale exists, the default locale is used.

bundleChanged

public final void bundleChanged(BundleEvent event)
Description copied from interface: BundleListener
Receives notification that a bundle has had a lifecycle change.

Specified by:
bundleChanged in interface BundleListener
Parameters:
event - The BundleEvent.
See Also:
BundleListener.bundleChanged(org.osgi.framework.BundleEvent)


Copyright © 2011 Apache Software Foundation. All Rights Reserved.