com.bea.adapter.event
Class AbstractPushEventGenerator

java.lang.Object
  extended bycom.bea.adapter.event.AbstractEventGenerator
      extended bycom.bea.adapter.event.AbstractPushEventGenerator
All Implemented Interfaces:
EventListener, IEventGenerator, IPushListener
Direct Known Subclasses:
AbstractBEAPushEventGenerator

public abstract class AbstractPushEventGenerator
extends AbstractEventGenerator
implements IPushListener

The primary responsibilites of this class is to listen for events and call postEvents. The PostEvents method will be implemented in the concrete implementation.

Author:
Copyright (c) 1998-2000 by BEA Systems, Inc. All Rights Reserved.

Field Summary
 
Fields inherited from class com.bea.adapter.event.AbstractEventGenerator
m_setOfEventTypes
 
Constructor Summary
AbstractPushEventGenerator()
           
 
Method Summary
protected  void doCleanUpOnQuit()
          Performs any clean-up needed once this object determines that it is time to quit running.
 void performPush(PushEvent e)
          IPushListener implementation.
protected abstract  void postEvents(IEventRouter router, PushEvent event)
          Posts EIS events to the event router.
protected abstract  void removeDeadTypes(List listOfDeadTypes)
          Allows this instance to apply any EIS specific setup logic needed to handle dead event types; an event type is considered dead if it is no longer in the list of event types known to the router.
protected abstract  void setupNewTypes(List listOfNewTypes)
          Allows this instance to apply any EIS specific setup logic needed to handle new event types provided by the event router.
 void start()
          Adds this object, as a listener, to any IPushHandlers created.
 void stop()
          Removes this object, as a listener, from all IPushHandler objects
 
Methods inherited from class com.bea.adapter.event.AbstractEventGenerator
assertValidLicense, checkLicense, createSetOfEventTypes, doInit, getEventDefinition, getEventTypes, getInitializationParms, getLogContext, getLogger, getRouter, getSleepCount, handlePostEventException, init, isEventTypeKnownToRouter, isInitialized, logDeadTypes, logEventTypes, logNewTypes, logPostEventException, refresh
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractPushEventGenerator

public AbstractPushEventGenerator()
Method Detail

postEvents

protected abstract void postEvents(IEventRouter router,
                                   PushEvent event)
                            throws Exception
Posts EIS events to the event router. Adapter developer's should call isEventTypeKnownToRouter before processing an event because this worker should not waste computing cycles on generating events that the router does not care about. This method is invoked in a block of code that is synchronized around the set of event types maintained by this instance. Thus, any concurrent calls to the refresh from another thread will need to wait until this method returns.
 Iterator i = getEventTypes();
 while (i.hasNext())
 {
   String strEventType = (String)i.next();
   IEventDefinition eventDef = new EventDefinition();
   eventDef.setName(strEventType);
   IEvent event =
     new Event("<" + strEventType + ">bogus");
   event.setEventDefinition(eventDef);

   try
   {
     m_router.postEvent(event);
   }
   catch (Exception exc)
   {
     handlePostEventException(event, exc);
   } // end try/catch
 } // end while
 

Throws:
Exception

performPush

public void performPush(PushEvent e)
IPushListener implementation. Used to log and route events to the concrete implementation.

Specified by:
performPush in interface IPushListener

doCleanUpOnQuit

protected void doCleanUpOnQuit()
                        throws Exception
Performs any clean-up needed once this object determines that it is time to quit running. Adapter developers should override this method to free any resources held by this instance.

Specified by:
doCleanUpOnQuit in class AbstractEventGenerator
Throws:
Exception - - an exceptional condition was encountered while attempting to clean-up resources used by this instance.

start

public void start()
           throws Exception
Adds this object, as a listener, to any IPushHandlers created.

Specified by:
start in interface IEventGenerator
Specified by:
start in class AbstractEventGenerator
Throws:
Exception

stop

public void stop()
          throws Exception
Removes this object, as a listener, from all IPushHandler objects

Specified by:
stop in interface IEventGenerator
Specified by:
stop in class AbstractEventGenerator
Throws:
Exception

setupNewTypes

protected abstract void setupNewTypes(List listOfNewTypes)
                               throws Exception
Allows this instance to apply any EIS specific setup logic needed to handle new event types provided by the event router.

Specified by:
setupNewTypes in class AbstractEventGenerator
Parameters:
listOfNewTypes - - a list of new types (IEventDefinition objects)that were not in the set of event types maintained by this instance prior to the refresh.
Throws:
Exception

removeDeadTypes

protected abstract void removeDeadTypes(List listOfDeadTypes)
                                 throws Exception
Allows this instance to apply any EIS specific setup logic needed to handle dead event types; an event type is considered dead if it is no longer in the list of event types known to the router.

Specified by:
removeDeadTypes in class AbstractEventGenerator
Parameters:
listOfDeadTypes - - a list of event types (IEventDefinition objects) that were not in the list of event types provided by the router and were in the set maintained by this instance prior to the refresh.
Throws:
Exception