KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > ejtools > jmx > browser > web > form > RegisterForm


1 /*
2
3  * EJTools, the Enterprise Java Tools
4
5  *
6
7  * Distributable under LGPL license.
8
9  * See terms of license at www.gnu.org.
10
11  */

12
13 package org.ejtools.jmx.browser.web.form;
14
15
16
17 import javax.servlet.http.HttpServletRequest JavaDoc;
18
19
20
21 import org.apache.log4j.Logger;
22
23 import org.apache.struts.action.ActionError;
24
25 import org.apache.struts.action.ActionErrors;
26
27 import org.apache.struts.action.ActionForm;
28
29 import org.apache.struts.action.ActionMapping;
30
31
32
33 /**
34
35  * Description of the Class
36
37  *
38
39  * @author letiemble
40
41  * @created 13 février 2002
42
43  * @version $Revision: 1.6 $
44
45  * @todo Javadoc to complete
46
47  */

48
49 public class RegisterForm extends ActionForm
50
51 {
52
53    /** Description of the Field */
54
55    protected String JavaDoc classLoader = "";
56
57    /** Description of the Field */
58
59    protected String JavaDoc className = "";
60
61    /** Description of the Field */
62
63    protected String JavaDoc objectName = "";
64
65    /** Description of the Field */
66
67    protected String JavaDoc parameters = "";
68
69    /** Description of the Field */
70
71    protected String JavaDoc signature = "";
72
73    /** Description of the Field */
74
75    private static Logger logger = Logger.getLogger(RegisterForm.class);
76
77
78
79
80
81    /** Constructor for the ConnectForm object */
82
83    public RegisterForm() { }
84
85
86
87
88
89    /**
90
91     * Gets the classLoader attribute of the RegisterForm object
92
93     *
94
95     * @return The classLoader value
96
97     */

98
99    public String JavaDoc getClassLoader()
100
101    {
102
103       return this.classLoader;
104
105    }
106
107
108
109
110
111    /**
112
113     * Gets the className attribute of the RegisterForm object
114
115     *
116
117     * @return The className value
118
119     */

120
121    public String JavaDoc getClassName()
122
123    {
124
125       return this.className;
126
127    }
128
129
130
131
132
133    /**
134
135     * Gets the objectName attribute of the RegisterForm object
136
137     *
138
139     * @return The objectName value
140
141     */

142
143    public String JavaDoc getObjectName()
144
145    {
146
147       return this.objectName;
148
149    }
150
151
152
153
154
155    /**
156
157     * Gets the arguments attribute of the RegisterForm object
158
159     *
160
161     * @return The arguments value
162
163     */

164
165    public String JavaDoc getParameters()
166
167    {
168
169       return this.parameters;
170
171    }
172
173
174
175
176
177    /**
178
179     * Gets the signatures attribute of the RegisterForm object
180
181     *
182
183     * @return The signatures value
184
185     */

186
187    public String JavaDoc getSignature()
188
189    {
190
191       return this.signature;
192
193    }
194
195
196
197
198
199    /**
200
201     * Description of the Method
202
203     *
204
205     * @param mapping Description of the Parameter
206
207     * @param request Description of the Parameter
208
209     */

210
211    public void reset(ActionMapping mapping, HttpServletRequest JavaDoc request)
212
213    {
214
215       this.objectName = "";
216
217       this.className = "";
218
219       this.classLoader = "";
220
221       this.parameters = "";
222
223       this.signature = "";
224
225    }
226
227
228
229
230
231    /**
232
233     * Sets the classLoader attribute of the RegisterForm object
234
235     *
236
237     * @param classLoader The new classLoader value
238
239     */

240
241    public void setClassLoader(String JavaDoc classLoader)
242
243    {
244
245       this.classLoader = classLoader;
246
247    }
248
249
250
251
252
253    /**
254
255     * Sets the className attribute of the RegisterForm object
256
257     *
258
259     * @param className The new className value
260
261     */

262
263    public void setClassName(String JavaDoc className)
264
265    {
266
267       this.className = className;
268
269    }
270
271
272
273
274
275    /**
276
277     * Sets the objectName attribute of the RegisterForm object
278
279     *
280
281     * @param objectName The new objectName value
282
283     */

284
285    public void setObjectName(String JavaDoc objectName)
286
287    {
288
289       this.objectName = objectName;
290
291    }
292
293
294
295
296
297    /**
298
299     * Sets the arguments attribute of the RegisterForm object
300
301     *
302
303     * @param parameters The new parameters value
304
305     */

306
307    public void setParameters(String JavaDoc parameters)
308
309    {
310
311       this.parameters = parameters;
312
313    }
314
315
316
317
318
319    /**
320
321     * Sets the signatures attribute of the RegisterForm object
322
323     *
324
325     * @param signature The new signature value
326
327     */

328
329    public void setSignature(String JavaDoc signature)
330
331    {
332
333       this.signature = signature;
334
335    }
336
337
338
339
340
341    /**
342
343     * Description of the Method
344
345     *
346
347     * @param mapping Description of the Parameter
348
349     * @param request Description of the Parameter
350
351     * @return Description of the Return Value
352
353     */

354
355    public ActionErrors validate(ActionMapping mapping, HttpServletRequest JavaDoc request)
356
357    {
358
359       ActionErrors errors = new ActionErrors();
360
361
362
363       logger.debug("className=<" + this.className + ">");
364
365       logger.debug("objectName=<" + this.objectName + ">");
366
367       logger.debug("classLoader=<" + this.classLoader + ">");
368
369       logger.debug("signature=<" + this.signature + ">");
370
371       logger.debug("parameters=<" + this.parameters + ">");
372
373
374
375       if (this.className.length() == 0)
376
377       {
378
379          errors.add("className", new ActionError("web.error.className.required"));
380
381       }
382
383       if (this.objectName.length() == 0)
384
385       {
386
387          errors.add("objectName", new ActionError("web.error.objectName.required"));
388
389       }
390
391
392
393       if ((this.parameters.length() > 0) && (this.signature.length() == 0))
394
395       {
396
397          errors.add("signatures", new ActionError("web.error.signature.required"));
398
399       }
400
401       if ((this.signature.length() > 0) && (this.parameters.length() == 0))
402
403       {
404
405          errors.add("arguments", new ActionError("web.error.parameters.required"));
406
407       }
408
409
410
411       return errors;
412
413    }
414
415 }
416
417
Popular Tags