Source Code Cross Referenced for CachedHeaderfields.java in  » Mail-Clients » columba-1.4 » org » columba » mail » folder » headercache » 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 » Mail Clients » columba 1.4 » org.columba.mail.folder.headercache 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        // The contents of this file are subject to the Mozilla Public License Version
002:        // 1.1
003:        //(the "License"); you may not use this file except in compliance with the
004:        //License. You may obtain a copy of the License at http://www.mozilla.org/MPL/
005:        //
006:        //Software distributed under the License is distributed on an "AS IS" basis,
007:        //WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
008:        //for the specific language governing rights and
009:        //limitations under the License.
010:        //
011:        //The Original Code is "The Columba Project"
012:        //
013:        //The Initial Developers of the Original Code are Frederik Dietz and Timo
014:        // Stich.
015:        //Portions created by Frederik Dietz and Timo Stich are Copyright (C) 2003.
016:        //
017:        //All Rights Reserved.
018:        package org.columba.mail.folder.headercache;
019:
020:        import java.awt.Color;
021:        import java.util.Date;
022:
023:        import org.columba.mail.message.ColumbaHeader;
024:        import org.columba.mail.message.IColumbaHeader;
025:        import org.columba.ristretto.message.Address;
026:
027:        /**
028:         * 
029:         * 
030:         * Holds a collection of all cached headerfields, which Columba needs to be able
031:         * to quickly show the message summary, etc. to the user.
032:         * 
033:         * @author fdietz
034:         */
035:        public class CachedHeaderfields {
036:
037:            // internally used headerfields
038:            // these are all boolean values, which are saved using
039:            // a single int value
040:            public static final String[] INTERNAL_COMPRESSED_HEADERFIELDS = {
041:
042:                    // message flags
043:                    "columba.flags.seen", "columba.flags.recent",
044:                    "columba.flags.answered", "columba.flags.flagged",
045:                    "columba.flags.expunged", "columba.flags.draft",
046:                    //	true, if message has attachments, false otherwise
047:                    "columba.attachment",
048:                    //	true/false
049:                    "columba.spam" };
050:
051:            // this internally used headerfields can be of every basic
052:            // type, including String, Integer, Boolean, Date, etc.
053:            public static final String[] INTERNAL_HEADERFIELDS = {
054:
055:            // priority as integer value
056:                    "columba.priority",
057:                    // short from, containing only name of person
058:                    "columba.from",
059:                    // host from which this message was downloaded
060:                    "columba.host",
061:                    // date
062:                    "columba.date",
063:                    // size of message
064:                    "columba.size",
065:                    // properly decoded subject
066:                    "columba.subject",
067:                    // message color
068:                    "columba.color",
069:                    // account ID
070:                    "columba.accountuid",
071:                    // to
072:                    "columba.to",
073:                    // Cc
074:                    "columba.cc" };
075:
076:            public static final Class[] INTERNAL_HEADERFIELDS_TYPE = {
077:                    Integer.class, Address.class, String.class, Date.class,
078:                    Integer.class, String.class, Color.class, Integer.class,
079:                    Address.class, String.class };
080:
081:            // these are cached by default
082:            public static final String[] DEFAULT_HEADERFIELDS = { "Subject",
083:                    "From", "To", "Cc", "Date", "Message-ID", "In-Reply-To",
084:                    "References", "Content-Type" };
085:
086:            public static final String[] POP3_HEADERFIELDS = { "Subject",
087:                    "From", "columba.date", "columba.size",
088:                    // POP3 message UID
089:                    "columba.pop3uid",
090:                    // was this message already fetched from the server?
091:                    "columba.alreadyfetched" };
092:
093:            public static final Class[] POP3_HEADERFIELDS_TYPE = {
094:                    String.class, String.class, Date.class, Integer.class,
095:                    String.class, Boolean.class };
096:
097:            /**
098:             * No need for creating instances of this class.
099:             */
100:            private CachedHeaderfields() {
101:            }
102:
103:            /**
104:             * 
105:             * create new header which only contains headerfields needed by Columba
106:             * (meaning they also get cached)
107:             * 
108:             * @param h
109:             * @return
110:             */
111:            public static IColumbaHeader stripHeaders(IColumbaHeader h) {
112:                //return h;
113:                IColumbaHeader strippedHeader = new ColumbaHeader();
114:
115:                //		copy all internally used headerfields
116:                for (int i = 0; i < DEFAULT_HEADERFIELDS.length; i++) {
117:                    if (h.get(DEFAULT_HEADERFIELDS[i]) != null) {
118:
119:                        strippedHeader.set(DEFAULT_HEADERFIELDS[i], h
120:                                .get(DEFAULT_HEADERFIELDS[i]));
121:                    }
122:                }
123:
124:                for (int i = 0; i < INTERNAL_HEADERFIELDS.length; i++) {
125:                    if (h.get(INTERNAL_HEADERFIELDS[i]) != null) {
126:                        strippedHeader.set(INTERNAL_HEADERFIELDS[i], h
127:                                .get(INTERNAL_HEADERFIELDS[i]));
128:                    }
129:                }
130:
131:                for (int i = 0; i < INTERNAL_COMPRESSED_HEADERFIELDS.length; i++) {
132:                    if (h.get(INTERNAL_COMPRESSED_HEADERFIELDS[i]) != null) {
133:                        strippedHeader.set(INTERNAL_COMPRESSED_HEADERFIELDS[i],
134:                                h.get(INTERNAL_COMPRESSED_HEADERFIELDS[i]));
135:                    }
136:                }
137:
138:                return strippedHeader;
139:            }
140:
141:            public static String[] getDefaultHeaderfields() {
142:                String[] result = new String[DEFAULT_HEADERFIELDS.length];
143:                System.arraycopy(DEFAULT_HEADERFIELDS, 0, result, 0,
144:                        DEFAULT_HEADERFIELDS.length);
145:                return result;
146:            }
147:        };
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.