|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.cometway.props.Props
com.cometway.ak.Agent
com.cometway.ak.ScheduledAgent
com.cometway.email.ReceivePOP3EmailAgent
public class ReceivePOP3EmailAgent
This agent periodically checks for new POP3 messages, passing routing the message to the registered RequestAgent matching the message recipient's email address.
| Field Summary |
|---|
| Fields inherited from class com.cometway.ak.ScheduledAgent |
|---|
schedule |
| Fields inherited from class com.cometway.ak.Agent |
|---|
agent_id, agentController, CREATING_STATE, debugReporter, DESTROYED_STATE, DESTROYING_STATE, errorReporter, FAILED_STATE, printlnReporter, props, RUNNING_STATE, STARTING_STATE, STOPPED_STATE, STOPPING_STATE, warningReporter |
| Constructor Summary | |
|---|---|
ReceivePOP3EmailAgent()
|
|
| Method Summary | |
|---|---|
protected void |
closeConnection()
Closes the connection to the POP3 server. |
protected boolean |
deleteMessage(int msg_num)
Deletes the specified message from the POP3 server. |
void |
deliverMessage(IMessage m)
This method creates an AgentRequest from the specified IMessage, and delivers it to the RequestAgent that is registered as the message recipient. |
protected java.util.Vector |
getAllMessages()
Return a vector holding (Integer {msg_num},(String {msg_header},String {msg_body})). |
protected java.lang.String |
getLine()
Reads a line of input from the POP3 server. |
protected IMessage |
getMessage(int msg_num)
Downloads the specified message from the POP3 server and returns it as an IMessage. |
protected java.util.Vector |
getRange(int start,
int stop)
Return a vector holding (Integer {msg_num},(String {msg_header},String {msg_body})). |
void |
initProps()
Initializes the default Props for this agent: "schedule" is specifies the schedule this agent uses to check the POP3 server (default: every 60 seconds), "pop3_host" is the POP3 server's host name (default: localhost), "pop3_port" is the POP3 server's port (default: 110), "username" is the POP3 account username, "password" is the POP3 account password, "max_trys" is the number of connection attempt to the POP3 server before giving up, "delete_messages" is set to true if the messages are to be deleted after downloading (default: true). |
protected int |
last()
Returns the number of the highest message accesed. |
protected IntegerPair |
listMessage(int msg_num)
This method lists a message on the POP3 server by its message number. |
protected java.util.Vector |
listMessages()
Returns a vector of pairs. |
protected boolean |
logon(java.lang.String username,
java.lang.String password)
Sends the logon command to the POP3 server using the specified username and password. |
protected void |
noop()
Sends a NOOP command to the POP3 server. |
protected boolean |
okResponse()
Returns true if the server returned '+OK'. |
protected boolean |
okResponse(java.lang.String s)
Return true if input String starts with '+OK'. |
protected void |
openConnection()
Opens a connection to the POP3 server for the agent to use. |
protected java.util.Vector |
parseAllMessages(java.util.Vector v)
Parses a Vector containing Pairs referencing message headers and bodies into a Vector of Hashtables containing message attributes including the message body. |
protected java.util.Hashtable |
parseMessage(Pair p)
Parses the message header and body in the specified Pair into a Hashtable containing attributes, with the "body" attribute set to the specified body. |
protected java.util.Hashtable |
parseMessage(java.lang.String header,
java.lang.String body)
Parses the message header and body into a Hastable containing attributes, with the "body" attribute set to the specified body. |
protected void |
quit()
End connection to server. |
protected void |
reset()
Reset maildrop to previous state. |
protected int |
send(java.lang.String pop_msg)
If connected, send a line to the server. |
protected IntegerPair |
splitInt(java.lang.String s)
|
protected IntegerPair |
stat()
Get the status of the current user. |
void |
wakeup()
On wakeup, this agent connects to the POP3 server and downloads any new messages it finds. |
| Methods inherited from class com.cometway.ak.ScheduledAgent |
|---|
addScheduleChangeListener, getSchedule, removeScheduleChangeListener, schedule, start, stop, unschedule |
| Methods inherited from class com.cometway.ak.Agent |
|---|
currentStateEquals, debug, destroy, error, error, getAgentController, getDateTimeStr, getProps, getServiceImpl, getStateMachineModel, println, register, registerService, setAgentController, setProps, toString, unregister, unregisterService, warning, warning |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public ReceivePOP3EmailAgent()
| Method Detail |
|---|
public void initProps()
initProps in interface AgentInterfaceinitProps in class ScheduledAgentpublic void wakeup()
wakeup in interface ISchedulablewakeup in class ScheduledAgentpublic void deliverMessage(IMessage m)
protected void openConnection()
protected boolean deleteMessage(int msg_num)
protected void closeConnection()
protected java.lang.String getLine()
protected int last()
protected java.util.Vector listMessages()
protected IntegerPair listMessage(int msg_num)
msg_num - The message number to list.
protected boolean logon(java.lang.String username,
java.lang.String password)
protected void noop()
protected boolean okResponse(java.lang.String s)
protected boolean okResponse()
protected java.util.Vector getAllMessages()
protected java.util.Vector getRange(int start,
int stop)
protected IMessage getMessage(int msg_num)
protected java.util.Vector parseAllMessages(java.util.Vector v)
protected java.util.Hashtable parseMessage(Pair p)
protected java.util.Hashtable parseMessage(java.lang.String header,
java.lang.String body)
protected void quit()
protected void reset()
protected int send(java.lang.String pop_msg)
protected IntegerPair splitInt(java.lang.String s)
protected IntegerPair stat()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||