org.springframework.integration.adapter.mail
Class AbstractMailHeaderGenerator

java.lang.Object
  extended by org.springframework.integration.adapter.mail.AbstractMailHeaderGenerator
All Implemented Interfaces:
MailHeaderGenerator
Direct Known Subclasses:
DefaultMailHeaderGenerator, StaticMailHeaderGenerator

public abstract class AbstractMailHeaderGenerator
extends java.lang.Object
implements MailHeaderGenerator

Base implementation for MailHeaderGenerators. This class is abstract. Subclasses must implement the corresponding template methods to retrieve the values for the mail message's subject, recipients, and from/reply-to addresses based on the integration Message.

Author:
Marius Bogoevici, Mark Fisher

Field Summary
private  org.apache.commons.logging.Log logger
           
 
Constructor Summary
AbstractMailHeaderGenerator()
           
 
Method Summary
protected abstract  java.lang.String[] getBcc(Message<?> message)
          Retrieve the BCC recipients list from an integration message.
protected abstract  java.lang.String[] getCc(Message<?> message)
          Retrieve the CC recipients list from an integration message.
protected abstract  java.lang.String getFrom(Message<?> message)
          Retrieve the From: e-mail address from an integration message.
protected abstract  java.lang.String getReplyTo(Message<?> message)
          Retrieve the Reply To: e-mail address from an integration message.
protected abstract  java.lang.String getSubject(Message<?> message)
          Retrieve the subject of an e-mail message from an integration message.
protected abstract  java.lang.String[] getTo(Message<?> message)
          Retrieve the recipients list from an integration message.
 void populateMailMessageHeader(org.springframework.mail.MailMessage mailMessage, Message<?> message)
          Populate the mail message using the results of the template methods.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

private final org.apache.commons.logging.Log logger
Constructor Detail

AbstractMailHeaderGenerator

public AbstractMailHeaderGenerator()
Method Detail

getSubject

protected abstract java.lang.String getSubject(Message<?> message)
Retrieve the subject of an e-mail message from an integration message.

Parameters:
message - the integration Message
Returns:
the e-mail message subject

getTo

protected abstract java.lang.String[] getTo(Message<?> message)
Retrieve the recipients list from an integration message.

Parameters:
message - the integration Message
Returns:
recipients list (TO)

getCc

protected abstract java.lang.String[] getCc(Message<?> message)
Retrieve the CC recipients list from an integration message.

Parameters:
message - the integration Message
Returns:
CC recipients list (e-mail addresses)

getBcc

protected abstract java.lang.String[] getBcc(Message<?> message)
Retrieve the BCC recipients list from an integration message.

Parameters:
message - the integration Message
Returns:
BCC recipients list (e-mail addresses)

getFrom

protected abstract java.lang.String getFrom(Message<?> message)
Retrieve the From: e-mail address from an integration message.

Parameters:
message - the integration Message
Returns:
the From: e-mail address

getReplyTo

protected abstract java.lang.String getReplyTo(Message<?> message)
Retrieve the Reply To: e-mail address from an integration message.

Parameters:
message - the integration Message
Returns:
the ReplyTo: e-mail address

populateMailMessageHeader

public final void populateMailMessageHeader(org.springframework.mail.MailMessage mailMessage,
                                            Message<?> message)
Populate the mail message using the results of the template methods.

Specified by:
populateMailMessageHeader in interface MailHeaderGenerator