|
TsBiff 1.3 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object
|
+--ts.mail.AbstractMailServer
|
+--ts.mail.Pop3Agent
This Class is a FetchAgent that connects to a POP3 server to fetch mail. The class extends the AbstractMailServer, and use the super class to connect to the server.
The class does not retrieve mail messages from the POP3 server, it only STAT and TOP the server. If the server does not support the TOP command an exception is thrown.
The getMail method implements the FetchAgents interface method getMail. It returns the content of the POP3 servers mail drop as a Vector of MailModel objects, where one MailModel represents one mail message from the mailbox file.
DefaultMailModel,
FetchAgent,
MailParser| Inner Class Summary | |
protected class |
Pop3Agent.MailParserConnector
|
| Field Summary | |
protected static int |
DEFAULT_PORT
Default portnumber for the POP3 protocol |
protected java.io.BufferedReader |
in
Server input stream |
protected java.lang.String |
myPassword
Password at pop3 server |
protected java.lang.String |
myUserName
Username at pop3 server |
protected java.io.PrintWriter |
out
Server output stream |
protected static java.lang.String |
POP3_ERROR
The POP3 error status indicators |
protected static java.lang.String |
POP3_OK
The POP3 ok status indicators |
protected java.lang.String |
PROTOCOL
Protocol used by this class |
| Fields inherited from class ts.mail.AbstractMailServer |
myMailServer, myMailServerPortNumber, SO_TIMEOUT |
| Constructor Summary | |
Pop3Agent(java.lang.String aServer)
Initializes the object with the given values for the mail server, using the default pop3 port. |
|
Pop3Agent(java.lang.String aServer,
int aPort)
Initializes the object with the given values for the pop3 server |
|
| Method Summary | |
protected void |
authenticate()
Login to the POP3 server |
boolean |
canTerminate()
Implementation of the SafeTerminate interface |
protected java.lang.String |
command(java.lang.String action)
Send a command to the POP3 server and return the result string |
java.util.Vector |
getMail()
Implementation of the getMail method. |
java.lang.String |
getProtocol()
Returns this FetchAgents protocol |
protected java.lang.String |
isOk()
Read a line from the server and check the response. |
protected java.util.Vector |
parseMail()
Connect a stream with mail messages from the POP3 server to the MailParsers input stream. |
void |
setAuth(java.lang.String uname,
java.lang.String passwd)
Set username and password for authentication at the pop3 server |
void |
setNumLines(int num)
Set maximum number of lines to read from a mail-message |
protected int |
stat()
Stat the server and return the number of messages in the maildrop |
void |
stopScan()
Stop current mail scan |
protected java.lang.String |
top(int messageid)
Top a message and return the multi-line response from the server in a String. |
| Methods inherited from class ts.mail.AbstractMailServer |
closeConnection, getInputStream, getMailServer, getMailServerName, getMailServerPortNumber, getOutputStream, openConnection |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected final java.lang.String PROTOCOL
protected static final int DEFAULT_PORT
protected static final java.lang.String POP3_ERROR
protected static final java.lang.String POP3_OK
protected java.lang.String myUserName
protected java.lang.String myPassword
protected java.io.PrintWriter out
protected java.io.BufferedReader in
| Constructor Detail |
public Pop3Agent(java.lang.String aServer)
throws java.net.UnknownHostException
aServer - The POP3 server addressjava.net.UnknownHostException - Is thrown if no IP address
for the host could be found
public Pop3Agent(java.lang.String aServer,
int aPort)
throws java.net.UnknownHostException
aServer - The POP3 server addressaPort - The POP3 server port numberjava.net.UnknownHostException - Is thrown if no IP address
for the host could be found| Method Detail |
public boolean canTerminate()
canTerminate in interface SafeTerminate
public void setAuth(java.lang.String uname,
java.lang.String passwd)
uname - a pop3-server usernamepasswd - the password that goes along with the unamejava.lang.IllegalArgumentException - if uname or passwd is nullpublic void setNumLines(int num)
num - maximum number of lines to read from a mail messagejava.lang.IllegalArgumentException - if num lines is less than 0
public java.util.Vector getMail()
throws GetMailException
getMail in interface FetchAgentGetMailException - Thrown if mail for some reason
could not be readpublic java.lang.String getProtocol()
getProtocol in interface FetchAgentpublic void stopScan()
stopScan in interface FetchAgent
protected void authenticate()
throws GetMailException
GetMailException - Is thrown if error status from server
protected int stat()
throws GetMailException
GetMailException - thrown if drop listing format is wrong
protected java.lang.String top(int messageid)
throws GetMailException
messageid - the id of the message to topGetMailException - thrown if error response from server
protected java.lang.String command(java.lang.String action)
throws GetMailException
action - a POP3 protocol recognizable commandGetMailException - Thrown if could not write to server
protected java.lang.String isOk()
throws GetMailException
GetMailException - Is thrown if error status from server
protected java.util.Vector parseMail()
throws GetMailException
GetMailException - Thrown if error from MailParser
|
TsBiff 1.3 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||