| 
Protomatter Classes v1.1.6 | |||||||||
| PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES | |||||||||
See: 
          Description
| Class Summary | |
| PASEventManagerImpl | The default implementation of the PASEventManager interface. | 
The default implementation of the PAS event tree facility.
    package com.protomatter.pas.event;
    public class PASEvent
    {
      public PASEvent(Object payload) { ... }
      public Object getPayload() { ... }
    }
    public interface PASEventListener
    {
      public void handlePASEvent(String topic, PASEvent event);
    }
    public interface PASEventManager
    {
      public void sendEvent(String topic, PASEvent event);
      public void registerListener(String topic, PASEventListener l);
      public void unregisterListener(String topic, PASEventListener l);
    }
    
  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.Event listeners can also be configured through the PAS properties file as follows:
     pas.event.SOMENAME=\
	topics=TOPIC1;TOPIC2;...;TOPICn,\
	listener=event.listener.class.name
     The class specified in the "listener" option above must implement the PASEventListener interface. It's default constructor is called, and it is then registered with the event manager to listen to the given event topics. When used in conjuntion with the com.protomatter.pas.cron facility this can provide a robust mechanism for performing actions at pre-determined dates and times, and on regular schedules.
  | 
              Protomatter Classes v1.1.6               Copyright 1998-2001 Nate Sammons  | 
|||||||||
| PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES | |||||||||
| Protomatter Classes v1.1.6 | http://protomatter.sourceforge.net/1.1.6 |