org.apache.commons.resources
Interface ResourcesFactory

All Superinterfaces:
Serializable
All Known Implementing Classes:
JDBCResourcesFactory, PropertyResourcesFactory, ResourceBundleResourcesFactory, ResourcesFactoryBase, WebappPropertyResourcesFactory, WebappResourcesFactoryBase, WebappXMLResourcesFactory, XMLResourcesFactory

public interface ResourcesFactory
extends Serializable

A ResourcesFactory is a factory pattern interface for a class that can create Resources instances based on a logical name that is passed to the factory. Repeated requests to return a Resources instance with the same name should return the same Resources instance each time.

Implementations of ResourcesFactory MUST include a zero-arguments constructor so that instances of the factory can be dynamically created. Therefore, configuration information above and beyond the configuration String will generally be specified via JavaBeans property setters on the ResourcesFactory implementation class.

See Also:
ResourcesFactoryBase, JDBCResourcesFactory, PropertyResourcesFactory, ResourceBundleResourcesFactory, WebappResourcesFactoryBase, WebappPropertyResourcesFactory, WebappXMLResourcesFactory, XMLResourcesFactory

Method Summary
 Resources getResources(String name)
          Create (if necessary) and return a Resources instance for the specified logical name, with a default configuration.
 Resources getResources(String name, String config)
          Create (if necessary) and return a Resources instance for the specified logical name, with a configuration based on the specified configuration String.
 boolean isReturnNull()
          Return the returnNull property value that will be configured on Resources instances created by this factory.
 void release()
          Release any internal references to Resources instances that have been returned previously, after calling the destroy() method of each such instance.
 void setReturnNull(boolean returnNull)
          Set the returnNull property value that will be configured on Resources instances created by this factory.
 

Method Detail

isReturnNull

boolean isReturnNull()

Return the returnNull property value that will be configured on Resources instances created by this factory.

Returns:
'true' if null is returned for invalid key values.

setReturnNull

void setReturnNull(boolean returnNull)

Set the returnNull property value that will be configured on Resources instances created by this factory.

Parameters:
returnNull - The new value to delegate

getResources

Resources getResources(String name)

Create (if necessary) and return a Resources instance for the specified logical name, with a default configuration.

Parameters:
name - Logical name of the Resources instance to be returned
Returns:
The resources instance.
Throws:
ResourcesException - if a Resources instance of the specified logical name cannot be returned.

getResources

Resources getResources(String name,
                       String config)

Create (if necessary) and return a Resources instance for the specified logical name, with a configuration based on the specified configuration String.

Parameters:
name - Logical name of the Resources instance to be returned
config - Configuration string for this resource (meaning is dependent upon the ResourcesFactory implementation being utilized), or null for the default configuration
Returns:
The resources.
Throws:
ResourcesException - if a Resources instance of the specified logical name cannot be returned.

release

void release()

Release any internal references to Resources instances that have been returned previously, after calling the destroy() method of each such instance.

Throws:
ResourcesException - if an error occurs while releasing


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