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 22 package org.apache.james.transport; 23 24 import org.apache.mailet.Mail; 25 26 /** 27 * NOTE: this is an experimental interface. It will be probably dropped later. 28 * 29 * @since 2.3.0a3 30 * 31 * The <code>service</code> perform all needed work 32 * on the Mail object. Whatever remains at the end of the service is considered 33 * to need futher processing and will go to the next Mailet if there is one 34 * configured or will go to the error processor if not. 35 * Setting a Mail state (setState(String)) to Mail.GHOST or cleaning its recipient 36 * list has the same meaning that s no more processing is needed. 37 */ 38 public interface MailProcessor { 39 /** 40 * Called by the mailet container to allow the mailet to process to 41 * a message. 42 * <p> 43 * This method is only called after the mailet's init() method has completed 44 * successfully. 45 * <p> 46 * Mailets typically run inside multithreaded mailet containers that can handle 47 * multiple requests concurrently. Developers must be aware to synchronize access 48 * to any shared resources such as files, network connections, as well as the 49 * mailet's class and instance variables. More information on multithreaded 50 * programming in Java is available in <a href="http://java.sun.com/Series/Tutorial/java/threads/multithreaded.html">the 51 * Java tutorial on multi-threaded programming</a>. 52 * 53 * @param mail - the Mail object that contains the message and routing information 54 * @throws javax.mail.MessagingException - if a message or address parsing exception occurs or 55 * an exception that interferes with the mailet's normal operation 56 */ 57 void service(Mail mail) throws javax.mail.MessagingException; 58 }