KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > struts > config > ModuleConfig


1 /*
2  * $Id: ModuleConfig.java 54929 2004-10-16 16:38:42Z germuska $
3  *
4  * Copyright 1999-2004 The Apache Software Foundation.
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  */

18 package org.apache.struts.config;
19
20 /**
21  * <p>The collection of static configuration information that describes a
22  * Struts-based module. Multiple modules are identified by
23  * a <em>prefix</em> at the beginning of the context
24  * relative portion of the request URI. If no module prefix can be
25  * matched, the default configuration (with a prefix equal to a zero-length
26  * string) is selected, which is elegantly backwards compatible with the
27  * previous Struts behavior that only supported one module.</p>
28  *
29  * @version $Rev: 54929 $ $Date: 2004-10-16 17:38:42 +0100 (Sat, 16 Oct 2004) $
30  * @since Struts 1.1
31  */

32 public interface ModuleConfig {
33     /**
34      * Has this module been completely configured yet. Once this flag
35      * has been set, any attempt to modify the configuration will return an
36      * IllegalStateException.
37      */

38     boolean getConfigured();
39
40     /**
41      * The controller configuration object for this module.
42      */

43     ControllerConfig getControllerConfig();
44     /**
45      * The controller configuration object for this module.
46      * @param cc The controller configuration object for this module.
47      */

48
49     void setControllerConfig(ControllerConfig cc);
50
51     /**
52      * The prefix of the context-relative portion of the request URI, used to
53      * select this configuration versus others supported by the controller
54      * servlet. A configuration with a prefix of a zero-length String is the
55      * default configuration for this web module.
56      */

57     String JavaDoc getPrefix();
58
59     /**
60      * The prefix of the context-relative portion of the request URI, used to
61      * select this configuration versus others supported by the controller
62      * servlet. A configuration with a prefix of a zero-length String is the
63      * default configuration for this web module.
64      * @param prefix The prefix of the context-relative portion of the request URI.
65      */

66     public void setPrefix(String JavaDoc prefix);
67
68     /**
69      * The default class name to be used when creating action form bean
70      * instances.
71      */

72     String JavaDoc getActionFormBeanClass();
73
74     /**
75      * The default class name to be used when creating action form bean
76      * instances.
77      *
78      * @param actionFormBeanClass default class name to be used when creating
79      * action form bean instances.
80      */

81     void setActionFormBeanClass(String JavaDoc actionFormBeanClass);
82
83     /**
84      * The default class name to be used when creating action mapping instances.
85      */

86     String JavaDoc getActionMappingClass();
87
88     /**
89      * The default class name to be used when creating action mapping instances.
90      *
91      * @param actionMappingClass default class name to be used when creating
92      * action mapping instances.
93      */

94     void setActionMappingClass(String JavaDoc actionMappingClass);
95
96     /**
97      * Add a new <code>ActionConfig</code> instance to the set associated
98      * with this module.
99      *
100      * @param config The new configuration instance to be added
101      *
102      * @exception java.lang.IllegalStateException if this module configuration
103      * has been frozen
104      */

105     void addActionConfig(ActionConfig config);
106
107     /**
108      * Add a new <code>DataSourceConfig</code> instance to the set associated
109      * with this module.
110      *
111      * @param config The new configuration instance to be added
112      *
113      * @exception java.lang.IllegalStateException if this module configuration
114      * has been frozen
115      */

116     void addDataSourceConfig(DataSourceConfig config);
117
118     /**
119      * Add a new <code>ExceptionConfig</code> instance to the set associated
120      * with this module.
121      *
122      * @param config The new configuration instance to be added
123      *
124      * @exception java.lang.IllegalStateException if this module configuration
125      * has been frozen
126      */

127     void addExceptionConfig(ExceptionConfig config);
128
129     /**
130      * Add a new <code>FormBeanConfig</code> instance to the set associated
131      * with this module.
132      *
133      * @param config The new configuration instance to be added
134      *
135      * @exception java.lang.IllegalStateException if this module configuration
136      * has been frozen
137      */

138     void addFormBeanConfig(FormBeanConfig config);
139
140     /**
141      * The default class name to be used when creating action forward instances.
142      */

143     String JavaDoc getActionForwardClass();
144
145     /**
146      * The default class name to be used when creating action forward instances.
147      *
148      * @param actionForwardClass default class name to be used when creating
149      * action forward instances.
150      */

151     void setActionForwardClass(String JavaDoc actionForwardClass);
152
153     /**
154      * Add a new <code>ForwardConfig</code> instance to the set of global
155      * forwards associated with this module.
156      *
157      * @param config The new configuration instance to be added
158      *
159      * @exception java.lang.IllegalStateException if this module configuration
160      * has been frozen
161      */

162     void addForwardConfig(ForwardConfig config);
163
164     /**
165      * Add a new <code>MessageResourcesConfig</code> instance to the set
166      * associated with this module.
167      *
168      * @param config The new configuration instance to be added
169      *
170      * @exception IllegalStateException if this module configuration
171      * has been frozen
172      */

173     void addMessageResourcesConfig(MessageResourcesConfig config);
174
175     /**
176      * Add a newly configured {@link org.apache.struts.config.PlugInConfig} instance to the set of
177      * plug-in Actions for this module.
178      *
179      * @param plugInConfig The new configuration instance to be added
180      */

181     void addPlugInConfig(PlugInConfig plugInConfig);
182
183     /**
184      * Return the action configuration for the specified path, if any;
185      * otherwise return <code>null</code>.
186      *
187      * @param path Path of the action configuration to return
188      */

189     ActionConfig findActionConfig(String JavaDoc path);
190
191     /**
192      * Return the action configurations for this module. If there are
193      * none, a zero-length array is returned.
194      */

195     ActionConfig[] findActionConfigs();
196
197     /**
198      * Return the data source configuration for the specified key, if any;
199      * otherwise return <code>null</code>.
200      *
201      * @param key Key of the data source configuration to return
202      */

203     DataSourceConfig findDataSourceConfig(String JavaDoc key);
204
205     /**
206      * Return the data source configurations for this module. If there
207      * are none, a zero-length array is returned.
208      */

209     DataSourceConfig[] findDataSourceConfigs();
210
211     /**
212      * Return the exception configuration for the specified type, if any;
213      * otherwise return <code>null</code>.
214      *
215      * @param type Exception class name to find a configuration for
216      */

217     ExceptionConfig findExceptionConfig(String JavaDoc type);
218
219     /**
220      * Return the exception configurations for this module. If there
221      * are none, a zero-length array is returned.
222      */

223     ExceptionConfig[] findExceptionConfigs();
224
225     /**
226      * Return the form bean configuration for the specified key, if any;
227      * otherwise return <code>null</code>.
228      *
229      * @param name Name of the form bean configuration to return
230      */

231     FormBeanConfig findFormBeanConfig(String JavaDoc name);
232
233     /**
234      * Return the form bean configurations for this module. If there
235      * are none, a zero-length array is returned.
236      */

237     FormBeanConfig[] findFormBeanConfigs();
238
239     /**
240      * Return the forward configuration for the specified key, if any;
241      * otherwise return <code>null</code>.
242      *
243      * @param name Name of the forward configuration to return
244      */

245     ForwardConfig findForwardConfig(String JavaDoc name);
246
247     /**
248      * Return the form bean configurations for this module. If there
249      * are none, a zero-length array is returned.
250      */

251     ForwardConfig[] findForwardConfigs();
252
253     /**
254      * Return the message resources configuration for the specified key,
255      * if any; otherwise return <code>null</code>.
256      *
257      * @param key Key of the data source configuration to return
258      */

259     MessageResourcesConfig findMessageResourcesConfig(String JavaDoc key);
260
261     /**
262      * Return the message resources configurations for this module.
263      * If there are none, a zero-length array is returned.
264      */

265     MessageResourcesConfig[] findMessageResourcesConfigs();
266
267     /**
268      * Return the configured plug-in actions for this module. If there
269      * are none, a zero-length array is returned.
270      */

271     PlugInConfig[] findPlugInConfigs();
272
273     /**
274      * Freeze the configuration of this module. After this method
275      * returns, any attempt to modify the configuration will return
276      * an IllegalStateException.
277      */

278     void freeze();
279
280     /**
281      * Remove the specified action configuration instance.
282      *
283      * @param config ActionConfig instance to be removed
284      *
285      * @exception java.lang.IllegalStateException if this module configuration
286      * has been frozen
287      */

288     void removeActionConfig(ActionConfig config);
289
290     /**
291      * Remove the specified exception configuration instance.
292      *
293      * @param config ActionConfig instance to be removed
294      *
295      * @exception java.lang.IllegalStateException if this module configuration
296      * has been frozen
297      */

298     void removeExceptionConfig(ExceptionConfig config);
299
300     /**
301      * Remove the specified data source configuration instance.
302      *
303      * @param config DataSourceConfig instance to be removed
304      *
305      * @exception java.lang.IllegalStateException if this module configuration
306      * has been frozen
307      */

308     void removeDataSourceConfig(DataSourceConfig config);
309
310     /**
311      * Remove the specified form bean configuration instance.
312      *
313      * @param config FormBeanConfig instance to be removed
314      *
315      * @exception java.lang.IllegalStateException if this module configuration
316      * has been frozen
317      */

318     void removeFormBeanConfig(FormBeanConfig config);
319
320     /**
321      * Remove the specified forward configuration instance.
322      *
323      * @param config ForwardConfig instance to be removed
324      *
325      * @exception java.lang.IllegalStateException if this module configuration
326      * has been frozen
327      */

328     void removeForwardConfig(ForwardConfig config);
329
330     /**
331      * Remove the specified message resources configuration instance.
332      *
333      * @param config MessageResourcesConfig instance to be removed
334      *
335      * @exception java.lang.IllegalStateException if this module configuration
336      * has been frozen
337      */

338     void removeMessageResourcesConfig(MessageResourcesConfig config);
339 }
340
Popular Tags