org.apache.commons.resources.impl
Class WebappPropertyResourcesFactory

java.lang.Object
  extended by org.apache.commons.resources.impl.ResourcesFactoryBase
      extended by org.apache.commons.resources.impl.WebappResourcesFactoryBase
          extended by org.apache.commons.resources.impl.WebappPropertyResourcesFactory
All Implemented Interfaces:
Serializable, ResourcesFactory

public class WebappPropertyResourcesFactory
extends WebappResourcesFactoryBase

Concrete implementation of ResourcesFactory that creates Resources instances that wrap a family (one per Locale) of property files that share a base context-relative path for servlet context resources, and have name suffixes reflecting the Locale for which the file's messages apply. Resources are looked up in a hierarchy of files in a manner identical to that performed by java.util.ResourceBundle.getBundle().

The configuration variable passed to the createResources() method must be the context-relative base name of the properties file family, and must begin with a slash ('/') character. For example, if the configuration URL is passed as /WEB-INF/resources/MyResources, the resources for the en_US Locale would be stored under context resource /WEB-INF/resources/MyReesources_en_US.properties, and the default resources would be stored in /WEB-INF/resources/MyResources.properties.

See Also:
Serialized Form

Constructor Summary
WebappPropertyResourcesFactory()
           
 
Method Summary
protected  Resources createResources(String name, String config)
          Create and return a new Resources instance with the specified logical name, after calling its init() method and delegating the relevant properties.
 
Methods inherited from class org.apache.commons.resources.impl.WebappResourcesFactoryBase
getServletContext, setServletContext
 
Methods inherited from class org.apache.commons.resources.impl.ResourcesFactoryBase
getResources, getResources, isReturnNull, release, setReturnNull
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WebappPropertyResourcesFactory

public WebappPropertyResourcesFactory()
Method Detail

createResources

protected Resources createResources(String name,
                                    String config)

Create and return a new Resources instance with the specified logical name, after calling its init() method and delegating the relevant properties.

Specified by:
createResources in class ResourcesFactoryBase
Parameters:
name - Logical name of the Resources instance to create
config - Configuration string for this resource (if any)
Returns:
The new Resources instance.
Throws:
ResourcesException - if a Resources instance of the specified logical name cannot be created.


Copyright © 2001-2010 The Apache Software Foundation. All Rights Reserved.