KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > jonas > webapp > jonasadmin > service > db > DatasourceForm


1 /**
2  * JOnAS: Java(TM) Open Application Server
3  * Copyright (C) 1999-2004 Bull S.A.
4  * Contact: jonas-team@objectweb.org
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
19  * USA
20  *
21  * --------------------------------------------------------------------------
22  * $Id: DatasourceForm.java,v 1.17 2005/04/21 08:59:54 kemlerp Exp $
23  * --------------------------------------------------------------------------
24  */

25
26 package org.objectweb.jonas.webapp.jonasadmin.service.db;
27
28 import java.util.ArrayList JavaDoc;
29
30 import javax.servlet.http.HttpServletRequest JavaDoc;
31
32 import org.apache.struts.action.ActionMessage;
33 import org.apache.struts.action.ActionErrors;
34 import org.apache.struts.action.ActionForm;
35 import org.apache.struts.action.ActionMapping;
36 import org.objectweb.jonas.webapp.jonasadmin.Jlists;
37
38 /**
39  * @author Michel-Ange ANTON
40  */

41 public class DatasourceForm extends ActionForm {
42
43     // --------------------------------------------------------- Constants
44

45     // --------------------------------------------------------- Properties variables
46

47     private String JavaDoc action = null;
48     private String JavaDoc className = null;
49     private String JavaDoc datasourceDescription = null;
50     private String JavaDoc datasourceFactory = null;
51     private String JavaDoc datasourceName = null;
52     private String JavaDoc dsName = null;
53     private String JavaDoc jdbcTestStatement = null;
54     private String JavaDoc password = null;
55     private String JavaDoc url = null;
56     private String JavaDoc userName = null;
57     private String JavaDoc datasourceMapper = null;
58     private java.util.List JavaDoc checkingLevels = Jlists.getJdbcConnectionCheckingLevels();
59     private String JavaDoc currentOpened = null;
60     private String JavaDoc currentBusy = null;
61     private String JavaDoc busyMaxRecent = null;
62     private String JavaDoc busyMinRecent = null;
63     private String JavaDoc currentInTx = null;
64     private String JavaDoc openedCount = null;
65     private String JavaDoc connectionFailures = null;
66     private String JavaDoc connectionLeaks = null;
67     private String JavaDoc currentWaiters = null;
68     private String JavaDoc waitersHigh = null;
69     private String JavaDoc waitersHighRecent = null;
70     private String JavaDoc waiterCount = null;
71     private String JavaDoc waitingTime = null;
72     private String JavaDoc waitingHigh = null;
73     private String JavaDoc waitingHighRecent = null;
74     private String JavaDoc servedOpen = null;
75     private String JavaDoc rejectedOpen = null;
76     private String JavaDoc rejectedFull = null;
77     private String JavaDoc rejectedTimeout = null;
78     private String JavaDoc rejectedOther = null;
79     private String JavaDoc jdbcConnCheckLevel = null;
80     private String JavaDoc jdbcConnMaxAge = null;
81     private String JavaDoc jdbcMaxOpenTime = null;
82     private String JavaDoc jdbcMaxConnPool = null;
83     private String JavaDoc jdbcMinConnPool = null;
84     private String JavaDoc jdbcMaxWaitTime = null;
85     private String JavaDoc jdbcMaxWaiters = null;
86     private String JavaDoc jdbcSamplingPeriod = null;
87
88     private ArrayList JavaDoc listUsedByEjb = new ArrayList JavaDoc();
89
90     // --------------------------------------------------------- Public Methods
91

92     /**
93      * Reset all properties to their default values.
94      *
95      * @param mapping The mapping used to select this instance
96      * @param request The servlet request we are processing
97      */

98
99     public void reset(ActionMapping mapping, HttpServletRequest JavaDoc request) {
100         action = "apply";
101     }
102
103     /**
104      * Validate the properties that have been set from this HTTP request,
105      * and return an <code>ActionErrors</code> object that encapsulates any
106      * validation errors that have been found. If no errors are found, return
107      * <code>null</code> or an <code>ActionErrors</code> object with no
108      * recorded error messages.
109      *
110      * @param mapping The mapping used to select this instance
111      * @param request The servlet request we are processing
112      * @return List of errors
113      */

114     public ActionErrors validate(ActionMapping mapping, HttpServletRequest JavaDoc request) {
115         ActionErrors oErrors = new ActionErrors();
116
117         validateInteger(oErrors, jdbcConnMaxAge, "jdbcConnMaxAge"
118                         , "error.database.datasource.jdbcConnMaxAge.numberformat");
119         validateInteger(oErrors, jdbcMaxOpenTime, "jdbcMaxOpenTime"
120                         , "error.database.datasource.jdbcMaxOpenTime.numberformat");
121         validateInteger(oErrors, jdbcMaxConnPool, "jdbcMaxConnPool"
122                         , "error.database.datasource.jdbcMaxConnPool.numberformat");
123         validateInteger(oErrors, jdbcMinConnPool, "jdbcMinConnPool"
124                         , "error.database.datasource.jdbcMinConnPool.numberformat");
125         validateInteger(oErrors, jdbcMaxWaitTime, "jdbcMaxWaitTime"
126                         , "error.database.datasource.jdbcMaxWaitTime.numberformat");
127         validateInteger(oErrors, jdbcMaxWaiters, "jdbcMaxWaiters"
128                         , "error.database.datasource.jdbcMaxWaiters.numberformat");
129         validateInteger(oErrors, jdbcSamplingPeriod, "jdbcSamplingPeriod"
130                         , "error.database.datasource.jdbcSamplingPeriod.numberformat");
131
132         return oErrors;
133     }
134
135     protected void validateInteger(ActionErrors p_Errors, String JavaDoc p_Value, String JavaDoc p_Tag
136                                    , String JavaDoc p_ResError) {
137         try {
138             Integer.parseInt(p_Value);
139         } catch (NumberFormatException JavaDoc e) {
140             p_Errors.add(p_Tag, new ActionMessage(p_ResError));
141         }
142     }
143
144     // --------------------------------------------------------- Properties Methods
145

146     public String JavaDoc getClassName() {
147         return className;
148     }
149
150     public void setClassName(String JavaDoc className) {
151         this.className = className;
152     }
153
154     public String JavaDoc getCurrentOpened() {
155         return currentOpened;
156     }
157
158     public void setCurrentOpened(String JavaDoc s) {
159         currentOpened = s;
160     }
161
162     public String JavaDoc getCurrentBusy() {
163         return currentBusy;
164     }
165
166     public void setCurrentBusy(String JavaDoc s) {
167         currentBusy = s;
168     }
169
170     public String JavaDoc getCurrentInTx() {
171         return currentInTx;
172     }
173
174     public void setCurrentInTx(String JavaDoc s) {
175         currentInTx = s;
176     }
177
178     public String JavaDoc getOpenedCount() {
179         return openedCount;
180     }
181
182     public void setOpenedCount(String JavaDoc s) {
183         openedCount = s;
184     }
185
186     public String JavaDoc getConnectionFailures() {
187         return connectionFailures;
188     }
189
190     public void setConnectionFailures(String JavaDoc s) {
191         connectionFailures = s;
192     }
193
194     public String JavaDoc getConnectionLeaks() {
195         return connectionLeaks;
196     }
197
198     public void setConnectionLeaks(String JavaDoc s) {
199         connectionLeaks = s;
200     }
201
202     public String JavaDoc getCurrentWaiters() {
203         return currentWaiters;
204     }
205
206     public void setCurrentWaiters(String JavaDoc s) {
207         currentWaiters = s;
208     }
209
210     public String JavaDoc getWaitersHigh() {
211         return waitersHigh;
212     }
213
214     public void setWaitersHigh(String JavaDoc s) {
215         waitersHigh = s;
216     }
217
218     public String JavaDoc getWaitersHighRecent() {
219         return waitersHighRecent;
220     }
221
222     public void setWaitersHighRecent(String JavaDoc s) {
223         waitersHighRecent = s;
224     }
225
226     public String JavaDoc getBusyMaxRecent() {
227         return busyMaxRecent;
228     }
229
230     public void setBusyMaxRecent(String JavaDoc s) {
231         busyMaxRecent = s;
232     }
233
234     public String JavaDoc getBusyMinRecent() {
235         return busyMinRecent;
236     }
237
238     public void setBusyMinRecent(String JavaDoc s) {
239         busyMinRecent = s;
240     }
241
242     public String JavaDoc getWaiterCount() {
243         return waiterCount;
244     }
245
246     public void setWaiterCount(String JavaDoc s) {
247         waiterCount = s;
248     }
249
250     public String JavaDoc getWaitingTime() {
251         return waitingTime;
252     }
253
254     public void setWaitingTime(String JavaDoc s) {
255         waitingTime = s;
256     }
257
258     public String JavaDoc getWaitingHigh() {
259         return waitingHigh;
260     }
261
262     public void setWaitingHigh(String JavaDoc s) {
263         waitingHigh = s;
264     }
265
266     public String JavaDoc getWaitingHighRecent() {
267         return waitingHighRecent;
268     }
269
270     public void setWaitingHighRecent(String JavaDoc s) {
271         waitingHighRecent = s;
272     }
273
274     public String JavaDoc getServedOpen() {
275         return servedOpen;
276     }
277
278     public void setServedOpen(String JavaDoc s) {
279         servedOpen = s;
280     }
281
282     public String JavaDoc getRejectedOpen() {
283         return rejectedOpen;
284     }
285
286     public void setRejectedOpen(String JavaDoc s) {
287         rejectedOpen = s;
288     }
289
290     public String JavaDoc getRejectedFull() {
291         return rejectedFull;
292     }
293
294     public void setRejectedFull(String JavaDoc s) {
295         rejectedFull = s;
296     }
297
298     public String JavaDoc getRejectedTimeout() {
299         return rejectedTimeout;
300     }
301
302     public void setRejectedTimeout(String JavaDoc s) {
303         rejectedTimeout = s;
304     }
305
306     public String JavaDoc getRejectedOther() {
307         return rejectedOther;
308     }
309
310     public void setRejectedOther(String JavaDoc s) {
311         rejectedOther = s;
312     }
313
314     public String JavaDoc getDatasourceDescription() {
315         return datasourceDescription;
316     }
317
318     public void setDatasourceDescription(String JavaDoc datasourceDescription) {
319         this.datasourceDescription = datasourceDescription;
320     }
321
322     public String JavaDoc getDatasourceName() {
323         return datasourceName;
324     }
325
326     public void setDatasourceName(String JavaDoc datasourceName) {
327         this.datasourceName = datasourceName;
328     }
329
330     public String JavaDoc getDatasourceMapper() {
331         return datasourceMapper;
332     }
333
334     public void setDatasourceMapper(String JavaDoc datasourceMapper) {
335         this.datasourceMapper = datasourceMapper;
336     }
337
338     public String JavaDoc getDsName() {
339         return dsName;
340     }
341
342     public void setDsName(String JavaDoc dsName) {
343         this.dsName = dsName;
344     }
345
346     public String JavaDoc getJdbcConnCheckLevel() {
347         return jdbcConnCheckLevel;
348     }
349
350     public void setJdbcConnCheckLevel(String JavaDoc jdbcConnCheckLevel) {
351         this.jdbcConnCheckLevel = jdbcConnCheckLevel;
352     }
353
354     public String JavaDoc getJdbcConnMaxAge() {
355         return jdbcConnMaxAge;
356     }
357
358     public void setJdbcConnMaxAge(String JavaDoc s) {
359         jdbcConnMaxAge = s;
360     }
361
362     public String JavaDoc getJdbcMaxOpenTime() {
363         return jdbcMaxOpenTime;
364     }
365
366     public void setJdbcMaxOpenTime(String JavaDoc s) {
367         jdbcMaxOpenTime = s;
368     }
369
370     public String JavaDoc getJdbcMaxConnPool() {
371         return jdbcMaxConnPool;
372     }
373
374     public void setJdbcMaxConnPool(String JavaDoc jdbcMaxConnPool) {
375         this.jdbcMaxConnPool = jdbcMaxConnPool;
376     }
377
378     public String JavaDoc getJdbcMinConnPool() {
379         return jdbcMinConnPool;
380     }
381
382     public void setJdbcMinConnPool(String JavaDoc jdbcMinConnPool) {
383         this.jdbcMinConnPool = jdbcMinConnPool;
384     }
385
386     public String JavaDoc getJdbcMaxWaitTime() {
387         return jdbcMaxWaitTime;
388     }
389
390     public void setJdbcMaxWaitTime(String JavaDoc jdbcMaxWaitTime) {
391         this.jdbcMaxWaitTime = jdbcMaxWaitTime;
392     }
393
394     public String JavaDoc getJdbcMaxWaiters() {
395         return jdbcMaxWaiters;
396     }
397
398     public void setJdbcMaxWaiters(String JavaDoc s) {
399         this.jdbcMaxWaiters = s;
400     }
401
402     public String JavaDoc getJdbcSamplingPeriod() {
403         return jdbcSamplingPeriod;
404     }
405
406     public void setJdbcSamplingPeriod(String JavaDoc s) {
407         this.jdbcSamplingPeriod = s;
408     }
409
410     public String JavaDoc getJdbcTestStatement() {
411         return jdbcTestStatement;
412     }
413
414     public void setJdbcTestStatement(String JavaDoc jdbcTestStatement) {
415         this.jdbcTestStatement = jdbcTestStatement;
416     }
417
418     public String JavaDoc getPassword() {
419         return password;
420     }
421
422     public void setPassword(String JavaDoc password) {
423         this.password = password;
424     }
425
426     public String JavaDoc getUrl() {
427         return url;
428     }
429
430     public void setUrl(String JavaDoc url) {
431         this.url = url;
432     }
433
434     public String JavaDoc getUserName() {
435         return userName;
436     }
437
438     public void setUserName(String JavaDoc userName) {
439         this.userName = userName;
440     }
441
442     public String JavaDoc getAction() {
443         return action;
444     }
445
446     public void setAction(String JavaDoc action) {
447         this.action = action;
448     }
449
450     public java.util.List JavaDoc getCheckingLevels() {
451         return checkingLevels;
452     }
453
454     public ArrayList JavaDoc getListUsedByEjb() {
455         return listUsedByEjb;
456     }
457
458     public void setListUsedByEjb(ArrayList JavaDoc listUsedByEjb) {
459         this.listUsedByEjb = listUsedByEjb;
460     }
461
462 }
463
Popular Tags