001: /**
002: * JOnAS: Java(TM) Open Application Server
003: * Copyright (C) 2006 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: CreateResourceAdapterForm.java 8645 2006-06-16 13:16:16Z pasmith $
023: * --------------------------------------------------------------------------
024: */package org.objectweb.jonas.webapp.jonasadmin.resourceadapter;
025:
026: import javax.servlet.http.HttpServletRequest;
027:
028: import org.apache.struts.action.ActionMessage;
029: import org.apache.struts.action.ActionErrors;
030: import org.apache.struts.action.ActionForm;
031: import org.apache.struts.action.ActionMapping;
032: import org.objectweb.jonas.webapp.jonasadmin.Jlists;
033:
034: /**
035: * The form used for the create resource adapter functionality.
036: *
037: * @author Patrick Smith
038: */
039: public class CreateResourceAdapterForm extends ActionForm {
040:
041: // --------------------------------------------------------- Constants
042:
043: // --------------------------------------------------------- Properties variables
044:
045: private String rarName = null;
046: private String displayName = null;
047: private String description = null;
048: private String vendorName = null;
049: private String specVersion = null;
050: private String eisType = null;
051: private String template = "JDBC";
052: private boolean isDomain = false;
053:
054: private String jndiName = null;
055: private String nativeLib = null;
056: private String logEnabled = null;
057: private String logTopic = null;
058: private int poolInit = 0;
059: private int poolMin = 0;
060: private int poolMax = 100;
061: private int poolMaxAge = 0;
062: private int pstmtMax = 10;
063: private int poolMaxOpenTime = 0;
064: private int poolMaxWaiters = 0;
065: private int poolMaxWaittime = 0;
066: private int poolSamplingPeriod = 30;
067: private int checkLevel = 0;
068: private String dsClass = null;
069: private String URL = null;
070: private String user = null;
071: private String password = null;
072: private String loginTimeout = null;
073: private String isolationLevel = null;
074: private String mapperName = null;
075: private String configLogTopic = null;
076:
077: private java.util.List booleanValues = Jlists.getBooleanValues();
078: private java.util.List checkingLevels = Jlists
079: .getJdbcConnectionCheckingLevels();
080: private java.util.List specVersions = Jlists.getSpecVersion();
081:
082: // --------------------------------------------------------- Public Methods
083:
084: /**
085: * Returns the spec version.
086: * @return Returns the specVersions.
087: */
088: public java.util.List getSpecVersions() {
089: return specVersions;
090: }
091:
092: /**
093: * Set the spec version for the form.
094: * @param specVersions The specVersions to set.
095: */
096: public void setSpecVersions(java.util.List specVersions) {
097: this .specVersions = specVersions;
098: }
099:
100: /**
101: * Reset the form back to its default values.
102: * @param mapping the ActionMapping used for the struts actions.
103: * @param request the HttpServletRequest used in the execution of the struts actions.
104: */
105: public void reset(ActionMapping mapping, HttpServletRequest request) {
106: // Reset datas
107: rarName = null;
108: displayName = null;
109: description = null;
110: vendorName = null;
111: specVersion = null;
112: eisType = null;
113: isDomain = false;
114:
115: jndiName = null;
116: nativeLib = null;
117: logEnabled = null;
118: logTopic = null;
119: poolInit = 0;
120: poolMin = 0;
121: poolMax = 100;
122: poolMaxAge = 0;
123: pstmtMax = 10;
124: poolMaxOpenTime = 0;
125: poolMaxWaiters = 0;
126: poolMaxWaittime = 0;
127: poolSamplingPeriod = 30;
128: checkLevel = 0;
129: dsClass = null;
130: URL = null;
131: user = null;
132: password = null;
133: loginTimeout = null;
134: isolationLevel = null;
135: mapperName = null;
136: configLogTopic = null;
137: }
138:
139: /**
140: * Validates the values in the form.
141: * @param mapping the ActionMapping used in the struts actions.
142: * @param request the HttpServletRequest used for the struts actions.
143: * @return The errors generated from the validation.
144: */
145: public ActionErrors validate(ActionMapping mapping,
146: HttpServletRequest request) {
147:
148: ActionErrors oErrors = new ActionErrors();
149: if ((rarName == null) || (rarName.length() == 0)) {
150: oErrors.add("name", new ActionMessage(
151: "error.resourceadapter.rarname.required"));
152: }
153: if (template.equals("Other")) {
154: if ((displayName == null) || (displayName.length() == 0)) {
155: oErrors.add("datasourceName", new ActionMessage(
156: "error.resourceadapter.displayname.required"));
157: }
158: if ((description == null) || (description.length() == 0)) {
159: oErrors.add("datasourceClassname", new ActionMessage(
160: "error.resourceadapter.description.required"));
161: }
162: if ((vendorName == null) || (vendorName.length() == 0)) {
163: oErrors.add("datasourceClassname", new ActionMessage(
164: "error.resourceadapter.vendorname.required"));
165: }
166: if ((specVersion == null) || (specVersion.length() == 0)) {
167: oErrors.add("datasourceClassname", new ActionMessage(
168: "error.resourceadapter.specversion.required"));
169: }
170: if ((eisType == null) || (eisType.length() == 0)) {
171: oErrors.add("datasourceClassname", new ActionMessage(
172: "error.resourceadapter.eistype.required"));
173: }
174: }
175: return oErrors;
176: }
177:
178: // --------------------------------------------------------- Properties Methods
179:
180: /**
181: * Return the name of the RAR file.
182: * @return the name of the RAR file.
183: */
184: public String getRarName() {
185: return this .rarName;
186: }
187:
188: /**
189: * Sets the name of the RAR file.
190: * @param rarName the new name of the RAR file.
191: */
192: public void setRarName(String rarName) {
193: this .rarName = rarName;
194: }
195:
196: /**
197: * Returns the display name for this RAR.
198: * @return the RAR's display name.
199: */
200: public String getDisplayName() {
201: return this .displayName;
202: }
203:
204: /**
205: * Sets the display name for this RAR.
206: * @param displayName The new display name.
207: */
208: public void setDisplayName(String displayName) {
209: this .displayName = displayName;
210: }
211:
212: /**
213: * Return the description for this RAR.
214: * @return the description for this RAR.
215: */
216: public String getDescription() {
217: return this .description;
218: }
219:
220: /**
221: * Sets the description used for this RAR.
222: * @param description The new description for this RAR.
223: */
224: public void setDescription(String description) {
225: this .description = description;
226: }
227:
228: /**
229: * Returns the vendor name used for this RAR.
230: * @return The vendor name used for this RAR.
231: */
232: public String getVendorName() {
233: return vendorName;
234: }
235:
236: /**
237: * Sets the vendor name used for this RAR.
238: * @param vendorName The new vendor name for this RAR.
239: */
240: public void setVendorName(String vendorName) {
241: this .vendorName = vendorName;
242: }
243:
244: /**
245: * Returns the spec version for this RAR.
246: * @return the spec version used for this RAR.
247: */
248: public String getSpecVersion() {
249: return this .specVersion;
250: }
251:
252: /**
253: * Sets the spec version to use for this RAR.
254: * @param specVersion the new Spec version for this RAR.
255: */
256: public void setSpecVersion(String specVersion) {
257: this .specVersion = specVersion;
258: }
259:
260: /**
261: * Returns the EIS Type for this RAR.
262: * @return The EIS type for this RAR.
263: */
264: public String getEisType() {
265: return this .eisType;
266: }
267:
268: /**
269: * Sets the EIS Type for this RAR.
270: * @param eisType The new EIS type to use for thsi RAR.
271: */
272: public void setEisType(String eisType) {
273: this .eisType = eisType;
274: }
275:
276: /**
277: * Returns which template this new RAR should be based on.
278: * @return which template this new RAR should be based on.
279: */
280: public String getTemplate() {
281: return this .template;
282: }
283:
284: /**
285: * Sets which template to use for this RAR.
286: * @param template The new template to use.
287: */
288: public void setTemplate(String template) {
289: this .template = template;
290: }
291:
292: /**
293: * Returns this RAR's JNDI name.
294: * @return This RAR's JNDI name.
295: */
296: public String getJndiName() {
297: return this .jndiName;
298: }
299:
300: /**
301: * Sets the JNDI name for this RAR.
302: * @param jndiName The JNDI name for this RAR.
303: */
304: public void setJndiName(String jndiName) {
305: this .jndiName = jndiName;
306: }
307:
308: /**
309: * Returns the Native Lib to use for this RAR.
310: * @return The native Lib to use for this RAR.
311: */
312: public String getNativeLib() {
313: return this .nativeLib;
314: }
315:
316: /**
317: * Sets the native lib to use for this RAR.
318: * @param nativeLib the new Native lib to use for this RAR.
319: */
320: public void setNativeLib(String nativeLib) {
321: this .nativeLib = nativeLib;
322: }
323:
324: /**
325: * If this RAR should be log enabled.
326: * @return if this RAR should be log enabled.
327: */
328: public String getLogEnabled() {
329: return this .logEnabled;
330: }
331:
332: /**
333: * Sets if this RAR should be log enabled.
334: * @param logEnabled
335: */
336: public void setLogEnabled(String logEnabled) {
337: this .logEnabled = logEnabled;
338: }
339:
340: /**
341: * Get the log topic for this RAR.
342: * @return the log topic for this RAR.
343: */
344: public String getLogTopic() {
345: return this .logTopic;
346: }
347:
348: /**
349: * Sets the log topic for this RAR.
350: * @param logTopic the new log topic for this RAR.
351: */
352: public void setLogTopic(String logTopic) {
353: this .logTopic = logTopic;
354: }
355:
356: /**
357: * Returns the pool init value for this RAR.
358: * @return the pool init value to use for this RAR.
359: */
360: public int getPoolInit() {
361: return this .poolInit;
362: }
363:
364: /**
365: * Sets a new pool init value for this RAR.
366: * @param poolInit the new pool init value for this RAR.
367: */
368: public void setPoolInit(int poolInit) {
369: this .poolInit = poolInit;
370: }
371:
372: /**
373: * Returns the pool min value to use for this RAR.
374: * @return the pool min value to use for this RAR.
375: */
376: public int getPoolMin() {
377: return this .poolMin;
378: }
379:
380: /**
381: * Sets the pool min value to use.
382: * @param poolMin The new pool min value to use for this RAR.
383: */
384: public void setPoolMin(int poolMin) {
385: this .poolMin = poolMin;
386: }
387:
388: /**
389: * Returns the pool max value used for this RAR.
390: * @return The pool max value used for this RAR.
391: */
392: public int getPoolMax() {
393: return this .poolMax;
394: }
395:
396: /**
397: * Sets the pool max value of this new RAR.
398: * @param poolMax The new pool max value of this RAR.s
399: */
400: public void setPoolMax(int poolMax) {
401: this .poolMax = poolMax;
402: }
403:
404: /**
405: * Returns the pool max age for this new RAR.
406: * @return the pool max age value used for this RAR.
407: */
408: public int getPoolMaxAge() {
409: return this .poolMaxAge;
410: }
411:
412: /**
413: * Sets the pool max age to use for this new RAR.
414: * @param poolMaxAge The new pool max age to use for this RAR.
415: */
416: public void setPoolMaxAge(int poolMaxAge) {
417: this .poolMaxAge = poolMaxAge;
418: }
419:
420: /**
421: * The PSTMT Max value for this RAR.
422: * @return the PSTMT max value used for this RAR.
423: */
424: public int getPstmtMax() {
425: return this .pstmtMax;
426: }
427:
428: /**
429: * Sets the new PSTMT max value to use for this RAR.
430: * @param pstmtMax the new PSTMT max value to use.
431: */
432: public void setPstmtMax(int pstmtMax) {
433: this .pstmtMax = pstmtMax;
434: }
435:
436: /**
437: * Returns the pool max open time value used for this RAR.
438: * @return The pool max open time value used for this RAR.
439: */
440: public int getPoolMaxOpenTime() {
441: return this .poolMaxOpenTime;
442: }
443:
444: /**
445: * Sets the pool max open time value used for this RAR.
446: * @param poolMaxOpenTime The new pool max open time value to use.
447: */
448: public void setPoolMaxOpenTime(int poolMaxOpenTime) {
449: this .poolMaxOpenTime = poolMaxOpenTime;
450: }
451:
452: /**
453: * Returns the pool max waiters value used by this RAR.
454: * @return The pool max waiters value used.
455: */
456: public int getPoolMaxWaiters() {
457: return this .poolMaxWaiters;
458: }
459:
460: /**
461: * Sets the pool max waiters value used by this RAR.
462: * @param poolMaxWaiters the new pool max waiters value to use.
463: */
464: public void setPoolMaxWaiters(int poolMaxWaiters) {
465: this .poolMaxWaiters = poolMaxWaiters;
466: }
467:
468: /**
469: * Get the pool max wait time value used by this RAR.
470: * @return The pool max wait time value.
471: */
472: public int getPoolMaxWaittime() {
473: return this .poolMaxWaittime;
474: }
475:
476: /**
477: * Sets the poool max wait time value used.
478: * @param poolMaxWaittime The new Pool max wait time value to use.
479: */
480: public void setPoolMaxWaittime(int poolMaxWaittime) {
481: this .poolMaxWaittime = poolMaxWaittime;
482: }
483:
484: /**
485: * Get the pool sampling period value used for this RAR.
486: * @return The pool sampling period used.
487: */
488: public int getPoolSamplingPeriod() {
489: return this .poolSamplingPeriod;
490: }
491:
492: /**
493: * Sets the pool sampling period value used for this new RAR.
494: * @param poolSamplingPeriod The new pool sampling period value to use.
495: */
496: public void setPoolSamplingPeriod(int poolSamplingPeriod) {
497: this .poolSamplingPeriod = poolSamplingPeriod;
498: }
499:
500: /**
501: * REturns the check level value for this new RAR.
502: * @return the check level value.
503: */
504: public int getCheckLevel() {
505: return this .checkLevel;
506: }
507:
508: /**
509: * Sets the new check level value to use for this RAR.
510: * @param checkLevel the new check level value to use.
511: */
512: public void setCheckLevel(int checkLevel) {
513: this .checkLevel = checkLevel;
514: }
515:
516: /**
517: * Returns the DS Class used for this new RAR.
518: * @return The DS class used for this new RAR.
519: */
520: public String getDsClass() {
521: return this .dsClass;
522: }
523:
524: /**
525: * Sets the DS Class to use for this new RAR.
526: * @param dsClass The new DS Class value to use for this RAR.
527: */
528: public void setDsClass(String dsClass) {
529: this .dsClass = dsClass;
530: }
531:
532: /**
533: * Returns the URL used in this RAR.
534: * @return the URL value used in this RAR.
535: */
536: public String getURL() {
537: return this .URL;
538: }
539:
540: /**
541: * Sets the new URL value to use for this RAR.
542: * @param URL the new URL value to use for this RAR.
543: */
544: public void setURL(String URL) {
545: this .URL = URL;
546: }
547:
548: /**
549: * Returns the username used by this RAR.
550: * @return the username used by this RAR.
551: */
552: public String getUser() {
553: return this .user;
554: }
555:
556: /**
557: * Set a new username to use in this RAR.
558: * @param user The new user name value for this RAR.
559: */
560: public void setUser(String user) {
561: this .user = user;
562: }
563:
564: /**
565: * Returns the password for the user of this RAR.
566: * @return the password for the user of this RAR.
567: */
568: public String getPassword() {
569: return this .password;
570: }
571:
572: /**
573: * Set a new password for the user of this RAR.
574: * @param password the new password to use for this RAR.
575: */
576: public void setPassword(String password) {
577: this .password = password;
578: }
579:
580: /**
581: * Returns the login timeout for this RAR.
582: * @return The login timeout for this RAR.
583: */
584: public String getLoginTimeout() {
585: return this .loginTimeout;
586: }
587:
588: /**
589: * Sets a new login timeout value for this RAR.
590: * @param loginTimeout the new login timeout value for this RAR.
591: */
592: public void setLoginTimeout(String loginTimeout) {
593: this .loginTimeout = loginTimeout;
594: }
595:
596: /**
597: * Returns the isolation level used by this RAR.
598: * @return the isolation level used by this RAR.
599: */
600: public String getIsolationLevel() {
601: return this .isolationLevel;
602: }
603:
604: /**
605: * Sets a new isolation level for this RAR to use.
606: * @param isolationLevel the new isolation level to use for this RAR.
607: */
608: public void setIsolationLevel(String isolationLevel) {
609: this .isolationLevel = isolationLevel;
610: }
611:
612: /**
613: * Returns the mapper name for this RAR.
614: * @return the mapper name for this RAR.
615: */
616: public String getMapperName() {
617: return this .mapperName;
618: }
619:
620: /**
621: * Sets a new mapper name for this RAR to use.
622: * @param mapperName the new mapper name for this RAR to use.
623: */
624: public void setMapperName(String mapperName) {
625: this .mapperName = mapperName;
626: }
627:
628: /**
629: * Returns the config log topic for this RAR.
630: * @return the config log topic for this RAR.
631: */
632: public String getConfigLogTopic() {
633: return this .configLogTopic;
634: }
635:
636: /**
637: * Sets a new config log topic for this RAR.
638: * @param configLogTopic the new config log topic to use for this RAR.
639: */
640: public void setConfigLogTopic(String configLogTopic) {
641: this .configLogTopic = configLogTopic;
642: }
643:
644: /**
645: * Return if the action is a domain management operation.
646: * @return if the action is a domain management operation.
647: */
648: public boolean getIsDomain() {
649: return this .isDomain;
650: }
651:
652: /**
653: * Sets if the action is a domain management operation.
654: * @param isDomain if the action is a domain management operation.
655: */
656: public void setIsDomain(boolean isDomain) {
657: this .isDomain = isDomain;
658: }
659:
660: /**
661: * @return Returns the booleanValues.
662: */
663: public java.util.List getBooleanValues() {
664: return booleanValues;
665: }
666:
667: /**
668: * @param booleanValues The booleanValues to set.
669: */
670: public void setBooleanValues(java.util.List booleanValues) {
671: this .booleanValues = booleanValues;
672: }
673:
674: /**
675: * @return Returns the checkingLevels.
676: */
677: public java.util.List getCheckingLevels() {
678: return checkingLevels;
679: }
680:
681: /**
682: * @param checkingLevels The checkingLevels to set.
683: */
684: public void setCheckingLevels(java.util.List checkingLevels) {
685: this.checkingLevels = checkingLevels;
686: }
687: }
|