org.jaffa.util
Class PropertyMessageResources
java.lang.Object
org.apache.struts.util.MessageResources
org.apache.struts.util.PropertyMessageResources
org.jaffa.util.PropertyMessageResources
- All Implemented Interfaces:
- Serializable
- public class PropertyMessageResources
- extends PropertyMessageResources
Concrete subclass of MessageResources that reads message keys
and corresponding strings from named property resources in the same manner
that java.util.PropertyResourceBundle does. The
base property defines the base property resource name, and
must be specified.
IMPLEMENTATION NOTE - This class trades memory for
speed by caching all messages located via generalizing the Locale under
the original locale as well.
This results in specific messages being stored in the message cache
more than once, but improves response time on subsequent requests for
the same locale + key combination.
This class is based on the struts class org.apache.struts.util.PropertyMessageResources
It loads the properties file using File I/O. This allows us to view the changes to the file, without having to reload the webapp.
It supports the flushing of the message-resource cache.
- Author:
- GautamJ
- See Also:
- Serialized Form
|
Method Summary |
void |
flushCache()
This method flushes the cache that holds all the messages read from the resource. |
protected void |
loadLocale(String localeKey)
This method is a copy of the implementation in the base class
The only difference is that it tries to first load the properties file using File I/O; if that doesn't work, then it uses the ClassLoader to load the file.
|
| 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 |
PropertyMessageResources
public PropertyMessageResources(MessageResourcesFactory factory,
String config)
- Construct a new PropertyMessageResources according to the
specified parameters.
- Parameters:
factory - The MessageResourcesFactory that created usconfig - The configuration parameter for this MessageResources
PropertyMessageResources
public PropertyMessageResources(MessageResourcesFactory factory,
String config,
boolean returnNull)
- Construct a new PropertyMessageResources according to the
specified parameters.
- Parameters:
factory - The MessageResourcesFactory that created usconfig - The configuration parameter for this MessageResourcesreturnNull - The returnNull property we should initialize with
flushCache
public void flushCache()
- This method flushes the cache that holds all the messages read from the resource.
loadLocale
protected void loadLocale(String localeKey)
- This method is a copy of the implementation in the base class
The only difference is that it tries to first load the properties file using File I/O; if that doesn't work, then it uses the ClassLoader to load the file.
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
Copyright © 2002-2004 JAFFA Project.