KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > james > imapserver > FolderRecord


1 /***********************************************************************
2  * Copyright (c) 2000-2004 The Apache Software Foundation. *
3  * All rights reserved. *
4  * ------------------------------------------------------------------- *
5  * Licensed under the Apache License, Version 2.0 (the "License"); you *
6  * may not use this file except in compliance with the License. You *
7  * may obtain a copy of the License at: *
8  * *
9  * http://www.apache.org/licenses/LICENSE-2.0 *
10  * *
11  * Unless required by applicable law or agreed to in writing, software *
12  * distributed under the License is distributed on an "AS IS" BASIS, *
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or *
14  * implied. See the License for the specific language governing *
15  * permissions and limitations under the License. *
16  ***********************************************************************/

17
18 package org.apache.james.imapserver;
19
20 import java.util.Map JavaDoc;
21 import java.util.Set JavaDoc;
22
23 /**
24  * Interface for objects representing the record of a folder on an IMAP host.
25  *
26  * @version 0.1 on 14 Dec 2000
27  */

28
29 public interface FolderRecord {
30              
31     /**
32      * Returns the full name, including namespace, of this mailbox.
33      * Example 1: '#mail.projectBonzi'
34      * Example 2: '#shared.projectBonzi'
35      *
36      * @return String mailbox hierarchical name including namespace
37      */

38     //String readAstring();
39

40     /**
41      * Returns the user in whose namespace the mailbox existed.
42      * Example 1: 'fred.flintstone'
43      * Example 2: ''
44      *
45      * @param user String a user.An empty string indicates that the
46      * mailbox name is absolute.
47      */

48     String JavaDoc getUser();
49
50     /**
51      * Returns the absolute name of this mailbox. The absolute name is
52      * user-independent and unique for a given host.
53      * Example 1: 'privatemail.fred.flintstone.projectBonzi'
54      * Example 2: '#shared.projectBonzi'
55      *
56      * @return String mailbox absolute name
57      */

58     String JavaDoc getAbsoluteName();
59
60     /**
61      * Records if this mailbox name is currently in use. The mailbox name is
62      * in use when a mailbox with this name has been created. Implementations
63      * that allow shared mailboxes may encounter a sate where the mailbox has
64      * been deleted but there are clients who were already connected to the
65      * mailbox. In this case the name remains in use until all clients have
66      * either de-selected the mailbox or been disconnected from the server.
67      *
68      * @param state boolean true when mailbox created, false when name no
69      * longer in use.
70      */

71     void setNameInUse(boolean state);
72
73     /**
74      * Returns unavailability of name for a new mailbox.
75      *
76      * @return true if this name is in use. Must return true if isDeleted
77      * returns false.
78      */

79     boolean isNameInUse();
80
81     /**
82      * Records if the corresponding mailbox has been deleted.
83      *
84      * @param state boolean true when mailbox deleted, false when created
85      */

86     void setDeleted(boolean state);
87
88     /**
89      * Returns whether mailbox has been deleted. A deleted mailbox is an
90      * invalid argument to any IMAP command..
91      *
92      * @return boolean true if mailbox does not exist
93      */

94     boolean isDeleted();
95
96     /**
97      * Records the Unique Identifier Validity Value for this mailbox.
98      *
99      * @param uidValidity int the uid validity value must be incremented if
100      * the current uid values overlap uid values of this or a previous
101      * incarnation of the mailbox.
102      */

103     void setUidValidity(int uidValidity);
104
105     /**
106      * Returns current uid validity value
107      *
108      * @return int uid validity value
109      */

110     int getUidValidity();
111
112     /**
113      * Records the highest assigned Unique Identifier Value for this mailbox.
114      *
115      * @param uid int the highest uid assigned to a message in this mailbox.
116      */

117     void setHighestUid(int uid);
118
119     /**
120      * Returns current highest assigned uid value
121      *
122      * @return int uid value
123      */

124     int getHighestUid();
125
126     /**
127      * Record which users have LookupRights.
128      *
129      * @param users Set of Strings, one per user with Lookup rights
130      */

131     void setLookupRights(Set JavaDoc users);
132
133     /**
134      * Indicates if given user has lookup rights for this mailbox. Need
135      * lookup rights to be included in a List response.
136      *
137      * @return boolean true if user has lookup rights
138      */

139     boolean hasLookupRights(String JavaDoc user);
140
141     /**
142      * Record which users have ReadRights.
143      *
144      * @param users Set of Strings, one per user with read rights
145      */

146     void setReadRights(Set JavaDoc users);
147
148     /**
149      * Indicates if given user has read rights for this mailbox. Need read
150      * rights for user to select or examine mailbox.
151      *
152      * @return boolean true if user has read rights
153      */

154     boolean hasReadRights(String JavaDoc user);
155
156     /**
157      * Record if mailbox is marked.
158      */

159     void setMarked(boolean mark);
160
161     /**
162      * Indicates if the mailbox is marked. Usually means unseen mail.
163      *
164      * @return boolean true if marked
165      */

166     boolean isMarked();
167
168     /**
169      * Mark this mailbox as not selectable by anyone.
170      * Example folders at the roots of hierarchies, e. #mail for each user.
171      *
172      * @param state true if folder is not selectable by anyone
173      */

174     void setNotSelectableByAnyone(boolean state);
175
176     boolean isNotSelectableByAnyone();
177
178     /**
179      * A folder is selectable by a given user if both it is not
180      * NotSelectableByAnyone and the named user has read rights.
181      *
182      * @param user the user to be tested
183      * @return true if user can SELECT this mailbox.
184      */

185     boolean isSelectable(String JavaDoc user);
186
187     /**
188      * Set number of messages in this folder
189      */

190     void setExists(int num);
191
192     /**
193      * Indicates number of messages in folder
194      *
195      * @return int number of messages
196      */

197     int getExists();
198
199     /**
200      * Set number of messages in this folder with Recent flag set
201      */

202     void setRecent(int num);
203
204     /**
205      * Indicates no of messages with \Recent flag set
206      *
207      * @return int no of messages with \Recent flag set
208      */

209     int getRecent();
210
211     /**
212      * Set map of users versus number of messages in this folder without
213      * \Seen flag set for them
214      */

215     void setUnseenbyUser(Map JavaDoc unseen);
216
217     /**
218      * Indicates the number of unseen messages for the specified user.
219      *
220      * @return int number of messages without \Seen flag set for this User.
221      */

222     int getUnseen(String JavaDoc user);
223 }
224
Popular Tags