|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavax.mail.Service
An abstract messaging service (store or transport).
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(java.lang.String host,
int port,
java.lang.String user,
java.lang.String password)
Connects to this service using the specified details. |
void |
connect(java.lang.String host,
java.lang.String user,
java.lang.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(java.lang.String host,
int port,
java.lang.String user,
java.lang.String password)
Provider implementation for a service. |
protected void |
queueEvent(MailEvent event,
java.util.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. |
java.lang.String |
toString()
Returns getURLName.toString if this service has a URLName,
otherwise returns the default toString . |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
protected Session session
protected URLName url
protected boolean debug
Constructor Detail |
protected Service(Session session, URLName url)
session
- the session context for this serviceurl
- the URLName of this serviceMethod Detail |
public void connect() throws MessagingException
AuthenticationFailedException
- on authentication failure
MessagingException
- for other failures
java.lang.IllegalStateException
- if the service is already connectedpublic void connect(java.lang.String host, java.lang.String user, java.lang.String password) throws MessagingException
host
- the host to connect touser
- the usernamepassword
- the password
AuthenticationFailedException
- on authentication failure
MessagingException
- for other failures
java.lang.IllegalStateException
- if the service is already connectedpublic void connect(java.lang.String host, int port, java.lang.String user, java.lang.String password) throws MessagingException
host
- the host to connect toport
- the port to use (-1 for the default port)user
- the usernamepassword
- the password
AuthenticationFailedException
- on authentication failure
MessagingException
- for other failures
java.lang.IllegalStateException
- if the service is already connectedprotected boolean protocolConnect(java.lang.String host, int port, java.lang.String user, java.lang.String password) throws MessagingException
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
.
host
- the name of the host to connect toport
- the port to use (-1 for the default port)user
- the usernamepassword
- the password
AuthenticationFailedException
- on authentication failure
MessagingException
- for non-authentication failurespublic boolean isConnected()
protected void setConnected(boolean connected)
public void close() throws MessagingException
MessagingException
public URLName getURLName()
protected void setURLName(URLName url)
public void addConnectionListener(ConnectionListener l)
public void removeConnectionListener(ConnectionListener l)
protected void notifyConnectionListeners(int type)
public java.lang.String toString()
getURLName.toString
if this service has a URLName,
otherwise returns the default toString
.
protected void queueEvent(MailEvent event, java.util.Vector vector)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |