001: /**
002: * ChainBuilder ESB
003: * Visual Enterprise Integration
004: *
005: * Copyright (C) 2006 Bostech Corporation
006: *
007: * This program is free software; you can redistribute it and/or modify it
008: * under the terms of the GNU General Public License as published by the
009: * Free Software Foundation; either version 2 of the License, or (at your option)
010: * any later version.
011: *
012: * This program is distributed in the hope that it will be useful,
013: * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
014: * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
015: * for more details.
016: *
017: * You should have received a copy of the GNU General Public License along with
018: * this program; if not, write to the Free Software Foundation, Inc.,
019: * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
020: *
021: *
022: * $Id$
023: */package com.bostechcorp.cbesb.runtime.component.email;
024:
025: /**
026: * @author LPS
027: *
028: */
029: public enum EmailPropertiesEnumeration {
030: ATTACHEMENT_DIR {
031: String getValue(EmailEndpoint endpoint) {
032: return endpoint.getAttachmentDir();
033: }
034:
035: void setValue(EmailEndpoint endpoint, Object value) {
036: if (isSetable())
037: endpoint.setAttachmentDir((String) value);
038: }
039:
040: boolean isSetable() {
041: return true;
042: }
043: },
044: BCC {
045: String getValue(EmailEndpoint endpoint) {
046: return endpoint.getBcc();
047: }
048:
049: void setValue(EmailEndpoint endpoint, Object value) {
050: if (isSetable())
051: endpoint.setBcc((String) value);
052: }
053:
054: boolean isSetable() {
055: return true;
056: }
057: },
058: CC {
059: String getValue(EmailEndpoint endpoint) {
060: return endpoint.getCc();
061: }
062:
063: void setValue(EmailEndpoint endpoint, Object value) {
064: if (isSetable())
065: endpoint.setCc((String) value);
066: }
067:
068: boolean isSetable() {
069: return true;
070: }
071: },
072: CHARSET {
073: String getValue(EmailEndpoint endpoint) {
074: return endpoint.getCharset();
075: }
076:
077: void setValue(EmailEndpoint endpoint, Object value) {
078: if (isSetable())
079: endpoint.setCharset((String) value);
080: }
081:
082: boolean isSetable() {
083: return true;
084: }
085: },
086: FROM {
087: String getValue(EmailEndpoint endpoint) {
088: return endpoint.getFrom();
089: }
090:
091: void setValue(EmailEndpoint endpoint, Object value) {
092: if (isSetable())
093: endpoint.setFrom((String) value);
094: }
095:
096: boolean isSetable() {
097: return true;
098: }
099: },
100: HOST {
101: String getValue(EmailEndpoint endpoint) {
102: return endpoint.getHost();
103: }
104:
105: void setValue(EmailEndpoint endpoint, Object value) {
106: if (isSetable())
107: endpoint.setHost((String) value);
108: }
109:
110: boolean isSetable() {
111: return true;
112: }
113: },
114: PASSWORD {
115: String getValue(EmailEndpoint endpoint) {
116: return endpoint.getPassword();
117: }
118:
119: void setValue(EmailEndpoint endpoint, Object value) {
120: if (isSetable())
121: endpoint.setPassword((String) value);
122: }
123:
124: boolean isSetable() {
125: return true;
126: }
127: },
128: POLING_SCHEDULE {
129: String getValue(EmailEndpoint endpoint) {
130: return endpoint.getPollingSchedule();
131: }
132:
133: void setValue(EmailEndpoint endpoint, Object value) {
134: if (isSetable())
135: endpoint.setPollingSchedule((String) value);
136: }
137:
138: boolean isSetable() {
139: return true;
140: }
141: },
142: POLING_INTERVAL {
143: String getValue(EmailEndpoint endpoint) {
144: return String.valueOf(endpoint.getPollInterval());
145: }
146:
147: void setValue(EmailEndpoint endpoint, Object value) {
148: if (isSetable())
149: endpoint.setPollInterval(Integer
150: .parseInt(((String) value)));
151: }
152:
153: boolean isSetable() {
154: return true;
155: }
156: },
157: PORT {
158: String getValue(EmailEndpoint endpoint) {
159: return endpoint.getPort();
160: }
161:
162: void setValue(EmailEndpoint endpoint, Object value) {
163: if (isSetable())
164: endpoint.setPort((String) value);
165: }
166:
167: boolean isSetable() {
168: return true;
169: }
170: },
171: RECORD_TYPE {
172: String getValue(EmailEndpoint endpoint) {
173: return endpoint.getRecordType();
174: }
175:
176: void setValue(EmailEndpoint endpoint, Object value) {
177: if (isSetable())
178: endpoint.setRecordType((String) value);
179: }
180:
181: boolean isSetable() {
182: return true;
183: }
184: },
185: REPLY_CHARSET {
186: String getValue(EmailEndpoint endpoint) {
187: return endpoint.getReplyCharset();
188: }
189:
190: void setValue(EmailEndpoint endpoint, Object value) {
191: if (isSetable())
192: endpoint.setReplyCharset((String) value);
193: }
194:
195: boolean isSetable() {
196: return true;
197: }
198: },
199: REPLY_HOST {
200: String getValue(EmailEndpoint endpoint) {
201: return endpoint.getReplyHost();
202: }
203:
204: void setValue(EmailEndpoint endpoint, Object value) {
205: if (isSetable())
206: endpoint.setReplyHost((String) value);
207: }
208:
209: boolean isSetable() {
210: return true;
211: }
212: },
213: REPLY_PASSWORD {
214: String getValue(EmailEndpoint endpoint) {
215: return endpoint.getReplyPassword();
216: }
217:
218: void setValue(EmailEndpoint endpoint, Object value) {
219: if (isSetable())
220: endpoint.setReplyPassword((String) value);
221: }
222:
223: boolean isSetable() {
224: return true;
225: }
226: },
227: REPLY_PORT {
228: String getValue(EmailEndpoint endpoint) {
229: return endpoint.getReplyPort();
230: }
231:
232: void setValue(EmailEndpoint endpoint, Object value) {
233: if (isSetable())
234: endpoint.setReplyPort((String) value);
235: }
236:
237: boolean isSetable() {
238: return true;
239: }
240: },
241: REPLY_USER {
242: String getValue(EmailEndpoint endpoint) {
243: return endpoint.getReplyUser();
244: }
245:
246: void setValue(EmailEndpoint endpoint, Object value) {
247: if (isSetable())
248: endpoint.setReplyUser((String) value);
249: }
250:
251: boolean isSetable() {
252: return true;
253: }
254: },
255: SUBJECT {
256: String getValue(EmailEndpoint endpoint) {
257: return endpoint.getSubject();
258: }
259:
260: void setValue(EmailEndpoint endpoint, Object value) {
261: if (isSetable())
262: endpoint.setSubject((String) value);
263: }
264:
265: boolean isSetable() {
266: return true;
267: }
268: },
269: TO {
270: String getValue(EmailEndpoint endpoint) {
271: return endpoint.getTo();
272: }
273:
274: void setValue(EmailEndpoint endpoint, Object value) {
275: if (isSetable())
276: endpoint.setTo((String) value);
277: }
278:
279: boolean isSetable() {
280: return true;
281: }
282: },
283: USER {
284: String getValue(EmailEndpoint endpoint) {
285: return endpoint.getUser();
286: }
287:
288: void setValue(EmailEndpoint endpoint, Object value) {
289: if (isSetable())
290: endpoint.setUser((String) value);
291: }
292:
293: boolean isSetable() {
294: return true;
295: }
296: },
297: USE_SSL {
298: String getValue(EmailEndpoint endpoint) {
299: return Boolean.toString(endpoint.getUseSSL());
300: }
301:
302: void setValue(EmailEndpoint endpoint, Object value) {
303: if (isSetable())
304: endpoint.setUseSSL((String) value);
305: }
306:
307: boolean isSetable() {
308: return true;
309: }
310: };
311:
312: /**
313: *
314: * @param endpoint -- endpoint in use
315: * @return - attribute value according to enumeration item
316: */
317: abstract String getValue(EmailEndpoint endpoint);
318:
319: /**
320: *
321: * @param endpoint-- endpoint in use
322: * @param value - sets attribute value according to enumeration item
323: */
324: abstract void setValue(EmailEndpoint endpoint, Object value);
325:
326: /**
327: * tells either is possible or not to set the value
328: * false if the attribute is read only
329: * @return
330: */
331: abstract boolean isSetable();
332: }
|