Package org.apache.struts.tiles
Interface DefinitionsFactory
- All Superinterfaces:
Serializable
- All Known Implementing Classes:
ComponentDefinitionsFactoryWrapper
Tiles Definition factory.
This interface replace old ComponentDefinitionsFactory.
Main method getDefinition() is exactly the same. Initialization method change.
This interface allows to retrieve a definition by its name, independently of
the factory implementation.
Object life cycle is as follow:
- Constructor: create object
- setConfig: set config and initialize factory. After first call to this method, factory is operational.
- destroy: factory is being shutdown.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
destroy()
Receive notification that the factory is being shut down.Get factory configuration.getDefinition
(String name, ServletRequest request, ServletContext servletContext) Get a definition by its name.void
init
(DefinitionsFactoryConfig config, ServletContext servletContext) Init definition factory.void
setConfig
(DefinitionsFactoryConfig config, ServletContext servletContext) Set factory configuration.
-
Method Details
-
getDefinition
ComponentDefinition getDefinition(String name, ServletRequest request, ServletContext servletContext) throws NoSuchDefinitionException, DefinitionsFactoryException Get a definition by its name.- Parameters:
name
- Name of requested definition.request
- Current servelet requestservletContext
- current servlet context- Throws:
DefinitionsFactoryException
- An error occur while getting definition.NoSuchDefinitionException
- No definition found for specified name Implementation can throw more accurate exception as a subclass of this exception
-
init
void init(DefinitionsFactoryConfig config, ServletContext servletContext) throws DefinitionsFactoryException Init definition factory. This method is called immediately after factory creation, and prior any call to setConfig().- Parameters:
config
- Configuration object used to set factory configuration.servletContext
- Servlet Context passed to factory.- Throws:
DefinitionsFactoryException
- An error occur during initialization.
-
destroy
void destroy()Receive notification that the factory is being shut down.
-
setConfig
void setConfig(DefinitionsFactoryConfig config, ServletContext servletContext) throws DefinitionsFactoryException Set factory configuration. This method is used to change factory configuration. This method is optional, and can send an exception if implementation doesn't allow change in configuration.- Parameters:
config
- Configuration object used to set factory configuration.servletContext
- Servlet Context passed to factory.- Throws:
DefinitionsFactoryException
- An error occur during initialization.
-
getConfig
DefinitionsFactoryConfig getConfig()Get factory configuration.- Returns:
- TilesConfig
-