1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 package org.apache.struts.config;
19
20
21 /***
22 * <p>The collection of static configuration information that describes a
23 * Struts-based module. Multiple modules are identified by a <em>prefix</em>
24 * at the beginning of the context relative portion of the request URI. If no
25 * module prefix can be matched, the default configuration (with a prefix
26 * equal to a zero-length string) is selected, which is elegantly backwards
27 * compatible with the previous Struts behavior that only supported one
28 * module.</p>
29 *
30 * @version $Rev: 421119 $ $Date: 2005-08-06 04:12:10 -0400 (Sat, 06 Aug 2005)
31 * $
32 * @since Struts 1.1
33 */
34 public interface ModuleConfig {
35 /***
36 * <p> Has this module been completely configured yet. Once this flag has
37 * been set, any attempt to modify the configuration will return an
38 * IllegalStateException. </p>
39 */
40 boolean getConfigured();
41
42 /***
43 * <p> The controller configuration object for this module. </p>
44 */
45 ControllerConfig getControllerConfig();
46
47 /***
48 * <p> The controller configuration object for this module. </p>
49 *
50 * @param cc The controller configuration object for this module.
51 */
52 void setControllerConfig(ControllerConfig cc);
53
54 /***
55 * <p> The prefix of the context-relative portion of the request URI, used
56 * to select this configuration versus others supported by the controller
57 * servlet. A configuration with a prefix of a zero-length String is the
58 * default configuration for this web module. </p>
59 */
60 String getPrefix();
61
62 /***
63 * <p> The prefix of the context-relative portion of the request URI, used
64 * to select this configuration versus others supported by the controller
65 * servlet. A configuration with a prefix of a zero-length String is the
66 * default configuration for this web module. </p>
67 *
68 * @param prefix The prefix of the context-relative portion of the request
69 * URI.
70 */
71 public void setPrefix(String prefix);
72
73 /***
74 * <p> The default class name to be used when creating action form bean
75 * instances. </p>
76 */
77 String getActionFormBeanClass();
78
79 /***
80 * <p> The default class name to be used when creating action form bean
81 * instances. </p>
82 *
83 * @param actionFormBeanClass default class name to be used when creating
84 * action form bean instances.
85 */
86 void setActionFormBeanClass(String actionFormBeanClass);
87
88 /***
89 * <p> The default class name to be used when creating action mapping
90 * instances. </p>
91 */
92 String getActionMappingClass();
93
94 /***
95 * <p> The default class name to be used when creating action mapping
96 * instances. </p>
97 *
98 * @param actionMappingClass default class name to be used when creating
99 * action mapping instances.
100 */
101 void setActionMappingClass(String actionMappingClass);
102
103 /***
104 * <p> Add a new <code>ActionConfig</code> instance to the set associated
105 * with this module. </p>
106 *
107 * @param config The new configuration instance to be added
108 * @throws IllegalStateException if this module configuration has been
109 * frozen
110 */
111 void addActionConfig(ActionConfig config);
112
113 /***
114 * <p> Add a new <code>ExceptionConfig</code> instance to the set
115 * associated with this module. </p>
116 *
117 * @param config The new configuration instance to be added
118 * @throws IllegalStateException if this module configuration has been
119 * frozen
120 */
121 void addExceptionConfig(ExceptionConfig config);
122
123 /***
124 * <p> Add a new <code>FormBeanConfig</code> instance to the set
125 * associated with this module. </p>
126 *
127 * @param config The new configuration instance to be added
128 * @throws IllegalStateException if this module configuration has been
129 * frozen
130 */
131 void addFormBeanConfig(FormBeanConfig config);
132
133 /***
134 * <p> The default class name to be used when creating action forward
135 * instances. </p>
136 */
137 String getActionForwardClass();
138
139 /***
140 * <p> The default class name to be used when creating action forward
141 * instances. </p>
142 *
143 * @param actionForwardClass default class name to be used when creating
144 * action forward instances.
145 */
146 void setActionForwardClass(String actionForwardClass);
147
148 /***
149 * <p> Add a new <code>ForwardConfig</code> instance to the set of global
150 * forwards associated with this module. </p>
151 *
152 * @param config The new configuration instance to be added
153 * @throws IllegalStateException if this module configuration has been
154 * frozen
155 */
156 void addForwardConfig(ForwardConfig config);
157
158 /***
159 * <p> Add a new <code>MessageResourcesConfig</code> instance to the set
160 * associated with this module. </p>
161 *
162 * @param config The new configuration instance to be added
163 * @throws IllegalStateException if this module configuration has been
164 * frozen
165 */
166 void addMessageResourcesConfig(MessageResourcesConfig config);
167
168 /***
169 * <p> Add a newly configured {@link PlugInConfig} instance to the set of
170 * plug-in Actions for this module. </p>
171 *
172 * @param plugInConfig The new configuration instance to be added
173 */
174 void addPlugInConfig(PlugInConfig plugInConfig);
175
176 /***
177 * <p> Return the action configuration for the specified path, if any;
178 * otherwise return <code>null</code>. </p>
179 *
180 * @param path Path of the action configuration to return
181 */
182 ActionConfig findActionConfig(String path);
183
184 /***
185 * <p> Return the action configurations for this module. If there are
186 * none, a zero-length array is returned. </p>
187 */
188 ActionConfig[] findActionConfigs();
189
190 /***
191 * <p> Return the exception configuration for the specified type, if any;
192 * otherwise return <code>null</code>. </p>
193 *
194 * @param type Exception class name to find a configuration for
195 */
196 ExceptionConfig findExceptionConfig(String type);
197
198 /***
199 * <p> Perform a recursive search for an ExceptionConfig registered for
200 * this class, or for any superclass. This should only be used in the
201 * case when an <code>ActionConfig</code> is not available; otherwise, use
202 * <code>ActionConfig.findException(Class)</code> to preserve the search
203 * order. </p>
204 *
205 * @param type Exception class name to find a configuration for
206 * @see ActionConfig findException(Class)
207 */
208 ExceptionConfig findException(Class type);
209
210 /***
211 * <p> Return the exception configurations for this module. If there are
212 * none, a zero-length array is returned. </p>
213 */
214 ExceptionConfig[] findExceptionConfigs();
215
216 /***
217 * <p> Return the form bean configuration for the specified key, if any;
218 * otherwise return <code>null</code>.
219 *
220 * @param name Name of the form bean configuration to return
221 */
222 FormBeanConfig findFormBeanConfig(String name);
223
224 /***
225 * <p> Return the form bean configurations for this module. If there are
226 * none, a zero-length array is returned. </p>
227 */
228 FormBeanConfig[] findFormBeanConfigs();
229
230 /***
231 * <p> Return the forward configuration for the specified key, if any;
232 * otherwise return <code>null</code>. </p>
233 *
234 * @param name Name of the forward configuration to return
235 */
236 ForwardConfig findForwardConfig(String name);
237
238 /***
239 * <p> Return the form bean configurations for this module. If there are
240 * none, a zero-length array is returned. </p>
241 */
242 ForwardConfig[] findForwardConfigs();
243
244 /***
245 * <p> Return the message resources configuration for the specified key,
246 * if any; otherwise return <code>null</code>. </p>
247 *
248 * @param key Key of the data source configuration to return
249 */
250 MessageResourcesConfig findMessageResourcesConfig(String key);
251
252 /***
253 * <p> Return the message resources configurations for this module. If
254 * there are none, a zero-length array is returned. </p>
255 */
256 MessageResourcesConfig[] findMessageResourcesConfigs();
257
258 /***
259 * <p> Return the configured plug-in actions for this module. If there
260 * are none, a zero-length array is returned. </p>
261 */
262 PlugInConfig[] findPlugInConfigs();
263
264 /***
265 * <p> Freeze the configuration of this module. After this method
266 * returns, any attempt to modify the configuration will return an
267 * IllegalStateException. </p>
268 */
269 void freeze();
270
271 /***
272 * <p> Remove the specified action configuration instance. </p>
273 *
274 * @param config ActionConfig instance to be removed
275 * @throws IllegalStateException if this module configuration has been
276 * frozen
277 */
278 void removeActionConfig(ActionConfig config);
279
280 /***
281 * <p> Remove the specified exception configuration instance. </p>
282 *
283 * @param config ActionConfig instance to be removed
284 * @throws IllegalStateException if this module configuration has been
285 * frozen
286 */
287 void removeExceptionConfig(ExceptionConfig config);
288
289 /***
290 * <p> Remove the specified form bean configuration instance. </p>
291 *
292 * @param config FormBeanConfig instance to be removed
293 * @throws IllegalStateException if this module configuration has been
294 * frozen
295 */
296 void removeFormBeanConfig(FormBeanConfig config);
297
298 /***
299 * <p> Remove the specified forward configuration instance. </p>
300 *
301 * @param config ForwardConfig instance to be removed
302 * @throws IllegalStateException if this module configuration has been
303 * frozen
304 */
305 void removeForwardConfig(ForwardConfig config);
306
307 /***
308 * <p> Remove the specified message resources configuration instance.
309 * </p>
310 *
311 * @param config MessageResourcesConfig instance to be removed
312 * @throws IllegalStateException if this module configuration has been
313 * frozen
314 */
315 void removeMessageResourcesConfig(MessageResourcesConfig config);
316 }