1. Project Clover database Tue Dec 20 2016 21:24:09 CET
  2. Package org.xwiki.mail

File MailListener.java

 

Code metrics

0
0
0
1
119
16
0
-
-
0
-

Classes

Class Line # Actions
MailListener 33 0 - 0 0
-1.0 -
 

Contributing tests

No tests hitting this source file were found.

Source view

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 org.xwiki.component.annotation.Role;
25   
26    /**
27    * Allows listening to Mail sending results.
28    *
29    * @version $Id: 1d50511f77473b66ee1843af1b03c47b4b619c46 $
30    * @since 6.1M2
31    */
32    @Role
 
33    public interface MailListener
34    {
35    /**
36    * Called when the preparation phase begins.
37    *
38    * @param batchId identifier of the batch being prepared
39    * @param parameters some parameters specifying addition context data
40    * @since 7.1RC1
41    */
42    void onPrepareBegin(String batchId, Map<String, Object> parameters);
43   
44    /**
45    * Called when a mail has been prepared with success.
46    *
47    * @param message the message to be sent
48    * @param parameters some parameters specifying addition context data
49    * @since 7.4.1
50    */
51    void onPrepareMessageSuccess(ExtendedMimeMessage message, Map<String, Object> parameters);
52   
53    /**
54    * Called when a mail has failed to be prepared.
55    *
56    * @param message the message that was tried to be prepared
57    * @param e the exception explaining why the message couldn't be sent
58    * @param parameters some parameters specifying addition context data
59    * @since 7.4.1
60    */
61    void onPrepareMessageError(ExtendedMimeMessage message, Exception e, Map<String, Object> parameters);
62   
63    /**
64    * Called when the preparation phase has encounter a fatal error.
65    * The batch in progress has been incompletely processed.
66    *
67    * @param exception the exception explaining why messages couldn't be prepared
68    * @param parameters some parameters specifying addition context data
69    * @since 7.1RC1
70    */
71    void onPrepareFatalError(Exception exception, Map<String, Object> parameters);
72   
73    /**
74    * Called when the preparation phase is finished.
75    *
76    * @param parameters some parameters specifying addition context data
77    * @since 7.1RC1
78    */
79    void onPrepareEnd(Map<String, Object> parameters);
80   
81    /**
82    * Called when a mail has been sent successfully.
83    *
84    * @param message the message sent
85    * @param parameters some parameters specifying addition context data
86    * @since 7.4.1
87    */
88    void onSendMessageSuccess(ExtendedMimeMessage message, Map<String, Object> parameters);
89   
90    /**
91    * Called when a mail has failed to be sent.
92    *
93    * @param message the message that was tried to be sent
94    * @param exception the exception explaining why the message couldn't be sent
95    * @param parameters some parameters specifying addition context data
96    * @since 7.4.1
97    */
98    void onSendMessageError(ExtendedMimeMessage message, Exception exception, Map<String, Object> parameters);
99   
100    /**
101    * Called when a message could not be retrieve for sending.
102    *
103    * @param uniqueMessageId the unique message identifier that was tried to be load for sending
104    * @param exception the exception explaining why the message couldn't be sent
105    * @param parameters some parameters specifying addition context data
106    * @since 7.4.1
107    */
108    void onSendMessageFatalError(String uniqueMessageId, Exception exception, Map<String, Object> parameters);
109   
110    /**
111    * @return the status of all the mails from the batch (whether they were sent successfully, failed to be sent,
112    * ready to be sent but not sent yet, etc). Note that since mails can be sent asynchronously it's possible
113    * that when calling this method, not all mails have been processed yet for sending and thus users or this
114    * method should call {@link MailStatusResult#waitTillProcessed(long)}
115    * or {@link MailStatusResult#isProcessed()} to ensure that all mails have been processed
116    * @since 6.4M3
117    */
118    MailStatusResult getMailStatusResult();
119    }