01: //The contents of this file are subject to the Mozilla Public License Version 1.1
02: //(the "License"); you may not use this file except in compliance with the
03: //License. You may obtain a copy of the License at http://www.mozilla.org/MPL/
04: //
05: //Software distributed under the License is distributed on an "AS IS" basis,
06: //WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
07: //for the specific language governing rights and
08: //limitations under the License.
09: //
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;
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[] CAPABILITY_LIST = { "Body",
44: "Subject", "From", "To", "Cc", "Bcc", "Custom Headerfield",
45: "Date", "Size" };
46: private IMAPFolder folder;
47:
48: /**
49: * Contructor
50: *
51: * @param f IMAPFolder
52: */
53: public IMAPQueryEngine(IMAPFolder f) {
54: this .folder = f;
55: }
56:
57: public String[] getCaps() {
58: return CAPABILITY_LIST;
59: }
60:
61: public void sync() throws Exception {
62: // method is not needed by IMAP
63: }
64:
65: public List queryEngine(IFilterRule filter) throws Exception {
66: // pass the work to IMAPStore
67: return folder.getServer().search(filter, folder);
68: }
69:
70: public List queryEngine(IFilterRule filter, Object[] uids)
71: throws Exception {
72: // pass the work to IMAPStore
73: return folder.getServer().search(uids, filter, folder);
74: }
75:
76: public void messageAdded(Object uid) throws Exception {
77: // method is not needed by IMAP
78: }
79:
80: public void messageRemoved(Object uid) throws Exception {
81: // method is not needed by IMAP
82: }
83:
84: public void reset() throws Exception {
85: // method is not needed by IMAP
86: }
87:
88: public void save() {
89: // TODO Auto-generated method stub
90:
91: }
92: }
|