de.kosi.server
Class MailerInterfaceImpl

java.lang.Object
  |
  +--de.kosi.server.MailerInterfaceImpl
All Implemented Interfaces:
MailerInterface, java.rmi.Remote, java.io.Serializable

public class MailerInterfaceImpl
extends java.lang.Object
implements MailerInterface, java.io.Serializable

The MailerInterfaceImpl can be used to send e-mails.

ChangeLog:

 $Log: MailerInterfaceImpl.java,v $
 Revision 1.2  2001/06/04 14:21:10  jiriki
 Made source more comliant to coding guidelines.

 Revision 1.1.1.1  2001/04/29 18:05:19  jiriki
 Imported sources from zola.

 Revision 1.5  2001/04/24 23:19:22  wombat
 - Implemented I18N features of server
 - Implemented actions for Admin Client
 - Other changes is AdminClient

 Revision 1.4  2001/04/11 17:49:34  wombat
 Added Serial version id

 Revision 1.3  2001/04/11 17:40:49  wombat
 Updated Documentation.

 

Version:
$Revision: 1.2 $ ($Date: 2001/06/04 14:21:10 $)
Author:
Jan-Ole Janssen, Niklas Mehner, Time Sticher
See Also:
Serialized Form

Constructor Summary
MailerInterfaceImpl()
          Creates a new MailerInterfaceImpl.
 
Method Summary
 java.lang.String getHost()
          Return the SMTP server, that is used to send mail.
static MailerInterfaceImpl getMailer()
          Returns the singleton instance of the MailerInterfaceImpl.
 java.util.Vector getMailTextNames()
          Return an array containing the names of mails that can be send.
 java.lang.String getSenderAddress()
          Return the email address, that is used to send mail.
 boolean isDebugging()
          Wether debug output is printed to stdio.
 void sendMail(java.lang.String eMail, java.lang.String name, java.util.Locale locale, java.lang.Object[] params)
          Send a Mail.
 void sendTestMail(java.lang.String eMail, java.lang.String textName, java.util.Locale locale)
          Send a test mail.
 void setDebug(boolean debug)
          Set wether debug output is printed to stdio.
 void setHost(java.lang.String hostname)
          Set the SMTP server, that is used to send mail.
 void setSenderAddress(java.lang.String eMail)
          Set the email address, that is used to send mail.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MailerInterfaceImpl

public MailerInterfaceImpl()
Creates a new MailerInterfaceImpl.
Method Detail

sendMail

public void sendMail(java.lang.String eMail,
                     java.lang.String name,
                     java.util.Locale locale,
                     java.lang.Object[] params)
              throws javax.mail.MessagingException
Send a Mail. The actual subject and text of the mail are loaded from the 'mail.resources' file. The keys .subject and .text have to be present in this file. The text and subject are then processed using java.text.MessageFormat.format() and the supplied parameters.
Parameters:
eMail - E-Mail address the mail is sent to.
name - Name of the message. This is used to load the values from the resources (see above).
locale - The mail is send in.
params - Parameters used to insert data into the mail.
Throws:
javax.mail.MessagingException - If sending the mail fails.

getMailer

public static MailerInterfaceImpl getMailer()
Returns the singleton instance of the MailerInterfaceImpl.
Returns:
The MailerInterfaceImpl.

isDebugging

public boolean isDebugging()
                    throws KosiAccessException,
                           InvalidSessionException
Wether debug output is printed to stdio.
Specified by:
isDebugging in interface MailerInterface
Returns:
True if debug output is printed to stdio.
Throws:
KosiAccessException - If called by an user, that has no administration permission.
InvalidSessionException - If called from an invalid session cotext.

setDebug

public void setDebug(boolean debug)
              throws KosiAccessException,
                     InvalidSessionException
Set wether debug output is printed to stdio.
Specified by:
setDebug in interface MailerInterface
Parameters:
debug - True if debug output is to be printed to stdio.
Throws:
KosiAccessException - If called by an user, that has no administration permission.
InvalidSessionException - If called from an invalid session cotext.

getHost

public java.lang.String getHost()
                         throws KosiAccessException,
                                InvalidSessionException
Return the SMTP server, that is used to send mail.
Specified by:
getHost in interface MailerInterface
Returns:
Name of the server.
Throws:
KosiAccessException - If called by an user, that has no administration permission.
InvalidSessionException - If called from an invalid session cotext.

setHost

public void setHost(java.lang.String hostname)
             throws KosiAccessException,
                    InvalidSessionException
Set the SMTP server, that is used to send mail.
Specified by:
setHost in interface MailerInterface
Parameters:
hostname - Name of the server.
Throws:
KosiAccessException - If called by an user, that has no administration permission.
InvalidSessionException - If called from an invalid session cotext.

getSenderAddress

public java.lang.String getSenderAddress()
                                  throws KosiAccessException,
                                         InvalidSessionException
Return the email address, that is used to send mail.
Specified by:
getSenderAddress in interface MailerInterface
Returns:
EMail address.
Throws:
KosiAccessException - If called by an user, that has no administration permission.
InvalidSessionException - If called from an invalid session cotext.

setSenderAddress

public void setSenderAddress(java.lang.String eMail)
                      throws KosiAccessException,
                             InvalidSessionException
Set the email address, that is used to send mail.
Specified by:
setSenderAddress in interface MailerInterface
Parameters:
eMail - EMail address.
Throws:
KosiAccessException - If called by an user, that has no administration permission.
InvalidSessionException - If called from an invalid session cotext.

sendTestMail

public void sendTestMail(java.lang.String eMail,
                         java.lang.String textName,
                         java.util.Locale locale)
                  throws java.rmi.RemoteException,
                         KosiAccessException,
                         InvalidSessionException,
                         javax.mail.MessagingException
Send a test mail.
Specified by:
sendTestMail in interface MailerInterface
Parameters:
eMail - EMail address to send the testmail to.
locale - Locale the message is sent in.
textName - Name of the text to send. This must be one of the Names returned by getTextNames.
Throws:
java.rmi.RemoteException - If the remote call fails.
KosiAccessException - If called by an user, that has no administration permission.
InvalidSessionException - If called from an invalid session cotext.
javax.mail.MessagingException - If the mail could not be send.

getMailTextNames

public java.util.Vector getMailTextNames()
                                  throws java.rmi.RemoteException,
                                         KosiAccessException,
                                         InvalidSessionException
Return an array containing the names of mails that can be send. These can be used as input for sendTestMail().
Specified by:
getMailTextNames in interface MailerInterface
Returns:
Vector containing names of mails.
Throws:
java.rmi.RemoteException - If the remote call fails.
KosiAccessException - If called by an user, that has no administration permission.
InvalidSessionException - If called from an invalid session cotext.