001: /**
002: * JOnAS: Java(TM) Open Application Server
003: * Copyright (C) 1999-2004 Bull S.A.
004: * Contact: jonas-team@objectweb.org
005: *
006: * This library is free software; you can redistribute it and/or
007: * modify it under the terms of the GNU Lesser General Public
008: * License as published by the Free Software Foundation; either
009: * version 2.1 of the License, or any later version.
010: *
011: * This library is distributed in the hope that it will be useful,
012: * but WITHOUT ANY WARRANTY; without even the implied warranty of
013: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
014: * Lesser General Public License for more details.
015: *
016: * You should have received a copy of the GNU Lesser General Public
017: * License along with this library; if not, write to the Free Software
018: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
019: * USA
020: *
021: * --------------------------------------------------------------------------
022: * $Id: DatasourceForm.java 7180 2005-08-05 10:14:17Z durieuxp $
023: * --------------------------------------------------------------------------
024: */package org.objectweb.jonas.webapp.jonasadmin.service.db;
025:
026: import java.util.ArrayList;
027:
028: import javax.servlet.http.HttpServletRequest;
029:
030: import org.apache.struts.action.ActionMessage;
031: import org.apache.struts.action.ActionErrors;
032: import org.apache.struts.action.ActionForm;
033: import org.apache.struts.action.ActionMapping;
034: import org.objectweb.jonas.webapp.jonasadmin.Jlists;
035:
036: /**
037: * @author Michel-Ange ANTON
038: */
039: public class DatasourceForm extends ActionForm {
040:
041: // --------------------------------------------------------- Constants
042:
043: // --------------------------------------------------------- Properties variables
044:
045: private String action = null;
046: private String className = null;
047: private String datasourceDescription = null;
048: private String datasourceFactory = null;
049: private String datasourceName = null;
050: private String dsName = null;
051: private String jdbcTestStatement = null;
052: private String password = null;
053: private String url = null;
054: private String userName = null;
055: private String datasourceMapper = null;
056: private java.util.List checkingLevels = Jlists
057: .getJdbcConnectionCheckingLevels();
058: private String currentOpened = null;
059: private String currentBusy = null;
060: private String busyMaxRecent = null;
061: private String busyMinRecent = null;
062: private String currentInTx = null;
063: private String openedCount = null;
064: private String connectionFailures = null;
065: private String connectionLeaks = null;
066: private String currentWaiters = null;
067: private String waitersHigh = null;
068: private String waitersHighRecent = null;
069: private String waiterCount = null;
070: private String waitingTime = null;
071: private String waitingHigh = null;
072: private String waitingHighRecent = null;
073: private String servedOpen = null;
074: private String rejectedOpen = null;
075: private String rejectedFull = null;
076: private String rejectedTimeout = null;
077: private String rejectedOther = null;
078: private String jdbcConnCheckLevel = null;
079: private String jdbcConnMaxAge = null;
080: private String jdbcMaxOpenTime = null;
081: private String jdbcMaxConnPool = null;
082: private String jdbcMinConnPool = null;
083: private String jdbcMaxWaitTime = null;
084: private String jdbcMaxWaiters = null;
085: private String jdbcSamplingPeriod = null;
086: private String jdbcPstmtMax = null;
087:
088: private ArrayList listUsedByEjb = new ArrayList();
089:
090: // --------------------------------------------------------- Public Methods
091:
092: /**
093: * Reset all properties to their default values.
094: *
095: * @param mapping The mapping used to select this instance
096: * @param request The servlet request we are processing
097: */
098:
099: public void reset(ActionMapping mapping, HttpServletRequest 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,
115: HttpServletRequest request) {
116: ActionErrors oErrors = new ActionErrors();
117:
118: validateInteger(oErrors, jdbcConnMaxAge, "jdbcConnMaxAge",
119: "error.database.datasource.jdbcConnMaxAge.numberformat");
120: validateInteger(oErrors, jdbcMaxOpenTime, "jdbcMaxOpenTime",
121: "error.database.datasource.jdbcMaxOpenTime.numberformat");
122: validateInteger(oErrors, jdbcMaxConnPool, "jdbcMaxConnPool",
123: "error.database.datasource.jdbcMaxConnPool.numberformat");
124: validateInteger(oErrors, jdbcMinConnPool, "jdbcMinConnPool",
125: "error.database.datasource.jdbcMinConnPool.numberformat");
126: validateInteger(oErrors, jdbcMaxWaitTime, "jdbcMaxWaitTime",
127: "error.database.datasource.jdbcMaxWaitTime.numberformat");
128: validateInteger(oErrors, jdbcMaxWaiters, "jdbcMaxWaiters",
129: "error.database.datasource.jdbcMaxWaiters.numberformat");
130: validateInteger(oErrors, jdbcPstmtMax, "jdbcPstmtMax",
131: "error.database.datasource.jdbcPstmtMax.numberformat");
132: validateInteger(oErrors, jdbcSamplingPeriod,
133: "jdbcSamplingPeriod",
134: "error.database.datasource.jdbcSamplingPeriod.numberformat");
135:
136: return oErrors;
137: }
138:
139: protected void validateInteger(ActionErrors p_Errors,
140: String p_Value, String p_Tag, String p_ResError) {
141: try {
142: Integer.parseInt(p_Value);
143: } catch (NumberFormatException e) {
144: p_Errors.add(p_Tag, new ActionMessage(p_ResError));
145: }
146: }
147:
148: // --------------------------------------------------------- Properties Methods
149:
150: public String getClassName() {
151: return className;
152: }
153:
154: public void setClassName(String className) {
155: this .className = className;
156: }
157:
158: public String getCurrentOpened() {
159: return currentOpened;
160: }
161:
162: public void setCurrentOpened(String s) {
163: currentOpened = s;
164: }
165:
166: public String getCurrentBusy() {
167: return currentBusy;
168: }
169:
170: public void setCurrentBusy(String s) {
171: currentBusy = s;
172: }
173:
174: public String getCurrentInTx() {
175: return currentInTx;
176: }
177:
178: public void setCurrentInTx(String s) {
179: currentInTx = s;
180: }
181:
182: public String getOpenedCount() {
183: return openedCount;
184: }
185:
186: public void setOpenedCount(String s) {
187: openedCount = s;
188: }
189:
190: public String getConnectionFailures() {
191: return connectionFailures;
192: }
193:
194: public void setConnectionFailures(String s) {
195: connectionFailures = s;
196: }
197:
198: public String getConnectionLeaks() {
199: return connectionLeaks;
200: }
201:
202: public void setConnectionLeaks(String s) {
203: connectionLeaks = s;
204: }
205:
206: public String getCurrentWaiters() {
207: return currentWaiters;
208: }
209:
210: public void setCurrentWaiters(String s) {
211: currentWaiters = s;
212: }
213:
214: public String getWaitersHigh() {
215: return waitersHigh;
216: }
217:
218: public void setWaitersHigh(String s) {
219: waitersHigh = s;
220: }
221:
222: public String getWaitersHighRecent() {
223: return waitersHighRecent;
224: }
225:
226: public void setWaitersHighRecent(String s) {
227: waitersHighRecent = s;
228: }
229:
230: public String getBusyMaxRecent() {
231: return busyMaxRecent;
232: }
233:
234: public void setBusyMaxRecent(String s) {
235: busyMaxRecent = s;
236: }
237:
238: public String getBusyMinRecent() {
239: return busyMinRecent;
240: }
241:
242: public void setBusyMinRecent(String s) {
243: busyMinRecent = s;
244: }
245:
246: public String getWaiterCount() {
247: return waiterCount;
248: }
249:
250: public void setWaiterCount(String s) {
251: waiterCount = s;
252: }
253:
254: public String getWaitingTime() {
255: return waitingTime;
256: }
257:
258: public void setWaitingTime(String s) {
259: waitingTime = s;
260: }
261:
262: public String getWaitingHigh() {
263: return waitingHigh;
264: }
265:
266: public void setWaitingHigh(String s) {
267: waitingHigh = s;
268: }
269:
270: public String getWaitingHighRecent() {
271: return waitingHighRecent;
272: }
273:
274: public void setWaitingHighRecent(String s) {
275: waitingHighRecent = s;
276: }
277:
278: public String getServedOpen() {
279: return servedOpen;
280: }
281:
282: public void setServedOpen(String s) {
283: servedOpen = s;
284: }
285:
286: public String getRejectedOpen() {
287: return rejectedOpen;
288: }
289:
290: public void setRejectedOpen(String s) {
291: rejectedOpen = s;
292: }
293:
294: public String getRejectedFull() {
295: return rejectedFull;
296: }
297:
298: public void setRejectedFull(String s) {
299: rejectedFull = s;
300: }
301:
302: public String getRejectedTimeout() {
303: return rejectedTimeout;
304: }
305:
306: public void setRejectedTimeout(String s) {
307: rejectedTimeout = s;
308: }
309:
310: public String getRejectedOther() {
311: return rejectedOther;
312: }
313:
314: public void setRejectedOther(String s) {
315: rejectedOther = s;
316: }
317:
318: public String getDatasourceDescription() {
319: return datasourceDescription;
320: }
321:
322: public void setDatasourceDescription(String datasourceDescription) {
323: this .datasourceDescription = datasourceDescription;
324: }
325:
326: public String getDatasourceName() {
327: return datasourceName;
328: }
329:
330: public void setDatasourceName(String datasourceName) {
331: this .datasourceName = datasourceName;
332: }
333:
334: public String getDatasourceMapper() {
335: return datasourceMapper;
336: }
337:
338: public void setDatasourceMapper(String datasourceMapper) {
339: this .datasourceMapper = datasourceMapper;
340: }
341:
342: public String getDsName() {
343: return dsName;
344: }
345:
346: public void setDsName(String dsName) {
347: this .dsName = dsName;
348: }
349:
350: public String getJdbcConnCheckLevel() {
351: return jdbcConnCheckLevel;
352: }
353:
354: public void setJdbcConnCheckLevel(String jdbcConnCheckLevel) {
355: this .jdbcConnCheckLevel = jdbcConnCheckLevel;
356: }
357:
358: public String getJdbcConnMaxAge() {
359: return jdbcConnMaxAge;
360: }
361:
362: public void setJdbcConnMaxAge(String s) {
363: jdbcConnMaxAge = s;
364: }
365:
366: public String getJdbcMaxOpenTime() {
367: return jdbcMaxOpenTime;
368: }
369:
370: public void setJdbcMaxOpenTime(String s) {
371: jdbcMaxOpenTime = s;
372: }
373:
374: public String getJdbcMaxConnPool() {
375: return jdbcMaxConnPool;
376: }
377:
378: public void setJdbcMaxConnPool(String jdbcMaxConnPool) {
379: this .jdbcMaxConnPool = jdbcMaxConnPool;
380: }
381:
382: public String getJdbcMinConnPool() {
383: return jdbcMinConnPool;
384: }
385:
386: public void setJdbcMinConnPool(String jdbcMinConnPool) {
387: this .jdbcMinConnPool = jdbcMinConnPool;
388: }
389:
390: public String getJdbcMaxWaitTime() {
391: return jdbcMaxWaitTime;
392: }
393:
394: public void setJdbcMaxWaitTime(String jdbcMaxWaitTime) {
395: this .jdbcMaxWaitTime = jdbcMaxWaitTime;
396: }
397:
398: public String getJdbcMaxWaiters() {
399: return jdbcMaxWaiters;
400: }
401:
402: public void setJdbcMaxWaiters(String s) {
403: this .jdbcMaxWaiters = s;
404: }
405:
406: public String getJdbcSamplingPeriod() {
407: return jdbcSamplingPeriod;
408: }
409:
410: public void setJdbcSamplingPeriod(String s) {
411: this .jdbcSamplingPeriod = s;
412: }
413:
414: public String getJdbcTestStatement() {
415: return jdbcTestStatement;
416: }
417:
418: public void setJdbcTestStatement(String jdbcTestStatement) {
419: this .jdbcTestStatement = jdbcTestStatement;
420: }
421:
422: public String getJdbcPstmtMax() {
423: return jdbcPstmtMax;
424: }
425:
426: public void setJdbcPstmtMax(String jdbcPstmtMax) {
427: this .jdbcPstmtMax = jdbcPstmtMax;
428: }
429:
430: public String getPassword() {
431: return password;
432: }
433:
434: public void setPassword(String password) {
435: this .password = password;
436: }
437:
438: public String getUrl() {
439: return url;
440: }
441:
442: public void setUrl(String url) {
443: this .url = url;
444: }
445:
446: public String getUserName() {
447: return userName;
448: }
449:
450: public void setUserName(String userName) {
451: this .userName = userName;
452: }
453:
454: public String getAction() {
455: return action;
456: }
457:
458: public void setAction(String action) {
459: this .action = action;
460: }
461:
462: public java.util.List getCheckingLevels() {
463: return checkingLevels;
464: }
465:
466: public ArrayList getListUsedByEjb() {
467: return listUsedByEjb;
468: }
469:
470: public void setListUsedByEjb(ArrayList listUsedByEjb) {
471: this.listUsedByEjb = listUsedByEjb;
472: }
473:
474: }
|