javax.mail
public abstract class Service extends Object
Version: 1.3
Field Summary | |
---|---|
protected boolean | debug
The debug flag for this service.
|
protected Session | session
The session context for this service. |
protected URLName | url
The URLName of this service. |
Constructor Summary | |
---|---|
protected | Service(Session session, URLName url)
Constructor. |
Method Summary | |
---|---|
void | addConnectionListener(ConnectionListener l)
Adds a listener for connection events on this service. |
void | close()
Closes this service, terminating any underlying connections. |
void | connect()
Connects to this service.
|
void | connect(String host, String user, String password)
Connects to this service using the specified details.
|
void | connect(String host, int port, String user, String password)
Connects to this service using the specified details.
|
URLName | getURLName()
Return a URLName representing this service. |
boolean | isConnected()
Indicates whether this service is currently connected. |
protected void | notifyConnectionListeners(int type)
Notify all connection listeners. |
protected boolean | protocolConnect(String host, int port, String user, String password)
Provider implementation for a service.
|
protected void | queueEvent(MailEvent event, Vector vector)
Adds the event and vector of listeners to be notified. |
void | removeConnectionListener(ConnectionListener l)
Removes a connection event listener. |
protected void | setConnected(boolean connected)
Sets the connection state of this service. |
protected void | setURLName(URLName url)
Set the URLName representing this service.
|
String | toString()
Returns getURLName.toString if this service has a URLName,
otherwise returns the default toString . |
Parameters: session the session context for this service url the URLName of this service
Throws: AuthenticationFailedException on authentication failure MessagingException for other failures IllegalStateException if the service is already connected
Parameters: host the host to connect to user the username password the password
Throws: AuthenticationFailedException on authentication failure MessagingException for other failures IllegalStateException if the service is already connected
Parameters: host the host to connect to port the port to use (-1 for the default port) user the username password the password
Throws: AuthenticationFailedException on authentication failure MessagingException for other failures IllegalStateException if the service is already connected
This method should return false
if authentication fails,
due to the username or password being unavailable or incorrect, or may
throw AuthenticationFailedException
for further details.
In the case of failures not related to authentication, such as an
invalid configuration or network error, this method should throw an
appropriate MessagingException
.
Parameters: host the name of the host to connect to port the port to use (-1 for the default port) user the username password the password
Returns: true on success, false if authentication failed
Throws: AuthenticationFailedException on authentication failure MessagingException for non-authentication failures
getURLName.toString
if this service has a URLName,
otherwise returns the default toString
.