org.ploin.pmf
Interface IMailFactory

All Known Implementing Classes:
MailFactory

public interface IMailFactory

Description: This is the main class. This interface functions as facade for the MailReader, MailReplacer,
MailSender and the PropertiesLoader.

$LastChangedBy: r.reiz $
$Revision: 77 $
$Date: 2010-03-15 13:13:45 +0100 (Mon, 15 Mar 2010) $


Method Summary
 String getDirectory()
          Returns the directory where the email-templates and the clients are in.
 String getHtmlExtension()
          returns the html extension.
 String getHtmlMessage(TemplateConfig templateConfig)
          This method tries to find a HTML template file with the given name in the templateConfig, fills it with the values from the map and returns the filled template.
 IMailReader getMailReader()
          Returns the IMailReader
 IMailReplacer getMailReplacer()
          Returns the IMailReplacer
 IMailSender getMailSender()
          Returns the IMailSender
 String getPlainExtension()
          returns the plain extension.
 String getPlainMessage(TemplateConfig templateConfig)
          This method tries to find a plain-text template file with the given name in the templateConfig, fills it with the values from the map and returns the filled template.
 IPropertiesLoader getPropertiesLoader()
          Returns the IPropertiesLoader
 void init()
          Initialize the mail Factory
 boolean isSingleThread()
          returns the variable "singleThread"
 SendingResult sendMail(MailConfig mailConfig, TemplateConfig templateConfig)
          This is the main method.
 SendingResult sendMailWithContent(MailConfig mailConfig, TemplateConfig templateConfig, String plainReplaced, String htmlReplaced)
          This method sends an e-mail with the given plainReplaced content and htmlReplaced content.
 void setDirectory(String directory)
          Set teh directory where the email-templates and the clients are in.
 void setHtmlExtension(String htmlExtension)
          Set the html extension.
 void setMailReader(IMailReader mailReader)
          Set the IMailReader
 void setMailReplacer(IMailReplacer mailReplacer)
          Set the IMailReplacer
 void setMailSender(IMailSender mailSender)
          Set the IMailSender
 void setPlainExtension(String plainExtendsion)
          Set the plain extension.
 void setPropertiesLoader(IPropertiesLoader propertiesLoader)
          Set the IPropertiesLoader
 void setSingleThread(boolean singleThread)
          Set the singleThread
 

Method Detail

init

void init()
          throws MailFactoryException
Initialize the mail Factory

Throws:
MailFactoryException

sendMail

SendingResult sendMail(MailConfig mailConfig,
                       TemplateConfig templateConfig)
                       throws MailFactoryException
This is the main method.

Parameters:
mailConfig - the object containing the recipients and the client
templateConfig - containing client, locale, template-name and map.
Returns:
A SendingResult object containing the result from the commons-email-api and the MimeMessage
Throws:
MailFactoryException

sendMailWithContent

SendingResult sendMailWithContent(MailConfig mailConfig,
                                  TemplateConfig templateConfig,
                                  String plainReplaced,
                                  String htmlReplaced)
                                  throws MailFactoryException
This method sends an e-mail with the given plainReplaced content and htmlReplaced content. A template is not necessary.

Parameters:
mailConfig - the mailConfig object
templateConfig - containing client, locale, template-name and map.
plainReplaced - the plain text content to be send in the email.
htmlReplaced - the HTML content to be send in the email.
Returns:
A SendingResult object containing the result from the commons-email-api and the MimeMessage
Throws:
Exception
MailFactoryException

getPlainMessage

String getPlainMessage(TemplateConfig templateConfig)
                       throws MailFactoryException
This method tries to find a plain-text template file with the given name in the templateConfig, fills it with the values from the map and returns the filled template.

Parameters:
templateConfig - containing client, locale, template-name and map.
Returns:
filled template file, or null
Throws:
MailFactoryException

getHtmlMessage

String getHtmlMessage(TemplateConfig templateConfig)
                      throws MailFactoryException
This method tries to find a HTML template file with the given name in the templateConfig, fills it with the values from the map and returns the filled template.

Parameters:
templateConfig - containing client, locale, template-name and map.
Returns:
filled template file, or null
Throws:
MailFactoryException

getMailReader

IMailReader getMailReader()
Returns the IMailReader

Returns:
IMailReader

setMailReader

void setMailReader(IMailReader mailReader)
Set the IMailReader

Parameters:
mailReader -

getMailReplacer

IMailReplacer getMailReplacer()
Returns the IMailReplacer

Returns:
IMailReplacer

setMailReplacer

void setMailReplacer(IMailReplacer mailReplacer)
Set the IMailReplacer

Parameters:
mailReplacer -

getMailSender

IMailSender getMailSender()
Returns the IMailSender

Returns:
IMailSender

setMailSender

void setMailSender(IMailSender mailSender)
Set the IMailSender

Parameters:
mailSender -

getPropertiesLoader

IPropertiesLoader getPropertiesLoader()
Returns the IPropertiesLoader

Returns:
IPropertiesLoader

setPropertiesLoader

void setPropertiesLoader(IPropertiesLoader propertiesLoader)
Set the IPropertiesLoader

Parameters:
propertiesLoader -

getDirectory

String getDirectory()
Returns the directory where the email-templates and the clients are in.

Returns:
String, directroy

setDirectory

void setDirectory(String directory)
Set teh directory where the email-templates and the clients are in.

Parameters:
directory -

getHtmlExtension

String getHtmlExtension()
returns the html extension.

Returns:
String, htmlExtension

setHtmlExtension

void setHtmlExtension(String htmlExtension)
Set the html extension. The standard is ".html"

Parameters:
htmlExtension -

getPlainExtension

String getPlainExtension()
returns the plain extension.

Returns:
String, plainExtension

setPlainExtension

void setPlainExtension(String plainExtendsion)
Set the plain extension. The standard is ".txt"

Parameters:
plainExtendsion -

isSingleThread

boolean isSingleThread()
returns the variable "singleThread"

Returns:
boolean

setSingleThread

void setSingleThread(boolean singleThread)
Set the singleThread

Parameters:
singleThread -


Copyright © 2012 PLOIN GmbH. All Rights Reserved.