001: /*
002: * JOnAS: Java(TM) Open Application Server
003: * Copyright (C) 1999 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:
023: * --------------------------------------------------------------------------
024: */
025:
026: package org.objectweb.jonas.webapp.jonasadmin.resource;
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:
035: public class MailFactoryPropertiesForm extends ActionForm {
036:
037: // --------------------------------------------------------- Constants
038:
039: // --------------------------------------------------------- Properties variables
040: private String mailFactoryName = null;
041: private String jndiName = null;
042: private String type = null;
043: // authentication props
044: private String username = null;
045: private String password = null;
046: // mail session props
047: private String sessionProps = null;
048: // mimepart datasource message props
049: private String to = null;
050: private String subject = null;
051: private String cc = null;
052: private String bcc = null;
053:
054: // --------------------------------------------------------- Public Methods
055:
056: /**
057: * Reset all properties to their default values.
058: *
059: * @param mapping The mapping used to select this instance
060: * @param request The servlet request we are processing
061: */
062:
063: public void reset(ActionMapping mapping, HttpServletRequest request) {
064: mailFactoryName = null;
065: jndiName = null;
066: type = null;
067: // authentication props
068: username = null;
069: password = null;
070: // mail session props
071: sessionProps = null;
072: // mimepart datasource message props
073: to = null;
074: subject = null;
075: cc = null;
076: bcc = null;
077: }
078:
079: /**
080: * Validate the properties that have been set from this HTTP request,
081: * and return an <code>ActionErrors</code> object that encapsulates any
082: * validation errors that have been found. If no errors are found, return
083: * <code>null</code> or an <code>ActionErrors</code> object with no
084: * recorded error messages.
085: *
086: * @param mapping The mapping used to select this instance
087: * @param request The servlet request we are processing
088: */
089: public ActionErrors validate(ActionMapping mapping,
090: HttpServletRequest request) {
091: ActionErrors oErrors = new ActionErrors();
092: if ((jndiName == null) || (jndiName.length() == 0)) {
093: oErrors.add("jndiName", new ActionMessage(
094: "error.mailservice.mailfactory.emptyjndiname"));
095: }
096: if ((mailFactoryName == null)
097: || (mailFactoryName.length() == 0)) {
098: oErrors.add("jndiName", new ActionMessage(
099: "error.mailservice.mailfactory.emptyname"));
100: }
101: if ((type == null) || (type.length() == 0)) {
102: oErrors.add("jndiName", new ActionMessage(
103: "error.mailservice.mailfactory.emptytype"));
104: }
105: return oErrors;
106: }
107:
108: // --------------------------------------------------------- Properties Methods
109:
110: public String getMailFactoryName() {
111: return mailFactoryName;
112: }
113:
114: public void setMailFactoryName(String mailFactoryName) {
115: this .mailFactoryName = mailFactoryName;
116: }
117:
118: public String getJndiName() {
119: return jndiName;
120: }
121:
122: public void setJndiName(String jndiName) {
123: this .jndiName = jndiName;
124: }
125:
126: public String getType() {
127: return type;
128: }
129:
130: public void setType(String type) {
131: this .type = type;
132: }
133:
134: public String getUsername() {
135: return username;
136: }
137:
138: public void setUsername(String username) {
139: this .username = username;
140: }
141:
142: public String getPassword() {
143: return password;
144: }
145:
146: public void setPassword(String password) {
147: this .password = password;
148: }
149:
150: public String getSessionProps() {
151: return sessionProps;
152: }
153:
154: public void setSessionProps(String sessionProps) {
155: this .sessionProps = sessionProps;
156: }
157:
158: public String getTo() {
159: return to;
160: }
161:
162: public void setTo(String to) {
163: this .to = to;
164: }
165:
166: public String getSubject() {
167: return subject;
168: }
169:
170: public void setSubject(String subject) {
171: this .subject = subject;
172: }
173:
174: public String getCc() {
175: return cc;
176: }
177:
178: public void setCc(String cc) {
179: this .cc = cc;
180: }
181:
182: public String getBcc() {
183: return bcc;
184: }
185:
186: public void setBcc(String bcc) {
187: this.bcc = bcc;
188: }
189:
190: }
|