org.ploin.pmf
Interface IPropertiesLoader

All Known Implementing Classes:
PropertiesLoader

public interface IPropertiesLoader

Description: This class is responsible for reading properties files

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


Method Summary
 String getDirectory()
          Gets the path to the properties file.
 Properties getProperties(String client, String propName)
          This method looks for a properties file with the given name "propName".
It looks for a properties file in the following directories in this order: client directory mail directory class-root
 Properties getPropertiesOnlyClient(String client, String propertyFilename)
          This method looks for a properties file with the given name "propertyFilename".
It looks for the file only in the client-directory.
 Properties getPropertiesOnlyDirectory(String propertyFilename)
          This method looks for a properties file with the given name "propertyFilename".
It looks for the file only in the mail-directory.
 Properties getPropertiesOnlyRoot(String propertyFilename)
          This method looks for a properties file with the given name "propertyFilename".
It looks for the file only in the root-directory (class-root).
 String getPropFile()
          Gets the name of the properties file.
 String getValue(String key)
          Returns a message with the key "key" from the property file "propFile".
 String getValue(String client, String key)
          Returns a message with the key "key" from the property file.
 void replaceVariables(String client, MailConfig mailConfig)
          This method replaces all variables with keys like "${variable}" in the email-addresses of the receivers (to, cc, bcc) with values found in the mail.properties having the key "variable".
 void replaceVariables(TemplateConfig templateConfig)
          This method replaces all variables with keys like "${variable}" in the map of the templateConfig with values found in the mail.properties having the key "variable".
 void setDirectory(String directory)
          Sets the path to the properties file.
 void setPropFile(String propFile)
          Sets the name of the properties file.
 

Method Detail

getValue

String getValue(String key)
                throws MailFactoryException
Returns a message with the key "key" from the property file "propFile". It looks for a properties file in the following directories in this order:
  1. mail directory
  2. class-root
If the key is null, the method throws a MailFactoryException.

Parameters:
key - :the key to search
Returns:
String :the value to the key.
Throws:
MailFactoryException

getValue

String getValue(String client,
                String key)
                throws MailFactoryException
Returns a message with the key "key" from the property file. It looks for a properties file in the following directories in this order:
  1. client directory
  2. mail directory
  3. class-root

Parameters:
client - :the client for the mail
key - :the key to search
Returns:
String :the value to the key.
Throws:
MailFactoryException

replaceVariables

void replaceVariables(TemplateConfig templateConfig)
                      throws MailFactoryException
This method replaces all variables with keys like "${variable}" in the map of the templateConfig with values found in the mail.properties having the key "variable".

Parameters:
templateConfig - containing client, locale, template-name and map.
Throws:
MailFactoryException

replaceVariables

void replaceVariables(String client,
                      MailConfig mailConfig)
                      throws MailFactoryException
This method replaces all variables with keys like "${variable}" in the email-addresses of the receivers (to, cc, bcc) with values found in the mail.properties having the key "variable".

Parameters:
mailConfig - containing receiver-Emailadresses (to, cc, bcc)
Throws:
MailFactoryException

getProperties

Properties getProperties(String client,
                         String propName)
                         throws MailFactoryException
This method looks for a properties file with the given name "propName".
It looks for a properties file in the following directories in this order:
  1. client directory
  2. mail directory
  3. class-root

Parameters:
client - - the client of the mail
propName - - the name of the properties file
Returns:
A Properties Object
Throws:
MailFactoryException

getPropertiesOnlyClient

Properties getPropertiesOnlyClient(String client,
                                   String propertyFilename)
                                   throws MailFactoryException
This method looks for a properties file with the given name "propertyFilename".
It looks for the file only in the client-directory. If there is no file with the given name it throws an MailFactoryException.

Parameters:
client - - the client of the mail
propertyFilename - - the file name of the properties file.
Returns:
A Properties Object
Throws:
MailFactoryException

getPropertiesOnlyDirectory

Properties getPropertiesOnlyDirectory(String propertyFilename)
                                      throws MailFactoryException
This method looks for a properties file with the given name "propertyFilename".
It looks for the file only in the mail-directory. If there is no file with the given name it throws an MailFactoryException.

Parameters:
propertyFilename - - the client of the mail
Returns:
A Properties Object
Throws:
MailFactoryException

getPropertiesOnlyRoot

Properties getPropertiesOnlyRoot(String propertyFilename)
                                 throws MailFactoryException
This method looks for a properties file with the given name "propertyFilename".
It looks for the file only in the root-directory (class-root). If there is no file with the given name it throws an MailFactoryException.

Parameters:
propertyFilename - - the client of the mail
Returns:
A Properties Object
Throws:
MailFactoryException

getDirectory

String getDirectory()
Gets the path to the properties file.

Returns:
the path to the directory there the mail-templates are placed

setDirectory

void setDirectory(String directory)
Sets the path to the properties file.

Parameters:
directory - - path to the directory there the mail-templates are placed.

getPropFile

String getPropFile()
Gets the name of the properties file.

Returns:
the name of the properties files. The standard is "mail.properties".

setPropFile

void setPropFile(String propFile)
Sets the name of the properties file.

Parameters:
propFile - - the name of the properties files.


Copyright © 2012 PLOIN GmbH. All Rights Reserved.