org.ploin.pmf.impl
Class MailFactory

java.lang.Object
  extended by org.ploin.pmf.impl.MailFactory
All Implemented Interfaces:
Serializable, IMailFactory

public class MailFactory
extends Object
implements Serializable, IMailFactory

Description: Implementation of the IMailFactory interface. This is the main class. This class control the MailReader, MailReplacer,
MailSender and the PropertiesLoader.

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

See Also:
Serialized Form

Constructor Summary
MailFactory()
           
 
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 extension)
          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 extension)
          Set the plain extension.
 void setPropertiesLoader(IPropertiesLoader propertiesLoader)
          Set the IPropertiesLoader
 void setSingleThread(boolean singleThread)
          Set the singleThread
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MailFactory

public MailFactory()
Method Detail

init

public void init()
          throws MailFactoryException
Description copied from interface: IMailFactory
Initialize the mail Factory

Specified by:
init in interface IMailFactory
Throws:
MailFactoryException

sendMail

public SendingResult sendMail(MailConfig mailConfig,
                              TemplateConfig templateConfig)
                       throws MailFactoryException
Description copied from interface: IMailFactory
This is the main method.

Specified by:
sendMail in interface IMailFactory
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

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

Specified by:
sendMailWithContent in interface IMailFactory
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:
MailFactoryException

getPlainMessage

public String getPlainMessage(TemplateConfig templateConfig)
                       throws MailFactoryException
Description copied from interface: IMailFactory
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.

Specified by:
getPlainMessage in interface IMailFactory
Parameters:
templateConfig - containing client, locale, template-name and map.
Returns:
filled template file, or null
Throws:
MailFactoryException

getHtmlMessage

public String getHtmlMessage(TemplateConfig templateConfig)
                      throws MailFactoryException
Description copied from interface: IMailFactory
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.

Specified by:
getHtmlMessage in interface IMailFactory
Parameters:
templateConfig - containing client, locale, template-name and map.
Returns:
filled template file, or null
Throws:
MailFactoryException

getMailReader

public IMailReader getMailReader()
Description copied from interface: IMailFactory
Returns the IMailReader

Specified by:
getMailReader in interface IMailFactory
Returns:
IMailReader

setMailReader

public void setMailReader(IMailReader mailReader)
Description copied from interface: IMailFactory
Set the IMailReader

Specified by:
setMailReader in interface IMailFactory

getMailReplacer

public IMailReplacer getMailReplacer()
Description copied from interface: IMailFactory
Returns the IMailReplacer

Specified by:
getMailReplacer in interface IMailFactory
Returns:
IMailReplacer

setMailReplacer

public void setMailReplacer(IMailReplacer mailReplacer)
Description copied from interface: IMailFactory
Set the IMailReplacer

Specified by:
setMailReplacer in interface IMailFactory

getMailSender

public IMailSender getMailSender()
Description copied from interface: IMailFactory
Returns the IMailSender

Specified by:
getMailSender in interface IMailFactory
Returns:
IMailSender

setMailSender

public void setMailSender(IMailSender mailSender)
Description copied from interface: IMailFactory
Set the IMailSender

Specified by:
setMailSender in interface IMailFactory

getPropertiesLoader

public IPropertiesLoader getPropertiesLoader()
Description copied from interface: IMailFactory
Returns the IPropertiesLoader

Specified by:
getPropertiesLoader in interface IMailFactory
Returns:
IPropertiesLoader

setPropertiesLoader

public void setPropertiesLoader(IPropertiesLoader propertiesLoader)
Description copied from interface: IMailFactory
Set the IPropertiesLoader

Specified by:
setPropertiesLoader in interface IMailFactory

getDirectory

public String getDirectory()
Description copied from interface: IMailFactory
Returns the directory where the email-templates and the clients are in.

Specified by:
getDirectory in interface IMailFactory
Returns:
String, directroy

setDirectory

public void setDirectory(String directory)
Description copied from interface: IMailFactory
Set teh directory where the email-templates and the clients are in.

Specified by:
setDirectory in interface IMailFactory

getHtmlExtension

public String getHtmlExtension()
Description copied from interface: IMailFactory
returns the html extension.

Specified by:
getHtmlExtension in interface IMailFactory
Returns:
String, htmlExtension

getPlainExtension

public String getPlainExtension()
Description copied from interface: IMailFactory
returns the plain extension.

Specified by:
getPlainExtension in interface IMailFactory
Returns:
String, plainExtension

setHtmlExtension

public void setHtmlExtension(String extension)
Description copied from interface: IMailFactory
Set the html extension. The standard is ".html"

Specified by:
setHtmlExtension in interface IMailFactory

setPlainExtension

public void setPlainExtension(String extension)
Description copied from interface: IMailFactory
Set the plain extension. The standard is ".txt"

Specified by:
setPlainExtension in interface IMailFactory

isSingleThread

public boolean isSingleThread()
Description copied from interface: IMailFactory
returns the variable "singleThread"

Specified by:
isSingleThread in interface IMailFactory
Returns:
boolean

setSingleThread

public void setSingleThread(boolean singleThread)
Description copied from interface: IMailFactory
Set the singleThread

Specified by:
setSingleThread in interface IMailFactory


Copyright © 2012 PLOIN GmbH. All Rights Reserved.