Class AppMessageResources

  extended by org.apache.struts.util.MessageResources
      extended by org.apache.struts.util.PropertyMessageResources
          extended by com.softslate.commerce.customer.core.AppMessageResources
All Implemented Interfaces:

public class AppMessageResources
extends org.apache.struts.util.PropertyMessageResources

Extension of the Struts PropertyMessageResources class which wraps a second PropertyMessageResources object holding custom application messages.

Messages that come distributed with the application are stored in the files under the "/WEB-INF/classes/resources" directory. These files may be overwritten with a future upgrade, if new messages need to be added to the files. In order to make use of the Struts MessageResources facility for custom messages, this class automatically creates a second AppMessageResources object from a file named in the same directory as the distributed file. Custom messages can safely be placed in these files because they will not be overwritten during an upgrade.

This class overrides a constructor method, to create the second, custom AppMessageResources object from the file. It also overrides the getMessage method to look for a message first in the custom object before attempting to find it in the original AppMessageResources object. This allows users to override the default messages with custom ones.

David Tobey
See Also:
Serialized Form

Field Summary
(package private)  AppMessageResources customMessageResources
(package private)  boolean isChild
(package private) static org.apache.commons.logging.Log log
private static long serialVersionUID
Fields inherited from class org.apache.struts.util.PropertyMessageResources
locales, messages
Fields inherited from class org.apache.struts.util.MessageResources
config, defaultFactory, defaultLocale, factory, formats, returnNull
Constructor Summary
AppMessageResources(org.apache.struts.util.MessageResourcesFactory factory, java.lang.String config, boolean returnNull, boolean isChild)
Method Summary
 AppMessageResources getCustomMessageResources()
 java.util.Map getFormats()
 java.util.Map getLocales()
 java.lang.String getMessage(java.util.Locale locale, java.lang.String key)
 java.util.Map getMessages()
 java.lang.String messageKeyPublic(java.lang.String locale, java.lang.String key)
 void setCustomMessageResources(AppMessageResources customMessageResources)
Methods inherited from class org.apache.struts.util.PropertyMessageResources
loadLocale, setMode
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, isEscape, isPresent, isPresent, localeKey, log, log, messageKey, messageKey, setEscape, setReturnNull
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Field Detail


private static final long serialVersionUID
See Also:
Constant Field Values


static org.apache.commons.logging.Log log


boolean isChild


AppMessageResources customMessageResources
Constructor Detail


public AppMessageResources(org.apache.struts.util.MessageResourcesFactory factory,
                           java.lang.String config,
                           boolean returnNull,
                           boolean isChild)
Method Detail


public AppMessageResources getCustomMessageResources()


public void setCustomMessageResources(AppMessageResources customMessageResources)


public java.lang.String getMessage(java.util.Locale locale,
                                   java.lang.String key)
getMessage in class org.apache.struts.util.PropertyMessageResources


public java.util.Map getMessages()


public java.util.Map getLocales()


public java.util.Map getFormats()


public java.lang.String messageKeyPublic(java.lang.String locale,
                                         java.lang.String key)

Copyright © SoftSlate, LLC 2003–2005