View Javadoc

1   /*****************************************************************
2    * Licensed to the Apache Software Foundation (ASF) under one   *
3    * or more contributor license agreements.  See the NOTICE file *
4    * distributed with this work for additional information        *
5    * regarding copyright ownership.  The ASF licenses this file   *
6    * to you under the Apache License, Version 2.0 (the            *
7    * "License"); you may not use this file except in compliance   *
8    * with the License.  You may obtain a copy of the License at   *
9    *                                                              *
10   *   http://www.apache.org/licenses/LICENSE-2.0                 *
11   *                                                              *
12   * Unless required by applicable law or agreed to in writing,   *
13   * software distributed under the License is distributed on an  *
14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
15   * KIND, either express or implied.  See the License for the    *
16   * specific language governing permissions and limitations      *
17   * under the License.                                           *
18   ****************************************************************/
19  
20  
21  package org.apache.james.postage.smtpserver;
22  
23  import org.apache.mailet.MailetContext;
24  import org.apache.mailet.Mail;
25  import org.apache.mailet.MailAddress;
26  
27  import javax.mail.MessagingException;
28  import javax.mail.internet.MimeMessage;
29  import java.util.Collection;
30  import java.util.Iterator;
31  
32  /***
33   * mock-up of MailetContext
34   */
35  public class TrivialMailContext implements MailetContext {
36  
37      public void bounce(Mail mail, String message) throws MessagingException {
38          // trivial implementation
39      }
40  
41      public void bounce(Mail mail, String message, MailAddress bouncer) throws MessagingException {
42          // trivial implementation
43      }
44  
45      public Collection getMailServers(String host) {
46          return null;  // trivial implementation
47      }
48  
49      public MailAddress getPostmaster() {
50          return null;  // trivial implementation
51      }
52  
53      public Object getAttribute(String name) {
54          return null;  // trivial implementation
55      }
56  
57      public Iterator getAttributeNames() {
58          return null;  // trivial implementation
59      }
60  
61      public int getMajorVersion() {
62          return 0;  // trivial implementation
63      }
64  
65      public int getMinorVersion() {
66          return 0;  // trivial implementation
67      }
68  
69      public String getServerInfo() {
70          return null;  // trivial implementation
71      }
72  
73      public boolean isLocalServer(String serverName) {
74          return false;  // trivial implementation
75      }
76  
77      public boolean isLocalUser(String userAccount) {
78          return false;  // trivial implementation
79      }
80  
81      public void log(String message) {
82          // trivial implementation
83      }
84  
85      public void log(String message, Throwable t) {
86          // trivial implementation
87      }
88  
89      public void removeAttribute(String name) {
90          // trivial implementation
91      }
92  
93      public void sendMail(MimeMessage msg) throws MessagingException {
94          // trivial implementation
95      }
96  
97      public void sendMail(MailAddress sender, Collection recipients, MimeMessage msg) throws MessagingException {
98          // trivial implementation
99      }
100 
101     public void sendMail(MailAddress sender, Collection recipients, MimeMessage msg, String state) throws MessagingException {
102         // trivial implementation
103     }
104 
105     public void sendMail(Mail mail) throws MessagingException {
106         // trivial implementation
107     }
108 
109     public void setAttribute(String name, Object object) {
110         // trivial implementation
111     }
112 
113     public void storeMail(MailAddress sender, MailAddress recipient, MimeMessage msg) throws MessagingException {
114         // trivial implementation
115     }
116 
117     public Iterator getSMTPHostAddresses(String domainName) {
118         return null;  // trivial implementation
119     }
120 
121     // compatibility with James-trunk
122     public boolean isLocalEmail(MailAddress arg0) {
123         return false; // trivial implementation
124     }
125 }
126