public class

MessagesManager

extends AbstractConfigurationElement
java.lang.Object
   ↳ com.microstrategy.utils.config.AbstractConfigurationElement
     ↳ com.microstrategy.web.beans.MessagesManager

Class Overview

This class contains a list of Messages instances, each of which is associated with a specific java.util.Locale object or a Windows LCID (Window-based locale ID). The default ResourceBundle name is set to "resources.MessagesBundle"

Summary

Constants
String ATT_RESOURCE_BUNDLE
String ATT_VERSION
String DEFAULT_MESSAGES_BUNDLE The name of the default MessagesBundle file.
String LOCALES_XML
String NODE_NAME
[Expand]
Inherited Constants
From class com.microstrategy.utils.config.AbstractConfigurationElement
Fields
protected static final Locale DEFAULT_LOCALE The Locale used by default
Public Constructors
MessagesManager()
Constructs a MessagesManager using default values.
MessagesManager(Locale locale)
This constructor is deprecated. The MessagesManager should be configured using an external xml configuration file using the load(String) method.
MessagesManager(Document doc)
This constructor is deprecated. The MessagesManager should be configured using an external xml configuration file using the load(String) method.
Public Methods
void applyCustomizations()
Loops through all the CustomizationInfo in the Customizations class and apply the corresponding customizations.
String getBrowserLocale(String browserLocale)
Returns the Web browser's locale ID, a Windows-based locale ID.
String getBundleName()
Returns the base name for the bundle holding the messages.
static MessagesManager getInstance()
static String getLocaleId(Locale locale)
Returns the corresponding windows-based locale ID for the given Java Locale
MessageInfo getMessageInfo(String localeId)
Returns the MessageInfo objects for the given locale.
HashList getMessageInfo()
This method is deprecated. Use getMessageInfo(String) to obtain a particular MessageInfo, or getMessageInfoList() to obtain the list of all available MessageInfo.
AbstractConfigurationElement.FilteredList getMessageInfoList()
Returns Filteredlist with the list of MessageInfo objects available from this MessagesManager.
Messages getMessages(Locale locale)
Returns the Messages object with the best-match possible for the specified java.util.Locale.
Messages getMessages()
This method is deprecated. No replacement.
Messages getMessages(String localeId)
Returns the Messages object with the best-match possible for the specified Windows locale ID.
AbstractConfigurationElement.FilteredList getPartiallySupportedMessageInfoList()
static void init(String filePath)
void load(String fileName)
Loads the file with the given name and initializes this ConfigurationElement with its content.
void setBundleName(String value)
Sets the base name for the bundle holding the messages.
Protected Methods
String getKeyAttribute()
This method must return the attribute that uniquely identifies this element among its siblings; if no single attribute can be used, return null and override the getKey and setKey methods.
void initDefaultAttributes()
This method can be overridden to set default values for attributes.
[Expand]
Inherited Methods
From class com.microstrategy.utils.config.AbstractConfigurationElement
From class java.lang.Object
From interface com.microstrategy.utils.config.ConfigurationElement
From interface com.microstrategy.utils.config.ConfigurationFile

Constants

protected static final String ATT_RESOURCE_BUNDLE

Constant Value: "resource-bundle"

protected static final String ATT_VERSION

Constant Value: "version"

protected static final String DEFAULT_MESSAGES_BUNDLE

The name of the default MessagesBundle file.

Constant Value: "resources.MessagesBundle"

public static final String LOCALES_XML

Constant Value: "locales.xml"

public static final String NODE_NAME

Constant Value: "locales"

Fields

protected static final Locale DEFAULT_LOCALE

The Locale used by default

Public Constructors

public MessagesManager ()

Constructs a MessagesManager using default values. It's strongly recommended that the singleton getInstance() is used instead of creating a new instance.

public MessagesManager (Locale locale)

This constructor is deprecated.
The MessagesManager should be configured using an external xml configuration file using the load(String) method.

Constructs a MessagesManager using the specified java.util.Locale as default.

Parameters
locale the java.util.Locale to use.

public MessagesManager (Document doc)

This constructor is deprecated.
The MessagesManager should be configured using an external xml configuration file using the load(String) method.

Constructs a MessagesManager with the specified org.w3c.dom.Document object.

Parameters
doc a org.w3c.dom.Document object.

Public Methods

public void applyCustomizations ()

Loops through all the CustomizationInfo in the Customizations class and apply the corresponding customizations.

public String getBrowserLocale (String browserLocale)

Returns the Web browser's locale ID, a Windows-based locale ID. This method first extracts the country and language from the parameter browserLocale and then tries to use them to find out the Windows locale ID and returns it. If not found, the default one used when initializing this MessagesManager is returned.

Parameters
browserLocale a browser's locale information
Returns
  • a Windows-based locale ID

public String getBundleName ()

Returns the base name for the bundle holding the messages.

public static MessagesManager getInstance ()

public static String getLocaleId (Locale locale)

Returns the corresponding windows-based locale ID for the given Java Locale

public MessageInfo getMessageInfo (String localeId)

Returns the MessageInfo objects for the given locale.

Parameters
localeId The locale id identifying the MessageInfo
Returns
  • MessageInfo associated with the given locale, null if it doesn't exist.

public HashList getMessageInfo ()

This method is deprecated.
Use getMessageInfo(String) to obtain a particular MessageInfo, or getMessageInfoList() to obtain the list of all available MessageInfo.

Returns Hashlist over the collection of MessageInfo objects from this MessagesManager, keyed by the Windows LCID.

Returns
  • a Hashlist over the collection of MessageInfo

public AbstractConfigurationElement.FilteredList getMessageInfoList ()

Returns Filteredlist with the list of MessageInfo objects available from this MessagesManager.

public Messages getMessages (Locale locale)

Returns the Messages object with the best-match possible for the specified java.util.Locale.

Parameters
locale a java.util.Locale.
Returns
  • a Messages object.

public Messages getMessages ()

This method is deprecated.
No replacement.

Returns the Messages object with the java.util.Locale specified at initialization time.

Returns
  • a Messages object.

public Messages getMessages (String localeId)

Returns the Messages object with the best-match possible for the specified Windows locale ID.

Parameters
localeId a Window-based locale ID.
Returns
  • a Messages object

public AbstractConfigurationElement.FilteredList getPartiallySupportedMessageInfoList ()

Returns
  • the list of partially supported locales, in that they are recognized by this application, but are not fully localized.

public static void init (String filePath)

public void load (String fileName)

Loads the file with the given name and initializes this ConfigurationElement with its content.

Parameters
fileName The path to the configuration file. This path will be resolved by the FileLoader

public void setBundleName (String value)

Sets the base name for the bundle holding the messages.

Protected Methods

protected String getKeyAttribute ()

This method must return the attribute that uniquely identifies this element among its siblings; if no single attribute can be used, return null and override the getKey and setKey methods.

protected void initDefaultAttributes ()

This method can be overridden to set default values for attributes. Simply extend this method and call setAttribute(String, Object)