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


001:        package org.columba.mail.imap;
002:
003:        import java.io.IOException;
004:        import java.io.InputStream;
005:        import java.util.ArrayList;
006:        import java.util.List;
007:        import java.util.Observable;
008:
009:        import org.columba.api.command.IStatusObservable;
010:        import org.columba.core.command.CommandCancelledException;
011:        import org.columba.core.filter.FilterRule;
012:        import org.columba.core.filter.IFilterRule;
013:        import org.columba.core.xml.XmlElement;
014:        import org.columba.mail.config.ImapItem;
015:        import org.columba.mail.folder.headercache.MemoryHeaderList;
016:        import org.columba.mail.folder.imap.IMAPFolder;
017:        import org.columba.mail.message.IColumbaHeader;
018:        import org.columba.mail.message.IHeaderList;
019:        import org.columba.ristretto.imap.IMAPException;
020:        import org.columba.ristretto.imap.IMAPFlags;
021:        import org.columba.ristretto.imap.ListInfo;
022:        import org.columba.ristretto.imap.MailboxStatus;
023:        import org.columba.ristretto.imap.NamespaceCollection;
024:        import org.columba.ristretto.imap.SearchKey;
025:        import org.columba.ristretto.imap.SequenceSet;
026:        import org.columba.ristretto.message.Header;
027:        import org.columba.ristretto.message.MailboxInfo;
028:        import org.columba.ristretto.message.MimeTree;
029:
030:        public class TestServer implements  IImapServer {
031:
032:            private MailboxStatus status;
033:            private IHeaderList headerList;
034:            private ArrayList<IColumbaHeader> indices;
035:
036:            public TestServer(MailboxStatus status) {
037:                super ();
038:                this .status = status;
039:                indices = new ArrayList<IColumbaHeader>();
040:                headerList = new MemoryHeaderList();
041:            }
042:
043:            public void addHeader(IColumbaHeader h, Object uid) {
044:                headerList.add(h, uid);
045:                indices.add(h);
046:            }
047:
048:            public IColumbaHeader removeHeader(int index) {
049:                IColumbaHeader h = indices.remove(index - 1);
050:                headerList.remove(h.get("columba.uid"));
051:
052:                return h;
053:            }
054:
055:            public String getDelimiter() throws IOException, IMAPException,
056:                    CommandCancelledException {
057:                // TODO Auto-generated method stub
058:                return null;
059:            }
060:
061:            public void logout() throws Exception {
062:                // TODO Auto-generated method stub
063:
064:            }
065:
066:            public List checkSupportedAuthenticationMethods()
067:                    throws IOException {
068:                // TODO Auto-generated method stub
069:                return null;
070:            }
071:
072:            public boolean isSupported(String command) throws IOException {
073:                // TODO Auto-generated method stub
074:                return false;
075:            }
076:
077:            public void setFirstLoginAction(IFirstLoginAction action) {
078:                // TODO Auto-generated method stub
079:
080:            }
081:
082:            public void ensureSelectedState(IMAPFolder folder)
083:                    throws IOException, IMAPException,
084:                    CommandCancelledException {
085:                // TODO Auto-generated method stub
086:
087:            }
088:
089:            public MailboxStatus getStatus(IMAPFolder folder)
090:                    throws IOException, IMAPException,
091:                    CommandCancelledException {
092:                return status;
093:            }
094:
095:            public ListInfo[] list(String reference, String pattern)
096:                    throws Exception {
097:                // TODO Auto-generated method stub
098:                return null;
099:            }
100:
101:            public Integer append(InputStream messageSource, IMAPFlags flags,
102:                    IMAPFolder folder) throws Exception {
103:                // TODO Auto-generated method stub
104:                return null;
105:            }
106:
107:            public Integer append(InputStream messageSource, IMAPFolder folder)
108:                    throws Exception {
109:                // TODO Auto-generated method stub
110:                return null;
111:            }
112:
113:            public void createMailbox(String mailboxName, IMAPFolder folder)
114:                    throws IOException, IMAPException,
115:                    CommandCancelledException {
116:                // TODO Auto-generated method stub
117:
118:            }
119:
120:            public void deleteFolder(String path) throws Exception {
121:                // TODO Auto-generated method stub
122:
123:            }
124:
125:            public void renameFolder(String oldMailboxName,
126:                    String newMailboxName) throws IOException, IMAPException,
127:                    CommandCancelledException {
128:                // TODO Auto-generated method stub
129:
130:            }
131:
132:            public void subscribeFolder(String mailboxName) throws IOException,
133:                    IMAPException, CommandCancelledException {
134:                // TODO Auto-generated method stub
135:
136:            }
137:
138:            public void unsubscribeFolder(String mailboxName)
139:                    throws IOException, IMAPException,
140:                    CommandCancelledException {
141:                // TODO Auto-generated method stub
142:
143:            }
144:
145:            public void expunge(IMAPFolder folder) throws IOException,
146:                    IMAPException, CommandCancelledException {
147:                // TODO Auto-generated method stub
148:
149:            }
150:
151:            public Integer[] copy(IMAPFolder destFolder, Object[] uids,
152:                    IMAPFolder folder) throws Exception {
153:                // TODO Auto-generated method stub
154:                return null;
155:            }
156:
157:            public int fetchUid(SequenceSet set, IMAPFolder folder)
158:                    throws IOException, IMAPException,
159:                    CommandCancelledException {
160:
161:                //if(set.toString().equals("*")) {
162:                return (Integer) indices.get(indices.size() - 1).get(
163:                        "columba.uid");
164:            }
165:
166:            public Integer[] fetchUids(SequenceSet set, IMAPFolder folder)
167:                    throws IOException, IMAPException,
168:                    CommandCancelledException {
169:
170:                int[] idx = set.toArray(indices.size());
171:                Integer[] result = new Integer[idx.length];
172:
173:                int pos = 0;
174:                for (int i : idx) {
175:                    result[pos++] = (Integer) indices.get(i - 1).get(
176:                            "columba.uid");
177:                }
178:
179:                return result;
180:            }
181:
182:            public IMAPFlags[] fetchFlagsListStartFrom(int startIdx,
183:                    IMAPFolder folder) throws IOException, IMAPException,
184:                    CommandCancelledException {
185:                // TODO Auto-generated method stub
186:                return null;
187:            }
188:
189:            public IMAPFlags[] fetchFlagsListStartFrom2(int startIdx,
190:                    IMAPFolder folder) throws IOException, IMAPException,
191:                    CommandCancelledException {
192:
193:                int size = indices.size() - startIdx + 1;
194:                IMAPFlags[] result = new IMAPFlags[size];
195:
196:                for (int i = 0; i < size; i++) {
197:                    IColumbaHeader h = indices.get(startIdx - 1 + i);
198:                    IMAPFlags flags = new IMAPFlags(h.getFlags().getFlags());
199:                    flags.setUid(h.get("columba.uid"));
200:
201:                    result[i] = flags;
202:                }
203:
204:                return result;
205:            }
206:
207:            public NamespaceCollection fetchNamespaces() throws IOException,
208:                    IMAPException, CommandCancelledException {
209:                // TODO Auto-generated method stub
210:                return null;
211:            }
212:
213:            public void fetchHeaderList(IHeaderList resultList, List list,
214:                    IMAPFolder folder) throws Exception {
215:
216:                for (Object uid : list) {
217:                    resultList.add(headerList.get(uid), uid);
218:                }
219:            }
220:
221:            public MimeTree getMimeTree(Object uid, IMAPFolder folder)
222:                    throws IOException, IMAPException,
223:                    CommandCancelledException {
224:                // TODO Auto-generated method stub
225:                return null;
226:            }
227:
228:            public InputStream getMimePartBodyStream(Object uid,
229:                    Integer[] address, IMAPFolder folder) throws IOException,
230:                    IMAPException, CommandCancelledException {
231:                // TODO Auto-generated method stub
232:                return null;
233:            }
234:
235:            public Header getHeaders(Object uid, String[] keys,
236:                    IMAPFolder folder) throws IOException, IMAPException,
237:                    CommandCancelledException {
238:                // TODO Auto-generated method stub
239:                return null;
240:            }
241:
242:            public Header getAllHeaders(Object uid, IMAPFolder folder)
243:                    throws IOException, IMAPException,
244:                    CommandCancelledException {
245:                // TODO Auto-generated method stub
246:                return null;
247:            }
248:
249:            public InputStream getMimePartSourceStream(Object uid,
250:                    Integer[] address, IMAPFolder folder) throws IOException,
251:                    IMAPException, CommandCancelledException {
252:                // TODO Auto-generated method stub
253:                return null;
254:            }
255:
256:            public InputStream getMessageSourceStream(Object uid,
257:                    IMAPFolder folder) throws IOException, IMAPException,
258:                    CommandCancelledException {
259:                // TODO Auto-generated method stub
260:                return null;
261:            }
262:
263:            public void markMessage(Object[] uids, int variant,
264:                    IMAPFolder folder) throws IOException, IMAPException,
265:                    CommandCancelledException {
266:                // TODO Auto-generated method stub
267:
268:            }
269:
270:            public void setFlags(Object[] uids, IMAPFlags flags,
271:                    IMAPFolder folder) throws IOException, IMAPException,
272:                    CommandCancelledException {
273:                // TODO Auto-generated method stub
274:
275:            }
276:
277:            public List search(Object[] uids, IFilterRule filterRule,
278:                    IMAPFolder folder) throws Exception {
279:                // TODO Auto-generated method stub
280:                return null;
281:            }
282:
283:            public int getIndex(Integer uid, IMAPFolder folder)
284:                    throws IOException, IMAPException,
285:                    CommandCancelledException {
286:                int pos = 0;
287:                for (IColumbaHeader h : indices) {
288:                    if (h.get("columba.uid").equals(uid)) {
289:                        return pos + 1;
290:                    }
291:                    pos++;
292:                }
293:
294:                return -1;
295:            }
296:
297:            public Integer[] search(SearchKey key, IMAPFolder folder)
298:                    throws IOException, IMAPException,
299:                    CommandCancelledException {
300:                return new Integer[0];
301:            }
302:
303:            public List search(IFilterRule filterRule, IMAPFolder folder)
304:                    throws IOException, IMAPException,
305:                    CommandCancelledException {
306:
307:                return new ArrayList();
308:            }
309:
310:            public MailboxInfo getMessageFolderInfo(IMAPFolder folder)
311:                    throws IOException, IMAPException,
312:                    CommandCancelledException {
313:                // TODO Auto-generated method stub
314:                return null;
315:            }
316:
317:            public ListInfo[] fetchSubscribedFolders() throws IOException,
318:                    IMAPException, CommandCancelledException {
319:                // TODO Auto-generated method stub
320:                return null;
321:            }
322:
323:            public boolean isSelected(IMAPFolder folder) throws IOException,
324:                    IMAPException, CommandCancelledException {
325:                // TODO Auto-generated method stub
326:                return false;
327:            }
328:
329:            public void alertMessage(String arg0) {
330:                // TODO Auto-generated method stub
331:
332:            }
333:
334:            public void connectionClosed(String arg0, String arg1) {
335:                // TODO Auto-generated method stub
336:
337:            }
338:
339:            public void existsChanged(String arg0, int arg1) {
340:                // TODO Auto-generated method stub
341:
342:            }
343:
344:            public void flagsChanged(String arg0, IMAPFlags arg1) {
345:                // TODO Auto-generated method stub
346:
347:            }
348:
349:            public void parseError(String arg0) {
350:                // TODO Auto-generated method stub
351:
352:            }
353:
354:            public void recentChanged(String arg0, int arg1) {
355:                // TODO Auto-generated method stub
356:
357:            }
358:
359:            public void warningMessage(String arg0) {
360:                // TODO Auto-generated method stub
361:
362:            }
363:
364:            public ImapItem getItem() {
365:                return new ImapItem(new XmlElement());
366:            }
367:
368:            public void update(Observable o, Object arg) {
369:                // TODO Auto-generated method stub
370:
371:            }
372:
373:            public void setExistsChangedAction(
374:                    IExistsChangedAction existsChangedAction) {
375:                // TODO Auto-generated method stub
376:
377:            }
378:
379:            public void setUpdateFlagAction(IUpdateFlagAction updateFlagAction) {
380:                // TODO Auto-generated method stub
381:
382:            }
383:
384:            public void setObservable(IStatusObservable observable) {
385:                // TODO Auto-generated method stub
386:
387:            }
388:
389:            public void setStatus(MailboxStatus status) {
390:                this .status = status;
391:            }
392:
393:            public IHeaderList getHeaderList() {
394:                return headerList;
395:            }
396:
397:            public int getLargestRemoteUid(IMAPFolder folder)
398:                    throws IOException, IMAPException,
399:                    CommandCancelledException {
400:                // TODO Auto-generated method stub
401:                return 0;
402:            }
403:
404:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.