com.oroad.stxx.plugin
Class StxxPropertyMessageResources

java.lang.Object
  extended byorg.apache.struts.util.MessageResources
      extended bycom.oroad.stxx.plugin.StxxPropertyMessageResources
All Implemented Interfaces:
java.io.Serializable

public class StxxPropertyMessageResources
extends org.apache.struts.util.MessageResources

Stores message resources

Author:
Jeff Pennal, Don Brown
See Also:
Serialized Form

Field Summary
protected  java.util.HashMap locales
          The set of locale keys for which we have already loaded messages, keyed by the value calculated in localeKey().
protected  java.util.HashMap messages
          The cache of messages we have accumulated over time, keyed by the value calculated in messageKey().
 
Fields inherited from class org.apache.struts.util.MessageResources
config, defaultFactory, defaultLocale, factory, formats, log, returnNull
 
Constructor Summary
StxxPropertyMessageResources(org.apache.struts.util.MessageResourcesFactory factory, java.lang.String config)
          Construct a new PropertyMessageResources according to the specified parameters.
StxxPropertyMessageResources(org.apache.struts.util.MessageResourcesFactory factory, java.lang.String config, boolean returnNull)
          Construct a new PropertyMessageResources according to the specified parameters.
 
Method Summary
 void clearMessages()
          Clears the messages
 java.util.HashMap getLocales()
          Returns the locales for this resource
 java.lang.String getMessage(java.util.Locale locale, java.lang.String key)
          Returns a text message for the specified key, for the default Locale.
 java.util.HashMap getMessages()
          Returns the messages object for the resource
 void loadLocale(java.lang.String localeKey)
          Load the messages associated with the specified Locale key.
 
Methods inherited from class org.apache.struts.util.MessageResources
escape, getConfig, getFactory, getMessage, getMessage, getMessage, getMessage, getMessage, getMessage, getMessage, getMessage, getMessage, getMessage, getMessage, getMessageResources, getReturnNull, isPresent, isPresent, localeKey, log, log, messageKey, messageKey, setReturnNull
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

locales

protected java.util.HashMap locales
The set of locale keys for which we have already loaded messages, keyed by the value calculated in localeKey().


messages

protected java.util.HashMap messages
The cache of messages we have accumulated over time, keyed by the value calculated in messageKey().

Constructor Detail

StxxPropertyMessageResources

public StxxPropertyMessageResources(org.apache.struts.util.MessageResourcesFactory factory,
                                    java.lang.String config)
Construct a new PropertyMessageResources according to the specified parameters.

Parameters:
factory - The MessageResourcesFactory that created us
config - The configuration parameter for this MessageResources

StxxPropertyMessageResources

public StxxPropertyMessageResources(org.apache.struts.util.MessageResourcesFactory factory,
                                    java.lang.String config,
                                    boolean returnNull)
Construct a new PropertyMessageResources according to the specified parameters.

Parameters:
factory - The MessageResourcesFactory that created us
config - The configuration parameter for this MessageResources
returnNull - The returnNull property we should initialize with
Method Detail

getMessage

public java.lang.String getMessage(java.util.Locale locale,
                                   java.lang.String key)
Returns a text message for the specified key, for the default Locale. A null string result will be returned by this method if no relevant message resource is found for this key or Locale, if the returnNull property is set. Otherwise, an appropriate error message will be returned.

This method must be implemented by a concrete subclass.

Parameters:
locale - The requested message Locale, or null for the system default Locale
key - The message key to look up
Returns:
The message value

loadLocale

public void loadLocale(java.lang.String localeKey)
Load the messages associated with the specified Locale key. For this implementation, the config property should contain a fully qualified package and resource name, separated by periods, of a series of property resources to be loaded from the class loader that created this PropertyMessageResources instance. This is exactly the same name format you would use when utilizing the java.util.PropertyResourceBundle class.

Parameters:
localeKey - Locale key for the messages to be retrieved

getMessages

public java.util.HashMap getMessages()
Returns the messages object for the resource

Returns:
The messages value

clearMessages

public void clearMessages()
Clears the messages


getLocales

public java.util.HashMap getLocales()
Returns the locales for this resource

Returns:
The locales value