org.ow2.petals.bc.mail
Class MimeMessageManager

java.lang.Object
  extended by org.ow2.petals.bc.mail.MimeMessageManager

public class MimeMessageManager
extends java.lang.Object

This class is used to process (reading or creating) mail messages

Author:
Adrien LOUIS - EBMWebSourcing, ofabre - EBM Websourcing

Field Summary
protected  java.util.logging.Logger log
           
 
Constructor Summary
MimeMessageManager(java.util.logging.Logger log)
           
 
Method Summary
 javax.mail.internet.MimeMessage mapNormalizedMessageToMimeMessage(javax.mail.Session session, ProvideDescriptor provideDescriptor, org.ow2.petals.component.framework.api.message.Exchange exchange, org.w3c.dom.Node rootNode)
          Create a MimeMessage from the given NormalizedMessage, including mail Session information.
protected  void setMimeMessageAttachments(javax.mail.Multipart multipart, org.ow2.petals.component.framework.api.message.Exchange exchange, org.w3c.dom.Node rootNode)
          Add NormalizedMessage attachments to MimeMessage attachments.
protected  void setMimeMessageAttributes(javax.mail.internet.MimeMessage mimeMessage, java.lang.String toAddress, java.lang.String fromAddress, java.lang.String subject)
          Set MimeMessage recipient, date, from and subject.
protected  void setMimeMessageBody(javax.mail.Multipart multipart, java.lang.String content, java.lang.String contentType)
          Set the MimeMessage body from the given content.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected java.util.logging.Logger log
Constructor Detail

MimeMessageManager

public MimeMessageManager(java.util.logging.Logger log)
Parameters:
log - the component Logger
channel - the component DeliveryChannel
Method Detail

mapNormalizedMessageToMimeMessage

public javax.mail.internet.MimeMessage mapNormalizedMessageToMimeMessage(javax.mail.Session session,
                                                                         ProvideDescriptor provideDescriptor,
                                                                         org.ow2.petals.component.framework.api.message.Exchange exchange,
                                                                         org.w3c.dom.Node rootNode)
                                                                  throws javax.jbi.messaging.MessagingException,
                                                                         MissingElementException
Create a MimeMessage from the given NormalizedMessage, including mail Session information.

Parameters:
session - the mail Session
provideDescriptor - the SessionDescriptor
exchange - the mapped NormalizedMessage
rootNode - TODO
Returns:
the created MimeMessage
Throws:
javax.mail.MessagingException - if an error occurs during MimeMessage creation
MissingElementException
javax.jbi.messaging.MessagingException

setMimeMessageAttachments

protected void setMimeMessageAttachments(javax.mail.Multipart multipart,
                                         org.ow2.petals.component.framework.api.message.Exchange exchange,
                                         org.w3c.dom.Node rootNode)
                                  throws javax.jbi.messaging.MessagingException
Add NormalizedMessage attachments to MimeMessage attachments. If an error occurs during the transmission of an attachment, it is skipped and the process continues with other attachments.

Parameters:
multipart - the Multipart used to handle attachments
in - the NormalizedMessage handling attachments that have to be transmitted
Throws:
javax.jbi.messaging.MessagingException

setMimeMessageAttributes

protected void setMimeMessageAttributes(javax.mail.internet.MimeMessage mimeMessage,
                                        java.lang.String toAddress,
                                        java.lang.String fromAddress,
                                        java.lang.String subject)
                                 throws javax.jbi.messaging.MessagingException
Set MimeMessage recipient, date, from and subject.

Parameters:
mimeMessage - the MimeMessage to set
internetAddress - the InternetAddress of the recipient
fromInternetAddress - the InternetAddress of the sender
subject - the mail subject
Throws:
javax.jbi.messaging.MessagingException

setMimeMessageBody

protected void setMimeMessageBody(javax.mail.Multipart multipart,
                                  java.lang.String content,
                                  java.lang.String contentType)
                           throws javax.mail.MessagingException
Set the MimeMessage body from the given content.

Parameters:
multipart - the Multipart that will handle the NormalizedMessage content
content - the content
Throws:
javax.mail.MessagingException


Copyright © 2005-2011 Petals Link (EBM Websourcing). All Rights Reserved.