1 package com.atlassian.mail.server;
2
3 import com.atlassian.mail.MailException;
4
5 import javax.annotation.Nullable;
6 import javax.mail.Authenticator;
7 import javax.mail.Session;
8 import java.util.List;
9 import java.util.Map;
10 import java.util.Properties;
11
12 public interface MailServerManager
13 {
14
15
16
17
18 String[] SERVER_TYPES = new String[]{"pop", "smtp"};
19
20 @Nullable
21 MailServer getMailServer(Long id) throws MailException;
22
23 @Nullable
24 MailServer getMailServer(String name) throws MailException;
25
26 Long create(MailServer mailServer) throws MailException;
27
28 void update(MailServer mailServer) throws MailException;
29
30 void delete(Long mailServerId) throws MailException;
31
32 List<String> getServerNames() throws MailException;
33
34 List<SMTPMailServer> getSmtpMailServers();
35
36 List<PopMailServer> getPopMailServers();
37
38 @Nullable
39 SMTPMailServer getDefaultSMTPMailServer();
40
41
42
43
44
45 boolean isDefaultSMTPMailServerDefined();
46
47 @Nullable
48 PopMailServer getDefaultPopMailServer();
49
50 Session getSession(Properties props, @Nullable Authenticator auth) throws MailException;
51
52 void init(Map params);
53
54
55
56
57
58
59
60
61
62
63
64
65 void setMailServerConfigurationHandler(@Nullable MailServerConfigurationHandler mailServerConfigurationHandler);
66 }