Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.bea.adapter.event
Class AbstractPullEventGenerator

    java.lang.Object
      com.bea.adapter.event.AbstractEventGenerator
          com.bea.adapter.event.AbstractPullEventGenerator

All Implemented Interfaces:
  IEventGenerator, Runnable

Direct Known Subclasses:
  AbstractBEAPullEventGenerator

public abstract class AbstractPullEventGenerator
extends AbstractEventGenerator
implements Runnable

A class that does work for an event generator. Adapter providers can override methods on this class to provide EIS specific event generation logic.

NOTE: This class implements the methods needed to support the ISuspendableEventGenerator interface. This class does NOT, however, implement ISuspendableEventGenerator. The decision to implement or not is left to the subclasses of this class. However, if a subclass does decide to implement ISuspendableEventGenerator, they can simply delegate the calls on this interface to 'super'.

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
`AbstractPullEventGenerator()`

Method Summary
`protected void` | `checkInitializeState()` Checks initialization state of PullEventGenerator
`protected void` | `checkThreadState()` Checks the thread state of the PullEventGenerator
`protected void` | `doCleanUpOnQuit()` Performs any clean-up needed once this object determines that it is time to quit running.
`protected void` | `doInit(Map map)` Performs EIS specific initialization of this object based on properties in the `map` argument.
`boolean` | `isSuspended()` Indicates if this thread is in the suspended state.
`protected abstract void` | `postEvents(IEventRouter router)` 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.
`void` | `resume()` Resume the generation of events.
`void` | `run()` Runnable implementation.
`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()` Starts the PullEventGenerator to polling.
`void` | `stop()` Notifies this thread that it should stop posting events to the event router.
`void` | `suspend()` Suspend (temporarily) the generation of events.

Methods inherited from class com.bea.adapter.event.AbstractEventGenerator
`assertValidLicense, checkLicense, createSetOfEventTypes, 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

### AbstractPullEventGenerator

    public AbstractPullEventGenerator()

Method Detail

### doInit

    protected void doInit(Map map)
                   throws Exception

  Performs EIS specific initialization of this object based on properties in the `map` argument. Adapter developers must override this method according to their EIS specific needs.

  Specified by:
    `doInit` in class `AbstractEventGenerator`
  Throws:
    `Exception` - - an exceptional condition was encountered while attempting to initialize this object based on properties in the map; perhaps the map is missing a required parameter.

### checkInitializeState

    protected void checkInitializeState()
                                 throws Exception

  Checks initialization state of PullEventGenerator

  Throws:
    `Exception`

### checkThreadState

    protected void checkThreadState()
                             throws Exception

  Checks the thread state of the PullEventGenerator

  Throws:
    `Exception`

### 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.

### postEvents

    protected abstract void postEvents(IEventRouter router)
                                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. For implementations that can post multiple events from a single call to postEvents, they should periodically check the value of `isSuspended` and return in a timely fashion when it returns true. 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`

### suspend

    public void suspend()
                 throws Exception

  Suspend (temporarily) the generation of events. Any events that occur on the EIS instance must be preserved either on the EIS instance itself, or within some EventGenerator-specific store. This call will allow any active call to postEvents to return before it itself returns.

  Throws:
    `Exception`

### resume

    public void resume()
                throws Exception

  Resume the generation of events. Any events that have occurred while this EventGenerator was suspended, should now be delivered as soon as possible to the EventRouter.

  Throws:
    `Exception`

### isSuspended

    public boolean isSuspended()

  Indicates if this thread is in the suspended state. If this method returns true, no calls will be made to postEvents, though current calls to postEvents are allowed to complete. Subclasses should periodically check the return value of this method, and return from postEvents in a timely fashion when it returns true.

### run

    public void run()

  Runnable implementation. Used to log and route events to the concrete implementation.

  Specified by:
    `run` in interface `Runnable`

### start

    public void start()
               throws Exception

  Starts the PullEventGenerator to polling.

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

### stop

    public void stop()
              throws Exception

  Notifies this thread that it should stop posting events to the event router.

  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`

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD