KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > james > services > MailServer


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.services;
19
20 import org.apache.mailet.Mail;
21 import org.apache.mailet.MailAddress;
22
23 import javax.mail.MessagingException JavaDoc;
24 import javax.mail.internet.MimeMessage JavaDoc;
25 import java.io.InputStream JavaDoc;
26 import java.util.Collection JavaDoc;
27
28 /**
29  * The interface for Phoenix blocks to the James MailServer
30  *
31  *
32  * @version This is $Revision: 1.11.4.3 $
33  */

34 public interface MailServer
35 {
36     /**
37      * The component role used by components implementing this service
38      */

39     String JavaDoc ROLE = "org.apache.james.services.MailServer";
40
41     /**
42      * Reserved user name for the mail delivery agent for multi-user mailboxes
43      */

44     String JavaDoc MDA = "JamesMDA";
45
46     /**
47      * Reserved user name meaning all users for multi-user mailboxes
48      */

49     String JavaDoc ALL = "AllMailUsers";
50
51     /**
52      * Pass a MimeMessage to this MailServer for processing
53      *
54      * @param sender - the sender of the message
55      * @param recipients - a Collection of String objects of recipients
56      * @param msg - the MimeMessage of the headers and body content of
57      * the outgoing message
58      * @throws MessagingException - if the message fails to parse
59      */

60     void sendMail(MailAddress sender, Collection JavaDoc recipients, MimeMessage JavaDoc msg)
61         throws MessagingException JavaDoc;
62
63     /**
64      * Pass a MimeMessage to this MailServer for processing
65      *
66      * @param sender - the sender of the message
67      * @param recipients - a Collection of String objects of recipients
68      * @param msg - an InputStream containing the headers and body content of
69      * the outgoing message
70      * @throws MessagingException - if the message fails to parse
71      */

72     void sendMail(MailAddress sender, Collection JavaDoc recipients, InputStream JavaDoc msg)
73         throws MessagingException JavaDoc;
74
75     /**
76      * Pass a Mail to this MailServer for processing
77      * @param mail the Mail to be processed
78      * @throws MessagingException
79      */

80     void sendMail(Mail mail)
81         throws MessagingException JavaDoc;
82         
83     /**
84      * Pass a MimeMessage to this MailServer for processing
85      * @param message the message
86      * @throws MessagingException
87      */

88     void sendMail(MimeMessage JavaDoc message)
89         throws MessagingException JavaDoc;
90
91     /**
92      * Retrieve the primary mailbox for userName. For POP3 style stores this
93      * is their (sole) mailbox.
94      *
95      * @param sender - the name of the user
96      * @return a reference to an initialised mailbox
97      */

98     MailRepository getUserInbox(String JavaDoc userName);
99
100     /**
101      * Generate a new identifier/name for a mail being processed by this server.
102      *
103      * @return the new identifier
104      */

105     String JavaDoc getId();
106
107     /**
108      * Adds a new user to the mail system with userName. For POP3 style stores
109      * this may only involve adding the user to the UsersStore.
110      *
111      * @param sender - the name of the user
112      * @return a reference to an initialised mailbox
113      */

114     boolean addUser(String JavaDoc userName, String JavaDoc password);
115
116     /**
117      * Checks if a server is serviced by mail context
118      *
119      * @param serverName - name of server.
120      * @return true if server is local, i.e. serviced by this mail context
121      */

122     boolean isLocalServer(String JavaDoc serverName);
123 }
124
Popular Tags