Revision 42621
Added by Sandro La Bruzzo almost 8 years ago
EmailDispatcher.java | ||
---|---|---|
7 | 7 |
import java.util.Properties; |
8 | 8 |
import java.util.concurrent.BlockingQueue; |
9 | 9 |
import java.util.concurrent.LinkedBlockingQueue; |
10 |
|
|
11 |
import javax.annotation.Resource; |
|
12 |
import javax.mail.Authenticator; |
|
13 |
import javax.mail.Message; |
|
14 |
import javax.mail.MessagingException; |
|
15 |
import javax.mail.PasswordAuthentication; |
|
16 |
import javax.mail.Session; |
|
17 |
import javax.mail.Transport; |
|
10 |
import javax.mail.*; |
|
18 | 11 |
import javax.mail.internet.InternetAddress; |
19 | 12 |
import javax.mail.internet.MimeMessage; |
20 | 13 |
|
14 |
import com.google.common.base.Splitter; |
|
15 |
import eu.dnetlib.enabling.locators.UniqueServiceLocator; |
|
16 |
import eu.dnetlib.msro.workflows.procs.WorkflowProcess; |
|
17 |
import eu.dnetlib.msro.workflows.procs.WorkflowProcess.Status; |
|
18 |
import eu.dnetlib.rmi.enabling.ISLookUpService; |
|
21 | 19 |
import org.antlr.stringtemplate.StringTemplate; |
22 | 20 |
import org.apache.commons.lang3.StringUtils; |
23 | 21 |
import org.apache.commons.logging.Log; |
24 | 22 |
import org.apache.commons.logging.LogFactory; |
25 | 23 |
import org.dom4j.Document; |
26 | 24 |
import org.dom4j.io.SAXReader; |
25 |
import org.springframework.beans.factory.annotation.Autowired; |
|
27 | 26 |
import org.springframework.beans.factory.annotation.Required; |
28 | 27 |
|
29 |
import com.google.common.base.Splitter; |
|
30 |
|
|
31 |
import eu.dnetlib.enabling.locators.UniqueServiceLocator; |
|
32 |
import eu.dnetlib.msro.workflows.procs.WorkflowProcess; |
|
33 |
import eu.dnetlib.msro.workflows.procs.WorkflowProcess.Status; |
|
34 |
import eu.dnetlib.rmi.enabling.ISLookUpService; |
|
35 |
|
|
36 | 28 |
public class EmailDispatcher { |
37 | 29 |
|
30 |
private static final Log log = LogFactory.getLog(EmailDispatcher.class); |
|
31 |
private final BlockingQueue<Message> queue = new LinkedBlockingQueue<Message>(); |
|
38 | 32 |
private String from; |
39 | 33 |
private String fromName; |
40 | 34 |
private String cc; |
... | ... | |
44 | 38 |
private String smtpPassword; |
45 | 39 |
private String baseUrl; |
46 | 40 |
private String infrastructure; |
47 |
|
|
48 |
private static final Log log = LogFactory.getLog(EmailDispatcher.class); |
|
49 |
|
|
50 |
@Resource |
|
41 |
@Autowired |
|
51 | 42 |
private UniqueServiceLocator serviceLocator; |
52 | 43 |
|
53 |
private final BlockingQueue<Message> queue = new LinkedBlockingQueue<Message>(); |
|
54 |
|
|
55 | 44 |
public void sendMail(final String to, final String subject, final String message) { |
56 | 45 |
try { |
57 | 46 |
final Session session = Session.getInstance(obtainProperties(), obtainAuthenticator()); |
Also available in: Unified diff
Chnaged Resource to Autowired