org.apache.struts.config.impl

Class ModuleConfigImpl

public class ModuleConfigImpl extends Object implements Serializable, ModuleConfig

The collection of static configuration information that describes a Struts-based module. Multiple modules are identified by a prefix at the beginning of the context relative portion of the request URI. If no module prefix can be matched, the default configuration (with a prefix equal to a zero-length string) is selected, which is elegantly backwards compatible with the previous Struts behavior that only supported one module.

Since: Struts 1.1

Version: $Rev: 170858 $ $Date: 2005-05-19 03:58:27 +0100 (Thu, 19 May 2005) $

Field Summary
protected ListactionConfigList
The set of action configurations for this module, if any, listed in the order in which they are added.
protected HashMapactionConfigs
The set of action configurations for this module, if any, keyed by the path property.
protected StringactionFormBeanClass
The default class name to be used when creating action form bean instances.
protected StringactionForwardClass
The default class name to be used when creating action forward instances.
protected StringactionMappingClass
The default class name to be used when creating action mapping instances.
protected booleanconfigured
Has this module been completely configured yet.
protected ControllerConfigcontrollerConfig
The controller configuration object for this module.
protected HashMapdataSources
The set of JDBC data source configurations for this module, if any, keyed by the key property.
protected HashMapexceptions
The set of exception handling configurations for this module, if any, keyed by the type property.
protected HashMapformBeans
The set of form bean configurations for this module, if any, keyed by the name property.
protected HashMapforwards
The set of global forward configurations for this module, if any, keyed by the name property.
protected ActionConfigMatchermatcher
Matches action config paths against compiled wildcard patterns
protected HashMapmessageResources
The set of message resources configurations for this module, if any, keyed by the key property.
protected ArrayListplugIns
The set of configured plug-in Actions for this module, if any, in the order they were declared and configured.
protected Stringprefix
The prefix of the context-relative portion of the request URI, used to select this configuration versus others supported by the controller servlet.
Constructor Summary
ModuleConfigImpl()
Constructor for ModuleConfigImpl.
ModuleConfigImpl(String prefix)
Construct an ModuleConfigImpl object according to the specified parameter values.
Method Summary
voidaddActionConfig(ActionConfig config)
Add a new ActionConfig instance to the set associated with this module.
voidaddDataSourceConfig(DataSourceConfig config)
Add a new DataSourceConfig instance to the set associated with this module.
voidaddExceptionConfig(ExceptionConfig config)
Add a new ExceptionConfig instance to the set associated with this module.
voidaddFormBeanConfig(FormBeanConfig config)
Add a new FormBeanConfig instance to the set associated with this module.
voidaddForwardConfig(ForwardConfig config)
Add a new ForwardConfig instance to the set of global forwards associated with this module.
voidaddMessageResourcesConfig(MessageResourcesConfig config)
Add a new MessageResourcesConfig instance to the set associated with this module.
voidaddPlugInConfig(PlugInConfig plugInConfig)
Add a newly configured {@link org.apache.struts.config.PlugInConfig} instance to the set of plug-in Actions for this module.
ActionConfigfindActionConfig(String path)
Return the action configuration for the specified path, first looking a direct match, then if none found, a wildcard pattern match; otherwise return null.
ActionConfig[]findActionConfigs()
Return the action configurations for this module.
DataSourceConfigfindDataSourceConfig(String key)
Return the data source configuration for the specified key, if any; otherwise return null.
DataSourceConfig[]findDataSourceConfigs()
Return the data source configurations for this module.
ExceptionConfigfindExceptionConfig(String type)
Return the exception configuration for the specified type, if any; otherwise return null.
ExceptionConfig[]findExceptionConfigs()
Return the exception configurations for this module.
FormBeanConfigfindFormBeanConfig(String name)
Return the form bean configuration for the specified key, if any; otherwise return null.
FormBeanConfig[]findFormBeanConfigs()
Return the form bean configurations for this module.
ForwardConfigfindForwardConfig(String name)
Return the forward configuration for the specified key, if any; otherwise return null.
ForwardConfig[]findForwardConfigs()
Return the form bean configurations for this module.
MessageResourcesConfigfindMessageResourcesConfig(String key)
Return the message resources configuration for the specified key, if any; otherwise return null.
MessageResourcesConfig[]findMessageResourcesConfigs()
Return the message resources configurations for this module.
PlugInConfig[]findPlugInConfigs()
Return the configured plug-in actions for this module.
voidfreeze()
Freeze the configuration of this module.
StringgetActionFormBeanClass()
The default class name to be used when creating action form bean instances.
StringgetActionForwardClass()
The default class name to be used when creating action forward instances.
StringgetActionMappingClass()
The default class name to be used when creating action mapping instances.
booleangetConfigured()
Has this module been completely configured yet.
ControllerConfiggetControllerConfig()
The controller configuration object for this module.
StringgetPrefix()
The prefix of the context-relative portion of the request URI, used to select this configuration versus others supported by the controller servlet.
voidremoveActionConfig(ActionConfig config)
Remove the specified action configuration instance.
voidremoveDataSourceConfig(DataSourceConfig config)
Remove the specified data source configuration instance.
voidremoveExceptionConfig(ExceptionConfig config)
Remove the specified exception configuration instance.
voidremoveFormBeanConfig(FormBeanConfig config)
Remove the specified form bean configuration instance.
voidremoveForwardConfig(ForwardConfig config)
Remove the specified forward configuration instance.
voidremoveMessageResourcesConfig(MessageResourcesConfig config)
Remove the specified message resources configuration instance.
voidsetActionFormBeanClass(String actionFormBeanClass)
The default class name to be used when creating action form bean instances.
voidsetActionForwardClass(String actionForwardClass)
The default class name to be used when creating action forward instances.
voidsetActionMappingClass(String actionMappingClass)
The default class name to be used when creating action mapping instances.
voidsetControllerConfig(ControllerConfig cc)
The controller configuration object for this module.
voidsetPrefix(String prefix)
The prefix of the context-relative portion of the request URI, used to select this configuration versus others supported by the controller servlet.

Field Detail

actionConfigList

protected List actionConfigList
The set of action configurations for this module, if any, listed in the order in which they are added.

actionConfigs

protected HashMap actionConfigs
The set of action configurations for this module, if any, keyed by the path property.

actionFormBeanClass

protected String actionFormBeanClass
The default class name to be used when creating action form bean instances.

actionForwardClass

protected String actionForwardClass
The default class name to be used when creating action forward instances.

actionMappingClass

protected String actionMappingClass
The default class name to be used when creating action mapping instances.

configured

protected boolean configured
Has this module been completely configured yet. Once this flag has been set, any attempt to modify the configuration will return an IllegalStateException.

controllerConfig

protected ControllerConfig controllerConfig
The controller configuration object for this module.

dataSources

protected HashMap dataSources
The set of JDBC data source configurations for this module, if any, keyed by the key property.

exceptions

protected HashMap exceptions
The set of exception handling configurations for this module, if any, keyed by the type property.

formBeans

protected HashMap formBeans
The set of form bean configurations for this module, if any, keyed by the name property.

forwards

protected HashMap forwards
The set of global forward configurations for this module, if any, keyed by the name property.

matcher

protected ActionConfigMatcher matcher
Matches action config paths against compiled wildcard patterns

messageResources

protected HashMap messageResources
The set of message resources configurations for this module, if any, keyed by the key property.

plugIns

protected ArrayList plugIns
The set of configured plug-in Actions for this module, if any, in the order they were declared and configured.

prefix

protected String prefix
The prefix of the context-relative portion of the request URI, used to select this configuration versus others supported by the controller servlet. A configuration with a prefix of a zero-length String is the default configuration for this web module.

Constructor Detail

ModuleConfigImpl

public ModuleConfigImpl()
Constructor for ModuleConfigImpl. Assumes default configuration.

Since: Struts 1.2.8

ModuleConfigImpl

public ModuleConfigImpl(String prefix)
Construct an ModuleConfigImpl object according to the specified parameter values.

Parameters: prefix Context-relative URI prefix for this module

Method Detail

addActionConfig

public void addActionConfig(ActionConfig config)
Add a new ActionConfig instance to the set associated with this module.

Parameters: config The new configuration instance to be added

Throws: java.lang.IllegalStateException if this module configuration has been frozen

addDataSourceConfig

public void addDataSourceConfig(DataSourceConfig config)
Add a new DataSourceConfig instance to the set associated with this module.

Parameters: config The new configuration instance to be added

Throws: java.lang.IllegalStateException if this module configuration has been frozen

addExceptionConfig

public void addExceptionConfig(ExceptionConfig config)
Add a new ExceptionConfig instance to the set associated with this module.

Parameters: config The new configuration instance to be added

Throws: java.lang.IllegalStateException if this module configuration has been frozen

addFormBeanConfig

public void addFormBeanConfig(FormBeanConfig config)
Add a new FormBeanConfig instance to the set associated with this module.

Parameters: config The new configuration instance to be added

Throws: java.lang.IllegalStateException if this module configuration has been frozen

addForwardConfig

public void addForwardConfig(ForwardConfig config)
Add a new ForwardConfig instance to the set of global forwards associated with this module.

Parameters: config The new configuration instance to be added

Throws: java.lang.IllegalStateException if this module configuration has been frozen

addMessageResourcesConfig

public void addMessageResourcesConfig(MessageResourcesConfig config)
Add a new MessageResourcesConfig instance to the set associated with this module.

Parameters: config The new configuration instance to be added

Throws: java.lang.IllegalStateException if this module configuration has been frozen

addPlugInConfig

public void addPlugInConfig(PlugInConfig plugInConfig)
Add a newly configured {@link org.apache.struts.config.PlugInConfig} instance to the set of plug-in Actions for this module.

Parameters: plugInConfig The new configuration instance to be added

findActionConfig

public ActionConfig findActionConfig(String path)
Return the action configuration for the specified path, first looking a direct match, then if none found, a wildcard pattern match; otherwise return null.

Parameters: path Path of the action configuration to return

findActionConfigs

public ActionConfig[] findActionConfigs()
Return the action configurations for this module. If there are none, a zero-length array is returned.

findDataSourceConfig

public DataSourceConfig findDataSourceConfig(String key)
Return the data source configuration for the specified key, if any; otherwise return null.

Parameters: key Key of the data source configuration to return

findDataSourceConfigs

public DataSourceConfig[] findDataSourceConfigs()
Return the data source configurations for this module. If there are none, a zero-length array is returned.

findExceptionConfig

public ExceptionConfig findExceptionConfig(String type)
Return the exception configuration for the specified type, if any; otherwise return null.

Parameters: type Exception class name to find a configuration for

findExceptionConfigs

public ExceptionConfig[] findExceptionConfigs()
Return the exception configurations for this module. If there are none, a zero-length array is returned.

findFormBeanConfig

public FormBeanConfig findFormBeanConfig(String name)
Return the form bean configuration for the specified key, if any; otherwise return null.

Parameters: name Name of the form bean configuration to return

findFormBeanConfigs

public FormBeanConfig[] findFormBeanConfigs()
Return the form bean configurations for this module. If there are none, a zero-length array is returned.

findForwardConfig

public ForwardConfig findForwardConfig(String name)
Return the forward configuration for the specified key, if any; otherwise return null.

Parameters: name Name of the forward configuration to return

findForwardConfigs

public ForwardConfig[] findForwardConfigs()
Return the form bean configurations for this module. If there are none, a zero-length array is returned.

findMessageResourcesConfig

public MessageResourcesConfig findMessageResourcesConfig(String key)
Return the message resources configuration for the specified key, if any; otherwise return null.

Parameters: key Key of the data source configuration to return

findMessageResourcesConfigs

public MessageResourcesConfig[] findMessageResourcesConfigs()
Return the message resources configurations for this module. If there are none, a zero-length array is returned.

findPlugInConfigs

public PlugInConfig[] findPlugInConfigs()
Return the configured plug-in actions for this module. If there are none, a zero-length array is returned.

freeze

public void freeze()
Freeze the configuration of this module. After this method returns, any attempt to modify the configuration will return an IllegalStateException.

getActionFormBeanClass

public String getActionFormBeanClass()
The default class name to be used when creating action form bean instances.

getActionForwardClass

public String getActionForwardClass()
The default class name to be used when creating action forward instances.

getActionMappingClass

public String getActionMappingClass()
The default class name to be used when creating action mapping instances.

getConfigured

public boolean getConfigured()
Has this module been completely configured yet. Once this flag has been set, any attempt to modify the configuration will return an IllegalStateException.

getControllerConfig

public ControllerConfig getControllerConfig()
The controller configuration object for this module.

getPrefix

public String getPrefix()
The prefix of the context-relative portion of the request URI, used to select this configuration versus others supported by the controller servlet. A configuration with a prefix of a zero-length String is the default configuration for this web module.

removeActionConfig

public void removeActionConfig(ActionConfig config)
Remove the specified action configuration instance.

Parameters: config ActionConfig instance to be removed

Throws: IllegalStateException if this module configuration has been frozen

removeDataSourceConfig

public void removeDataSourceConfig(DataSourceConfig config)
Remove the specified data source configuration instance.

Parameters: config DataSourceConfig instance to be removed

Throws: IllegalStateException if this module configuration has been frozen

removeExceptionConfig

public void removeExceptionConfig(ExceptionConfig config)
Remove the specified exception configuration instance.

Parameters: config ActionConfig instance to be removed

Throws: IllegalStateException if this module configuration has been frozen

removeFormBeanConfig

public void removeFormBeanConfig(FormBeanConfig config)
Remove the specified form bean configuration instance.

Parameters: config FormBeanConfig instance to be removed

Throws: IllegalStateException if this module configuration has been frozen

removeForwardConfig

public void removeForwardConfig(ForwardConfig config)
Remove the specified forward configuration instance.

Parameters: config ForwardConfig instance to be removed

Throws: IllegalStateException if this module configuration has been frozen

removeMessageResourcesConfig

public void removeMessageResourcesConfig(MessageResourcesConfig config)
Remove the specified message resources configuration instance.

Parameters: config MessageResourcesConfig instance to be removed

Throws: IllegalStateException if this module configuration has been frozen

setActionFormBeanClass

public void setActionFormBeanClass(String actionFormBeanClass)
The default class name to be used when creating action form bean instances.

Parameters: actionFormBeanClass default class name to be used when creating action form bean instances.

setActionForwardClass

public void setActionForwardClass(String actionForwardClass)
The default class name to be used when creating action forward instances.

Parameters: actionForwardClass default class name to be used when creating action forward instances.

setActionMappingClass

public void setActionMappingClass(String actionMappingClass)
The default class name to be used when creating action mapping instances.

Parameters: actionMappingClass default class name to be used when creating action mapping instances.

setControllerConfig

public void setControllerConfig(ControllerConfig cc)
The controller configuration object for this module.

Parameters: cc The controller configuration object for this module.

setPrefix

public void setPrefix(String prefix)
The prefix of the context-relative portion of the request URI, used to select this configuration versus others supported by the controller servlet. A configuration with a prefix of a zero-length String is the default configuration for this web module.
Copyright © 2000-2008 - The Apache Software Foundation