|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.struts.config.BaseConfig org.apache.struts.config.impl.ModuleConfigImpl
public class ModuleConfigImpl
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.
Field Summary | |
---|---|
protected HashMap |
actionConfigIds
The set of action configuration for this module, if any, keyed by the actionId property. |
protected List |
actionConfigList
The set of action configurations for this module, if any, listed in the order in which they are added. |
protected HashMap |
actionConfigs
The set of action configurations for this module, if any, keyed by the path property. |
protected String |
actionFormBeanClass
The default class name to be used when creating action form bean instances. |
protected String |
actionForwardClass
The default class name to be used when creating action forward instances. |
protected String |
actionMappingClass
The default class name to be used when creating action mapping instances. |
protected ControllerConfig |
controllerConfig
The controller configuration object for this module. |
protected HashMap |
exceptions
The set of exception handling configurations for this module, if any, keyed by the type property. |
protected HashMap |
formBeans
The set of form bean configurations for this module, if any, keyed by the name property. |
protected HashMap |
forwards
The set of global forward configurations for this module, if any, keyed by the name property. |
protected static Log |
log
Commons Logging instance. |
protected ActionConfigMatcher |
matcher
Matches action config paths against compiled wildcard patterns |
protected HashMap |
messageResources
The set of message resources configurations for this module, if any, keyed by the key property. |
protected ArrayList |
plugIns
The set of configured plug-in Actions for this module, if any, in the order they were declared and configured. |
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. |
Fields inherited from class org.apache.struts.config.BaseConfig |
---|
configured |
Constructor Summary | |
---|---|
ModuleConfigImpl()
Constructor for ModuleConfigImpl. |
|
ModuleConfigImpl(String prefix)
Construct an ModuleConfigImpl object according to the specified parameter values. |
Method Summary | |
---|---|
void |
addActionConfig(ActionConfig config)
Ad d a new ActionConfig instance to the set
associated with this module. |
void |
addExceptionConfig(ExceptionConfig config)
Add a new ExceptionConfig instance to the set
associated with this module. |
void |
addFormBeanConfig(FormBeanConfig config)
Add a new FormBeanConfig instance to the set
associated with this module. |
void |
addForwardConfig(ForwardConfig config)
Add a new ForwardConfig instance to the set of global
forwards associated with this module. |
void |
addMessageResourcesConfig(MessageResourcesConfig config)
Add a new MessageResourcesConfig instance to the set
associated with this module. |
void |
addPlugInConfig(PlugInConfig plugInConfig)
Add a newly configured PlugInConfig
instance to the set of plug-in Actions for this module. |
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 . |
ActionConfig |
findActionConfigId(String actionId)
Returns the action configuration for the specifed action action identifier. |
ActionConfig[] |
findActionConfigs()
Return the action configurations for this module. |
ExceptionConfig |
findException(Class type)
Find and return the ExceptionConfig instance defining
how Exceptions of the specified type should be handled. |
ExceptionConfig |
findExceptionConfig(String type)
Return the exception configuration for the specified type, if any; otherwise return null . |
ExceptionConfig[] |
findExceptionConfigs()
Return the exception configurations for this module. |
FormBeanConfig |
findFormBeanConfig(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. |
ForwardConfig |
findForwardConfig(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. |
MessageResourcesConfig |
findMessageResourcesConfig(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. |
void |
freeze()
Freeze the configuration of this module. |
String |
getActionFormBeanClass()
The default class name to be used when creating action form bean instances. |
String |
getActionForwardClass()
The default class name to be used when creating action forward instances. |
String |
getActionMappingClass()
The default class name to be used when creating action mapping instances. |
boolean |
getConfigured()
Has this module been completely configured yet. |
ControllerConfig |
getControllerConfig()
The controller configuration object for this module. |
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. |
void |
removeActionConfig(ActionConfig config)
Remove the specified action configuration instance. |
void |
removeExceptionConfig(ExceptionConfig config)
Remove the specified exception configuration instance. |
void |
removeFormBeanConfig(FormBeanConfig config)
Remove the specified form bean configuration instance. |
void |
removeForwardConfig(ForwardConfig config)
Remove the specified forward configuration instance. |
void |
removeMessageResourcesConfig(MessageResourcesConfig config)
Remove the specified message resources configuration instance. |
void |
setActionFormBeanClass(String actionFormBeanClass)
The default class name to be used when creating action form bean instances. |
void |
setActionForwardClass(String actionForwardClass)
The default class name to be used when creating action forward instances. |
void |
setActionMappingClass(String actionMappingClass)
The default class name to be used when creating action mapping instances. |
void |
setControllerConfig(ControllerConfig cc)
The controller configuration object for this module. |
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. |
Methods inherited from class org.apache.struts.config.BaseConfig |
---|
copyProperties, getProperties, getProperty, inheritProperties, setProperties, setProperty, throwIfConfigured |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static Log log
Commons Logging instance.
protected HashMap actionConfigs
The set of action configurations for this module, if any, keyed by
the path
property.
protected HashMap actionConfigIds
The set of action configuration for this module, if any, keyed by
the actionId
property.
protected List actionConfigList
The set of action configurations for this module, if any, listed in the order in which they are added.
protected HashMap exceptions
The set of exception handling configurations for this module, if
any, keyed by the type
property.
protected HashMap formBeans
The set of form bean configurations for this module, if any, keyed
by the name
property.
protected HashMap forwards
The set of global forward configurations for this module, if any,
keyed by the name
property.
protected HashMap messageResources
The set of message resources configurations for this module, if any,
keyed by the key
property.
protected ArrayList plugIns
The set of configured plug-in Actions for this module, if any, in the order they were declared and configured.
protected ControllerConfig controllerConfig
The controller configuration object for this module.
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.
protected String actionFormBeanClass
The default class name to be used when creating action form bean instances.
protected String actionMappingClass
protected String actionForwardClass
protected ActionConfigMatcher matcher
Matches action config paths against compiled wildcard patterns
Constructor Detail |
---|
public ModuleConfigImpl()
Constructor for ModuleConfigImpl. Assumes default configuration.
public ModuleConfigImpl(String prefix)
Construct an ModuleConfigImpl object according to the specified parameter values.
prefix
- Context-relative URI prefix for this moduleMethod Detail |
---|
public boolean getConfigured()
getConfigured
in interface ModuleConfig
public ControllerConfig getControllerConfig()
The controller configuration object for this module.
getControllerConfig
in interface ModuleConfig
public void setControllerConfig(ControllerConfig cc)
The controller configuration object for this module.
setControllerConfig
in interface ModuleConfig
cc
- The controller configuration object for this module.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.
getPrefix
in interface ModuleConfig
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.
setPrefix
in interface ModuleConfig
prefix
- The prefix of the context-relative portion of the request
URI.public String getActionFormBeanClass()
The default class name to be used when creating action form bean instances.
getActionFormBeanClass
in interface ModuleConfig
public void setActionFormBeanClass(String actionFormBeanClass)
The default class name to be used when creating action form bean instances.
setActionFormBeanClass
in interface ModuleConfig
actionFormBeanClass
- default class name to be used when creating
action form bean instances.public String getActionMappingClass()
The default class name to be used when creating action mapping instances.
getActionMappingClass
in interface ModuleConfig
public void setActionMappingClass(String actionMappingClass)
The default class name to be used when creating action mapping instances.
setActionMappingClass
in interface ModuleConfig
actionMappingClass
- default class name to be used when creating
action mapping instances.public void addActionConfig(ActionConfig config)
ActionConfig
instance to the set
associated with this module.
addActionConfig
in interface ModuleConfig
config
- The new configuration instance to be added
IllegalStateException
- if this module configuration has been
frozenpublic void addExceptionConfig(ExceptionConfig config)
Add a new ExceptionConfig
instance to the set
associated with this module.
addExceptionConfig
in interface ModuleConfig
config
- The new configuration instance to be added
IllegalStateException
- if this module configuration has been
frozenpublic void addFormBeanConfig(FormBeanConfig config)
Add a new FormBeanConfig
instance to the set
associated with this module.
addFormBeanConfig
in interface ModuleConfig
config
- The new configuration instance to be added
IllegalStateException
- if this module configuration has been
frozenpublic String getActionForwardClass()
The default class name to be used when creating action forward instances.
getActionForwardClass
in interface ModuleConfig
public void setActionForwardClass(String actionForwardClass)
The default class name to be used when creating action forward instances.
setActionForwardClass
in interface ModuleConfig
actionForwardClass
- default class name to be used when creating
action forward instances.public void addForwardConfig(ForwardConfig config)
Add a new ForwardConfig
instance to the set of global
forwards associated with this module.
addForwardConfig
in interface ModuleConfig
config
- The new configuration instance to be added
IllegalStateException
- if this module configuration has been
frozenpublic void addMessageResourcesConfig(MessageResourcesConfig config)
Add a new MessageResourcesConfig
instance to the set
associated with this module.
addMessageResourcesConfig
in interface ModuleConfig
config
- The new configuration instance to be added
IllegalStateException
- if this module configuration has been
frozenpublic void addPlugInConfig(PlugInConfig plugInConfig)
Add a newly configured PlugInConfig
instance to the set of plug-in Actions for this module.
addPlugInConfig
in interface ModuleConfig
plugInConfig
- The new configuration instance to be addedpublic 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
.
findActionConfig
in interface ModuleConfig
path
- Path of the action configuration to returnpublic ActionConfig findActionConfigId(String actionId)
Returns the action configuration for the specifed action action identifier.
findActionConfigId
in interface ModuleConfig
actionId
- the action identifier
null
ActionConfig.getActionId()
public ActionConfig[] findActionConfigs()
Return the action configurations for this module. If there are none, a zero-length array is returned.
findActionConfigs
in interface ModuleConfig
public ExceptionConfig findExceptionConfig(String type)
Return the exception configuration for the specified type, if any;
otherwise return null
.
findExceptionConfig
in interface ModuleConfig
type
- Exception class name to find a configuration forpublic ExceptionConfig findException(Class type)
Find and return the ExceptionConfig
instance defining
how Exceptions
of 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 an ActionConfig
has 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.
findException
in interface ModuleConfig
type
- Exception class for which to find a handlerfindException(Class)
public ExceptionConfig[] findExceptionConfigs()
Return the exception configurations for this module. If there are none, a zero-length array is returned.
findExceptionConfigs
in interface ModuleConfig
public FormBeanConfig findFormBeanConfig(String name)
Return the form bean configuration for the specified key, if any;
otherwise return null
.
findFormBeanConfig
in interface ModuleConfig
name
- Name of the form bean configuration to returnpublic FormBeanConfig[] findFormBeanConfigs()
Return the form bean configurations for this module. If there are none, a zero-length array is returned.
findFormBeanConfigs
in interface ModuleConfig
public ForwardConfig findForwardConfig(String name)
Return the forward configuration for the specified key, if any;
otherwise return null
.
findForwardConfig
in interface ModuleConfig
name
- Name of the forward configuration to returnpublic ForwardConfig[] findForwardConfigs()
Return the form bean configurations for this module. If there are none, a zero-length array is returned.
findForwardConfigs
in interface ModuleConfig
public MessageResourcesConfig findMessageResourcesConfig(String key)
Return the message resources configuration for the specified key,
if any; otherwise return null
.
findMessageResourcesConfig
in interface ModuleConfig
key
- Key of the data source configuration to returnpublic MessageResourcesConfig[] findMessageResourcesConfigs()
Return the message resources configurations for this module. If there are none, a zero-length array is returned.
findMessageResourcesConfigs
in interface ModuleConfig
public PlugInConfig[] findPlugInConfigs()
Return the configured plug-in actions for this module. If there are none, a zero-length array is returned.
findPlugInConfigs
in interface ModuleConfig
public void freeze()
Freeze the configuration of this module. After this method returns, any attempt to modify the configuration will return an IllegalStateException.
freeze
in interface ModuleConfig
freeze
in class BaseConfig
public void removeActionConfig(ActionConfig config)
Remove the specified action configuration instance.
removeActionConfig
in interface ModuleConfig
config
- ActionConfig instance to be removed
IllegalStateException
- if this module configuration has been
frozenpublic void removeExceptionConfig(ExceptionConfig config)
Remove the specified exception configuration instance.
removeExceptionConfig
in interface ModuleConfig
config
- ActionConfig instance to be removed
IllegalStateException
- if this module configuration has been
frozenpublic void removeFormBeanConfig(FormBeanConfig config)
Remove the specified form bean configuration instance.
removeFormBeanConfig
in interface ModuleConfig
config
- FormBeanConfig instance to be removed
IllegalStateException
- if this module configuration has been
frozenpublic void removeForwardConfig(ForwardConfig config)
Remove the specified forward configuration instance.
removeForwardConfig
in interface ModuleConfig
config
- ForwardConfig instance to be removed
IllegalStateException
- if this module configuration has been
frozenpublic void removeMessageResourcesConfig(MessageResourcesConfig config)
Remove the specified message resources configuration instance.
removeMessageResourcesConfig
in interface ModuleConfig
config
- MessageResourcesConfig instance to be removed
IllegalStateException
- if this module configuration has been
frozen
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |