Protomatter Classes v1.1.6

com.protomatter.pas.event
Interface PASEventManager

All Known Implementing Classes:
PASEventManagerImpl

public interface PASEventManager

This interface is implemented internally by PAS. It provides a mechanism for registering and un-registering interest in topics, and for sending events.

The PAS event topic tree is organized like this:

 *
 +------------+
 |            |
 weather      stocks
 +---------+
 |         |
 canada    usa
           +----------+
           |          |
           co         va
           +--------+
           |        |
           denver   boulder
    
"*" is the root of all topics. The higher up the tree, the more general the topic. If you're listening to the "*" topic, you get everything that passes through the event system. If you're listening to "weather.usa.co.denver" you only get events for that topic. If you're listening to "weather.usa.co" you'll get events for the "weather.usa.co", "weather.usa.co.denver" and "weather.usa.co.boulder" topics. The topic tree is dynamically created and pruned as listeners are added an removed. Events are delivered to listeners in the tree from top to bottom (so a listener to "weather" will get events before a listener to "weather.usa"). Events are delivered via a pool of threads, so that the PASEventManager.deliverEvent(...) method returns immediately, before the event is actually delivered.

You can get access to the default implementation of the PASEventManager interface like this:

    import javax.naming.*;               // JNDI stuff
    import com.protomatter.pas.event.*;  // PASEventManager

    ...

    Context context = get_A_JNDI_Context();
    PASEventManager em
      = (PASEventManager)context.lookup(PASEventManager.JNDI_NAME);
    
From there you can register for events, un-register for events, and send events of your own.


Field Summary
static java.lang.String JNDI_NAME
          Implementations of this interface are placed at this location in the JNDI tree.
 
Method Summary
 void registerListener(java.lang.String topic, PASEventListener listener)
          Register interest in the given topic.
 void sendEvent(java.lang.String topic, PASEvent event)
          Send an event to the given topic.
 void unregisterListener(java.lang.String topic, PASEventListener listener)
          Un-register interest in the given topic.
 

Field Detail

JNDI_NAME

public static final java.lang.String JNDI_NAME
Implementations of this interface are placed at this location in the JNDI tree.
Method Detail

sendEvent

public void sendEvent(java.lang.String topic,
                      PASEvent event)
Send an event to the given topic.

registerListener

public void registerListener(java.lang.String topic,
                             PASEventListener listener)
Register interest in the given topic.

unregisterListener

public void unregisterListener(java.lang.String topic,
                               PASEventListener listener)
Un-register interest in the given topic.

Protomatter Classes v1.1.6
Copyright 1998-2001 Nate Sammons

Protomatter Classes v1.1.6 http://protomatter.sourceforge.net/1.1.6