站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > JBOSS Portal 2.6 API 英文版文档

PortletResourceBundleManager - JBOSS Portal 2.6 API 英文版文档


org.jboss.portal.portlet.container.info
Class PortletResourceBundleManager

java.lang.Object
  extended byorg.jboss.portal.portlet.container.info.PortletResourceBundleManager

public class PortletResourceBundleManager
extends java.lang.Object

Manage resource bundles for a portlet.

Version:
$Revision: 5448 $
Author:
Julien Viet, Thomas Heute

Field Summary
private  java.lang.String baseName
           
private  java.lang.ClassLoader classLoader
           
private  java.util.ResourceBundle infoBundle
           
private  java.util.Map localeBundles
           
private  org.apache.log4j.Logger log
           
private  java.util.Collection supportedLocales
           
 
Constructor Summary
PortletResourceBundleManager(java.lang.ClassLoader classLoader, LanguagesMetaData metaData)
           
 
Method Summary
 LocalizedString getLocalizedValue(java.lang.String key, java.lang.String defaultValue)
          Return a localized value constructed from the various resource bundles.
 java.util.ResourceBundle getResourceBundle(java.util.Locale locale)
          Return a bundle for the given locale.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

private org.apache.log4j.Logger log

localeBundles

private java.util.Map localeBundles

baseName

private java.lang.String baseName

classLoader

private java.lang.ClassLoader classLoader

infoBundle

private java.util.ResourceBundle infoBundle

supportedLocales

private java.util.Collection supportedLocales
Constructor Detail

PortletResourceBundleManager

public PortletResourceBundleManager(java.lang.ClassLoader classLoader,
                                    LanguagesMetaData metaData)
Method Detail

getLocalizedValue

public LocalizedString getLocalizedValue(java.lang.String key,
                                         java.lang.String defaultValue)
                                  throws java.lang.IllegalArgumentException
Return a localized value constructed from the various resource bundles. The supported locales of the manager are used in combination with the specified key. The default value is used if no value is found for the Locale.ENGLISH.

Parameters:
key - the key to lookup in the bundles
defaultValue -
Returns:
the localized string
Throws:
java.lang.IllegalArgumentException - if the key of the default value is null

getResourceBundle

public java.util.ResourceBundle getResourceBundle(java.util.Locale locale)
                                           throws java.lang.IllegalArgumentException
Return a bundle for the given locale. If the complete locale (language + country + variant) does not exist then it falls back to (language + country) or (language) or the default file.

When the resource bundle object is found and was not in the global map, it put it in that map with a copy on write.

Throws:
java.lang.IllegalArgumentException - if the locale is null