Source Code Cross Referenced for Account.java in  » Net » 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 » Net » 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.ArrayList;
021:        import java.util.List;
022:
023:        import javax.mail.Session;
024:        import javax.mail.internet.ParseException;
025:
026:        import org.apache.avalon.framework.configuration.ConfigurationException;
027:        import org.apache.mailet.MailAddress;
028:
029:        /**
030:         * <p>Class <code>Account</code> encapsulates the account details required to
031:         * fetch mail from a message store.</p>
032:         * 
033:         * <p>Instances are <code>Comparable</code> based on their sequence number.</p>
034:         * 
035:         * <p>Creation Date: 05-Jun-03</p>
036:         */
037:        class Account implements  Comparable {
038:            /**
039:             * The user password for this account
040:             */
041:            private String fieldPassword;
042:
043:            /**
044:             * The user to send the fetched mail to
045:             */
046:            private MailAddress fieldRecipient;
047:
048:            /**
049:             * The user name for this account
050:             */
051:            private String fieldUser;
052:
053:            /**
054:             * The ParsedConfiguration
055:             */
056:            private ParsedConfiguration fieldParsedConfiguration;
057:
058:            /**
059:             * List of MessageIDs for which processing has been deferred
060:             * because the intended recipient could not be found.
061:             */
062:            private List fieldDeferredRecipientNotFoundMessageIDs;
063:
064:            /**
065:             * The sequence number for this account
066:             */
067:            private int fieldSequenceNumber;
068:
069:            /**
070:             * Ignore the recipient deduced from the header and use 'fieldRecipient'
071:             */
072:            private boolean fieldIgnoreRecipientHeader;
073:
074:            /**
075:             * The JavaMail Session for this Account.
076:             */
077:            private Session fieldSession;
078:
079:            /**
080:             * A custom header to be used as the recipient address
081:             */
082:            private String customRecipientHeader;
083:
084:            /**
085:             * Constructor for Account.
086:             */
087:            private Account() {
088:                super ();
089:            }
090:
091:            /**
092:             * Constructor for Account.
093:             * 
094:             * @param sequenceNumber
095:             * @param parsedConfiguration
096:             * @param user
097:             * @param password
098:             * @param recipient
099:             * @param ignoreRecipientHeader
100:             * @param session
101:             * @throws ConfigurationException
102:             */
103:
104:            public Account(int sequenceNumber,
105:                    ParsedConfiguration parsedConfiguration, String user,
106:                    String password, String recipient,
107:                    boolean ignoreRecipientHeader,
108:                    String customRecipientHeader, Session session)
109:                    throws ConfigurationException {
110:                this ();
111:                setSequenceNumber(sequenceNumber);
112:                setParsedConfiguration(parsedConfiguration);
113:                setUser(user);
114:                setPassword(password);
115:                setRecipient(recipient);
116:                setIgnoreRecipientHeader(ignoreRecipientHeader);
117:                setCustomRecipientHeader(customRecipientHeader);
118:                setSession(session);
119:            }
120:
121:            /**
122:             * Returns the custom recipient header.
123:             * @return String
124:             */
125:            public String getCustomRecipientHeader() {
126:                return this .customRecipientHeader;
127:            }
128:
129:            /**
130:             * Returns the password.
131:             * @return String
132:             */
133:            public String getPassword() {
134:                return fieldPassword;
135:            }
136:
137:            /**
138:             * Returns the recipient.
139:             * @return MailAddress
140:             */
141:            public MailAddress getRecipient() {
142:                return fieldRecipient;
143:            }
144:
145:            /**
146:             * Returns the user.
147:             * @return String
148:             */
149:            public String getUser() {
150:                return fieldUser;
151:            }
152:
153:            /**
154:             * Sets the custom recipient header.
155:             * @param customRecipientHeader The header to be used
156:             */
157:            public void setCustomRecipientHeader(String customRecipientHeader) {
158:                this .customRecipientHeader = customRecipientHeader;
159:            }
160:
161:            /**
162:             * Sets the password.
163:             * @param password The password to set
164:             */
165:            protected void setPassword(String password) {
166:                fieldPassword = password;
167:            }
168:
169:            /**
170:             * Sets the recipient.
171:             * @param recipient The recipient to set
172:             */
173:            protected void setRecipient(MailAddress recipient) {
174:                fieldRecipient = recipient;
175:            }
176:
177:            /**
178:             * Sets the recipient.
179:             * @param recipient The recipient to set
180:             */
181:            protected void setRecipient(String recipient)
182:                    throws ConfigurationException {
183:                if (null == recipient) {
184:                    fieldRecipient = null;
185:                    return;
186:                }
187:
188:                try {
189:                    setRecipient(new MailAddress(recipient));
190:                } catch (ParseException pe) {
191:                    throw new ConfigurationException(
192:                            "Invalid recipient address specified: " + recipient);
193:                }
194:            }
195:
196:            /**
197:             * Sets the user.
198:             * @param user The user to set
199:             */
200:            protected void setUser(String user) {
201:                fieldUser = user;
202:            }
203:
204:            /**
205:             * Sets the ignoreRecipientHeader.
206:             * @param ignoreRecipientHeader The ignoreRecipientHeader to set
207:             */
208:            protected void setIgnoreRecipientHeader(
209:                    boolean ignoreRecipientHeader) {
210:                fieldIgnoreRecipientHeader = ignoreRecipientHeader;
211:            }
212:
213:            /**
214:             * Returns the ignoreRecipientHeader.
215:             * @return boolean
216:             */
217:            public boolean isIgnoreRecipientHeader() {
218:                return fieldIgnoreRecipientHeader;
219:            }
220:
221:            /**
222:             * Returns the sequenceNumber.
223:             * @return int
224:             */
225:            public int getSequenceNumber() {
226:                return fieldSequenceNumber;
227:            }
228:
229:            /**
230:             * Sets the sequenceNumber.
231:             * @param sequenceNumber The sequenceNumber to set
232:             */
233:            protected void setSequenceNumber(int sequenceNumber) {
234:                fieldSequenceNumber = sequenceNumber;
235:            }
236:
237:            /**
238:             * Compares this object with the specified object for order.  Returns a
239:             * negative integer, zero, or a positive integer if this object is less
240:             * than, equal to, or greater than the specified object.
241:             * 
242:             * @see java.lang.Comparable#compareTo(Object)
243:             */
244:            public int compareTo(Object o) {
245:                return getSequenceNumber() - ((Account) o).getSequenceNumber();
246:            }
247:
248:            /**
249:             * Returns the deferredRecipientNotFoundMessageIDs. lazily initialised.
250:             * @return List
251:             */
252:            public List getDeferredRecipientNotFoundMessageIDs() {
253:                List messageIDs = null;
254:                if (null == (messageIDs = getDeferredRecipientNotFoundMessageIDsBasic())) {
255:                    updateDeferredRecipientNotFoundMessageIDs();
256:                    return getDeferredRecipientNotFoundMessageIDs();
257:                }
258:                return messageIDs;
259:            }
260:
261:            /**
262:             * Returns the deferredRecipientNotFoundMessageIDs.
263:             * @return List
264:             */
265:            private List getDeferredRecipientNotFoundMessageIDsBasic() {
266:                return fieldDeferredRecipientNotFoundMessageIDs;
267:            }
268:
269:            /**
270:             * Returns a new List of deferredRecipientNotFoundMessageIDs.
271:             * @return List
272:             */
273:            protected List computeDeferredRecipientNotFoundMessageIDs() {
274:                return new ArrayList(16);
275:            }
276:
277:            /**
278:             * Updates the deferredRecipientNotFoundMessageIDs.
279:             */
280:            protected void updateDeferredRecipientNotFoundMessageIDs() {
281:                setDeferredRecipientNotFoundMessageIDs(computeDeferredRecipientNotFoundMessageIDs());
282:            }
283:
284:            /**
285:             * Sets the defferedRecipientNotFoundMessageIDs.
286:             * @param defferedRecipientNotFoundMessageIDs The defferedRecipientNotFoundMessageIDs to set
287:             */
288:            protected void setDeferredRecipientNotFoundMessageIDs(
289:                    List defferedRecipientNotFoundMessageIDs) {
290:                fieldDeferredRecipientNotFoundMessageIDs = defferedRecipientNotFoundMessageIDs;
291:            }
292:
293:            /**
294:             * Returns the parsedConfiguration.
295:             * @return ParsedConfiguration
296:             */
297:            public ParsedConfiguration getParsedConfiguration() {
298:                return fieldParsedConfiguration;
299:            }
300:
301:            /**
302:             * Sets the parsedConfiguration.
303:             * @param parsedConfiguration The parsedConfiguration to set
304:             */
305:            protected void setParsedConfiguration(
306:                    ParsedConfiguration parsedConfiguration) {
307:                fieldParsedConfiguration = parsedConfiguration;
308:            }
309:
310:            /**
311:             * Returns the session.
312:             * @return Session
313:             */
314:            public Session getSession() {
315:                return fieldSession;
316:            }
317:
318:            /**
319:             * Sets the session.
320:             * @param session The session to set
321:             */
322:            protected void setSession(Session session) {
323:                fieldSession = session;
324:            }
325:
326:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.