KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > ivata > groupware > business > mail > server > MailServer


1 /*
2  * Copyright (c) 2001 - 2005 ivata limited.
3  * All rights reserved.
4  * -----------------------------------------------------------------------------
5  * ivata groupware may be redistributed under the GNU General Public
6  * License as published by the Free Software Foundation;
7  * version 2 of the License.
8  *
9  * These programs are free software; you can redistribute them and/or
10  * modify them under the terms of the GNU General License
11  * as published by the Free Software Foundation; version 2 of the License.
12  *
13  * These programs are distributed in the hope that they will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16  *
17  * See the GNU General License in the file LICENSE.txt for more
18  * details.
19  *
20  * If you would like a copy of the GNU General License write to
21  *
22  * Free Software Foundation, Inc.
23  * 59 Temple Place - Suite 330
24  * Boston, MA 02111-1307, USA.
25  *
26  *
27  * To arrange commercial support and licensing, contact ivata at
28  * http://www.ivata.com/contact.jsp
29  * -----------------------------------------------------------------------------
30  * $Log: MailServer.java,v $
31  * Revision 1.2 2005/04/09 17:20:01 colinmacleod
32  * Changed copyright text to GPL v2 explicitly.
33  *
34  * Revision 1.1.1.1 2005/03/10 17:51:22 colinmacleod
35  * Restructured ivata op around Hibernate/PicoContainer.
36  * Renamed ivata groupware.
37  *
38  * Revision 1.6 2004/11/12 15:57:25 colinmacleod
39  * Removed dependencies on SSLEXT.
40  * Moved Persistence classes to ivata masks.
41  *
42  * Revision 1.5 2004/11/03 16:18:09 colinmacleod
43  * Changed return type of getUserAliases to List.
44  *
45  * Revision 1.4 2004/07/13 19:48:12 colinmacleod
46  * Moved project to POJOs from EJBs.
47  * Applied PicoContainer to services layer (replacing session EJBs).
48  * Applied Hibernate to persistence layer (replacing entity EJBs).
49  *
50  * Revision 1.3 2004/03/21 21:16:39 colinmacleod
51  * Shortened name to ivata op.
52  *
53  * Revision 1.2 2004/03/21 20:38:22 colinmacleod
54  * Change SecurityServer into interface.
55  *
56  * Revision 1.1.1.1 2004/01/27 20:59:57 colinmacleod
57  * Moved ivata openportal to SourceForge..
58  * -----------------------------------------------------------------------------
59  */

60 package com.ivata.groupware.business.mail.server;
61
62 import java.util.Collection JavaDoc;
63 import java.util.List JavaDoc;
64
65 import javax.mail.Folder JavaDoc;
66 import javax.mail.Store JavaDoc;
67
68 import com.ivata.groupware.admin.security.server.SecurityServer;
69 import com.ivata.groupware.admin.security.server.SecuritySession;
70 import com.ivata.groupware.business.mail.session.MailSession;
71 import com.ivata.mask.util.SystemException;
72
73
74 /**
75  * <p>Extends the standard security server to add mail-specific features.</p>
76  *
77  * @author Colin MacLeod
78  * <a HREF='mailto:colin.macleod@ivata.com'>colin.macleod@ivata.com</a>
79  */

80 public interface MailServer extends SecurityServer {
81     /**
82      * <p>Helper. Get the store from the mail session and connect it.</p>
83      */

84     public Store JavaDoc connectStore(final MailSession mailSession)
85             throws SystemException;
86     /**
87      * Wrapper for <code>Store.getFolder</code> to get around the fact that
88      * courier/cyrus imap prefixes all "personal namespace" folder names with
89      * "INBOX".
90      *
91      * @param securitySession used to access the settings.
92      * @param store valid, connected store.
93      * @param name name of the folder you want to open.
94      * @return folder for the name you passed.
95      * @throws SystemException if the settings cannot be accessed, or there is
96      * any exception accessing the store.
97      */

98     public Folder JavaDoc getFolder(final SecuritySession securitySession,
99             final Store JavaDoc store, final String JavaDoc name)
100             throws SystemException;
101     /**
102      * <p>Adds or amends a mailing list with the name and users
103      * provided.</p>
104      *
105      * <p>This method calls the <code>setList</code> script with the name
106      * as the first parameter and the user names of each of the users as
107      * following parameters.</p>
108      *
109      * @param name the name of the list to be added.
110      * @param users <code>java.util.Collection</code> containing
111      * <code>UserLocal</code> instances of each of the users in the list.
112      * Note that if you are changing an existing list, this array should
113      * contain all of the users, not just the new ones.
114      * @throws BusinessException containing the content of the standard
115      * error stream, if the script returns non-zero.
116      */

117     void setList(final SecuritySession securitySession,
118             final String JavaDoc name,
119             final Collection JavaDoc users)
120         throws SystemException;
121
122     /**
123      * <p>Removes an existing mailing list from the system.</p>
124      *
125      * <p>The <code>removeList</code> script is called with
126      * <code>name</code> as its only parameter.</p>
127      *
128      * @param name the name of the list to remove.
129      * @throws BusinessException containing the content of the standard
130      * error stream, if the script returns non-zero.
131      */

132     void removeList(final SecuritySession securitySession,
133             final String JavaDoc name) throws SystemException;
134
135     /**
136      * <p>Gets all of the email aliases for the user provided.</p>
137      *
138      * <p>This method calls the script <code>getUserAliases</code>.</p>
139      *
140      * @param userName the user for whom to get the email aliases.
141      * @return a <code>java.util.Collection</code> containing
142      * <code>String</code> values for each of the aliases.
143      * @throws BusinessException containing the content of the standard
144      * error stream, if the script returns non-zero.
145      */

146     List JavaDoc getUserAliases(final SecuritySession securitySession,
147             final String JavaDoc userName)
148         throws SystemException;
149
150     /**
151      * <p>Gets all of the email aliases for the user provided.</p>
152      *
153      * <p>This method calls the script <code>setUserAliases</code>.</p>
154      *
155      * @param userName the user for whom to get the email aliases.
156      * @param aliases a <code>java.util.Collection</code> containing
157      * <code>String</code> values for each of the aliases.
158      * @throws BusinessException containing the content of the standard
159      * error stream, if the script returns non-zero.
160      */

161     void setUserAliases(final SecuritySession securitySession,
162             final String JavaDoc userName,
163             final Collection JavaDoc aliases)
164         throws SystemException;
165
166     /**
167      * <p>Get the email addresss this user's mail is forwarded to.</p>
168      *
169      * <p>This method calls the script <code>getUserForwarding</code>.</p>
170      *
171      * @param userName the user for whom to activate/deactive email
172      * forwarding.
173      * @return email address all email for this user is forwarded to, or
174      * <code>null</code> if there is no forwarding for this user.
175      * @throws BusinessException containing the content of the standard
176      * error stream, if the script returns non-zero.
177      */

178     String JavaDoc getUserForwarding(final SecuritySession securitySession,
179             final String JavaDoc userName)
180         throws SystemException;
181
182     /**
183      * <p>Set an email addresss to forward this user's mail to. If
184      * <code>address</code> is set to <code>null</code> then any previous
185      * email
186      * forwarding is removed.
187      *
188      * @param userName the user for whom to activate/deactive email
189      * forwarding.
190      * @param address email address to forward all email for this user to.
191      * If this
192      * address is set to <code>null</code> then any previous forwarding is
193      * removed.
194      * @throws BusinessException containing the content of the standard
195      * error
196      * stream, if the script returns non-zero.
197      *
198      *
199      */

200     void setUserForwarding(final SecuritySession securitySession,
201             final String JavaDoc userName,
202             final String JavaDoc address)
203         throws SystemException;
204
205     /**
206      * <p>Gets the current vacation method for the user provided. </p>
207      *
208      * <p>This method calls the script
209      * <code>getVacationMessage</code>.</p>
210      *
211      * @param userName the user for whom to set the vacation message.
212      * @return the current vacation message for this user, or
213      * <code>null</code> if
214      * the user does not have a vacation message.
215      * @throws BusinessException containing the content of the standard
216      * error stream, if the script returns non-zero.
217      */

218     String JavaDoc getVacationMessage(final SecuritySession securitySession,
219             final String JavaDoc userName)
220         throws SystemException;
221
222     /**
223      * <p>Sets the vacation method for the user provided. This message
224      * will be sent
225      * to all mails received at this address until it has been cleared, by
226      * calling
227      * this method again with a <code>null</code> value for the
228      * <code>message</code>
229      * parameter.</p>
230      *
231      * <p>This method calls the <code>setVacationMessage</code> script
232      * with <code>user name</code> and <code>message</code> as parameters.
233      * If the <code>message</code> parameter is <code>null</code>, then
234      * the
235      * script is called with just the
236      * <code>user name</code> parameter.</p>
237      *
238      * @param userName the user for whom to set the vacation message.
239      * @param message the new vacation message for this user. Set to
240      * <code>null</code> to remove any existing vacation message.
241      * @throws BusinessException containing the content of the standard
242      * error stream, if the script returns non-zero.
243      */

244     void setVacationMessage(final SecuritySession securitySession,
245             final String JavaDoc userName,
246             final String JavaDoc message)
247         throws SystemException;
248
249     /**
250      * <p>Get the time the specified mail folder was last modified as a
251      * <code>long</code>. This can then be saved and compared to
252      * subsequent
253      * calls of this method to see if the folder has changed.</p>
254      *
255      * @param userName the name of the user for whom to locate the folder.
256      * @param folderName the name of the folder to locate.
257      * @return operating system specific timestamp indicating when the
258      * folder was last changed.
259      * @throws BusinessException if the folder doesn't exists or there
260      * is an application problem retrieving the modified time.
261      */

262     boolean hasNewMessages(final SecuritySession securitySession,
263             final String JavaDoc userName,
264             final String JavaDoc folderName)
265         throws SystemException;
266 }
267
Popular Tags