KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > jonas > webapp > jonasadmin > resource > MailFactoryPropertiesForm


1 /*
2  * JOnAS: Java(TM) Open Application Server
3  * Copyright (C) 1999 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:
23  * --------------------------------------------------------------------------
24  */

25
26 package org.objectweb.jonas.webapp.jonasadmin.resource;
27
28 import javax.servlet.http.HttpServletRequest JavaDoc;
29
30 import org.apache.struts.action.ActionMessage;
31 import org.apache.struts.action.ActionErrors;
32 import org.apache.struts.action.ActionForm;
33 import org.apache.struts.action.ActionMapping;
34
35 public class MailFactoryPropertiesForm extends ActionForm {
36
37 // --------------------------------------------------------- Constants
38

39 // --------------------------------------------------------- Properties variables
40
private String JavaDoc mailFactoryName = null;
41     private String JavaDoc jndiName = null;
42     private String JavaDoc type = null;
43      // authentication props
44
private String JavaDoc username = null;
45     private String JavaDoc password = null;
46     // mail session props
47
private String JavaDoc sessionProps = null;
48     // mimepart datasource message props
49
private String JavaDoc to = null;
50     private String JavaDoc subject = null;
51     private String JavaDoc cc = null;
52     private String JavaDoc bcc = null;
53
54 // --------------------------------------------------------- Public Methods
55

56     /**
57      * Reset all properties to their default values.
58      *
59      * @param mapping The mapping used to select this instance
60      * @param request The servlet request we are processing
61      */

62
63     public void reset(ActionMapping mapping, HttpServletRequest JavaDoc request) {
64         mailFactoryName = null;
65         jndiName = null;
66         type = null;
67         // authentication props
68
username = null;
69         password = null;
70         // mail session props
71
sessionProps = null;
72         // mimepart datasource message props
73
to = null;
74         subject = null;
75         cc = null;
76         bcc = null;
77     }
78
79     /**
80      * Validate the properties that have been set from this HTTP request,
81      * and return an <code>ActionErrors</code> object that encapsulates any
82      * validation errors that have been found. If no errors are found, return
83      * <code>null</code> or an <code>ActionErrors</code> object with no
84      * recorded error messages.
85      *
86      * @param mapping The mapping used to select this instance
87      * @param request The servlet request we are processing
88      */

89     public ActionErrors validate(ActionMapping mapping, HttpServletRequest JavaDoc request) {
90         ActionErrors oErrors = new ActionErrors();
91         if ((jndiName == null) || (jndiName.length() == 0)) {
92             oErrors.add("jndiName", new ActionMessage("error.mailservice.mailfactory.emptyjndiname"));
93         }
94         if ((mailFactoryName == null) || (mailFactoryName.length() == 0)) {
95             oErrors.add("jndiName", new ActionMessage("error.mailservice.mailfactory.emptyname"));
96         }
97         if ((type == null) || (type.length() == 0)) {
98             oErrors.add("jndiName", new ActionMessage("error.mailservice.mailfactory.emptytype"));
99         }
100         return oErrors;
101     }
102
103 // --------------------------------------------------------- Properties Methods
104

105     public String JavaDoc getMailFactoryName() {
106         return mailFactoryName;
107     }
108
109     public void setMailFactoryName(String JavaDoc mailFactoryName) {
110         this.mailFactoryName = mailFactoryName;
111     }
112
113     public String JavaDoc getJndiName() {
114         return jndiName;
115     }
116
117     public void setJndiName(String JavaDoc jndiName) {
118         this.jndiName = jndiName;
119     }
120
121     public String JavaDoc getType() {
122         return type;
123     }
124
125     public void setType(String JavaDoc type) {
126         this.type = type;
127     }
128
129     public String JavaDoc getUsername() {
130         return username;
131     }
132
133     public void setUsername(String JavaDoc username) {
134         this.username = username;
135     }
136
137     public String JavaDoc getPassword() {
138         return password;
139     }
140
141     public void setPassword(String JavaDoc password) {
142         this.password = password;
143     }
144
145     public String JavaDoc getSessionProps() {
146         return sessionProps;
147     }
148
149     public void setSessionProps(String JavaDoc sessionProps) {
150         this.sessionProps = sessionProps;
151     }
152
153     public String JavaDoc getTo() {
154         return to;
155     }
156
157     public void setTo(String JavaDoc to) {
158         this.to = to;
159     }
160
161     public String JavaDoc getSubject() {
162         return subject;
163     }
164
165     public void setSubject(String JavaDoc subject) {
166         this.subject = subject;
167     }
168
169     public String JavaDoc getCc() {
170         return cc;
171     }
172
173     public void setCc(String JavaDoc cc) {
174         this.cc = cc;
175     }
176
177     public String JavaDoc getBcc() {
178         return bcc;
179     }
180
181     public void setBcc(String JavaDoc bcc) {
182         this.bcc = bcc;
183     }
184
185 }
186
Popular Tags