org.apache.struts.tiles

Class DefinitionsUtil

Implemented Interfaces:
ComponentConstants

public class DefinitionsUtil
extends TilesUtil
implements ComponentConstants

Utilities class for definitions factory. Also define userDebugLevel property (TODO to be moved from this class ?).

Nested Class Summary

(package private) static class
DefinitionsUtil.ServletPropertiesMap
Inner class.

Field Summary

static String
ACTION_DEFINITION
Constant name used to store definition in jsp context.
static String
DEFINITIONS_CONFIG_USER_DEBUG_LEVEL
Name of init property carrying debug level.
static String
DEFINITIONS_FACTORY
Constant name used to store factory in context.
static String
DEFINITIONS_FACTORY_CLASSNAME
Name of init property carrying factory class name.
static int
NO_DEBUG
Deprecated. This will be removed in a release after Struts 1.2.
protected static Log
log
Commons Logging instance.
static int
userDebugLevel
Deprecated. This will be removed in a release after Struts 1.2.

Fields inherited from class org.apache.struts.tiles.TilesUtil

implAlreadySet, log, tilesUtilImpl

Fields inherited from interface org.apache.struts.taglib.tiles.ComponentConstants

COMPONENT_CONTEXT, COMPONENT_SCOPE, EXCEPTION_KEY, LOCALE_KEY

Method Summary

static DefinitionsFactory
createDefinitionsFactory(ServletContext servletContext, Map properties)
Create default Definition factory.
static DefinitionsFactory
createDefinitionsFactory(ServletContext servletContext, Map properties, String classname)
Deprecated. Use createDefinitionsFactory(ServletContext servletContext, ServletConfig servletConfig)
static DefinitionsFactory
createDefinitionsFactory(ServletContext servletContext, ServletConfig servletConfig)
Create Definition factory.
static DefinitionsFactory
createDefinitionsFactory(ServletContext servletContext, ServletConfig servletConfig, boolean checkIfExist)
Create Definition factory.
static ComponentDefinition
getActionDefinition(ServletRequest request)
Get Definition stored in jsp context by an action.
static DefinitionsFactory
getDefinitionsFactory(ServletContext servletContext)
Deprecated. Use TilesUtil.getDefinitionsFactory(ServletRequest,ServletContext)
static void
populateDefinitionsFactoryConfig(DefinitionsFactoryConfig factoryConfig, ServletConfig servletConfig)
Populate Definition Factory Config from web.xml properties.
protected static DefinitionsFactoryConfig
readFactoryConfig(ServletConfig servletConfig)
Create FactoryConfig and initialize it from web.xml.
static void
removeActionDefinition(ServletRequest request, ComponentDefinition definition)
Remove Definition stored in jsp context.
static void
setActionDefinition(ServletRequest request, ComponentDefinition definition)
Store definition in jsp context.

Methods inherited from class org.apache.struts.tiles.TilesUtil

createDefinitionsFactory, doForward, doInclude, doInclude, getDefinition, getDefinitionsFactory, getTilesUtil, isTilesUtilImplSet, setTilesUtil, testReset

Field Details

ACTION_DEFINITION

public static final String ACTION_DEFINITION
Constant name used to store definition in jsp context. Used to pass definition from a Struts action to servlet forward.

DEFINITIONS_CONFIG_USER_DEBUG_LEVEL

public static final String DEFINITIONS_CONFIG_USER_DEBUG_LEVEL
Name of init property carrying debug level.

DEFINITIONS_FACTORY

public static final String DEFINITIONS_FACTORY
Constant name used to store factory in context.

DEFINITIONS_FACTORY_CLASSNAME

public static final String DEFINITIONS_FACTORY_CLASSNAME
Name of init property carrying factory class name.

NO_DEBUG

public static final int NO_DEBUG

Deprecated. This will be removed in a release after Struts 1.2.

User Debug level.
Field Value:
0

log

protected static Log log
Commons Logging instance.

userDebugLevel

public static int userDebugLevel

Deprecated. This will be removed in a release after Struts 1.2.

Global user defined debug level.

Method Details

createDefinitionsFactory

public static DefinitionsFactory createDefinitionsFactory(ServletContext servletContext,
                                                          Map properties)
            throws DefinitionsFactoryException
Create default Definition factory.
Parameters:
servletContext - Servlet Context passed to newly created factory.
properties - Map of name/property used to initialize factory configuration object.
Returns:
newly created factory of type ConfigurableDefinitionsFactory.
Throws:
DefinitionsFactoryException - If an error occur while initializing factory

createDefinitionsFactory

public static DefinitionsFactory createDefinitionsFactory(ServletContext servletContext,
                                                          Map properties,
                                                          String classname)
            throws DefinitionsFactoryException

Deprecated. Use createDefinitionsFactory(ServletContext servletContext, ServletConfig servletConfig)

Create Definition factory. If a factory class name is provided, a factory of this class is created. Otherwise, default factory is created.
Parameters:
servletContext - Servlet Context passed to newly created factory.
properties - Map of name/property used to initialize factory configuration object.
classname - Class name of the factory to create.
Returns:
newly created factory.
Throws:
DefinitionsFactoryException - If an error occur while initializing factory

createDefinitionsFactory

public static DefinitionsFactory createDefinitionsFactory(ServletContext servletContext,
                                                          ServletConfig servletConfig)
            throws DefinitionsFactoryException
Create Definition factory. Create configuration object from servlet web.xml file, then create ConfigurableDefinitionsFactory and initialized it with object.

Convenience method. Calls createDefinitionsFactory(ServletContext servletContext, DefinitionsFactoryConfig factoryConfig)

Parameters:
servletContext - Servlet Context passed to newly created factory.
servletConfig - Servlet config containing parameters to be passed to factory configuration object.
Returns:
newly created factory of type ConfigurableDefinitionsFactory.
Throws:
DefinitionsFactoryException - If an error occur while initializing factory

createDefinitionsFactory

public static DefinitionsFactory createDefinitionsFactory(ServletContext servletContext,
                                                          ServletConfig servletConfig,
                                                          boolean checkIfExist)
            throws DefinitionsFactoryException
Create Definition factory. Create configuration object from servlet web.xml file, then create ConfigurableDefinitionsFactory and initialized it with object.

If checkIfExist is true, start by checking if factory already exist. If yes, return it. If no, create a new one.

If checkIfExist is false, factory is always created.

Convenience method. Calls createDefinitionsFactory(ServletContext servletContext, DefinitionsFactoryConfig factoryConfig)

Parameters:
servletContext - Servlet Context passed to newly created factory.
servletConfig - Servlet config containing parameters to be passed to factory configuration object.
checkIfExist - Check if factory already exist. If true and factory exist, return it. If true and factory doesn't exist, create it. If false, create it in all cases.
Returns:
newly created factory of type ConfigurableDefinitionsFactory.
Throws:
DefinitionsFactoryException - If an error occur while initializing factory

getActionDefinition

public static ComponentDefinition getActionDefinition(ServletRequest request)
Get Definition stored in jsp context by an action.
Returns:
ComponentDefinition or null if not found.

getDefinitionsFactory

public static DefinitionsFactory getDefinitionsFactory(ServletContext servletContext)

Deprecated. Use TilesUtil.getDefinitionsFactory(ServletRequest,ServletContext)

Get definition factory from appropriate servlet context.
Returns:
Definitions factory or null if not found.
Since:
20020708

populateDefinitionsFactoryConfig

public static void populateDefinitionsFactoryConfig(DefinitionsFactoryConfig factoryConfig,
                                                    ServletConfig servletConfig)
            throws IllegalAccessException,
                   InvocationTargetException
Populate Definition Factory Config from web.xml properties.
Parameters:
factoryConfig - Definition Factory Config to populate.
servletConfig - Current servlet config containing web.xml properties.
Since:
tiles 20020708
See Also:
org.apache.commons.beanutils.BeanUtils

readFactoryConfig

protected static DefinitionsFactoryConfig readFactoryConfig(ServletConfig servletConfig)
            throws DefinitionsFactoryException
Create FactoryConfig and initialize it from web.xml.
Parameters:
servletConfig - ServletConfig for the module with which this plug in is associated
Throws:
DefinitionsFactoryException - if this PlugIn cannot be successfully initialized

removeActionDefinition

public static void removeActionDefinition(ServletRequest request,
                                          ComponentDefinition definition)
Remove Definition stored in jsp context. Mainly used by Struts to pass a definition defined in an Action to the forward.

setActionDefinition

public static void setActionDefinition(ServletRequest request,
                                       ComponentDefinition definition)
Store definition in jsp context. Mainly used by Struts to pass a definition defined in an Action to the forward.

Copyright B) 2000-2007 - The Apache Software Foundation