Class ReloadableDefinitionsFactory
java.lang.Object
org.apache.struts.tiles.definition.ReloadableDefinitionsFactory
- All Implemented Interfaces:
 Serializable,ComponentDefinitionsFactory
A reloadable factory.
 This factory is the main entrance to any factory implementation. It takes in
 charge real implementation instance, and allows reloading by creating a new
 instance.
- Since:
 - Struts 1.1
 - Version:
 - $Rev$ $Date$
 - See Also:
 
- 
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringName of init property carrying factory class name.protected ComponentDefinitionsFactoryThe real factory instance.Initialization parameters. - 
Constructor Summary
ConstructorsConstructorDescriptionReloadableDefinitionsFactory(ServletContext servletContext, ServletConfig servletConfig) Constructor.ReloadableDefinitionsFactory(ServletContext servletContext, Map<String, Object> properties) Constructor. - 
Method Summary
Modifier and TypeMethodDescriptioncreateDefaultFactory(ServletContext servletContext, Map<String, Object> properties) Create default Definition factory.createFactory(ServletContext servletContext, Map<String, Object> properties) Create Definition factory.createFactoryFromClassname(ServletContext servletContext, Map<String, Object> properties, String classname) Create Definition factory from provided classname.getDefinition(String definitionName, ServletRequest request, ServletContext servletContext) Get a definition by its name.Get underlying factory instance.voidinitFactory(ServletContext servletContext, Map<String, Object> properties) Init factory.voidreload(ServletContext servletContext) Reload underlying factory.toString()Return String representation. 
- 
Field Details
- 
factory
The real factory instance. - 
properties
Initialization parameters. - 
DEFINITIONS_FACTORY_CLASSNAME
Name of init property carrying factory class name.- See Also:
 
 
 - 
 - 
Constructor Details
- 
ReloadableDefinitionsFactory
public ReloadableDefinitionsFactory(ServletContext servletContext, ServletConfig servletConfig) throws DefinitionsFactoryException Constructor. Create a factory according to servlet settings.- Parameters:
 servletContext- Our servlet context.servletConfig- Our servlet config.- Throws:
 DefinitionsFactoryException- If factory creation fail.
 - 
ReloadableDefinitionsFactory
public ReloadableDefinitionsFactory(ServletContext servletContext, Map<String, Object> properties) throws DefinitionsFactoryExceptionConstructor. Create a factory according to servlet settings.- Parameters:
 servletContext- Our servlet context.properties- Map containing all properties.- Throws:
 DefinitionsFactoryException- If factory creation fail.
 
 - 
 - 
Method Details
- 
createFactoryFromClassname
public ComponentDefinitionsFactory createFactoryFromClassname(ServletContext servletContext, Map<String, Object> properties, String classname) throws DefinitionsFactoryExceptionCreate Definition factory from provided classname. If a factory class name is provided, a factory of this class is created. Otherwise, a default factory is created. Factory must have a constructor taking ServletContext and Map as parameter.- Parameters:
 servletContext- Servlet Context passed to newly created factory.properties- Map of name/property passed to newly created factory.classname- Class name of the factory to create.- Returns:
 - newly created factory.
 - Throws:
 DefinitionsFactoryException- If an error occur while initializing factory
 - 
createDefaultFactory
public ComponentDefinitionsFactory createDefaultFactory(ServletContext servletContext, Map<String, Object> properties) throws DefinitionsFactoryExceptionCreate default Definition factory. Factory must have a constructor taking ServletContext and Map as parameter. In this implementation, default factory is of class I18nFactorySet- Parameters:
 servletContext- Servlet Context passed to newly created factory.properties- Map of name/property passed to newly created factory.- Returns:
 - newly created factory.
 - Throws:
 DefinitionsFactoryException- If an error occur while initializing factory
 - 
createFactory
public ComponentDefinitionsFactory createFactory(ServletContext servletContext, Map<String, Object> properties) throws DefinitionsFactoryExceptionCreate Definition factory. Convenience method. ServletConfig is wrapped into a Map allowing retrieval of init parameters. Factory classname is also retrieved, as well as debug level. Finally, approriate createDefinitionsFactory() is called.- Parameters:
 servletContext- Servlet Context passed to newly created factory.properties- Map containing all properties.- Throws:
 DefinitionsFactoryException
 - 
getDefinition
public ComponentDefinition getDefinition(String definitionName, ServletRequest request, ServletContext servletContext) throws FactoryNotFoundException, DefinitionsFactoryException Get a definition by its name. Call appropriate method on underlying factory instance. Throw appropriate exception if definition or definition factory is not found.- Specified by:
 getDefinitionin interfaceComponentDefinitionsFactory- Parameters:
 definitionName- Name of requested definition.request- Current servlet request.servletContext- Current servlet context.- Throws:
 FactoryNotFoundException- Can't find definition factory.DefinitionsFactoryException- General error in factory while getting definition.
 - 
reload
Reload underlying factory. Reload is done by creating a new factory instance, and replacing the old instance with the new one.- Parameters:
 servletContext- Current servlet context.- Throws:
 DefinitionsFactoryException- If factory creation fails.
 - 
getFactory
Get underlying factory instance.- Returns:
 - ComponentDefinitionsFactory
 
 - 
initFactory
public void initFactory(ServletContext servletContext, Map<String, Object> properties) throws DefinitionsFactoryExceptionInit factory. This method is required by interface ComponentDefinitionsFactory. It is not used in this implementation, as it manages itself the underlying creation and initialization.- Specified by:
 initFactoryin interfaceComponentDefinitionsFactory- Parameters:
 servletContext- Servlet Context passed to newly created factory.properties- Map of name/property passed to newly created factory. Map can contain more properties than requested.- Throws:
 DefinitionsFactoryException- An error occur during initialization.
 - 
toString
Return String representation. 
 -