| dalma.endpoints.email.EmailEndPoint
EmailEndPoint | public class EmailEndPoint extends MultiplexedEndPoint (Code) | | EndPoint connected to an e-mail address.
author: Kohsuke Kawaguchi |
Method Summary | |
public InternetAddress | getAddress() Gets the e-mail address that this endpoint is connected to. | protected UUID | getKey(MimeMessage msg) | public NewMailHandler | getNewMailHandler() Gets the listener set by
EmailEndPoint.setNewMailHandler(NewMailHandler) . | public Session | getSession() Gets the JavaMail session that this endpoint uses to configure
JavaMail. | protected void | handleMessage(MimeMessage msg) | protected void | onNewMessage(MimeMessage msg) | public UUID | send(MimeMessage msg) Sends a message and return immediately. | public void | setNewMailHandler(NewMailHandler newMailHandler) Sets the handler that receives uncorrelated incoming e-mails. | protected void | start() | protected void | stop() | public ReplyIterator<MimeMessage> | waitForMultipleReplies(MimeMessage outgoing, Date expirationDate) Sends an e-mail out and waits for multiple replies.
Upon a successful completion, this method returns an
ReplyIterator that receives replies to the e-mail that was just sent, until the specified
expiration date is reached.
Parameters: outgoing - The message to be sent. | public ReplyIterator<MimeMessage> | waitForMultipleReplies(MimeMessage outgoing, long timeout, TimeUnit unit) Sends an e-mail out and waits for multiple replies.
The timeout and unit parameters together specifies the time period
in which the returned iterator waits for replies. | public ReplyIterator<MimeMessage> | waitForMultipleReplies(MimeMessage outgoing) Sends an e-mail out and waits for multiple replies. | public MimeMessage | waitForReply(MimeMessage outgoing) Sends an e-mail out and waits for a reply to come back.
This method blocks forever until a reply is received.
Parameters: outgoing - The message to be sent. | public MimeMessage | waitForReply(MimeMessage outgoing, long timeout, TimeUnit unit) Sends an e-mail out and waits for a reply to come back,
at most the time specfied.
Parameters: outgoing - The message to be sent. | public MimeMessage | waitForReply(MimeMessage outgoing, Date timeoutDate) Sends an e-mail out and waits for a reply to come back,
until the specified date.
Parameters: outgoing - The message to be sent. |
EmailEndPoint | public EmailEndPoint(String name, InternetAddress address, Listener listener)(Code) | | Creates a new e-mail end point.
This uses
Session.getInstance(System.getProperties()) as the JavaMail session,
so effectively it configures JavaMail from the system properties.
Parameters: name - The unique name assigned by the application that identifies this endpoint. Parameters: address - The e-mail address of this endpoint. Parameters: listener - The object that fetches incoming e-mails. |
EmailEndPoint | public EmailEndPoint(String name, InternetAddress address, Listener listener, Session session)(Code) | | Creates a new e-mail end point.
Parameters: name - The unique name assigned by the application that identifies this endpoint. Parameters: address - The e-mail address of this endpoint. Parameters: listener - The object that fetches incoming e-mails. Parameters: session - The JavaMail configuration. |
getAddress | public InternetAddress getAddress()(Code) | | Gets the e-mail address that this endpoint is connected to.
|
getKey | protected UUID getKey(MimeMessage msg)(Code) | | |
getSession | public Session getSession()(Code) | | Gets the JavaMail session that this endpoint uses to configure
JavaMail.
always non-null. |
handleMessage | protected void handleMessage(MimeMessage msg)(Code) | | |
onNewMessage | protected void onNewMessage(MimeMessage msg)(Code) | | |
send | public UUID send(MimeMessage msg)(Code) | | Sends a message and return immediately.
Use this method when no further reply is expected.
|
setNewMailHandler | public void setNewMailHandler(NewMailHandler newMailHandler)(Code) | | Sets the handler that receives uncorrelated incoming e-mails.
See Also: NewMailHandler |
start | protected void start()(Code) | | |
stop | protected void stop()(Code) | | |
waitForMultipleReplies | public ReplyIterator<MimeMessage> waitForMultipleReplies(MimeMessage outgoing, Date expirationDate)(Code) | | Sends an e-mail out and waits for multiple replies.
Upon a successful completion, this method returns an
ReplyIterator that receives replies to the e-mail that was just sent, until the specified
expiration date is reached.
Parameters: outgoing - The message to be sent. Must not be null. Parameters: expirationDate - null to indicate that the iterator shall never be expired.Otherwise, the iterator will stop accepting reply messagesonce the specified date is reached.always non-null. See Also: ReplyIterator |
waitForMultipleReplies | public ReplyIterator<MimeMessage> waitForMultipleReplies(MimeMessage outgoing, long timeout, TimeUnit unit)(Code) | | Sends an e-mail out and waits for multiple replies.
The timeout and unit parameters together specifies the time period
in which the returned iterator waits for replies. For example,
if you set "1 week", the returned iterator will catch all replies received
within 1 week from now. See
EmailEndPoint.waitForMultipleReplies(MimeMessage,long,TimeUnit) for
details.
|
waitForReply | public MimeMessage waitForReply(MimeMessage outgoing)(Code) | | Sends an e-mail out and waits for a reply to come back.
This method blocks forever until a reply is received.
Parameters: outgoing - The message to be sent. Must not be null.a message that represents the received reply.always a non-null valid message. |
waitForReply | public MimeMessage waitForReply(MimeMessage outgoing, long timeout, TimeUnit unit)(Code) | | Sends an e-mail out and waits for a reply to come back,
at most the time specfied.
Parameters: outgoing - The message to be sent. Must not be null.a message that represents the received reply.if a response was not received within the specified timeout period,null is returned. |
waitForReply | public MimeMessage waitForReply(MimeMessage outgoing, Date timeoutDate)(Code) | | Sends an e-mail out and waits for a reply to come back,
until the specified date.
Parameters: outgoing - The message to be sent. Must not be null. Parameters: timeoutDate - the time when this method returns even if no reply is received by then.a message that represents the received reply.if a response was not received within the specified timeout period,null is returned. |
|
|