Class ModuleConfigImpl
- All Implemented Interfaces:
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$ $Date: 2005-12-31 03:57:16 -0500 (Sat, 31 Dec 2005) $
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected HashMap<String, ActionConfig> The set of action configuration for this module, if any, keyed by theactionIdproperty.protected ArrayList<ActionConfig> The set of action configurations for this module, if any, listed in the order in which they are added.protected Map<String, ActionConfig> The set of action configurations for this module, if any, keyed by thepathproperty.protected StringThe default class name to be used when creating action form bean instances.protected StringThe default class name to be used when creating action forward instances.protected StringThe default class name to be used when creating action mapping instances.protected ControllerConfigThe controller configuration object for this module.protected HashMap<String, ExceptionConfig> The set of exception handling configurations for this module, if any, keyed by thetypeproperty.protected HashMap<String, FormBeanConfig> The set of form bean configurations for this module, if any, keyed by thenameproperty.protected HashMap<String, ForwardConfig> The set of global forward configurations for this module, if any, keyed by thenameproperty.protected ActionConfigMatcherMatches action config paths against compiled wildcard patternsprotected HashMap<String, MessageResourcesConfig> The set of message resources configurations for this module, if any, keyed by thekeyproperty.protected ArrayList<PlugInConfig> The set of configured plug-in Actions for this module, if any, in the order they were declared and configured.protected StringThe prefix of the context-relative portion of the request URI, used to select this configuration versus others supported by the controller servlet.Fields inherited from class org.apache.struts.config.BaseConfig
configured -
Constructor Summary
ConstructorsConstructorDescriptionConstructor for ModuleConfigImpl.ModuleConfigImpl(String prefix) Construct an ModuleConfigImpl object according to the specified parameter values. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddActionConfig(ActionConfig config) Ad d a newActionConfiginstance to the set associated with this module.voidaddExceptionConfig(ExceptionConfig config) Add a newExceptionConfiginstance to the set associated with this module.voidaddFormBeanConfig(FormBeanConfig config) Add a newFormBeanConfiginstance to the set associated with this module.voidaddForwardConfig(ForwardConfig config) Add a newForwardConfiginstance to the set of global forwards associated with this module.voidAdd a newMessageResourcesConfiginstance to the set associated with this module.voidaddPlugInConfig(PlugInConfig plugInConfig) Add a newly configuredPlugInConfiginstance to the set of plug-in Actions for this module.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 returnnull.findActionConfigId(String actionId) Returns the action configuration for the specifed action action identifier.Return the action configurations for this module.findException(Class<?> type) Find and return theExceptionConfiginstance defining howExceptionsof the specified type should be handled.findExceptionConfig(String type) Return the exception configuration for the specified type, if any; otherwise returnnull.Return the exception configurations for this module.findFormBeanConfig(String name) Return the form bean configuration for the specified key, if any; otherwise returnnull.Return the form bean configurations for this module.findForwardConfig(String name) Return the forward configuration for the specified key, if any; otherwise returnnull.Return the form bean configurations for this module.Return the message resources configuration for the specified key, if any; otherwise returnnull.Return the message resources configurations for this module.Return the configured plug-in actions for this module.voidfreeze()Freeze the configuration of this module.The default class name to be used when creating action form bean instances.The default class name to be used when creating action forward instances.The default class name to be used when creating action mapping instances.booleanHas this module been completely configured yet.The controller configuration object for this module.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.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.voidRemove 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.voidThe controller configuration object for this module.voidThe prefix of the context-relative portion of the request URI, used to select this configuration versus others supported by the controller servlet.voidsetProperty(String key, String value) Set an arbitary key/value pair which can be retrieved by this config class.Methods inherited from class org.apache.struts.config.BaseConfig
copyProperties, getProperties, getProperty, inheritProperties, setProperties, throwIfConfigured
-
Field Details
-
actionConfigs
The set of action configurations for this module, if any, keyed by the
pathproperty. -
actionConfigIds
The set of action configuration for this module, if any, keyed by the
actionIdproperty. -
actionConfigList
The set of action configurations for this module, if any, listed in the order in which they are added.
-
exceptions
The set of exception handling configurations for this module, if any, keyed by the
typeproperty. -
formBeans
The set of form bean configurations for this module, if any, keyed by the
nameproperty. -
forwards
The set of global forward configurations for this module, if any, keyed by the
nameproperty. -
messageResources
The set of message resources configurations for this module, if any, keyed by the
keyproperty. -
plugIns
The set of configured plug-in Actions for this module, if any, in the order they were declared and configured.
-
controllerConfig
The controller configuration object for this module.
-
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.
-
actionFormBeanClass
The default class name to be used when creating action form bean instances.
-
actionMappingClass
The default class name to be used when creating action mapping instances. -
actionForwardClass
The default class name to be used when creating action forward instances. -
matcher
Matches action config paths against compiled wildcard patterns
-
-
Constructor Details
-
ModuleConfigImpl
public ModuleConfigImpl()Constructor for ModuleConfigImpl. Assumes default configuration.
- Since:
- Struts 1.2.8
-
ModuleConfigImpl
Construct an ModuleConfigImpl object according to the specified parameter values.
- Parameters:
prefix- Context-relative URI prefix for this module
-
-
Method Details
-
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.- Specified by:
getConfiguredin interfaceModuleConfig
-
getControllerConfig
The controller configuration object for this module.
- Specified by:
getControllerConfigin interfaceModuleConfig
-
setControllerConfig
The controller configuration object for this module.
- Specified by:
setControllerConfigin interfaceModuleConfig- Parameters:
cc- The controller configuration object for this module.
-
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.
- Specified by:
getPrefixin interfaceModuleConfig
-
setPrefix
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.
- Specified by:
setPrefixin interfaceModuleConfig- Parameters:
prefix- The prefix of the context-relative portion of the request URI.
-
getActionFormBeanClass
The default class name to be used when creating action form bean instances.
- Specified by:
getActionFormBeanClassin interfaceModuleConfig
-
setActionFormBeanClass
The default class name to be used when creating action form bean instances.
- Specified by:
setActionFormBeanClassin interfaceModuleConfig- Parameters:
actionFormBeanClass- default class name to be used when creating action form bean instances.
-
getActionMappingClass
The default class name to be used when creating action mapping instances.
- Specified by:
getActionMappingClassin interfaceModuleConfig
-
setActionMappingClass
The default class name to be used when creating action mapping instances.
- Specified by:
setActionMappingClassin interfaceModuleConfig- Parameters:
actionMappingClass- default class name to be used when creating action mapping instances.
-
addActionConfig
Ad d a newActionConfiginstance to the set associated with this module.- Specified by:
addActionConfigin interfaceModuleConfig- Parameters:
config- The new configuration instance to be added- Throws:
IllegalStateException- if this module configuration has been frozen
-
addExceptionConfig
Add a new
ExceptionConfiginstance to the set associated with this module.- Specified by:
addExceptionConfigin interfaceModuleConfig- Parameters:
config- The new configuration instance to be added- Throws:
IllegalStateException- if this module configuration has been frozen
-
addFormBeanConfig
Add a new
FormBeanConfiginstance to the set associated with this module.- Specified by:
addFormBeanConfigin interfaceModuleConfig- Parameters:
config- The new configuration instance to be added- Throws:
IllegalStateException- if this module configuration has been frozen
-
getActionForwardClass
The default class name to be used when creating action forward instances.
- Specified by:
getActionForwardClassin interfaceModuleConfig
-
setActionForwardClass
The default class name to be used when creating action forward instances.
- Specified by:
setActionForwardClassin interfaceModuleConfig- Parameters:
actionForwardClass- default class name to be used when creating action forward instances.
-
addForwardConfig
Add a new
ForwardConfiginstance to the set of global forwards associated with this module.- Specified by:
addForwardConfigin interfaceModuleConfig- Parameters:
config- The new configuration instance to be added- Throws:
IllegalStateException- if this module configuration has been frozen
-
addMessageResourcesConfig
Add a new
MessageResourcesConfiginstance to the set associated with this module.- Specified by:
addMessageResourcesConfigin interfaceModuleConfig- Parameters:
config- The new configuration instance to be added- Throws:
IllegalStateException- if this module configuration has been frozen
-
addPlugInConfig
Add a newly configured
PlugInConfiginstance to the set of plug-in Actions for this module.- Specified by:
addPlugInConfigin interfaceModuleConfig- Parameters:
plugInConfig- The new configuration instance to be added
-
findActionConfig
Return the action configuration for the specified path, first looking a direct match, then if none found, a wildcard pattern match; otherwise return
null.- Specified by:
findActionConfigin interfaceModuleConfig- Parameters:
path- Path of the action configuration to return
-
findActionConfigId
Returns the action configuration for the specifed action action identifier.
- Specified by:
findActionConfigIdin interfaceModuleConfig- Parameters:
actionId- the action identifier- Returns:
- the action config if found; otherwise
null - Since:
- Struts 1.3.6
- See Also:
-
findActionConfigs
Return the action configurations for this module. If there are none, a zero-length array is returned.
- Specified by:
findActionConfigsin interfaceModuleConfig
-
findExceptionConfig
Return the exception configuration for the specified type, if any; otherwise return
null.- Specified by:
findExceptionConfigin interfaceModuleConfig- Parameters:
type- Exception class name to find a configuration for
-
findException
Find and return the
ExceptionConfiginstance defining howExceptionsof the specified type should be handled.In original Struts usage, this was only available in
ActionConfig, but there are cases when an exception could be thrown before anActionConfighas been identified, where global exception handlers may still be pertinent.TODO: Look for a way to share this logic with
ActionConfig, although there are subtle differences, and it certainly doesn't seem like it should be done with inheritance.- Specified by:
findExceptionin interfaceModuleConfig- Parameters:
type- Exception class for which to find a handler- Since:
- Struts 1.3.0
- See Also:
-
findExceptionConfigs
Return the exception configurations for this module. If there are none, a zero-length array is returned.
- Specified by:
findExceptionConfigsin interfaceModuleConfig
-
findFormBeanConfig
Return the form bean configuration for the specified key, if any; otherwise return
null.- Specified by:
findFormBeanConfigin interfaceModuleConfig- Parameters:
name- Name of the form bean configuration to return
-
findFormBeanConfigs
Return the form bean configurations for this module. If there are none, a zero-length array is returned.
- Specified by:
findFormBeanConfigsin interfaceModuleConfig
-
findForwardConfig
Return the forward configuration for the specified key, if any; otherwise return
null.- Specified by:
findForwardConfigin interfaceModuleConfig- Parameters:
name- Name of the forward configuration to return
-
findForwardConfigs
Return the form bean configurations for this module. If there are none, a zero-length array is returned.
- Specified by:
findForwardConfigsin interfaceModuleConfig
-
findMessageResourcesConfig
Return the message resources configuration for the specified key, if any; otherwise return
null.- Specified by:
findMessageResourcesConfigin interfaceModuleConfig- Parameters:
key- Key of the data source configuration to return
-
findMessageResourcesConfigs
Return the message resources configurations for this module. If there are none, a zero-length array is returned.
- Specified by:
findMessageResourcesConfigsin interfaceModuleConfig
-
findPlugInConfigs
Return the configured plug-in actions for this module. If there are none, a zero-length array is returned.
- Specified by:
findPlugInConfigsin interfaceModuleConfig
-
freeze
public void freeze()Freeze the configuration of this module. After this method returns, any attempt to modify the configuration will return an IllegalStateException.
- Specified by:
freezein interfaceModuleConfig- Overrides:
freezein classBaseConfig
-
removeActionConfig
Remove the specified action configuration instance.
- Specified by:
removeActionConfigin interfaceModuleConfig- Parameters:
config- ActionConfig instance to be removed- Throws:
IllegalStateException- if this module configuration has been frozen
-
removeExceptionConfig
Remove the specified exception configuration instance.
- Specified by:
removeExceptionConfigin interfaceModuleConfig- Parameters:
config- ActionConfig instance to be removed- Throws:
IllegalStateException- if this module configuration has been frozen
-
removeFormBeanConfig
Remove the specified form bean configuration instance.
- Specified by:
removeFormBeanConfigin interfaceModuleConfig- Parameters:
config- FormBeanConfig instance to be removed- Throws:
IllegalStateException- if this module configuration has been frozen
-
removeForwardConfig
Remove the specified forward configuration instance.
- Specified by:
removeForwardConfigin interfaceModuleConfig- Parameters:
config- ForwardConfig instance to be removed- Throws:
IllegalStateException- if this module configuration has been frozen
-
removeMessageResourcesConfig
Remove the specified message resources configuration instance.
- Specified by:
removeMessageResourcesConfigin interfaceModuleConfig- Parameters:
config- MessageResourcesConfig instance to be removed- Throws:
IllegalStateException- if this module configuration has been frozen
-
setProperty
Description copied from class:BaseConfigSet an arbitary key/value pair which can be retrieved by this config class. This facility should eliminate many use cases for subclassing
This method must not be called after configuration is complete, or an*Configclasses by providing a mechanism to pass any amount of arbitrary configuration information into an config class.IllegalStateExceptionwill be thrown.Example
<action path="/example" type="com.example.MyAction"> <set-property key="foo" property="bar" /> </action>- Overrides:
setPropertyin classBaseConfig- Parameters:
key- the key by which this value will be retrievedvalue- the value to store with the supplied key
-