Class EventQueueGenerator

  extended by atg.service.queue.EventQueueGenerator

public class EventQueueGenerator
extends java.lang.Object

This class is a standalone tool, that generates an EventQueue service for a particular event listener interface.

EventQueues are used to separate event generators from event listeners. For example, say that you have an object that implements the "PhoneCallListener" interface, receiving "PhoneCall" events. You add this object as a listener to an "Operator" service. Now say that the Operator is sending out PhoneCall events much faster than the PhoneCallListener can handle them, thereby causing processes to get backed up somewhere upstream.

The solution is to interpose an EventQueue between the Operator and the PhoneCallListener. This EventQueue would queue the method calls made by the Operator, and a separate Thread reads the events from the queue and makes the actual method calls on the PhoneCallListener. This queue would allow the Operator and PhoneCallListener to operate at different rates, thereby preventing backup of the system.

Ideally, you'd want to insert the EventQueue without having to make any changes to the PhoneCallListener or Operator. The simplest way to do this is to make the EventQueue implement the same PhoneCallListener interface, and to accept PhoneCallListeners. Then, you would add the EventQueue as a listener to the Operator, and add the original PhoneCallListener to the EventQueue as a listener.

To do this, you'll need a subclass of EventQueue that implements the PhoneCallListener interface, queues up the method calls, and empties the queue by making PhoneCallListener calls. In other words, you'll need a subclass of EventQueue specially designed for the PhoneCallListener interface.

This class will generate such a class. Given the name of an interface, this class will generate the java code needed to implement an EventQueue that queues method calls made to that interface and sends those calls to its listeners.

Field Summary
static java.lang.String CLASS_VERSION
          Class version string
Constructor Summary
EventQueueGenerator(java.lang.String pPackageName, java.lang.String pClassName, java.lang.String pSuperclassName, java.lang.Class pClass, pOut)
          Constructs an EventQueueGenerator for the specified class, sending the event queue class definition to the specified PrintStream.
Method Summary
static void main(java.lang.String[] pArgs)
          Runs the generator
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Field Detail


public static java.lang.String CLASS_VERSION
Class version string

Constructor Detail


public EventQueueGenerator(java.lang.String pPackageName,
                           java.lang.String pClassName,
                           java.lang.String pSuperclassName,
                           java.lang.Class pClass,
                    throws java.beans.IntrospectionException
Constructs an EventQueueGenerator for the specified class, sending the event queue class definition to the specified PrintStream.

pPackageName - the name of the generated class' package
pClassName - the name of the generated class
pSuperclassName - the name of the generated class' superclass
java.beans.IntrospectionException - if the generator was unable to analyze the class.
Method Detail


public static void main(java.lang.String[] pArgs)
                 throws java.lang.ClassNotFoundException,
Runs the generator

java.lang.ClassNotFoundException - if the class was not found
java.beans.IntrospectionException - if the class could not be analyzed