KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > columba > mail > folder > IDataStorage


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
package org.columba.mail.folder;
17
18 import java.io.InputStream JavaDoc;
19
20 import org.columba.ristretto.io.Source;
21
22
23 /**
24  * Interface for local folders. This is a complete separation from the
25  * headercache and the datastorage method.
26  * <p>
27  * This makes it very easy to add new mailbox formats.
28  * <p>
29  * {@link AbstractLocalFolder} uses this interface and the singleton pattern
30  * to make this work in a plug'n'play manner.
31  * <p>
32  * If you want to add another custom local mailbox format, like mbox,
33  * or maildir, etc. this is the interface you have to implement.
34  * <p>
35  * @see org.columba.mail.folder.AbstractLocalFolder
36  *
37  * @author fdietz
38  */

39 public interface IDataStorage {
40     /**
41  * Remove message from datastorage
42  *
43  * @param uid UID of message
44  * @throws Exception
45  */

46     public void removeMessage(Object JavaDoc uid) throws Exception JavaDoc;
47
48     /**
49  * Get message source from data storage
50  *
51  * @param uid UID of message
52  * @return source of message
53  * @throws Exception
54  */

55     public Source getMessageSource(Object JavaDoc uid) throws Exception JavaDoc;
56
57     /**
58      * Get the InputStream of the message source.
59      *
60      * @param uid UID of the message
61      * @return the message stream
62      * @throws Exception
63      */

64     public InputStream JavaDoc getMessageStream(Object JavaDoc uid) throws Exception JavaDoc;
65     
66     /**
67  * Save message in data storage.
68  *
69  * @param uid UID of message
70  * @param source message source as stream
71  * @throws Exception
72  */

73     public void saveMessage(Object JavaDoc uid, InputStream JavaDoc source)
74         throws Exception JavaDoc;
75
76     /**
77  * Gets the total message count.
78  *
79  * @return return message count
80  */

81     public int getMessageCount();
82
83     /**
84  * Check if message with UID exists in data storage
85  *
86  * @param uid UID of message
87  * @return true, if message exists. false, otherwise
88  * @throws Exception
89  */

90     public boolean exists(Object JavaDoc uid) throws Exception JavaDoc;
91
92     /**
93  * Get list of message UIDs managed by this data storage
94  *
95  * @return array containing message UIDs
96  */

97     public Object JavaDoc[] getMessageUids();
98 }
99
Popular Tags