1   package com.atlassian.mail;
2   
3   import com.atlassian.mail.config.ConfigLoader;
4   import com.atlassian.mail.server.MailServerManager;
5   import com.atlassian.mail.server.SMTPMailServer;
6   
7   import javax.mail.Multipart;
8   
9   public class MailFactory
10  {
11      public static final String MAIL_DISABLED_KEY = "atlassian.mail.senddisabled";
12  
13      private static MailServerManager serverManager;
14  
15      public static void refresh()
16      {
17          serverManager = null;
18      }
19  
20      public static MailServerManager getServerManager()
21      {
22          if (serverManager == null)
23          {
24              synchronized (MailFactory.class)
25              {
26                  if (serverManager == null)
27                  {
28                      serverManager = ConfigLoader.getServerManager();
29                  }
30              }
31          }
32  
33          return serverManager;
34      }
35  
36      public static void setServerManager(MailServerManager serverManager)
37      {
38          MailFactory.serverManager = serverManager;
39      }
40  
41      public static boolean isSendingDisabled()
42      {
43          return Boolean.getBoolean(MAIL_DISABLED_KEY);
44      }
45  }