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      String getSocksHost();
36  
37      String getSocksPort();
38  
39      boolean getDebug();
40  
41      Session getSession() throws NamingException, MailException;
42  
43      void setName(String name);
44  
45      void setDescription(String description);
46  
47      void setHostname(String hostname);
48  
49      void setUsername(String username);
50  
51      void setPassword(String password);
52  
53      void setId(Long id);
54  
55      void setPort(String port);
56  
57      void setMailProtocol(MailProtocol protocol);
58  
59      void setTimeout(long timeout);
60      
61      void setSocksHost(String socksHost);
62  
63      void setSocksPort(String socksPort);
64  
65      void setDebug(boolean debug);
66  
67  	/**
68  	 * If debug is enabled, output from underlying javamail will go to this stream.
69  	* @param debugStream An optional stream to send debug messages to. If null, System.out is used.
70  	*/
71  	void setDebugStream(PrintStream debugStream);
72  
73  
74      void setProperties(Properties props);
75  
76      /**
77       *
78       * @return the set of dynamic properties applied to thsi server, may very wel be null
79       * in which case the mail server properties can be obtained from the session
80       */
81      Properties getProperties();
82  
83  	void setLogger(Logger logger);
84  }