com.protomatter.pas.eventmanager
Downloads Source Javadoc
Author: Unspecified
Home Page:
Version: Unspecified
Release Tag: Unknown
Release Date: Unknown
JVM Required: Unspecified
License: GNU Library General Public License
Categories: None
Requirements:
Dependencies: No dependencies
Externals: None

The default implementation of the PAS event tree facility.
Hierarchical Event Trees

Like WebLogic, PAS provides an event tree. Unlike Tengah, the API for registering interest in and sending events is very simple. The API consists of two interfaces and one class:
     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 {@linkcom.protomatter.pas.cron} facility this can provide a robust mechanism for performing actions at pre-determined dates and times, and on regular schedules.


Downloads

The following page lists the available downloads for the release of package 'com.protomatter.pas.eventmanager' tagged 'Unknown'. If you need to work with releases other than 'Unknown', you will need to use the anonymous CVS server to access them.