Source Code Cross Referenced for EmailEndpoint.java in  » ESB » cbesb-1.2 » com » bostechcorp » cbesb » runtime » component » email » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » ESB » cbesb 1.2 » com.bostechcorp.cbesb.runtime.component.email 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


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 
008:         * it under the terms of the GNU General Public License as published by 
009:         * the Free Software Foundation; either version 2 of the License, or 
010:         * (at your option) 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 
014:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 
015:         * General Public License for more details.
016:         * 
017:         * You should have received a copy of the GNU General Public License 
018:         * along with this program; if not, write to the Free Software 
019:         * Foundation, Inc.,59 Temple Place, Suite 330, Boston, MA 02111-1307 
020:         * USA
021:         *
022:         * $Id: EmailEndpoint.java 9745 2007-10-26 11:04:50Z lzheng $
023:         *
024:         */
025:        package com.bostechcorp.cbesb.runtime.component.email;
026:
027:        import java.util.ArrayList;
028:        import java.util.List;
029:
030:        import javax.jbi.messaging.MessageExchange.Role;
031:
032:        import org.apache.commons.logging.Log;
033:        import org.apache.commons.logging.LogFactory;
034:
035:        import com.bostechcorp.cbesb.runtime.ccsl.jbi.messaging.CbEmbeddedSchedulerConsumerProcessor;
036:        import com.bostechcorp.cbesb.runtime.ccsl.jbi.messaging.IComponentProcessor;
037:        import com.bostechcorp.cbesb.runtime.ccsl.jbi.messaging.ScheduledEndpointProcessor;
038:        import com.bostechcorp.cbesb.runtime.component.email.processors.EmailConsumerHandler;
039:        import com.bostechcorp.cbesb.runtime.component.email.processors.EmailProviderProcessor;
040:
041:        /**
042:         * 
043:         */
044:        public class EmailEndpoint extends ScheduledEndpointProcessor {
045:
046:            protected final transient Log logger = LogFactory
047:                    .getLog(getClass());
048:
049:            /**
050:             * Value determines the type of data each record contains.
051:             */
052:            private String recordType;
053:
054:            /**
055:             * Value is the name of the charset to use to read in character data.
056:             */
057:            private String Charset;
058:
059:            /**
060:             * POP3 host name or IP address
061:             */
062:            private String Host;
063:
064:            /**
065:             * Remote port number for POP3
066:             */
067:            private String Port = "110";
068:
069:            /**
070:             * User name to connect to the host
071:             */
072:            private String User;
073:
074:            /**
075:             * Password.
076:             */
077:            private String Password;
078:
079:            /**
080:             * Directory to store attachment
081:             */
082:            private String attachmentDir;
083:
084:            /**
085:             * Polling interval to poll POP3 server
086:             */
087:            //    private long pollingInterval = 0;
088:            /**
089:             * Advanced schedule setting to poll POP3 server
090:             */
091:            private String pollingSchedule;
092:
093:            /**
094:             * Whether to use SSL
095:             */
096:            private boolean useSSL = false;
097:
098:            /**
099:             * Encoding
100:             */
101:            private String replyCharset;
102:
103:            /**
104:             * Reply SMTP host name or IP address
105:             */
106:            private String replyHost;
107:
108:            /**
109:             * Reply remote port number for SMTP for reply
110:             */
111:            private String replyPort;
112:
113:            /**
114:             * Reply user name for SMTP
115:             */
116:            private String replyUser;
117:
118:            /**
119:             * Reply password for SMTP
120:             */
121:            private String replyPassword;
122:
123:            /**
124:             * Whether to use SSL
125:             */
126:            private boolean replyUseSSL = false;
127:
128:            /**
129:             * The sender email address.
130:             */
131:            private String From;
132:
133:            /**
134:             * The recipient email address(es).  If multiple email addresses were specified in the
135:             * email, this will be a comma separated list.
136:             */
137:            private String To;
138:
139:            /**
140:             * The Carbon Copy Recipient email address(es).
141:             */
142:            private String Cc;
143:
144:            /**
145:             * The Blind Carbon Copy Recipient email address(es).  If multiple email addresses
146:             * were specified in the email, this will be a comma separated list.
147:             */
148:            private String Bcc;
149:
150:            /**
151:             * The email subject
152:             */
153:            private String Subject;
154:
155:            /**
156:             * the protocol type for reciving emails
157:             */
158:            private ReciveProtocolEnum protocol;
159:
160:            /**
161:             * for pop3 protocol, inbox folder can be only "INBOX"
162:             * but for imap we can fetch different folders
163:             */
164:            private String inboxFolder;
165:
166:            public EmailEndpoint() {
167:                this .handler = new EmailConsumerHandler(this );
168:            }
169:
170:            /**
171:             * @return the recordType
172:             */
173:            public String getRecordType() {
174:                return recordType;
175:            }
176:
177:            /**
178:             * @param recordType the recordType to set
179:             */
180:            public void setRecordType(String recordType) {
181:                this .recordType = recordType;
182:            }
183:
184:            /**
185:             * @return the charset
186:             */
187:            public String getCharset() {
188:                return Charset;
189:            }
190:
191:            /**
192:             * @param charset the charset to set
193:             */
194:            public void setCharset(String charset) {
195:                Charset = charset;
196:            }
197:
198:            /**
199:             * @return the host
200:             */
201:            public String getHost() {
202:                return Host;
203:            }
204:
205:            /**
206:             * @param host the host to set
207:             */
208:            public void setHost(String host) {
209:                Host = host;
210:            }
211:
212:            /**
213:             * @return the port
214:             */
215:            public String getPort() {
216:                return Port;
217:            }
218:
219:            /**
220:             * @param port the port to set
221:             */
222:            public void setPort(String port) {
223:                Port = port;
224:            }
225:
226:            /**
227:             * @return the user
228:             */
229:            public String getUser() {
230:                return User;
231:            }
232:
233:            /**
234:             * @param user the user to set
235:             */
236:            public void setUser(String user) {
237:                User = user;
238:            }
239:
240:            /**
241:             * @return the password
242:             */
243:            public String getPassword() {
244:                return Password;
245:            }
246:
247:            /**
248:             * @param password the password to set
249:             */
250:            public void setPassword(String password) {
251:                Password = password;
252:            }
253:
254:            /**
255:             * @return the attachmentDir
256:             */
257:            public String getAttachmentDir() {
258:                return attachmentDir;
259:            }
260:
261:            /**
262:             * @param attachmentDir the attachmentDir to set
263:             */
264:            public void setAttachmentDir(String attachmentDir) {
265:                this .attachmentDir = attachmentDir;
266:            }
267:
268:            /**
269:             * @return the pollingInterval
270:             */
271:            //    public long getPollingInterval() {
272:            //        return pollingInterval;
273:            //    }
274:            /**
275:             * @param pollingInterval the pollingInterval to set
276:             */
277:            //    public void setPollingInterval(long pollingInterval) {
278:            //        this.pollingInterval = pollingInterval;
279:            //    }
280:            /**
281:             * @param pollingInterval the pollingInterval to set
282:             */
283:            //    public void setPollingInterval(String pollingInterval) {
284:            //        if (pollingInterval != null && !"".equals(pollingInterval)) {
285:            //            this.pollingInterval = Long.parseLong(pollingInterval);
286:            //        }
287:            //    }
288:            /**
289:             * @return the pollingSchedule
290:             */
291:            public String getPollingSchedule() {
292:                return pollingSchedule;
293:            }
294:
295:            /**
296:             * @param pollingSchedule the pollingSchedule to set
297:             */
298:            public void setPollingSchedule(String pollingSchedule) {
299:                this .pollingSchedule = pollingSchedule;
300:            }
301:
302:            /**
303:             * @return the useSSL
304:             */
305:            public boolean getUseSSL() {
306:                return useSSL;
307:            }
308:
309:            /**
310:             * @param useSSL the useSSL to set
311:             */
312:            public void setUseSSL(boolean useSSL) {
313:                this .useSSL = useSSL;
314:            }
315:
316:            /**
317:             * @param useSSL the useSSL to set
318:             */
319:            public void setUseSSL(String useSSL) {
320:                if (useSSL != null && useSSL.compareToIgnoreCase("true") == 0) {
321:                    this .useSSL = true;
322:                }
323:            }
324:
325:            /**
326:             * @return the replyCharset
327:             */
328:            public String getReplyCharset() {
329:                return replyCharset;
330:            }
331:
332:            /**
333:             * @param replyCharset the replyCharset to set
334:             */
335:            public void setReplyCharset(String replyCharset) {
336:                this .replyCharset = replyCharset;
337:            }
338:
339:            /**
340:             * @return the replyHost
341:             */
342:            public String getReplyHost() {
343:                return replyHost;
344:            }
345:
346:            /**
347:             * @param replyHost the replyHost to set
348:             */
349:            public void setReplyHost(String replyHost) {
350:                this .replyHost = replyHost;
351:            }
352:
353:            /**
354:             * @return the replyPort
355:             */
356:            public String getReplyPort() {
357:                return replyPort;
358:            }
359:
360:            /**
361:             * @param replyPort the replyPort to set
362:             */
363:            public void setReplyPort(String replyPort) {
364:                this .replyPort = replyPort;
365:            }
366:
367:            /**
368:             * @return the replyUser
369:             */
370:            public String getReplyUser() {
371:                return replyUser;
372:            }
373:
374:            /**
375:             * @param replyUser the replyUser to set
376:             */
377:            public void setReplyUser(String replyUser) {
378:                this .replyUser = replyUser;
379:            }
380:
381:            /**
382:             * @return the replyPassword
383:             */
384:            public String getReplyPassword() {
385:                return replyPassword;
386:            }
387:
388:            /**
389:             * @param replyPassword the replyPassword to set
390:             */
391:            public void setReplyPassword(String replyPassword) {
392:                this .replyPassword = replyPassword;
393:            }
394:
395:            /**
396:             * @return the replyUseSSL
397:             */
398:            public boolean getReplyUseSSL() {
399:                return replyUseSSL;
400:            }
401:
402:            /**
403:             * @param replyUseSSL the replyUseSSL to set
404:             */
405:            public void setReplyUseSSL(boolean replyUseSSL) {
406:                this .replyUseSSL = replyUseSSL;
407:            }
408:
409:            /**
410:             * @param replyUseSSL the replyUseSSL to set
411:             */
412:            public void setReplyUseSSL(String replyUseSSL) {
413:                if (replyUseSSL != null
414:                        && replyUseSSL.compareToIgnoreCase("true") == 0) {
415:                    this .replyUseSSL = true;
416:                }
417:            }
418:
419:            /**
420:             * @return the from
421:             */
422:            public String getFrom() {
423:                return From;
424:            }
425:
426:            /**
427:             * @param from the from to set
428:             */
429:            public void setFrom(String from) {
430:                From = from;
431:            }
432:
433:            /**
434:             * @return the to
435:             */
436:            public String getTo() {
437:                return To;
438:            }
439:
440:            /**
441:             * @param to the to to set
442:             */
443:            public void setTo(String to) {
444:                To = to;
445:            }
446:
447:            /**
448:             * @return the cc
449:             */
450:            public String getCc() {
451:                return Cc;
452:            }
453:
454:            /**
455:             * @param cc the cc to set
456:             */
457:            public void setCc(String cc) {
458:                Cc = cc;
459:            }
460:
461:            /**
462:             * @return the bcc
463:             */
464:            public String getBcc() {
465:                return Bcc;
466:            }
467:
468:            /**
469:             * @param bcc the bcc to set
470:             */
471:            public void setBcc(String bcc) {
472:                Bcc = bcc;
473:            }
474:
475:            /**
476:             * @return the subject
477:             */
478:            public String getSubject() {
479:                return Subject;
480:            }
481:
482:            /**
483:             * @param subject the subject to set
484:             */
485:            public void setSubject(String subject) {
486:                Subject = subject;
487:            }
488:
489:            /* (non-Javadoc)
490:             * @see com.bostechcorp.cbesb.runtime.ccsl.jbi.messaging.BaseEndpoint#createProviderProcessor()
491:             */
492:            protected IComponentProcessor createProviderProcessor() {
493:                return new EmailProviderProcessor(this );
494:            }
495:
496:            /* (non-Javadoc)
497:             * @see com.bostechcorp.cbesb.runtime.ccsl.jbi.messaging.BaseEndpoint#createConsumerProcessor()
498:             */
499:            protected IComponentProcessor createConsumerProcessor() {
500:                //        return new EmailConsumerProcessor(this);
501:                return new CbEmbeddedSchedulerConsumerProcessor(this );
502:            }
503:
504:            /**********************************************************************************
505:             * These attributes and methods customize the LifeCycleEndpoint for this component
506:             ***********************************************************************************/
507:
508:            /*
509:             * The display parameters are general information for the admin console to display.
510:             */
511:            public String[] getDisplayParameterTitles() {
512:
513:                return new String[] { EmailPropertiesEnumeration.HOST.name(),
514:                        EmailPropertiesEnumeration.PORT.name(),
515:                        EmailPropertiesEnumeration.USER.name(),
516:                        EmailPropertiesEnumeration.USE_SSL.name(),
517:                        EmailPropertiesEnumeration.SUBJECT.name() };
518:
519:            }
520:
521:            /*
522:             * The values returned here correspond to the titles above.
523:             */
524:            public String[] getDisplayParameters() {
525:                return new String[] {
526:                        EmailPropertiesEnumeration.HOST.getValue(this ),
527:                        EmailPropertiesEnumeration.PORT.getValue(this ),
528:                        EmailPropertiesEnumeration.USER.getValue(this ),
529:                        EmailPropertiesEnumeration.USE_SSL.getValue(this ),
530:                        EmailPropertiesEnumeration.SUBJECT.getValue(this ) };
531:            }
532:
533:            /*
534:             * This returns a list of properties that can be read.
535:             */
536:            public String[] getGetableProperties() {
537:                EmailPropertiesEnumeration[] fps = EmailPropertiesEnumeration
538:                        .values();
539:                List<String> result = new ArrayList<String>();
540:                for (int i = 0; i < fps.length; i++) {
541:                    result.add(fps[i].name());
542:                }
543:                String[] sr = new String[result.size()];
544:                return result.toArray(sr);
545:            }
546:
547:            /*
548:             * This gets one property from the list above.
549:             */
550:            public String getProperty(int index) {
551:                return EmailPropertiesEnumeration.values()[index]
552:                        .getValue(this );
553:            }
554:
555:            /*
556:             * This gets one property from the list above.
557:             */
558:            public String getProperty(String property) {
559:                return EmailPropertiesEnumeration.valueOf(property).getValue(
560:                        this );
561:            }
562:
563:            /*
564:             * This returns a list of properties that can be set.
565:             */
566:            public String[] getSetableProperties() {
567:                EmailPropertiesEnumeration[] fps = EmailPropertiesEnumeration
568:                        .values();
569:                List<String> result = new ArrayList<String>();
570:                for (int i = 0; i < fps.length; i++) {
571:                    if (fps[i].isSetable())
572:                        result.add(fps[i].name());
573:                }
574:                String[] sr = new String[result.size()];
575:                return result.toArray(sr);
576:            }
577:
578:            /*
579:             * This sets one property from the list above.
580:             */
581:            public void setProperty(int index, String value) {
582:                EmailPropertiesEnumeration.values()[index]
583:                        .setValue(this , value);
584:            }
585:
586:            /*
587:             * This sets one property from the list above.
588:             */
589:            public void setProperty(String property, String value) {
590:                EmailPropertiesEnumeration.valueOf(property).setValue(this ,
591:                        value);
592:            }
593:
594:            /**
595:             * @return the inboxFolder
596:             */
597:            public String getInboxFolder() {
598:                return inboxFolder;
599:            }
600:
601:            /**
602:             * @param inboxFolder the inboxFolder to set
603:             */
604:            public void setInboxFolder(String inboxFolder) {
605:                this .inboxFolder = inboxFolder;
606:            }
607:
608:            /**
609:             * @return the protocol
610:             */
611:            public ReciveProtocolEnum getProtocol() {
612:                return protocol;
613:            }
614:
615:            /**
616:             * @param protocol the protocol to set
617:             */
618:            public void setProtocol(ReciveProtocolEnum protocol) {
619:                this .protocol = protocol;
620:            }
621:
622:            /**************************************************
623:             * Done with LifeCycleEndpoint methods
624:             ***************************************************/
625:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.