com.waveset.notification
Class Notifier

java.lang.Object
  extended bycom.waveset.notification.Notifier
Direct Known Subclasses:
EmailNotifier, TestNotifier

public abstract class Notifier
extends java.lang.Object

Interface for an object that can perform notifications.


Field Summary
static java.lang.String code_id
           
static java.lang.String TYPE_EMAIL
          Cannonical names for certain built-in notifier classes.
static java.lang.String TYPE_TEST
           
 
Constructor Summary
Notifier()
           
 
Method Summary
 java.lang.String getFilterDomain()
          Return a domain that should be ignored when emails are sent from idm.
 java.lang.String getNotificationFile()
          Returns the notification redirect file.
static Notifier getNotifier(java.lang.String type)
          Create a notifier of the given type.
abstract  WavesetResult notify(LighthouseContext context, java.util.Map paramaeters, VariableResolver resolver)
          Sends notification given a set of parmaters specified in a Map.
 WavesetResult notify(java.util.Map parameters, ObjectCache cache)
          Sends notification given a set of parmaters specified in a Map.
static void setTestFile(java.lang.String filename)
          Sets the notifier test file.
static void setTestNotifier(java.lang.String filename)
          Sets or clears the forced use of a TestNotifier object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

code_id

public static final java.lang.String code_id
See Also:
Constant Field Values

TYPE_EMAIL

public static final java.lang.String TYPE_EMAIL
Cannonical names for certain built-in notifier classes.

See Also:
Constant Field Values

TYPE_TEST

public static final java.lang.String TYPE_TEST
See Also:
Constant Field Values
Constructor Detail

Notifier

public Notifier()
Method Detail

notify

public WavesetResult notify(java.util.Map parameters,
                            ObjectCache cache)
                     throws WavesetException
Sends notification given a set of parmaters specified in a Map. All values are expected to be strings.

The "cache" argument should be passed if the Notifier needs to resolve references to other objects. This is currently the case for EmailNotifier which might need to find EmailTemplate objects.

Throws:
WavesetException

notify

public abstract WavesetResult notify(LighthouseContext context,
                                     java.util.Map paramaeters,
                                     VariableResolver resolver)
                              throws ServiceNotResponding,
                                     WavesetException
Sends notification given a set of parmaters specified in a Map. All values are expected to be strings.

A VariableResolver may be passed to resolve references to things not passed in the map.

The context argument should be passed if the Notifier needs to resolve references to other objects. This is currently the case for EmailNotifier which might need to find EmailTemplate objects. If the implementation can determine that the connection parameters were correct, but the service was not responding it will throw the exception ServiceNotReponding. This may be used to determine if it makes sense to attempt a retry of the notification.

Throws:
ServiceNotResponding
WavesetException

getNotifier

public static Notifier getNotifier(java.lang.String type)
                            throws WavesetException
Create a notifier of the given type.

Currently recognized type names are:

Type may also be the fully qualified name of a class that extends the Notifier class.

If the forceTestNotifier() method has been used, we will always return a TestNotifier object regardless of the specified type.

Throws:
WavesetException

setTestNotifier

public static void setTestNotifier(java.lang.String filename)
Sets or clears the forced use of a TestNotifier object.

This controls the type of object returned by the getNotifier factory method. If the filename argument is non-null, we will create a TestNotifier object that sends notification parameters to the indicated file. This object will always be returned by getNotifier, regardless of the requested type.

If the filename argument is null, we will stop forcing the TestNotifier object, and return to normal operation.


setTestFile

public static void setTestFile(java.lang.String filename)
Sets the notifier test file.

An alternative to setTestNotifier that results in better output messages for certain notifiers.


getNotificationFile

public java.lang.String getNotificationFile()
Returns the notification redirect file. This must be called by all Notifier subclasses, to see if notification output is being redircted. We will return the value of the _testFile field if it is set. Otherwise we will return the value of the notification.redirect property from the Waveset.properties file. If neither is set, we return null, and the Notifier class is free to perform notifications in the usual way.


getFilterDomain

public java.lang.String getFilterDomain()
Return a domain that should be ignored when emails are sent from idm. This method reads the notification.filterDomain from Waveset.properties and will silently ( without error or warning ) ignore any requests.