Sun Adapter for e-Mail API

com.stc.connector.emailadapter.appconn
Class EmailClientAgent

java.lang.Object
  extended by com.stc.connector.emailadapter.appconn.EmailClientAgent

public class EmailClientAgent
extends java.lang.Object

APIS for checking email, receiving email, and sending email.

Version:
$Version$
Author:
$Author: chuang $

Constructor Summary
EmailClientAgent(com.stc.connector.management.util.ObjectReference mbeanObject)
          Constructor for EmailClientAgent.
 
Method Summary
 boolean hasMessage(EmailConfiguration configuration)
          Determines whether there are message(s) to be received.
protected  void processInMessage(javax.mail.internet.MimeMessage msg, EmailMessage emailMsg)
          Process in the message specified in msg
protected  boolean processInSimpleMessage(javax.mail.internet.MimePart part, EmailMessage emailMsg)
          Process in the simple message specified in part
protected  void processOutAttachment(javax.mail.internet.MimeMultipart container, EmailMessage emailMsg, java.lang.String textencoding, java.lang.String headerencoding)
          Process out the Attachment parts of the message
protected  void processOutMsgTextHTML(javax.mail.internet.MimePart container, EmailMessage emailMsg, java.lang.String textencoding)
          Process out the MsgText and MsgHTML parts of the message.
protected  void processRecipients(javax.mail.internet.MimeMessage msg, javax.mail.Message.RecipientType type, boolean dirIn, EmailMessage emailMsg, java.lang.String textencoding, java.lang.String headerencoding)
          Process out the recipients of this message by parsing the addresses.
 boolean receiveMessage(EmailConfiguration configuration, EmailMessage emailMsg)
          Receive the next available message.
 boolean sendMessage(EmailConfiguration configuration, EmailMessage emailMsg)
          Send the message specified in the end user properties.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EmailClientAgent

public EmailClientAgent(com.stc.connector.management.util.ObjectReference mbeanObject)
Constructor for EmailClientAgent.

Parameters:
mbeanObject - The MBean object used for sending alerts.
Method Detail

processRecipients

protected void processRecipients(javax.mail.internet.MimeMessage msg,
                                 javax.mail.Message.RecipientType type,
                                 boolean dirIn,
                                 EmailMessage emailMsg,
                                 java.lang.String textencoding,
                                 java.lang.String headerencoding)
                          throws EmailApplicationException
Process out the recipients of this message by parsing the addresses. When dirIn is true process incoming message, otherwise outgoing.

Parameters:
msg - The MimeMessage which contains the email message from the server.
type - The RecipientType to process.
dirIn - The email message flow (receive or send).
emailMsg - The EmailMessage instance to populate in the case of receive or to read from in the case of send.
Throws:
EmailApplicationException - upon error.

processOutMsgTextHTML

protected void processOutMsgTextHTML(javax.mail.internet.MimePart container,
                                     EmailMessage emailMsg,
                                     java.lang.String textencoding)
                              throws EmailApplicationException
Process out the MsgText and MsgHTML parts of the message.

Parameters:
container - The MimePart of the mime message.
emailMsg - The EmailMessage containing the email message to be sent.
Throws:
EmailApplicationException - upon error.

processOutAttachment

protected void processOutAttachment(javax.mail.internet.MimeMultipart container,
                                    EmailMessage emailMsg,
                                    java.lang.String textencoding,
                                    java.lang.String headerencoding)
                             throws EmailApplicationException
Process out the Attachment parts of the message

Parameters:
container - The MimeMultipart message.
emailMsg - The EmailMessage instance to hold the email message.
Throws:
EmailApplicationException - upon error.

processInMessage

protected void processInMessage(javax.mail.internet.MimeMessage msg,
                                EmailMessage emailMsg)
                         throws EmailApplicationException
Process in the message specified in msg

Parameters:
msg - The MimeMessage which contains the email message from the server.
emailMsg - The EmailMessage instance to store the results from the server.
Throws:
EmailApplicationException - upon error.

processInSimpleMessage

protected boolean processInSimpleMessage(javax.mail.internet.MimePart part,
                                         EmailMessage emailMsg)
                                  throws EmailApplicationException
Process in the simple message specified in part

Parameters:
part - The message MimePart.
emailMsg - The EmailMessage instance to populate.
Throws:
EmailApplicationException - upon error.

sendMessage

public boolean sendMessage(EmailConfiguration configuration,
                           EmailMessage emailMsg)
                    throws EmailApplicationException
Send the message specified in the end user properties.

Parameters:
configuration - The EmailConfiguration instance which holds the connection specific information.
emailMsg - The EmailMessage instance which contains the email message to be sent.
Returns:
True if send was successful; false otherwise.
Throws:
EmailApplicationException - upon error.

receiveMessage

public boolean receiveMessage(EmailConfiguration configuration,
                              EmailMessage emailMsg)
                       throws EmailApplicationException
Receive the next available message.

Parameters:
configuration - The EmailConfiguration instance containing connection specific information.
emailMsg - The EmailMessage to put the email message that gets received.
Returns:
If there is/are more message(s) to be read then true will be returned; otherwise, false will be returned.
Throws:
EmailApplicationException - upon error.

hasMessage

public boolean hasMessage(EmailConfiguration configuration)
                   throws EmailApplicationException
Determines whether there are message(s) to be received.

Parameters:
configuration - The EmailConfiguration instance containing connection specific information.
Returns:
If there are messages to be read then true will be returned; otherwise, false will be returned.
Throws:
EmailApplicationException - upon error.

Sun Adapter for e-Mail API