org.abraracourcix.alipes.listeners.email
Class SelectiveEmailListener

java.lang.Object
  extended byorg.abraracourcix.alipes.listeners.AbstractListener
      extended byorg.abraracourcix.alipes.listeners.email.SelectiveEmailListener
All Implemented Interfaces:
Listener

public final class SelectiveEmailListener
extends AbstractListener

A more sophisticated listener which combines message templates with a dynamic filtering system allowing certain recipients to register interest with only certain resources. The class requires a file (defaults to email.txt) containing a list of properties associating regexps with email addresses. The regexps are applied to any object which fires an event and a positive match results in an email to the email addresses. @TODO not quite happy abou this since it seems to break the job of the Filter classes and be a bit monolithic

Author:
jdt

Constructor Summary
SelectiveEmailListener(java.lang.String smtpServer, java.lang.String user, java.lang.String password, java.lang.String returnAddress)
          Constructor
 
Method Summary
 void eventOccurred(Event event, java.lang.Object resource)
          Something's happened - fire off emails
static void main(java.lang.String[] args)
          Let's try it out.
 void setPropertiesFile(java.lang.String propertiesFile)
          Setter
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SelectiveEmailListener

public SelectiveEmailListener(java.lang.String smtpServer,
                              java.lang.String user,
                              java.lang.String password,
                              java.lang.String returnAddress)
Constructor

Parameters:
smtpServer - The mail server e.g. 127.0.0.1 port 25 is assumed
user - who's the email from?
password - user's password
returnAddress - who to complain to?
Method Detail

eventOccurred

public void eventOccurred(Event event,
                          java.lang.Object resource)
                   throws MultiplexorException,
                          EmailListenerException
Something's happened - fire off emails

Parameters:
event - what's happened
resource - to whom
Throws:
EmailListenerException - if unable to send email
MultiplexorException
See Also:
@TODO intercept emails, and wrap as multiplexed

main

public static void main(java.lang.String[] args)
                 throws ListenerException
Let's try it out.

Parameters:
args - password,
Throws:
ListenerException - sometimes

setPropertiesFile

public void setPropertiesFile(java.lang.String propertiesFile)
Setter

Parameters:
propertiesFile - The propertiesFile to set.


Copyright © 2004-2005 Abraracourcix. All Rights Reserved.