javax.mail
public abstract class Service extends Object
| Field Summary | |
|---|---|
| protected boolean | debug
Debug flag for this service, set from the Session's debug flag. |
| protected Session | session
The session from which this service was created. |
| protected URLName | url
The URLName of this service |
| Constructor Summary | |
|---|---|
| protected | Service(Session session, URLName url)
Construct a new Service. |
| Method Summary | |
|---|---|
| void | addConnectionListener(ConnectionListener listener) |
| void | close()
Close this service and terminate its physical connection.
|
| void | connect()
A generic connect method that takes no parameters allowing subclasses
to implement an appropriate authentication scheme.
|
| void | connect(String host, String user, String password)
Connect to the specified host using a simple username/password authenticaion scheme
and the default port.
|
| void | connect(String host, int port, String user, String password)
Connect to the specified host at the specified port using a simple username/password authenticaion scheme.
|
| protected void | finalize() |
| URLName | getURLName()
Return a copy of the URLName representing this service with the password and file information removed.
|
| boolean | isConnected()
Check if this service is currently connected.
|
| protected void | notifyConnectionListeners(int type) |
| protected boolean | protocolConnect(String host, int port, String user, String password)
Attempt the protocol-specific connection; subclasses should override this to establish
a connection in the appropriate manner.
|
| protected void | queueEvent(MailEvent event, Vector listeners) |
| void | removeConnectionListener(ConnectionListener listener) |
| protected void | setConnected(boolean connected)
Notification to subclasses that the connection state has changed.
|
| protected void | setURLName(URLName url)
Set the url field. |
| String | toString() |
Parameters: session the session from which this service was created url the URLName of this service
Throws: MessagingException if there were errors closing; the connection is still closed
connect(null, null, null)Throws: AuthenticationFailedException if authentication fails MessagingException for other failures
connect(host, -1, user, password)
Parameters: host the host to connect to user the user name password the user's password
Throws: AuthenticationFailedException if authentication fails MessagingException for other failures
Parameters: host the host to connect to port the port to connect to; pass -1 to use the default for the protocol user the user name password the user's password
Throws: AuthenticationFailedException if authentication fails MessagingException for other failures IllegalStateException if this service is already connected
Returns: the URLName for this service
Returns: true if this service is connected
Parameters: host port user password
Returns:
Throws: AuthenticationFailedException if authentication fails MessagingException for other failures
Parameters: connected the connection state
Parameters: url the new value