Class | Line # | Actions | |||||
---|---|---|---|---|---|---|---|
MimeMessageFactory | 41 | 0 | - | 0 | 0 |
1 | /* | |
2 | * See the NOTICE file distributed with this work for additional | |
3 | * information regarding copyright ownership. | |
4 | * | |
5 | * This is free software; you can redistribute it and/or modify it | |
6 | * under the terms of the GNU Lesser General Public License as | |
7 | * published by the Free Software Foundation; either version 2.1 of | |
8 | * the License, or (at your option) any later version. | |
9 | * | |
10 | * This software is distributed in the hope that it will be useful, | |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
13 | * Lesser General Public License for more details. | |
14 | * | |
15 | * You should have received a copy of the GNU Lesser General Public | |
16 | * License along with this software; if not, write to the Free | |
17 | * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA | |
18 | * 02110-1301 USA, or see the FSF site: http://www.fsf.org. | |
19 | */ | |
20 | package org.xwiki.mail; | |
21 | ||
22 | import java.util.Map; | |
23 | ||
24 | import javax.mail.MessagingException; | |
25 | ||
26 | import org.xwiki.component.annotation.Role; | |
27 | ||
28 | /** | |
29 | * Create one or several {@link javax.mail.internet.MimeMessage}. This allows Component implementers the ability to | |
30 | * create and pre-fill one or several {@link javax.mail.internet.MimeMessage} objects according to some algorithm. | |
31 | * For example a Template Mime Message Factory could compute the subject and its content from an XObject in a wiki | |
32 | * page. And a Group Mime Message Factory could generate an Iterator of MimeMessage, which itself would generate one | |
33 | * MimeMessage per user in the Group. | |
34 | * | |
35 | * @param <T> the return type of what gets created (usually a {@link javax.mail.internet.MimeMessage} or an | |
36 | * {@link java.util.Iterator} of {@link javax.mail.internet.MimeMessage}) | |
37 | * @version $Id: f3161e53bb4e6bfedae05524c7d881bb219cc208 $ | |
38 | * @since 6.4.1 | |
39 | */ | |
40 | @Role | |
41 | public interface MimeMessageFactory<T> | |
42 | { | |
43 | /** | |
44 | * Create one or several {@link javax.mail.internet.MimeMessage}. | |
45 | * | |
46 | * @param source the source from which to prefill the Mime Message(s) (depends on the implementation) | |
47 | * @param parameters an optional generic list of parameters. The supported parameters depend on the implementation | |
48 | * @return the pre-filled {@link javax.mail.internet.MimeMessage}(s) that can then be further modified by the user | |
49 | * @throws MessagingException in case of an error while creating the {@link javax.mail.internet.MimeMessage}(s) | |
50 | */ | |
51 | T createMessage(Object source, Map<String, Object> parameters) throws MessagingException; | |
52 | } |