PageRenderTime 25ms CodeModel.GetById 16ms app.highlight 5ms RepoModel.GetById 2ms app.codeStats 0ms

/sitebricks-mail/src/main/java/com/google/sitebricks/mail/Mail.java

http://github.com/dhanji/sitebricks
Java | 31 lines | 18 code | 10 blank | 3 comment | 0 complexity | dbc38f17659173195439373db048e09b MD5 | raw file
 1package com.google.sitebricks.mail;
 2
 3import com.google.inject.ImplementedBy;
 4import com.google.sitebricks.mail.oauth.OAuth2Config;
 5import com.google.sitebricks.mail.oauth.OAuthConfig;
 6
 7import java.util.concurrent.ExecutorService;
 8import java.util.concurrent.TimeUnit;
 9
10/**
11 * @author dhanji@gmail.com (Dhanji R. Prasanna)
12 */
13@ImplementedBy(SitebricksMail.class)
14public interface Mail {
15  AuthBuilder clientOf(String host, int port);
16
17  public enum Auth { PLAIN, SSL, OAUTH, OAUTH2 }
18
19  public static interface AuthBuilder {
20    AuthBuilder timeout(long amount, TimeUnit unit);
21
22    AuthBuilder executors(ExecutorService bossPool, ExecutorService workerPool);
23
24    MailClient prepare(Auth authType, String username, String password);
25
26
27    MailClient prepareOAuth(String username, OAuthConfig config);
28
29    MailClient prepareOAuth2(String username, OAuth2Config config);
30  }
31}