2008-11-01 17:32:06 -04:00
|
|
|
|
2008-12-16 18:34:01 -05:00
|
|
|
package com.android.email.mail;
|
2008-11-01 17:32:06 -04:00
|
|
|
|
2008-12-16 18:34:01 -05:00
|
|
|
import com.android.email.mail.transport.SmtpTransport;
|
|
|
|
import com.android.email.mail.transport.WebDavTransport;
|
2008-11-01 17:32:06 -04:00
|
|
|
|
|
|
|
public abstract class Transport {
|
|
|
|
protected static final int SOCKET_CONNECT_TIMEOUT = 10000;
|
|
|
|
|
2009-04-09 13:48:05 -04:00
|
|
|
// RFC 1047
|
|
|
|
protected static final int SOCKET_READ_TIMEOUT = 300000;
|
|
|
|
|
2008-11-01 17:32:06 -04:00
|
|
|
public synchronized static Transport getInstance(String uri) throws MessagingException {
|
|
|
|
if (uri.startsWith("smtp")) {
|
|
|
|
return new SmtpTransport(uri);
|
2008-12-06 19:29:11 -05:00
|
|
|
} else if (uri.startsWith("webdav")) {
|
|
|
|
return new WebDavTransport(uri);
|
2008-11-01 17:32:06 -04:00
|
|
|
} else {
|
|
|
|
throw new MessagingException("Unable to locate an applicable Transport for " + uri);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public abstract void open() throws MessagingException;
|
|
|
|
|
|
|
|
public abstract void sendMessage(Message message) throws MessagingException;
|
|
|
|
|
|
|
|
public abstract void close() throws MessagingException;
|
|
|
|
}
|