lazyj.notifications
Class Sender

java.lang.Object
  extended by lazyj.notifications.Sender
Direct Known Subclasses:
EmailSender, YMSender

public abstract class Sender
extends java.lang.Object

This is the base class that needs to be extended by any message delivery class.

Since:
Nov 16, 2007 (1.0.3)
Author:
costing

Constructor Summary
Sender()
           
 
Method Summary
 java.lang.Object getClassInstance(java.lang.String sClass)
          Load and create a class instance, with this order of loading: extra class loader (set by setClassLoader(ClassLoader)) class loader of the current thread current thread context class loader class loader of this object instance JVM default class loader
If none of these succeeds then return null.
 java.lang.ClassLoader getClassLoader()
          Get the extra class loader
abstract  boolean init(ExtProperties prop, java.lang.String keyPrefix)
          This method is called by Notifier after an instance of a class implementing this interface is created with the default constructor.
abstract  boolean send(Message m)
          Send the message to the target (mail / instant message / log file etc)
 void setClassLoader(java.lang.ClassLoader loader)
          Give an extra class loader, in case we need to load arbitrary classes
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Sender

public Sender()
Method Detail

init

public abstract boolean init(ExtProperties prop,
                             java.lang.String keyPrefix)
This method is called by Notifier after an instance of a class implementing this interface is created with the default constructor. Each implementing class should take what is useful for it from the given configuration, taking into account (only) the keys with the given prefix.

Parameters:
prop - configuration contents
keyPrefix - prefix for the subset of options that are relevant to this instance
Returns:
true if the initialization was ok, false if not (missing option etc)

send

public abstract boolean send(Message m)
Send the message to the target (mail / instant message / log file etc)

Parameters:
m - message to send
Returns:
true if sending went ok, false if not

setClassLoader

public final void setClassLoader(java.lang.ClassLoader loader)
Give an extra class loader, in case we need to load arbitrary classes

Parameters:
loader -

getClassLoader

public final java.lang.ClassLoader getClassLoader()
Get the extra class loader

Returns:
extra class loader

getClassInstance

public final java.lang.Object getClassInstance(java.lang.String sClass)
Load and create a class instance, with this order of loading:
If none of these succeeds then return null.

Parameters:
sClass -
Returns:
instance or null