|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.geronimo.javamail.util.MailConnection
public class MailConnection
Base class for all mail Store/Transport connection. Centralizes management of a lot of common connection handling. Actual protcol-specific functions are handled at the subclass level.
Field Summary | |
---|---|
protected static String |
AUTHENTICATION_CRAMMD5
|
protected static String |
AUTHENTICATION_DIGESTMD5
|
protected static String |
AUTHENTICATION_LOGIN
|
protected static String |
AUTHENTICATION_PLAIN
|
protected List |
authentications
|
protected String |
authid
|
protected Map |
capabilities
|
protected static String |
CAPABILITY_STARTTLS
|
protected static char |
CR
constants for EOL termination |
protected boolean |
debug
|
protected PrintStream |
debugStream
|
protected static String |
DEFAULT_MAIL_HOST
|
protected int |
defaultPort
|
protected InputStream |
inputStream
|
protected static char |
LF
|
protected InetAddress |
localAddress
|
protected String |
localHost
|
protected int |
localPort
|
protected static String |
MAIL_AUTH
property keys for protocol properties. |
protected static String |
MAIL_AUTHORIZATIONID
|
protected static String |
MAIL_ENCODE_TRACE
|
protected static String |
MAIL_FACTORY_CLASS
|
protected static String |
MAIL_FACTORY_FALLBACK
|
protected static String |
MAIL_FACTORY_PORT
|
protected static String |
MAIL_LOCALADDRESS
|
protected static String |
MAIL_LOCALHOST
|
protected static String |
MAIL_LOCALPORT
|
protected static String |
MAIL_LOGIN_DISABLE
|
protected static String |
MAIL_PLAIN_DISABLE
|
protected static String |
MAIL_PORT
|
protected static String |
MAIL_SASL_ENABLE
|
protected static String |
MAIL_SASL_MECHANISMS
|
protected static String |
MAIL_SASL_REALM
|
protected static String |
MAIL_SSL_CIPHERSUITES
|
protected static String |
MAIL_SSL_ENABLE
|
protected static String |
MAIL_SSL_PROTOCOLS
|
protected static String |
MAIL_STARTTLS_ENABLE
|
protected static String |
MAIL_TIMEOUT
|
protected List |
mechanisms
|
protected static int |
MIN_MILLIS
|
protected OutputStream |
outputStream
|
protected String |
password
|
protected ProtocolProperties |
props
|
protected String |
protocol
|
protected String |
realm
|
protected String |
serverHost
|
protected int |
serverPort
|
protected Session |
session
|
protected Socket |
socket
|
protected boolean |
sslConnection
|
protected int |
timeout
|
protected static int |
TIMEOUT
|
protected String |
username
|
Constructor Summary | |
---|---|
protected |
MailConnection(ProtocolProperties props)
|
Method Summary | |
---|---|
protected void |
checkConnected()
Verify that we have a good connection before attempting to send a command. |
void |
closeServerConnection()
Close the server connection at termination. |
void |
connect(Socket s)
Establish a connection using an existing socket. |
protected void |
debugOut(String message)
Internal debug output routine. |
protected void |
debugOut(String message,
Throwable e)
Internal debugging routine for reporting exceptions. |
Map |
getCapabilities()
Get the capabilities map. |
protected void |
getConnectedSocket()
Creates a connected socket |
protected void |
getConnectedSSLSocket()
Creates a connected SSL socket for an initial SSL connection. |
protected void |
getConnectedTLSSocket()
Switch the connection to using TLS level security, switching to an SSL socket. |
protected void |
getConnection()
Create a transport connection object and connect it to the target server. |
protected void |
getConnectionProperties()
Get common connection properties before creating a connection socket. |
protected void |
getConnectionStreams()
Set up the input and output streams for server communications once the socket connection has been made. |
String |
getHost()
Retrieve the connection host. |
String |
getLocalHost()
Retrieve the local client host name. |
protected ClientAuthenticator |
getLoginAuthenticator()
Process SASL-type authentication. |
protected List |
getSaslMechanisms()
Get a list of the SASL mechanisms we're configured to accept. |
String |
getSASLRealm()
Retrieve the SASL realm used for DIGEST-MD5 authentication. |
protected List |
getServerMechanisms()
Get the list of authentication mechanisms the server is supposed to support. |
boolean |
hasCapability(String capability)
Test if this connection has a given capability. |
boolean |
protocolConnect(String host,
int port,
String username,
String password)
Connect to the server and do the initial handshaking. |
protected List |
selectSaslMechanisms()
Merge the configured SASL mechanisms with the capabilities that the server has indicated it supports, returning a merged list that can be used for selecting a mechanism. |
void |
setLocalHost(String localHost)
Explicitly set the local host information. |
void |
setSASLRealm(String name)
Explicitly set the SASL realm used for DIGEST-MD5 authenticaiton. |
boolean |
supportsMechanism(String mech)
Test if the server supports a given mechanism. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static final char CR
protected static final char LF
protected static final String MAIL_AUTH
protected static final String MAIL_PORT
protected static final String MAIL_LOCALHOST
protected static final String MAIL_STARTTLS_ENABLE
protected static final String MAIL_SSL_ENABLE
protected static final String MAIL_TIMEOUT
protected static final String MAIL_SASL_ENABLE
protected static final String MAIL_SASL_REALM
protected static final String MAIL_AUTHORIZATIONID
protected static final String MAIL_SASL_MECHANISMS
protected static final String MAIL_PLAIN_DISABLE
protected static final String MAIL_LOGIN_DISABLE
protected static final String MAIL_FACTORY_CLASS
protected static final String MAIL_FACTORY_FALLBACK
protected static final String MAIL_FACTORY_PORT
protected static final String MAIL_SSL_PROTOCOLS
protected static final String MAIL_SSL_CIPHERSUITES
protected static final String MAIL_LOCALADDRESS
protected static final String MAIL_LOCALPORT
protected static final String MAIL_ENCODE_TRACE
protected static final int MIN_MILLIS
protected static final int TIMEOUT
protected static final String DEFAULT_MAIL_HOST
protected static final String CAPABILITY_STARTTLS
protected static final String AUTHENTICATION_PLAIN
protected static final String AUTHENTICATION_LOGIN
protected static final String AUTHENTICATION_CRAMMD5
protected static final String AUTHENTICATION_DIGESTMD5
protected Session session
protected String protocol
protected boolean sslConnection
protected int defaultPort
protected ProtocolProperties props
protected String serverHost
protected int serverPort
protected Socket socket
protected InetAddress localAddress
protected int localPort
protected String localHost
protected int timeout
protected String username
protected String password
protected String realm
protected String authid
protected InputStream inputStream
protected OutputStream outputStream
protected PrintStream debugStream
protected boolean debug
protected List authentications
protected Map capabilities
protected List mechanisms
Constructor Detail |
---|
protected MailConnection(ProtocolProperties props)
Method Detail |
---|
public boolean protocolConnect(String host, int port, String username, String password) throws MessagingException
host
- The target host name.port
- The target portusername
- The connection username (can be null)password
- The authentication password (can be null).
MessagingException
public void connect(Socket s)
s
- The socket to use.protected void getConnection() throws IOException, MessagingException
MessagingException
IOException
protected void getConnectionProperties()
protected void getConnectedSocket() throws IOException
MessagingException
IOException
protected void getConnectedSSLSocket() throws IOException
MessagingException
IOException
protected void getConnectedTLSSocket() throws MessagingException
MessagingException
protected void getConnectionStreams() throws MessagingException, IOException
MessagingException
IOException
public void closeServerConnection()
protected void checkConnected() throws MessagingException
MessagingException
public String getSASLRealm()
public void setSASLRealm(String name)
name
- The new realm name.protected List getSaslMechanisms()
protected List getServerMechanisms()
protected List selectSaslMechanisms()
protected ClientAuthenticator getLoginAuthenticator() throws MessagingException
MessagingException
protected void debugOut(String message)
value
- The string value to output.protected void debugOut(String message, Throwable e)
message
- A message associated with the exception context.e
- The received exception.public boolean hasCapability(String capability)
capability
- The capability name.
public Map getCapabilities()
public boolean supportsMechanism(String mech)
mech
- The mechanism name.
public String getHost()
public String getLocalHost() throws MessagingException
SMTPTransportException
MessagingException
public void setLocalHost(String localHost)
localHost
- The new localHost name.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |