ReloadableDefinitionsFactory (Struts 1.3.10 API)

Overview | Package | Class | Use | Tree | Deprecated | Index | Help

PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.struts.tiles.definition
Class ReloadableDefinitionsFactory

    java.lang.Object
      org.apache.struts.tiles.definition.ReloadableDefinitionsFactory

All Implemented Interfaces:
  Serializable, ComponentDefinitionsFactory

    public class ReloadableDefinitionsFactory

extends Object
implements 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: 471754 $ $Date: 2006-11-06 08:55:09 -0600 (Mon, 06 Nov 2006) $
See Also:
  Serialized Form

Field Summary
`static String` | `DEFINITIONS_FACTORY_CLASSNAME` Name of init property carrying factory class name.
`protected ComponentDefinitionsFactory` | `factory` The real factory instance.
`protected Map` | `properties` Initialization parameters.

Constructor Summary
`ReloadableDefinitionsFactory(ServletContext servletContext, Map properties)` Constructor.
`ReloadableDefinitionsFactory(ServletContext servletContext, ServletConfig servletConfig)` Constructor.

Method Summary
`ComponentDefinitionsFactory` | `createDefaultFactory(ServletContext servletContext, Map properties)` Create default Definition factory.
`ComponentDefinitionsFactory` | `createFactory(ServletContext servletContext, Map properties)` Create Definition factory.
`ComponentDefinitionsFactory` | `createFactoryFromClassname(ServletContext servletContext, Map properties, String classname)` Create Definition factory from provided classname.
`ComponentDefinition` | `getDefinition(String definitionName, ServletRequest request, ServletContext servletContext)` Get a definition by its name.
`ComponentDefinitionsFactory` | `getFactory()` Get underlying factory instance.
`void` | `initFactory(ServletContext servletContext, Map properties)` Init factory.
`void` | `reload(ServletContext servletContext)` Reload underlying factory.
`String` | `toString()` Return String representation.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Field Detail

### factory

    protected ComponentDefinitionsFactory factory

  The real factory instance.

### properties

    protected Map properties

  Initialization parameters.

### DEFINITIONS_FACTORY_CLASSNAME

    public static final String DEFINITIONS_FACTORY_CLASSNAME

  Name of init property carrying factory class name.

  See Also:
    Constant Field Values

Constructor Detail

### 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 properties)
                                 throws DefinitionsFactoryException

  Constructor. Create a factory according to servlet settings.

  Parameters:
    `servletContext` - Our servlet context.
    `properties` - Map containing all properties.
  Throws:
    `DefinitionsFactoryException` - If factory creation fail.

Method Detail

### createFactoryFromClassname

    public ComponentDefinitionsFactory createFactoryFromClassname(ServletContext servletContext,
                                                                  Map properties,
                                                                  String classname)
                                                           throws DefinitionsFactoryException

  Create 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:
    `classname` - Class name of the factory to create.
    `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

### createDefaultFactory

    public ComponentDefinitionsFactory createDefaultFactory(ServletContext servletContext,
                                                            Map properties)
                                                     throws DefinitionsFactoryException

  Create 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 properties)
                                              throws DefinitionsFactoryException

  Create 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:
    `getDefinition` in interface `ComponentDefinitionsFactory`
  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

    public void reload(ServletContext servletContext)
                throws DefinitionsFactoryException

  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

    public ComponentDefinitionsFactory getFactory()

  Get underlying factory instance.

  Returns:
    ComponentDefinitionsFactory

### initFactory

    public void initFactory(ServletContext servletContext,
                            Map properties)
                     throws DefinitionsFactoryException

  Init 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:
    `initFactory` in interface `ComponentDefinitionsFactory`
  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

    public String toString()

  Return String representation.

  Overrides:
    `toString` in class `Object`
  Returns:
    String representation.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help

PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2000-2008 Apache Software Foundation. All Rights Reserved.