1   
2   package com.atlassian.mail.server;
3   
4   import javax.mail.Session;
5   import com.atlassian.mail.MailException;
6   import com.atlassian.mail.MailProtocol;
7   import org.apache.log4j.Logger;
8   
9   import javax.naming.NamingException;
10  import java.io.PrintStream;
11  import java.util.Properties;
12  
13  public interface MailServer
14  {
15      Long getId();
16  
17      String getName();
18  
19      String getDescription();
20  
21      String getType();
22  
23      String getPort();
24  
25      MailProtocol getMailProtocol();
26  
27      String getHostname();
28  
29      String getUsername();
30  
31      String getPassword();
32  
33      long getTimeout();
34  
35      boolean getDebug();
36  
37      Session getSession() throws NamingException, MailException;
38  
39      void setName(String name);
40  
41      void setDescription(String description);
42  
43      void setHostname(String hostname);
44  
45      void setUsername(String username);
46  
47      void setPassword(String password);
48  
49      void setId(Long id);
50  
51      void setPort(String port);
52  
53      void setMailProtocol(MailProtocol protocol);
54  
55      void setTimeout(long timeout);
56  
57      void setDebug(boolean debug);
58  
59  	/**
60  	 * If debug is enabled, output from underlying javamail will go to this stream.
61  	* @param debugStream An optional stream to send debug messages to. If null, System.out is used.
62  	*/
63  	void setDebugStream(PrintStream debugStream);
64  
65  
66      void setProperties(Properties props);
67  
68      /**
69       *
70       * @return the set of dynamic properties applied to thsi server, may very wel be null
71       * in which case the mail server properties can be obtained from the session
72       */
73      Properties getProperties();
74  
75  	void setLogger(Logger logger);
76  }