KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > columba > mail > folder > search > IMAPQueryEngine


1 //The contents of this file are subject to the Mozilla Public License Version 1.1
2
//(the "License"); you may not use this file except in compliance with the
3
//License. You may obtain a copy of the License at http://www.mozilla.org/MPL/
4
//
5
//Software distributed under the License is distributed on an "AS IS" basis,
6
//WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
7
//for the specific language governing rights and
8
//limitations under the License.
9
//
10
//The Original Code is "The Columba Project"
11
//
12
//The Initial Developers of the Original Code are Frederik Dietz and Timo Stich.
13
//Portions created by Frederik Dietz and Timo Stich are Copyright (C) 2003.
14
//
15
//All Rights Reserved.
16

17 package org.columba.mail.folder.search;
18
19 import java.util.List JavaDoc;
20
21 import org.columba.core.filter.FilterRule;
22 import org.columba.core.filter.IFilterRule;
23 import org.columba.mail.folder.imap.IMAPFolder;
24
25 /**
26  * Performes search requests on the IMAP server-side.
27  * <p>
28  * Note, that some search-requests are executed using the local
29  * caching mechanism.
30  *
31  * @see org.columba.mail.imap.SearchRequestBuilder
32  * @see org.columba.mail.folder.search.DefaultSearchEngine
33  *
34  * @author fdietz
35  */

36 public class IMAPQueryEngine implements QueryEngine {
37     /**
38  * list of supported search requests
39  */

40
41     // This list is reduced, because most search requests can be
42
// answered anyway, using locally cached headerfields
43
private static final String JavaDoc[] CAPABILITY_LIST = {
44         "Body", "Subject", "From", "To", "Cc", "Bcc", "Custom Headerfield",
45         "Date", "Size"
46     };
47     private IMAPFolder folder;
48
49     /**
50  * Contructor
51  *
52  * @param f IMAPFolder
53  */

54     public IMAPQueryEngine(IMAPFolder f) {
55         this.folder = f;
56     }
57
58     public String JavaDoc[] getCaps() {
59         return CAPABILITY_LIST;
60     }
61
62     public void sync() throws Exception JavaDoc {
63         // method is not needed by IMAP
64
}
65
66     public List JavaDoc queryEngine(IFilterRule filter) throws Exception JavaDoc {
67         // pass the work to IMAPStore
68
return folder.getServer().search(filter, folder);
69     }
70
71     public List JavaDoc queryEngine(IFilterRule filter, Object JavaDoc[] uids)
72         throws Exception JavaDoc {
73         // pass the work to IMAPStore
74
return folder.getServer().search(uids, filter, folder);
75     }
76
77     public void messageAdded(Object JavaDoc uid) throws Exception JavaDoc {
78         // method is not needed by IMAP
79
}
80
81     public void messageRemoved(Object JavaDoc uid) throws Exception JavaDoc {
82         // method is not needed by IMAP
83
}
84
85     public void reset() throws Exception JavaDoc {
86         // method is not needed by IMAP
87
}
88
89     public void save() {
90         // TODO Auto-generated method stub
91

92     }
93 }
94
Popular Tags