org.apache.struts.config.ModuleConfig Maven / Gradle / Ivy
/*
* $Id$
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.struts.config;
/**
* 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.
*
* @version $Rev$ $Date: 2005-08-06 04:12:10 -0400 (Sat, 06 Aug 2005)
* $
* @since Struts 1.1
*/
public interface ModuleConfig {
/**
* Has this module been completely configured yet. Once this flag has
* been set, any attempt to modify the configuration will return an
* IllegalStateException.
*/
boolean getConfigured();
/**
* The controller configuration object for this module.
*/
ControllerConfig getControllerConfig();
/**
* The controller configuration object for this module.
*
* @param cc The controller configuration object for this module.
*/
void setControllerConfig(ControllerConfig cc);
/**
* 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.
*/
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.
*
* @param prefix The prefix of the context-relative portion of the request
* URI.
*/
public void setPrefix(String prefix);
/**
* The default class name to be used when creating action form bean
* instances.
*/
String getActionFormBeanClass();
/**
* The default class name to be used when creating action form bean
* instances.
*
* @param actionFormBeanClass default class name to be used when creating
* action form bean instances.
*/
void setActionFormBeanClass(String actionFormBeanClass);
/**
* The default class name to be used when creating action mapping
* instances.
*/
String getActionMappingClass();
/**
* The default class name to be used when creating action mapping
* instances.
*
* @param actionMappingClass default class name to be used when creating
* action mapping instances.
*/
void setActionMappingClass(String actionMappingClass);
/**
* Add a new ActionConfig
instance to the set associated
* with this module.
*
* @param config The new configuration instance to be added
* @throws IllegalStateException if this module configuration has been
* frozen
*/
void addActionConfig(ActionConfig config);
/**
* Add a new ExceptionConfig
instance to the set
* associated with this module.
*
* @param config The new configuration instance to be added
* @throws IllegalStateException if this module configuration has been
* frozen
*/
void addExceptionConfig(ExceptionConfig config);
/**
* Add a new FormBeanConfig
instance to the set
* associated with this module.
*
* @param config The new configuration instance to be added
* @throws IllegalStateException if this module configuration has been
* frozen
*/
void addFormBeanConfig(FormBeanConfig config);
/**
* The default class name to be used when creating action forward
* instances.
*/
String getActionForwardClass();
/**
* The default class name to be used when creating action forward
* instances.
*
* @param actionForwardClass default class name to be used when creating
* action forward instances.
*/
void setActionForwardClass(String actionForwardClass);
/**
* Add a new ForwardConfig
instance to the set of global
* forwards associated with this module.
*
* @param config The new configuration instance to be added
* @throws IllegalStateException if this module configuration has been
* frozen
*/
void addForwardConfig(ForwardConfig config);
/**
* Add a new MessageResourcesConfig
instance to the set
* associated with this module.
*
* @param config The new configuration instance to be added
* @throws IllegalStateException if this module configuration has been
* frozen
*/
void addMessageResourcesConfig(MessageResourcesConfig config);
/**
* Add a newly configured {@link PlugInConfig} instance to the set of
* plug-in Actions for this module.
*
* @param plugInConfig The new configuration instance to be added
*/
void addPlugInConfig(PlugInConfig plugInConfig);
/**
* Return the action configuration for the specified path, if any;
* otherwise return null
.
*
* @param path Path of the action configuration to return
*/
ActionConfig findActionConfig(String path);
/**
* Return the action configurations for this module. If there are
* none, a zero-length array is returned.
*/
ActionConfig[] findActionConfigs();
/**
* Returns the action configuration for the specifed action
* action identifier.
*
* @param actionId the action identifier
* @return the action config if found; otherwise null
* @see ActionConfig#getActionId()
* @since Struts 1.3.6
*/
ActionConfig findActionConfigId(String actionId);
/**
* Return the exception configuration for the specified type, if any;
* otherwise return null
.
*
* @param type Exception class name to find a configuration for
*/
ExceptionConfig findExceptionConfig(String type);
/**
* Perform a recursive search for an ExceptionConfig registered for
* this class, or for any superclass. This should only be used in the
* case when an ActionConfig
is not available; otherwise, use
* ActionConfig.findException(Class)
to preserve the search
* order.
*
* @param type Exception class name to find a configuration for
* @see ActionConfig findException(Class)
*/
ExceptionConfig findException(Class type);
/**
* Return the exception configurations for this module. If there are
* none, a zero-length array is returned.
*/
ExceptionConfig[] findExceptionConfigs();
/**
* Return the form bean configuration for the specified key, if any;
* otherwise return null
.
*
* @param name Name of the form bean configuration to return
*/
FormBeanConfig findFormBeanConfig(String name);
/**
*
Return the form bean configurations for this module. If there are
* none, a zero-length array is returned.
*/
FormBeanConfig[] findFormBeanConfigs();
/**
* Return the forward configuration for the specified key, if any;
* otherwise return null
.
*
* @param name Name of the forward configuration to return
*/
ForwardConfig findForwardConfig(String name);
/**
* Return the form bean configurations for this module. If there are
* none, a zero-length array is returned.
*/
ForwardConfig[] findForwardConfigs();
/**
* Return the message resources configuration for the specified key,
* if any; otherwise return null
.
*
* @param key Key of the data source configuration to return
*/
MessageResourcesConfig findMessageResourcesConfig(String key);
/**
* Return the message resources configurations for this module. If
* there are none, a zero-length array is returned.
*/
MessageResourcesConfig[] findMessageResourcesConfigs();
/**
* Return the configured plug-in actions for this module. If there
* are none, a zero-length array is returned.
*/
PlugInConfig[] findPlugInConfigs();
/**
* Freeze the configuration of this module. After this method
* returns, any attempt to modify the configuration will return an
* IllegalStateException.
*/
void freeze();
/**
* Remove the specified action configuration instance.
*
* @param config ActionConfig instance to be removed
* @throws IllegalStateException if this module configuration has been
* frozen
*/
void removeActionConfig(ActionConfig config);
/**
* Remove the specified exception configuration instance.
*
* @param config ActionConfig instance to be removed
* @throws IllegalStateException if this module configuration has been
* frozen
*/
void removeExceptionConfig(ExceptionConfig config);
/**
* Remove the specified form bean configuration instance.
*
* @param config FormBeanConfig instance to be removed
* @throws IllegalStateException if this module configuration has been
* frozen
*/
void removeFormBeanConfig(FormBeanConfig config);
/**
* Remove the specified forward configuration instance.
*
* @param config ForwardConfig instance to be removed
* @throws IllegalStateException if this module configuration has been
* frozen
*/
void removeForwardConfig(ForwardConfig config);
/**
* Remove the specified message resources configuration instance.
*
*
* @param config MessageResourcesConfig instance to be removed
* @throws IllegalStateException if this module configuration has been
* frozen
*/
void removeMessageResourcesConfig(MessageResourcesConfig config);
}