001: /*
002: * $Id: ModuleConfig.java 471754 2006-11-06 14:55:09Z husted $
003: *
004: * Licensed to the Apache Software Foundation (ASF) under one
005: * or more contributor license agreements. See the NOTICE file
006: * distributed with this work for additional information
007: * regarding copyright ownership. The ASF licenses this file
008: * to you under the Apache License, Version 2.0 (the
009: * "License"); you may not use this file except in compliance
010: * with the License. You may obtain a copy of the License at
011: *
012: * http://www.apache.org/licenses/LICENSE-2.0
013: *
014: * Unless required by applicable law or agreed to in writing,
015: * software distributed under the License is distributed on an
016: * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
017: * KIND, either express or implied. See the License for the
018: * specific language governing permissions and limitations
019: * under the License.
020: */
021: package org.apache.struts.config;
022:
023: /**
024: * <p>The collection of static configuration information that describes a
025: * Struts-based module. Multiple modules are identified by a <em>prefix</em>
026: * at the beginning of the context relative portion of the request URI. If no
027: * module prefix can be matched, the default configuration (with a prefix
028: * equal to a zero-length string) is selected, which is elegantly backwards
029: * compatible with the previous Struts behavior that only supported one
030: * module.</p>
031: *
032: * @version $Rev: 471754 $ $Date: 2005-08-06 04:12:10 -0400 (Sat, 06 Aug 2005)
033: * $
034: * @since Struts 1.1
035: */
036: public interface ModuleConfig {
037: /**
038: * <p> Has this module been completely configured yet. Once this flag has
039: * been set, any attempt to modify the configuration will return an
040: * IllegalStateException. </p>
041: */
042: boolean getConfigured();
043:
044: /**
045: * <p> The controller configuration object for this module. </p>
046: */
047: ControllerConfig getControllerConfig();
048:
049: /**
050: * <p> The controller configuration object for this module. </p>
051: *
052: * @param cc The controller configuration object for this module.
053: */
054: void setControllerConfig(ControllerConfig cc);
055:
056: /**
057: * <p> The prefix of the context-relative portion of the request URI, used
058: * to select this configuration versus others supported by the controller
059: * servlet. A configuration with a prefix of a zero-length String is the
060: * default configuration for this web module. </p>
061: */
062: String getPrefix();
063:
064: /**
065: * <p> The prefix of the context-relative portion of the request URI, used
066: * to select this configuration versus others supported by the controller
067: * servlet. A configuration with a prefix of a zero-length String is the
068: * default configuration for this web module. </p>
069: *
070: * @param prefix The prefix of the context-relative portion of the request
071: * URI.
072: */
073: public void setPrefix(String prefix);
074:
075: /**
076: * <p> The default class name to be used when creating action form bean
077: * instances. </p>
078: */
079: String getActionFormBeanClass();
080:
081: /**
082: * <p> The default class name to be used when creating action form bean
083: * instances. </p>
084: *
085: * @param actionFormBeanClass default class name to be used when creating
086: * action form bean instances.
087: */
088: void setActionFormBeanClass(String actionFormBeanClass);
089:
090: /**
091: * <p> The default class name to be used when creating action mapping
092: * instances. </p>
093: */
094: String getActionMappingClass();
095:
096: /**
097: * <p> The default class name to be used when creating action mapping
098: * instances. </p>
099: *
100: * @param actionMappingClass default class name to be used when creating
101: * action mapping instances.
102: */
103: void setActionMappingClass(String actionMappingClass);
104:
105: /**
106: * <p> Add a new <code>ActionConfig</code> instance to the set associated
107: * with this module. </p>
108: *
109: * @param config The new configuration instance to be added
110: * @throws IllegalStateException if this module configuration has been
111: * frozen
112: */
113: void addActionConfig(ActionConfig config);
114:
115: /**
116: * <p> Add a new <code>ExceptionConfig</code> instance to the set
117: * associated with this module. </p>
118: *
119: * @param config The new configuration instance to be added
120: * @throws IllegalStateException if this module configuration has been
121: * frozen
122: */
123: void addExceptionConfig(ExceptionConfig config);
124:
125: /**
126: * <p> Add a new <code>FormBeanConfig</code> instance to the set
127: * associated with this module. </p>
128: *
129: * @param config The new configuration instance to be added
130: * @throws IllegalStateException if this module configuration has been
131: * frozen
132: */
133: void addFormBeanConfig(FormBeanConfig config);
134:
135: /**
136: * <p> The default class name to be used when creating action forward
137: * instances. </p>
138: */
139: String getActionForwardClass();
140:
141: /**
142: * <p> The default class name to be used when creating action forward
143: * instances. </p>
144: *
145: * @param actionForwardClass default class name to be used when creating
146: * action forward instances.
147: */
148: void setActionForwardClass(String actionForwardClass);
149:
150: /**
151: * <p> Add a new <code>ForwardConfig</code> instance to the set of global
152: * forwards associated with this module. </p>
153: *
154: * @param config The new configuration instance to be added
155: * @throws IllegalStateException if this module configuration has been
156: * frozen
157: */
158: void addForwardConfig(ForwardConfig config);
159:
160: /**
161: * <p> Add a new <code>MessageResourcesConfig</code> instance to the set
162: * associated with this module. </p>
163: *
164: * @param config The new configuration instance to be added
165: * @throws IllegalStateException if this module configuration has been
166: * frozen
167: */
168: void addMessageResourcesConfig(MessageResourcesConfig config);
169:
170: /**
171: * <p> Add a newly configured {@link PlugInConfig} instance to the set of
172: * plug-in Actions for this module. </p>
173: *
174: * @param plugInConfig The new configuration instance to be added
175: */
176: void addPlugInConfig(PlugInConfig plugInConfig);
177:
178: /**
179: * <p> Return the action configuration for the specified path, if any;
180: * otherwise return <code>null</code>. </p>
181: *
182: * @param path Path of the action configuration to return
183: */
184: ActionConfig findActionConfig(String path);
185:
186: /**
187: * <p> Return the action configurations for this module. If there are
188: * none, a zero-length array is returned. </p>
189: */
190: ActionConfig[] findActionConfigs();
191:
192: /**
193: * <p>Returns the action configuration for the specifed action
194: * action identifier.</p>
195: *
196: * @param actionId the action identifier
197: * @return the action config if found; otherwise <code>null</code>
198: * @see ActionConfig#getActionId()
199: * @since Struts 1.3.6
200: */
201: ActionConfig findActionConfigId(String actionId);
202:
203: /**
204: * <p> Return the exception configuration for the specified type, if any;
205: * otherwise return <code>null</code>. </p>
206: *
207: * @param type Exception class name to find a configuration for
208: */
209: ExceptionConfig findExceptionConfig(String type);
210:
211: /**
212: * <p> Perform a recursive search for an ExceptionConfig registered for
213: * this class, or for any superclass. This should only be used in the
214: * case when an <code>ActionConfig</code> is not available; otherwise, use
215: * <code>ActionConfig.findException(Class)</code> to preserve the search
216: * order. </p>
217: *
218: * @param type Exception class name to find a configuration for
219: * @see ActionConfig findException(Class)
220: */
221: ExceptionConfig findException(Class type);
222:
223: /**
224: * <p> Return the exception configurations for this module. If there are
225: * none, a zero-length array is returned. </p>
226: */
227: ExceptionConfig[] findExceptionConfigs();
228:
229: /**
230: * <p> Return the form bean configuration for the specified key, if any;
231: * otherwise return <code>null</code>.
232: *
233: * @param name Name of the form bean configuration to return
234: */
235: FormBeanConfig findFormBeanConfig(String name);
236:
237: /**
238: * <p> Return the form bean configurations for this module. If there are
239: * none, a zero-length array is returned. </p>
240: */
241: FormBeanConfig[] findFormBeanConfigs();
242:
243: /**
244: * <p> Return the forward configuration for the specified key, if any;
245: * otherwise return <code>null</code>. </p>
246: *
247: * @param name Name of the forward configuration to return
248: */
249: ForwardConfig findForwardConfig(String name);
250:
251: /**
252: * <p> Return the form bean configurations for this module. If there are
253: * none, a zero-length array is returned. </p>
254: */
255: ForwardConfig[] findForwardConfigs();
256:
257: /**
258: * <p> Return the message resources configuration for the specified key,
259: * if any; otherwise return <code>null</code>. </p>
260: *
261: * @param key Key of the data source configuration to return
262: */
263: MessageResourcesConfig findMessageResourcesConfig(String key);
264:
265: /**
266: * <p> Return the message resources configurations for this module. If
267: * there are none, a zero-length array is returned. </p>
268: */
269: MessageResourcesConfig[] findMessageResourcesConfigs();
270:
271: /**
272: * <p> Return the configured plug-in actions for this module. If there
273: * are none, a zero-length array is returned. </p>
274: */
275: PlugInConfig[] findPlugInConfigs();
276:
277: /**
278: * <p> Freeze the configuration of this module. After this method
279: * returns, any attempt to modify the configuration will return an
280: * IllegalStateException. </p>
281: */
282: void freeze();
283:
284: /**
285: * <p> Remove the specified action configuration instance. </p>
286: *
287: * @param config ActionConfig instance to be removed
288: * @throws IllegalStateException if this module configuration has been
289: * frozen
290: */
291: void removeActionConfig(ActionConfig config);
292:
293: /**
294: * <p> Remove the specified exception configuration instance. </p>
295: *
296: * @param config ActionConfig instance to be removed
297: * @throws IllegalStateException if this module configuration has been
298: * frozen
299: */
300: void removeExceptionConfig(ExceptionConfig config);
301:
302: /**
303: * <p> Remove the specified form bean configuration instance. </p>
304: *
305: * @param config FormBeanConfig instance to be removed
306: * @throws IllegalStateException if this module configuration has been
307: * frozen
308: */
309: void removeFormBeanConfig(FormBeanConfig config);
310:
311: /**
312: * <p> Remove the specified forward configuration instance. </p>
313: *
314: * @param config ForwardConfig instance to be removed
315: * @throws IllegalStateException if this module configuration has been
316: * frozen
317: */
318: void removeForwardConfig(ForwardConfig config);
319:
320: /**
321: * <p> Remove the specified message resources configuration instance.
322: * </p>
323: *
324: * @param config MessageResourcesConfig instance to be removed
325: * @throws IllegalStateException if this module configuration has been
326: * frozen
327: */
328: void removeMessageResourcesConfig(MessageResourcesConfig config);
329: }
|