net.dpml.util
Class UnicastEventSource

java.lang.Object
  extended by java.rmi.server.RemoteObject
      extended by java.rmi.server.RemoteServer
          extended by java.rmi.server.UnicastRemoteObject
              extended by net.dpml.util.UnicastEventSource
All Implemented Interfaces:
Serializable, Remote, EventHandler
Direct Known Subclasses:
DefaultModel, UnicastEventSource

public abstract class UnicastEventSource
extends UnicastRemoteObject
implements EventHandler

A abstract base class that established an event queue and handles event dispatch operations for listeners declared in a class extending this base class.

Version:
1.0.3
Author:
Digital Product Meta Library
See Also:
Serialized Form

Field Summary
 
Fields inherited from class java.rmi.server.RemoteObject
ref
 
Constructor Summary
protected UnicastEventSource(EventQueue queue, Logger logger)
          Creation of a new UnicastEventSource.
 
Method Summary
protected  void addListener(EventListener listener)
          Add a listener to the set of listeners handled by this producer.
protected  void enqueueEvent(EventObject event)
          Enqueue an event for delivery to registered listeners unless there are no registered listeners.
 EventListener[] getEventListeners()
          Return the array of registered event listeners.
protected  EventQueue getEventQueue()
          Return the event queue.
protected  Logger getLocalLogger()
          Return the logging channel assigned to the event source.
protected  Object getLock()
          Return the internal synchronization lock.
abstract  void processEvent(EventObject event)
          Abstract operation to be implemented by classes extending this base class.
protected  void removeListener(EventListener listener)
          Remove a listener to the set of listeners handled by this producer.
 void terminate()
          Terminate the event source.
 
Methods inherited from class java.rmi.server.UnicastRemoteObject
clone, exportObject, exportObject, exportObject, unexportObject
 
Methods inherited from class java.rmi.server.RemoteServer
getClientHost, getLog, setLog
 
Methods inherited from class java.rmi.server.RemoteObject
equals, getRef, hashCode, toString, toStub
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

UnicastEventSource

protected UnicastEventSource(EventQueue queue,
                             Logger logger)
                      throws RemoteException
Creation of a new UnicastEventSource.

Parameters:
queue - the event queue
logger - the assigned logging channel
Throws:
RemoteException - if a remote I/O exception occurs
Method Detail

getLocalLogger

protected Logger getLocalLogger()
Return the logging channel assigned to the event source.

Returns:
the logging channel

getEventQueue

protected EventQueue getEventQueue()
Return the event queue.

Returns:
the queue

processEvent

public abstract void processEvent(EventObject event)
Abstract operation to be implemented by classes extending this base class. An implementation is reposible for the posting of the event to associated listeners. Event posting will be executed under a separate thread to the thread that initiated the event post.

Specified by:
processEvent in interface EventHandler
Parameters:
event - the event to process

addListener

protected void addListener(EventListener listener)
Add a listener to the set of listeners handled by this producer.

Parameters:
listener - the event listener

removeListener

protected void removeListener(EventListener listener)
Remove a listener to the set of listeners handled by this producer.

Parameters:
listener - the event listener

getEventListeners

public EventListener[] getEventListeners()
Return the array of registered event listeners.

Specified by:
getEventListeners in interface EventHandler
Returns:
the event listeners

enqueueEvent

protected void enqueueEvent(EventObject event)
Enqueue an event for delivery to registered listeners unless there are no registered listeners.

Parameters:
event - the event to enqueue

getLock

protected Object getLock()
Return the internal synchronization lock.

Returns:
the lock object

terminate

public void terminate()
Terminate the event source.