Source Code Cross Referenced for ProcessorAbstract.java in  » Web-Mail » james-2.3.1 » org » apache » james » fetchmail » 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 » Web Mail » james 2.3.1 » org.apache.james.fetchmail 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /****************************************************************
002:         * Licensed to the Apache Software Foundation (ASF) under one   *
003:         * or more contributor license agreements.  See the NOTICE file *
004:         * distributed with this work for additional information        *
005:         * regarding copyright ownership.  The ASF licenses this file   *
006:         * to you under the Apache License, Version 2.0 (the            *
007:         * "License"); you may not use this file except in compliance   *
008:         * with the License.  You may obtain a copy of the License at   *
009:         *                                                              *
010:         *   http://www.apache.org/licenses/LICENSE-2.0                 *
011:         *                                                              *
012:         * Unless required by applicable law or agreed to in writing,   *
013:         * software distributed under the License is distributed on an  *
014:         * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
015:         * KIND, either express or implied.  See the License for the    *
016:         * specific language governing permissions and limitations      *
017:         * under the License.                                           *
018:         ****************************************************************/package org.apache.james.fetchmail;
019:
020:        import java.util.List;
021:        import java.util.Set;
022:
023:        import javax.mail.MessagingException;
024:        import javax.mail.Session;
025:
026:        import org.apache.avalon.framework.logger.Logger;
027:        import org.apache.james.services.MailServer;
028:        import org.apache.mailet.MailAddress;
029:        import org.apache.james.services.UsersRepository;
030:
031:        /**
032:         * <p>Class <code>ProcessorAbstract</code> is an abstract class that
033:         * provides support for JavaMail processors. Concrete implementations are
034:         * required to implement the abstract method <code>void process()</code> to
035:         * process a JavaMail element.</p>
036:         * 
037:         * <p>Typically, processors are chained. A Store processor delegates to a Folder
038:         * processor that delegates to a Message processor.</p>
039:         * 
040:         * <p><code>ProcessorAbstract</code> wraps an Account - see 
041:         * <code>org.apache.james.fetchmail.Account</code>
042:         * - providing contextual information about the environment for the processor.</p>
043:         * 
044:         * <p>Creation Date: 27-May-03</p>
045:         * 
046:         */
047:        abstract public class ProcessorAbstract {
048:            /**
049:             * The prefix to place in front of any mail attributes used by this Processor.
050:             */
051:            private String fieldAttributePrefix;
052:
053:            /**
054:             * The Account for this task
055:             */
056:            private Account fieldAccount;
057:
058:            /**
059:             * Constructor for ProcessorAbstract.
060:             */
061:            private ProcessorAbstract() {
062:                super ();
063:            }
064:
065:            /**
066:             * Constructor for ProcessorAbstract.
067:             * @param account The <code>Account</code> to be processed 
068:             */
069:            protected ProcessorAbstract(Account account) {
070:                this ();
071:                setAccount(account);
072:            }
073:
074:            /**
075:             * Returns the defaultDomainName.
076:             * @return String
077:             */
078:            protected String getDefaultDomainName() {
079:                return getConfiguration().getDefaultDomainName();
080:            }
081:
082:            /**
083:             * Returns the defaultLocalPart.
084:             * 
085:             * @return String
086:             */
087:            protected String getDefaultLocalPart() {
088:                // TODO Consider making this configurable
089:                return "FETCHMAIL-SERVICE";
090:            }
091:
092:            /**
093:             * Returns the message ids. of messages for which processing has been
094:             * deferred as the recipient could not be found
095:             * @return List
096:             */
097:            protected List getDeferredRecipientNotFoundMessageIDs() {
098:                return getAccount().getDeferredRecipientNotFoundMessageIDs();
099:            }
100:
101:            /**
102:             * Returns the fetchTaskName.
103:             * @return String
104:             */
105:            protected String getFetchTaskName() {
106:                return getConfiguration().getFetchTaskName();
107:            }
108:
109:            /**
110:             * Returns the host.
111:             * @return String
112:             */
113:            protected String getHost() {
114:                return getConfiguration().getHost();
115:            }
116:
117:            /**
118:             * Returns the javaMailFolderName.
119:             * @return String
120:             */
121:            protected String getJavaMailFolderName() {
122:                return getConfiguration().getJavaMailFolderName();
123:            }
124:
125:            /**
126:             * Returns the javaMailProviderName.
127:             * @return String
128:             */
129:            protected String getJavaMailProviderName() {
130:                return getConfiguration().getJavaMailProviderName();
131:            }
132:
133:            /**
134:             * Returns the logger.
135:             * @return Logger
136:             */
137:            protected Logger getLogger() {
138:                return getConfiguration().getLogger();
139:            }
140:
141:            /**
142:             * Returns the password.
143:             * @return String
144:             */
145:            protected String getPassword() {
146:                return getAccount().getPassword();
147:            }
148:
149:            /**
150:             * Returns the recipient.
151:             * @return MailAddress
152:             */
153:            protected MailAddress getRecipient() {
154:                return getAccount().getRecipient();
155:            }
156:
157:            /**
158:             * Method getRemoteReceivedHeaderIndex.
159:             * @return int
160:             */
161:            protected int getRemoteReceivedHeaderIndex() {
162:                return getConfiguration().getRemoteReceivedHeaderIndex();
163:            }
164:
165:            /**
166:             * Returns the server.
167:             * @return MailServer
168:             */
169:            protected MailServer getServer() {
170:                return getConfiguration().getServer();
171:            }
172:
173:            /**
174:             * Returns the session.
175:             * @return Session
176:             */
177:            protected Session getSession() {
178:                return getAccount().getSession();
179:            }
180:
181:            /**
182:             * Returns the repository of local users.
183:             * @return UsersRepository
184:             */
185:            protected UsersRepository getLocalUsers() {
186:                return getConfiguration().getLocalUsers();
187:            }
188:
189:            /**
190:             * Returns the user.
191:             * @return String
192:             */
193:            protected String getUser() {
194:                return getAccount().getUser();
195:            }
196:
197:            /**
198:             * Returns the fetchAll.
199:             * @return boolean
200:             */
201:            protected boolean isFetchAll() {
202:                return getConfiguration().isFetchAll();
203:            }
204:
205:            /**
206:             * Returns the isDeferRecipientNotFound.
207:             * @return boolean
208:             */
209:            protected boolean isDeferRecipientNotFound() {
210:                return getConfiguration().isDeferRecipientNotFound();
211:            }
212:
213:            /**
214:             * Returns the ignoreOriginalRecipient.
215:             * @return boolean
216:             */
217:            protected boolean isIgnoreRecipientHeader() {
218:                return getAccount().isIgnoreRecipientHeader();
219:            }
220:
221:            /**
222:             * Returns the customRecipientHeader.
223:             * @return String
224:             */
225:            protected String getCustomRecipientHeader() {
226:                return getAccount().getCustomRecipientHeader();
227:            }
228:
229:            /**
230:             * Returns the leave.
231:             * @return boolean
232:             */
233:            protected boolean isLeave() {
234:                return getConfiguration().isLeave();
235:            }
236:
237:            /**
238:             * Returns the markSeen.
239:             * @return boolean
240:             */
241:            protected boolean isMarkSeen() {
242:                return getConfiguration().isMarkSeen();
243:            }
244:
245:            /**
246:             * Returns the leaveBlacklisted.
247:             * @return boolean
248:             */
249:            protected boolean isLeaveBlacklisted() {
250:                return getConfiguration().isLeaveBlacklisted();
251:            }
252:
253:            /**
254:             * Returns the leaveRemoteRecipient.
255:             * @return boolean
256:             */
257:            protected boolean isLeaveRemoteRecipient() {
258:                return getConfiguration().isLeaveRemoteRecipient();
259:            }
260:
261:            /**
262:             * Returns the leaveUserUndefinded.
263:             * @return boolean
264:             */
265:            protected boolean isLeaveUserUndefined() {
266:                return getConfiguration().isLeaveUserUndefined();
267:            }
268:
269:            /**
270:             * Returns the leaveRemoteReceivedHeaderInvalid.
271:             * @return boolean
272:             */
273:            protected boolean isLeaveRemoteReceivedHeaderInvalid() {
274:                return getConfiguration().isLeaveRemoteReceivedHeaderInvalid();
275:            }
276:
277:            /**
278:             * Returns the LeaveMaxMessageSizeExceeded.
279:             * @return boolean
280:             */
281:            protected boolean isLeaveMaxMessageSizeExceeded() {
282:                return getConfiguration().isLeaveMaxMessageSizeExceeded();
283:            }
284:
285:            /**
286:             * Returns the leaveUndeliverable.
287:             * @return boolean
288:             */
289:            protected boolean isLeaveUndeliverable() {
290:                return getConfiguration().isLeaveUndeliverable();
291:            }
292:
293:            /**
294:             * Returns the RejectUserUndefinded.
295:             * @return boolean
296:             */
297:            protected boolean isRejectUserUndefined() {
298:                return getConfiguration().isRejectUserUndefined();
299:            }
300:
301:            /**
302:             * Returns the RejectRemoteReceivedHeaderInvalid.
303:             * @return boolean
304:             */
305:            protected boolean isRejectRemoteReceivedHeaderInvalid() {
306:                return getConfiguration().isRejectRemoteReceivedHeaderInvalid();
307:            }
308:
309:            /**
310:             * Returns the RejectMaxMessageSizeExceeded.
311:             * @return boolean
312:             */
313:            protected boolean isRejectMaxMessageSizeExceeded() {
314:                return getConfiguration().isRejectMaxMessageSizeExceeded();
315:            }
316:
317:            /**
318:             * Returns the RejectUserBlacklisted.
319:             * @return boolean
320:             */
321:            protected boolean isRejectBlacklisted() {
322:                return getConfiguration().isRejectBlacklisted();
323:            }
324:
325:            /**
326:             * Returns the RejectRemoteRecipient.
327:             * @return boolean
328:             */
329:            protected boolean isRejectRemoteRecipient() {
330:                return getConfiguration().isRejectRemoteRecipient();
331:            }
332:
333:            /**
334:             * Returns the markBlacklistedSeen.
335:             * @return boolean
336:             */
337:            protected boolean isMarkBlacklistedSeen() {
338:                return getConfiguration().isMarkBlacklistedSeen();
339:            }
340:
341:            /**
342:             * Returns the markRecipientNotFoundSeen.
343:             * @return boolean
344:             */
345:            protected boolean isMarkRecipientNotFoundSeen() {
346:                return getConfiguration().isMarkRecipientNotFoundSeen();
347:            }
348:
349:            /**
350:             * Returns the leaveRecipientNotFound.
351:             * @return boolean
352:             */
353:            protected boolean isLeaveRecipientNotFound() {
354:                return getConfiguration().isLeaveRecipientNotFound();
355:            }
356:
357:            /**
358:             * Returns the rejectRecipientNotFound.
359:             * @return boolean
360:             */
361:            protected boolean isRejectRecipientNotFound() {
362:                return getConfiguration().isRejectRecipientNotFound();
363:            }
364:
365:            /**
366:             * Returns the markRemoteRecipientSeen.
367:             * @return boolean
368:             */
369:            protected boolean isMarkRemoteRecipientSeen() {
370:                return getConfiguration().isMarkRemoteRecipientSeen();
371:            }
372:
373:            /**
374:             * Returns the markUserUndefindedSeen.
375:             * @return boolean
376:             */
377:            protected boolean isMarkUserUndefinedSeen() {
378:                return getConfiguration().isMarkUserUndefinedSeen();
379:            }
380:
381:            /**
382:             * Returns the markRemoteReceivedHeaderInvalidSeen.
383:             * @return boolean
384:             */
385:            protected boolean isMarkRemoteReceivedHeaderInvalidSeen() {
386:                return getConfiguration()
387:                        .isMarkRemoteReceivedHeaderInvalidSeen();
388:            }
389:
390:            /**
391:             * Returns the MarkMaxMessageSizeExceededSeen.
392:             * @return boolean
393:             */
394:            protected boolean isMarkMaxMessageSizeExceededSeen() {
395:                return getConfiguration().isMarkMaxMessageSizeExceededSeen();
396:            }
397:
398:            /**
399:             * Returns the markUndeliverableSeen.
400:             * @return boolean
401:             */
402:            protected boolean isMarkUndeliverableSeen() {
403:                return getConfiguration().isMarkUndeliverableSeen();
404:            }
405:
406:            /**
407:             * Answers true if the folder should be opened read only.
408:             * For this to be true... 
409:             * - isKeep() must be true
410:             * - isMarkSeen() must be false
411:             * @return boolean
412:             */
413:            protected boolean isOpenReadOnly() {
414:                return getConfiguration().isOpenReadOnly();
415:            }
416:
417:            /**
418:             * Returns the recurse.
419:             * @return boolean
420:             */
421:            protected boolean isRecurse() {
422:                return getConfiguration().isRecurse();
423:            }
424:
425:            /**
426:             * Process the mail elements of the receiver
427:             */
428:            abstract public void process() throws MessagingException;
429:
430:            /**
431:             * Returns the blacklist.
432:             * @return Set
433:             */
434:            protected Set getBlacklist() {
435:                return getConfiguration().getBlacklist();
436:            }
437:
438:            /**
439:             * Returns the <code>ParsedConfiguration</code> from the <code>Account</code>.
440:             * @return ParsedConfiguration
441:             */
442:            protected ParsedConfiguration getConfiguration() {
443:                return getAccount().getParsedConfiguration();
444:            }
445:
446:            /**
447:             * Returns a lazy initialised attributePrefix.
448:             * @return String
449:             */
450:            protected String getAttributePrefix() {
451:                String value = null;
452:                if (null == (value = getAttributePrefixBasic())) {
453:                    updateAttributePrefix();
454:                    return getAttributePrefix();
455:                }
456:                return value;
457:            }
458:
459:            /**
460:             * Returns the attributePrefix.
461:             * @return String
462:             */
463:            private String getAttributePrefixBasic() {
464:                return fieldAttributePrefix;
465:            }
466:
467:            /**
468:             * Returns the computed attributePrefix.
469:             * @return String
470:             */
471:            protected String computeAttributePrefix() {
472:                return getClass().getPackage().getName() + ".";
473:            }
474:
475:            /**
476:             * Sets the attributePrefix.
477:             * @param attributePrefix The attributePrefix to set
478:             */
479:            protected void setAttributePrefix(String attributePrefix) {
480:                fieldAttributePrefix = attributePrefix;
481:            }
482:
483:            /**
484:             * Updates the attributePrefix.
485:             */
486:            protected void updateAttributePrefix() {
487:                setAttributePrefix(computeAttributePrefix());
488:            }
489:
490:            /**
491:             * Returns the account.
492:             * @return Account
493:             */
494:            public Account getAccount() {
495:                return fieldAccount;
496:            }
497:
498:            /**
499:             * Sets the account.
500:             * @param account The account to set
501:             */
502:            protected void setAccount(Account account) {
503:                fieldAccount = account;
504:            }
505:
506:            /**
507:             * Returns the getMaxMessageSizeLimit.
508:             * @return int
509:             */
510:            protected int getMaxMessageSizeLimit() {
511:                return getConfiguration().getMaxMessageSizeLimit();
512:            }
513:
514:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.