com.deltax.util.listener
Class BaseSignalSource

java.lang.Object
  extended bycom.deltax.util.listener.BaseSignalSource
All Implemented Interfaces:
SignalSource
Direct Known Subclasses:
TSignalSource

public abstract class BaseSignalSource
extends java.lang.Object
implements SignalSource

A base implementation of SignalSource. The notify(Signal) and notifyException(ExceptionSignal) methods are protected.

Version:
1.0
Author:
Cristiano Sadun

Field Summary
protected  ListenerSupport ls
          The listener support object
 
Constructor Summary
protected BaseSignalSource()
          Initialize the listener support object.
 
Method Summary
 void addListener(Listener listener)
          Allow source clients to add listeners.
 int countListeners()
          Return the number of registered listeners.
 boolean isRegistered(Listener listener)
          Return true if the given object is registered as a listener.
protected  void notify(Signal signal)
          Notify a signal to the listners.
protected  void notifyException(ExceptionSignal exceptionsignal)
          Notify a exception signal to the listners.
 void removeAllListeners()
           
 void removeListener(Listener listener)
          Allow source clients to remove listeners.
 boolean supportsExceptionSignals()
          Always return true, since this implementation does support exception signals.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ls

protected ListenerSupport ls
The listener support object

Constructor Detail

BaseSignalSource

protected BaseSignalSource()
Initialize the listener support object.

Method Detail

addListener

public void addListener(Listener listener)
Allow source clients to add listeners.

Parameters:
listener - the listener to add.

isRegistered

public boolean isRegistered(Listener listener)
Return true if the given object is registered as a listener.

Parameters:
listener - the listner to check
Returns:
true if the given object is registered as a listener, else false.

notify

protected void notify(Signal signal)
Notify a signal to the listners.

Parameters:
signal - the signal to be notified.

notifyException

protected void notifyException(ExceptionSignal exceptionsignal)
Notify a exception signal to the listners.


countListeners

public int countListeners()
Return the number of registered listeners.

Returns:
the number of registered listeners.

removeListener

public void removeListener(Listener listener)
Allow source clients to remove listeners.

Parameters:
listener - the listener to remove.

removeAllListeners

public void removeAllListeners()

supportsExceptionSignals

public boolean supportsExceptionSignals()
Always return true, since this implementation does support exception signals.

Specified by:
supportsExceptionSignals in interface SignalSource
Returns:
true