001: /*
002: * Copyright (c) 2001 - 2005 ivata limited.
003: * All rights reserved.
004: * -----------------------------------------------------------------------------
005: * ivata groupware may be redistributed under the GNU General Public
006: * License as published by the Free Software Foundation;
007: * version 2 of the License.
008: *
009: * These programs are free software; you can redistribute them and/or
010: * modify them under the terms of the GNU General License
011: * as published by the Free Software Foundation; version 2 of the License.
012: *
013: * These programs are distributed in the hope that they will be useful,
014: * but WITHOUT ANY WARRANTY; without even the implied warranty of
015: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
016: *
017: * See the GNU General License in the file LICENSE.txt for more
018: * details.
019: *
020: * If you would like a copy of the GNU General License write to
021: *
022: * Free Software Foundation, Inc.
023: * 59 Temple Place - Suite 330
024: * Boston, MA 02111-1307, USA.
025: *
026: *
027: * To arrange commercial support and licensing, contact ivata at
028: * http://www.ivata.com/contact.jsp
029: * -----------------------------------------------------------------------------
030: * $Log: MailServer.java,v $
031: * Revision 1.2 2005/04/09 17:20:01 colinmacleod
032: * Changed copyright text to GPL v2 explicitly.
033: *
034: * Revision 1.1.1.1 2005/03/10 17:51:22 colinmacleod
035: * Restructured ivata op around Hibernate/PicoContainer.
036: * Renamed ivata groupware.
037: *
038: * Revision 1.6 2004/11/12 15:57:25 colinmacleod
039: * Removed dependencies on SSLEXT.
040: * Moved Persistence classes to ivata masks.
041: *
042: * Revision 1.5 2004/11/03 16:18:09 colinmacleod
043: * Changed return type of getUserAliases to List.
044: *
045: * Revision 1.4 2004/07/13 19:48:12 colinmacleod
046: * Moved project to POJOs from EJBs.
047: * Applied PicoContainer to services layer (replacing session EJBs).
048: * Applied Hibernate to persistence layer (replacing entity EJBs).
049: *
050: * Revision 1.3 2004/03/21 21:16:39 colinmacleod
051: * Shortened name to ivata op.
052: *
053: * Revision 1.2 2004/03/21 20:38:22 colinmacleod
054: * Change SecurityServer into interface.
055: *
056: * Revision 1.1.1.1 2004/01/27 20:59:57 colinmacleod
057: * Moved ivata openportal to SourceForge..
058: * -----------------------------------------------------------------------------
059: */
060: package com.ivata.groupware.business.mail.server;
061:
062: import java.util.Collection;
063: import java.util.List;
064:
065: import javax.mail.Folder;
066: import javax.mail.Store;
067:
068: import com.ivata.groupware.admin.security.server.SecurityServer;
069: import com.ivata.groupware.admin.security.server.SecuritySession;
070: import com.ivata.groupware.business.mail.session.MailSession;
071: import com.ivata.mask.util.SystemException;
072:
073: /**
074: * <p>Extends the standard security server to add mail-specific features.</p>
075: *
076: * @author Colin MacLeod
077: * <a href='mailto:colin.macleod@ivata.com'>colin.macleod@ivata.com</a>
078: */
079: public interface MailServer extends SecurityServer {
080: /**
081: * <p>Helper. Get the store from the mail session and connect it.</p>
082: */
083: public Store connectStore(final MailSession mailSession)
084: throws SystemException;
085:
086: /**
087: * Wrapper for <code>Store.getFolder</code> to get around the fact that
088: * courier/cyrus imap prefixes all "personal namespace" folder names with
089: * "INBOX".
090: *
091: * @param securitySession used to access the settings.
092: * @param store valid, connected store.
093: * @param name name of the folder you want to open.
094: * @return folder for the name you passed.
095: * @throws SystemException if the settings cannot be accessed, or there is
096: * any exception accessing the store.
097: */
098: public Folder getFolder(final SecuritySession securitySession,
099: final Store store, final String name)
100: throws SystemException;
101:
102: /**
103: * <p>Adds or amends a mailing list with the name and users
104: * provided.</p>
105: *
106: * <p>This method calls the <code>setList</code> script with the name
107: * as the first parameter and the user names of each of the users as
108: * following parameters.</p>
109: *
110: * @param name the name of the list to be added.
111: * @param users <code>java.util.Collection</code> containing
112: * <code>UserLocal</code> instances of each of the users in the list.
113: * Note that if you are changing an existing list, this array should
114: * contain all of the users, not just the new ones.
115: * @throws BusinessException containing the content of the standard
116: * error stream, if the script returns non-zero.
117: */
118: void setList(final SecuritySession securitySession,
119: final String name, final Collection 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 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 getUserAliases(final SecuritySession securitySession,
147: final String userName) throws SystemException;
148:
149: /**
150: * <p>Gets all of the email aliases for the user provided.</p>
151: *
152: * <p>This method calls the script <code>setUserAliases</code>.</p>
153: *
154: * @param userName the user for whom to get the email aliases.
155: * @param aliases a <code>java.util.Collection</code> containing
156: * <code>String</code> values for each of the aliases.
157: * @throws BusinessException containing the content of the standard
158: * error stream, if the script returns non-zero.
159: */
160: void setUserAliases(final SecuritySession securitySession,
161: final String userName, final Collection aliases)
162: throws SystemException;
163:
164: /**
165: * <p>Get the email addresss this user's mail is forwarded to.</p>
166: *
167: * <p>This method calls the script <code>getUserForwarding</code>.</p>
168: *
169: * @param userName the user for whom to activate/deactive email
170: * forwarding.
171: * @return email address all email for this user is forwarded to, or
172: * <code>null</code> if there is no forwarding for this user.
173: * @throws BusinessException containing the content of the standard
174: * error stream, if the script returns non-zero.
175: */
176: String getUserForwarding(final SecuritySession securitySession,
177: final String userName) throws SystemException;
178:
179: /**
180: * <p>Set an email addresss to forward this user's mail to. If
181: * <code>address</code> is set to <code>null</code> then any previous
182: * email
183: * forwarding is removed.
184: *
185: * @param userName the user for whom to activate/deactive email
186: * forwarding.
187: * @param address email address to forward all email for this user to.
188: * If this
189: * address is set to <code>null</code> then any previous forwarding is
190: * removed.
191: * @throws BusinessException containing the content of the standard
192: * error
193: * stream, if the script returns non-zero.
194: *
195: *
196: */
197: void setUserForwarding(final SecuritySession securitySession,
198: final String userName, final String address)
199: throws SystemException;
200:
201: /**
202: * <p>Gets the current vacation method for the user provided. </p>
203: *
204: * <p>This method calls the script
205: * <code>getVacationMessage</code>.</p>
206: *
207: * @param userName the user for whom to set the vacation message.
208: * @return the current vacation message for this user, or
209: * <code>null</code> if
210: * the user does not have a vacation message.
211: * @throws BusinessException containing the content of the standard
212: * error stream, if the script returns non-zero.
213: */
214: String getVacationMessage(final SecuritySession securitySession,
215: final String userName) throws SystemException;
216:
217: /**
218: * <p>Sets the vacation method for the user provided. This message
219: * will be sent
220: * to all mails received at this address until it has been cleared, by
221: * calling
222: * this method again with a <code>null</code> value for the
223: * <code>message</code>
224: * parameter.</p>
225: *
226: * <p>This method calls the <code>setVacationMessage</code> script
227: * with <code>user name</code> and <code>message</code> as parameters.
228: * If the <code>message</code> parameter is <code>null</code>, then
229: * the
230: * script is called with just the
231: * <code>user name</code> parameter.</p>
232: *
233: * @param userName the user for whom to set the vacation message.
234: * @param message the new vacation message for this user. Set to
235: * <code>null</code> to remove any existing vacation message.
236: * @throws BusinessException containing the content of the standard
237: * error stream, if the script returns non-zero.
238: */
239: void setVacationMessage(final SecuritySession securitySession,
240: final String userName, final String message)
241: throws SystemException;
242:
243: /**
244: * <p>Get the time the specified mail folder was last modified as a
245: * <code>long</code>. This can then be saved and compared to
246: * subsequent
247: * calls of this method to see if the folder has changed.</p>
248: *
249: * @param userName the name of the user for whom to locate the folder.
250: * @param folderName the name of the folder to locate.
251: * @return operating system specific timestamp indicating when the
252: * folder was last changed.
253: * @throws BusinessException if the folder doesn't exists or there
254: * is an application problem retrieving the modified time.
255: */
256: boolean hasNewMessages(final SecuritySession securitySession,
257: final String userName, final String folderName)
258: throws SystemException;
259: }
|