net.sf.oness.common.webapp.controller.struts
Class CustomMessageResources

java.lang.Object
  extended byorg.apache.struts.util.MessageResources
      extended bynet.sf.oness.common.webapp.controller.struts.CustomMessageResources
All Implemented Interfaces:
java.io.Serializable

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

This class is a Custom Message Resource implementation for Struts. This class searches through a series of resource files passed to it via the constructor to obtain the localised value for a key passed. If the key cannot be resolved, it prints a warning message to the logger output.

 <message-resources null="false"
     parameter="net.sf.oness.common.webapp.messages.Messages,net.sf.oness.common.webapp.messages.OtherMessages"/>
 

Version:
$Revision: 1.1 $
Author:
Carlos Sanchez
See Also:
Serialized Form

Field Summary
protected  java.util.HashMap bundlesLoaded
          hashmap holding the resource bundle for which we have already loaded the values
protected  java.util.HashMap resourceMap
          hashmap for holding ther resource bundle key and value
 
Fields inherited from class org.apache.struts.util.MessageResources
config, defaultFactory, defaultLocale, factory, formats, log, returnNull
 
Constructor Summary
CustomMessageResources(java.util.List configFiles)
          Constructor accepting a list of resource bundle files.
 
Method Summary
 java.lang.String getMessage(java.util.Locale locale, java.lang.String key)
           
protected  void loadBundle(java.lang.String localeKey, java.lang.String config)
          Loads the resource bundle based on the locale.
 
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

bundlesLoaded

protected java.util.HashMap bundlesLoaded
hashmap holding the resource bundle for which we have already loaded the values


resourceMap

protected java.util.HashMap resourceMap
hashmap for holding ther resource bundle key and value

Constructor Detail

CustomMessageResources

public CustomMessageResources(java.util.List configFiles)
Constructor accepting a list of resource bundle files.

Parameters:
configFiles - A List of resouce bundle files.
Method Detail

getMessage

public java.lang.String getMessage(java.util.Locale locale,
                                   java.lang.String key)
See Also:
MessageResources.getMessage(java.util.Locale, java.lang.String)

loadBundle

protected void loadBundle(java.lang.String localeKey,
                          java.lang.String config)
Loads the resource bundle based on the locale.

Parameters:
localeKey - The locale
config - The resource file.


Copyright © 2003-2005 ONess Project. All Rights Reserved.