Enterprise Information Portal APIs

com.ibm.mm.beans
Class CMBResourceCenter

java.lang.Object
  |
  +--com.ibm.mm.beans.CMBResourceCenter

public class CMBResourceCenter
extends java.lang.Object

Class provides central control over the translatable resources of CM beans, includes:

    messages      design time and default runtime messages
    literals      literals to be displayed in build tools, such as property
                  display names and short descriptions
 
This class initially loads both literal and message resouce bundles using system locale, and then caches these resource bunldes for future use during the application session. You can call getBundle(String, Locale ) or getBundle(String) to reload the specified resouce dynamically.

Since:
6.1

Field Summary
static java.lang.String BASE_LITERAL_BUNDLE
          The resource file containing literals displayed in builder tools, including poperty display name, and short description.
static java.lang.String BASE_MESSAGE_BUNDLE
          The message resource file containing design time and default runtime messages.
 
Constructor Summary
CMBResourceCenter()
           
 
Method Summary
static java.util.ResourceBundle getBundle(java.lang.String resName)
          Get the specified resource bundle, re-loaded it with current locale.
static java.util.ResourceBundle getBundle(java.lang.String resName, java.util.Locale locale)
          Get the specified resource bundle, re-loaded with the specified locale.
static java.util.ResourceBundle getLiteralBundle()
          Get the literal resource bundle.
static java.lang.String getLiteralString(java.lang.String key)
          Get the literal string from resource bundle
static java.util.ResourceBundle getMessageBundle()
          Get the message resource bundle.
static java.lang.String getMessageString(java.lang.String key)
          Get the message string from resource bundle
static java.lang.String getMessageString(java.lang.String key, java.lang.String[] inserts)
          Formats a message with inserts.
static void setCurrentLocale(java.util.Locale locale)
          Set the application-wide locale.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BASE_LITERAL_BUNDLE

public static final java.lang.String BASE_LITERAL_BUNDLE
The resource file containing literals displayed in builder tools, including poperty display name, and short description. The files are:
    CMBBaseLiteral.properties       - for default locale and English
    CMBBaseLiteral_it.properties    - for Italian
    CMBBaseLiteral_ja.properties    - for Japanese
    CMBBaseLiteral_zh_CN.properties - for simplified Chinese
    etc.
 
Application designer can modify these files to provide default values global to all applications.

BASE_MESSAGE_BUNDLE

public static final java.lang.String BASE_MESSAGE_BUNDLE
The message resource file containing design time and default runtime messages. The files are:
    CMBBaseMessage.properties       - for default locale and English
    CMBBaseMessage_it.properties    - for Italian
    CMBBaseMessage_ja.properties    - for Japanese
    CMBBaseMessage_zh_CN.properties - for simplified Chinese
    etc.
 
Application designer can modify these files to provide default values global to all applications.
Constructor Detail

CMBResourceCenter

public CMBResourceCenter()
Method Detail

setCurrentLocale

public static void setCurrentLocale(java.util.Locale locale)
                             throws java.util.MissingResourceException
Set the application-wide locale. Calling this method will reload literal and message resource bundles using the specified locale. The loaded resource bundles will then be cached for future use during the application session. If application doesn't call this method at all, the locale used during application session will be whatever the system locale is.
Parameters:
locale - the locale to use for the application
Throws:
java.util.MissingResourceException - resource file not found

getLiteralBundle

public static java.util.ResourceBundle getLiteralBundle()
Get the literal resource bundle. This method gets the cached resource bundle.
Returns:
the literal resource bundle

getMessageBundle

public static java.util.ResourceBundle getMessageBundle()
Get the message resource bundle. This method gets cached resource bundle.
Returns:
the message resource bundle

getBundle

public static java.util.ResourceBundle getBundle(java.lang.String resName)
                                          throws java.util.MissingResourceException
Get the specified resource bundle, re-loaded it with current locale. The re-loaded bundle will NOT be cached.
Parameters:
resName - the resource bundle property file name
Returns:
the specified resource bundle, or null if file not found
Throws:
java.util.MissingResourceException - resource file not found

getBundle

public static java.util.ResourceBundle getBundle(java.lang.String resName,
                                                 java.util.Locale locale)
                                          throws java.util.MissingResourceException
Get the specified resource bundle, re-loaded with the specified locale. This method can be used to load resource with locale other than the current. It will not change application current locale. The re-loaded bundle will NOT be cached.
Parameters:
resName - the resource bundle property file name
locale - the locale to load resource bundle
Returns:
the specified resource bundle

getLiteralString

public static java.lang.String getLiteralString(java.lang.String key)
Get the literal string from resource bundle
Parameters:
key - the resource ID
Returns:
the resource value

getMessageString

public static java.lang.String getMessageString(java.lang.String key)
Get the message string from resource bundle
Parameters:
key - the resource ID
Returns:
the resource value

getMessageString

public static java.lang.String getMessageString(java.lang.String key,
                                                java.lang.String[] inserts)
Formats a message with inserts.
Parameters:
key - the resource ID
inserts - the message inserts
Returns:
the resource value

EIP JavaBeans

(c) Copyright International Business Machines Corporation 1996, 2002. IBM Corp. All rights reserved.