Package com.microstrategy.web.beans
Class MessagesManager
- java.lang.Object
-
- com.microstrategy.utils.config.AbstractConfigurationElement
-
- com.microstrategy.web.beans.MessagesManager
-
- All Implemented Interfaces:
ConfigurationElement
,ConfigurationFile
,java.lang.Cloneable
public class MessagesManager extends AbstractConfigurationElement
This class contains a list ofMessages
instances, each of which is associated with a specificjava.util.Locale
object or a Windows LCID (Window-based locale ID). The defaultResourceBundle
name is set to "resources.MessagesBundle"- Since:
- MicroStrategy Web 7.3.1 or earlier
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.microstrategy.utils.config.AbstractConfigurationElement
AbstractConfigurationElement.FilteredList
-
-
Field Summary
Fields Modifier and Type Field Description protected static java.lang.String
ATT_RESOURCE_BUNDLE
protected static java.lang.String
ATT_VERSION
protected static java.util.Locale
DEFAULT_LOCALE
The Locale used by defaultprotected static java.lang.String
DEFAULT_MESSAGES_BUNDLE
The name of the default MessagesBundle file.static java.lang.String
LOCALES_XML
static java.lang.String
NODE_NAME
-
Fields inherited from class com.microstrategy.utils.config.AbstractConfigurationElement
ATT_CONFIG_SRC, ATT_DELETED, ATT_POSITION, ATT_PROTOTYPE, ATT_USE_DEFAULT
-
-
Constructor Summary
Constructors Constructor Description MessagesManager()
Constructs a MessagesManager using default values.MessagesManager(java.util.Locale locale)
Deprecated.The MessagesManager should be configured using an external xml configuration file using theload(java.lang.String)
method.MessagesManager(org.w3c.dom.Document doc)
Deprecated.The MessagesManager should be configured using an external xml configuration file using theload(java.lang.String)
method.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
applyCustomizations()
Loops through all theCustomizationInfo
in theCustomizations
class and apply the corresponding customizations.java.lang.String
getBrowserLocale(java.lang.String browserLocale)
Returns the Web browser's locale ID, a Windows-based locale ID.java.lang.String
getBundleName()
Returns the base name for the bundle holding the messages.Messages
getCustomMessages(java.lang.String localeId)
Returns the customMessages
object with the best-match possible for the specified Windows locale ID.static MessagesManager
getInstance()
protected java.lang.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 thegetKey
andsetKey
methods.static java.lang.String
getLocaleId(java.util.Locale locale)
Returns the corresponding windows-based locale ID for the given Java LocaleHashList
getMessageInfo()
Deprecated.UsegetMessageInfo(String localeId)
to obtain a particular MessageInfo, orgetMessageInfoList()
to obtain the list of all available MessageInfo.MessageInfo
getMessageInfo(java.lang.String localeId)
Returns the MessageInfo objects for the given locale.AbstractConfigurationElement.FilteredList
getMessageInfoList()
ReturnsFilteredlist
with the list ofMessageInfo
objects available from this MessagesManager.Messages
getMessages()
Deprecated.Messages
getMessages(java.lang.String localeId)
Returns theMessages
object with the best-match possible for the specified Windows locale ID.Messages
getMessages(java.util.Locale locale)
Returns theMessages
object with the best-match possible for the specifiedjava.util.Locale
.AbstractConfigurationElement.FilteredList
getPartiallySupportedMessageInfoList()
static void
init(java.lang.String filePath)
protected void
initDefaultAttributes()
This method can be overridden to set default values for attributes.void
load(java.lang.String fileName)
Loads the file with the given name and initializes thisConfigurationElement
with its content.void
setBundleName(java.lang.String value)
Sets the base name for the bundle holding the messages.-
Methods inherited from class com.microstrategy.utils.config.AbstractConfigurationElement
addFileSource, applyCustomization, cleanUpDeletedElements, clone, delete, deltas, deltas, equalAtts, equalElements, equalNodeValues, equals, equalsIncludingDeletedElements, exportAttributesToXML, exportElementsToXML, exportNodeValueToXML, getAttribute, getAttributes, getBoolAttribute, getChildKey, getConfigSrc, getDTDFileName, getElement, getElement, getElements, getFileLoader, getIntAttribute, getIntAttribute, getKey, getLineNumber, getList, getNextKey, getNodeName, getNodeValue, getNodeValue, getOrCreateElement, getParent, getPosition, getPrototype, getRegisteredClass, getSelfInitPath, getSource, getStrAttribute, getUseDefault, getXMLParserParameters, getXMLSerializerParameters, hashCode, hashCodeAtts, hashCodeElements, hashCodeNodeValues, hasRegisteredClass, initAttributesFromXML, initElementFromXML, initElementsFromXML, initFromFile, initFromResource, initFromXML, initFromXML, initNodeValueFromXML, initPrototype, isActive, isCustomized, isDeleted, isDirty, isInSource, isKeyAttribute, mergeChanges, newChildInstance, newSource, original, populate, printAttributes, printElements, printNodeValue, refreshLists, registerClass, registerElement, registerElement, registerElementList, reload, reloadPrototype, removeAttribute, removeDefaults, replaceList, restore, save, save, saveChangesAs, saveConfig, saveFlatXML, saveNode, saveSource, setAttribute, setBoolAttribute, setChildOriginals, setConfigSrc, setCustomized, setElement, setFileLoader, setIntAttribute, setKey, setLineNumber, setNodeName, setNodeValue, setPosition, setPrototype, setSelfInitPath, setStrAttribute, setUseDefault, setUseValidation, throwConfigParseException, toString, toXML, toXML, toXML, toXML, useNodeValue, useValidation
-
-
-
-
Field Detail
-
LOCALES_XML
public static final java.lang.String LOCALES_XML
- See Also:
- Constant Field Values
-
NODE_NAME
public static final java.lang.String NODE_NAME
- Since:
- MicroStrategy Web 9.0.0
- See Also:
- Constant Field Values
-
ATT_RESOURCE_BUNDLE
protected static final java.lang.String ATT_RESOURCE_BUNDLE
- Since:
- MicroStrategy Web 9.0.0
- See Also:
- Constant Field Values
-
ATT_VERSION
protected static final java.lang.String ATT_VERSION
- Since:
- MicroStrategy Web 9.0.0
- See Also:
- Constant Field Values
-
DEFAULT_MESSAGES_BUNDLE
protected static final java.lang.String DEFAULT_MESSAGES_BUNDLE
The name of the default MessagesBundle file.- Since:
- MicroStrategy Web 9.0.0
- See Also:
- Constant Field Values
-
DEFAULT_LOCALE
protected static final java.util.Locale DEFAULT_LOCALE
The Locale used by default- Since:
- MicroStrategy Web 9.0.0
-
-
Constructor Detail
-
MessagesManager
public MessagesManager()
Constructs a MessagesManager using default values. It's strongly recommended that the singletongetInstance()
is used instead of creating a new instance.
-
MessagesManager
public MessagesManager(java.util.Locale locale)
Deprecated.The MessagesManager should be configured using an external xml configuration file using theload(java.lang.String)
method.Constructs a MessagesManager using the specifiedjava.util.Locale
as default.- Parameters:
locale
- thejava.util.Locale
to use.
-
MessagesManager
public MessagesManager(org.w3c.dom.Document doc)
Deprecated.The MessagesManager should be configured using an external xml configuration file using theload(java.lang.String)
method.Constructs a MessagesManager with the specifiedorg.w3c.dom.Document
object.- Parameters:
doc
- aorg.w3c.dom.Document
object.
-
-
Method Detail
-
getInstance
public static MessagesManager getInstance()
-
init
public static void init(java.lang.String filePath)
-
initDefaultAttributes
protected void initDefaultAttributes()
Description copied from class:AbstractConfigurationElement
This method can be overridden to set default values for attributes. Simply extend this method and callAbstractConfigurationElement.setAttribute(java.lang.String, java.lang.Object)
- Overrides:
initDefaultAttributes
in classAbstractConfigurationElement
- Since:
- MicroStrategy Web 9.0.0
-
getMessages
public Messages getMessages(java.util.Locale locale)
Returns theMessages
object with the best-match possible for the specifiedjava.util.Locale
.- Parameters:
locale
- ajava.util.Locale
.- Returns:
- a
Messages
object.
-
getMessages
public Messages getMessages(java.lang.String localeId)
Returns theMessages
object with the best-match possible for the specified Windows locale ID.- Parameters:
localeId
- a Window-based locale ID.- Returns:
- a
Messages
object
-
getMessages
public Messages getMessages()
Deprecated.Returns theMessages
object with thejava.util.Locale
specified at initialization time.- Returns:
- a
Messages
object.
-
getCustomMessages
public Messages getCustomMessages(java.lang.String localeId)
Returns the customMessages
object with the best-match possible for the specified Windows locale ID.- Parameters:
localeId
- a Window-based locale ID.- Returns:
- a
Messages
object
-
getBundleName
public java.lang.String getBundleName()
Returns the base name for the bundle holding the messages.- Since:
- MicroStrategy Web 9.0.0
-
setBundleName
public void setBundleName(java.lang.String value)
Sets the base name for the bundle holding the messages.- Since:
- MicroStrategy Web 9.0.0
-
getMessageInfo
public HashList getMessageInfo()
Deprecated.UsegetMessageInfo(String localeId)
to obtain a particular MessageInfo, orgetMessageInfoList()
to obtain the list of all available MessageInfo.ReturnsHashlist
over the collection ofMessageInfo
objects from this MessagesManager, keyed by the Windows LCID.- Returns:
- a
Hashlist
over the collection ofMessageInfo
-
getMessageInfo
public MessageInfo getMessageInfo(java.lang.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.
- Since:
- MicroStrategy Web 9.0.0
-
getMessageInfoList
public AbstractConfigurationElement.FilteredList getMessageInfoList()
ReturnsFilteredlist
with the list ofMessageInfo
objects available from this MessagesManager.- Since:
- MicroStrategy Web 9.0.0
-
getPartiallySupportedMessageInfoList
public AbstractConfigurationElement.FilteredList getPartiallySupportedMessageInfoList()
- Returns:
- the list of partially supported locales, in that they are recognized by this application, but are not fully localized.
- Since:
- MicroStrategy Web 9.0.0
-
getBrowserLocale
public java.lang.String getBrowserLocale(java.lang.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
-
getLocaleId
public static java.lang.String getLocaleId(java.util.Locale locale)
Returns the corresponding windows-based locale ID for the given Java Locale- Since:
- MicroStrategy Web 9.0.0
- See Also:
LocaleInfo.convertJavaLocaleToLCID(java.util.Locale)
-
getKeyAttribute
protected java.lang.String getKeyAttribute()
Description copied from class:AbstractConfigurationElement
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 thegetKey
andsetKey
methods.- Specified by:
getKeyAttribute
in classAbstractConfigurationElement
- Since:
- MicroStrategy Web 9.0.0
-
load
public void load(java.lang.String fileName) throws ConfigException
Description copied from class:AbstractConfigurationElement
Loads the file with the given name and initializes thisConfigurationElement
with its content.- Specified by:
load
in interfaceConfigurationFile
- Overrides:
load
in classAbstractConfigurationElement
- Parameters:
fileName
- The path to the configuration file. This path will be resolved by theFileLoader
- Throws:
ConfigException
- Since:
- MicroStrategy Web 9.0.0
-
applyCustomizations
public void applyCustomizations() throws ConfigException
Description copied from class:AbstractConfigurationElement
Loops through all theCustomizationInfo
in theCustomizations
class and apply the corresponding customizations.- Specified by:
applyCustomizations
in interfaceConfigurationFile
- Overrides:
applyCustomizations
in classAbstractConfigurationElement
- Throws:
ConfigException
-
-