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 AbstractEventGenerator

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

All Implemented Interfaces:
  IEventGenerator

Direct Known Subclasses:
  AbstractPullEventGenerator, AbstractPushEventGenerator

public abstract class AbstractEventGenerator
extends Object
implements IEventGenerator

Provides a base implementation of an event generator; an event generator is responsible for polling for an Event and posting an Event to the Event router.

Field Summary
`protected HashSet` | `m_setOfEventTypes`

Constructor Summary
`AbstractEventGenerator()`

Method Summary
`protected void` | `assertValidLicense()` Verifies the existence of a valid license for this adapter; if there is no valid license available, this method throws an exception to prevent the instantiation of a `ManagedConnectionFactory` object.
`protected ValidationResult` | `checkLicense()` Returns true if the adapter can locate a valid license in the runtime environment.
`protected HashSet` | `createSetOfEventTypes(Set currentSetOfEventTypes, List listOfNewTypes, List listOfDeadTypes)` Creates a set of event types that are known to the router.
`protected abstract void` | `doCleanUpOnQuit()` Performs any clean-up needed once this object determines that it is time to quit running.
`protected abstract void` | `doInit(Map map)` EIS specific initialization, only called once.
`protected com.bea.wlai.common.IEventDefinition` | `getEventDefinition(String strEventType)`
`protected Iterator` | `getEventTypes()`
`protected Map` | `getInitializationParms()` Accessor for initialization parms
`LogContext` | `getLogContext()` Retrieves an object that determines the logging configuration for this instance in the logging framework.
`ILogger` | `getLogger()` Retrieves an object used to log information to.
`protected IEventRouter` | `getRouter()` Accessor for router object.
`protected long` | `getSleepCount()` Accessor for sleep count
`protected void` | `handlePostEventException(com.bea.wlai.common.IEvent event, Exception exc)` Convenience method to handle an exception while posting an event; currently this method invokes logPostEventException.
`void` | `init(IEventRouter router, Map map)` intializes the EventGenerator.
`protected boolean` | `isEventTypeKnownToRouter(String strEventType)`
`boolean` | `isInitialized()` Validation method.
`protected void` | `logDeadTypes(List listOfDeadTypes)` Logs the list of dead types as information
`protected void` | `logEventTypes(ILogger logger, Set setOfEventTypes)` Convenience method for event type logging
`protected void` | `logNewTypes(List listOfNewTypes)` Logs the list of new types as information
`protected void` | `logPostEventException(com.bea.wlai.common.IEvent event, Exception exc)` Convenience method for logging an exception that occured while attempting to post an event to the event router.
`void` | `refresh()` Refreshes the set of event types known to this worker.
`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.
`abstract void` | `start()` Starts the EventGenerator
`abstract void` | `stop()` Stops the Event Generator

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### m_setOfEventTypes

    protected HashSet m_setOfEventTypes

Constructor Detail

### AbstractEventGenerator

    public AbstractEventGenerator()

Method Detail

### init

    public void init(IEventRouter router,
                     Map map)
              throws Exception

  intializes the EventGenerator. Extracts initialization parameters from the web.xml used in the EventRouter.war file.

  Specified by:
    `init` in interface `IEventGenerator`
  Throws:
    `Exception`

### isInitialized

    public boolean isInitialized()

  Validation method. Validates router and initialization parms for existence.

### doInit

    protected abstract void doInit(Map map)
                            throws Exception

  EIS specific initialization, only called once.

  Throws:
    `Exception`

### getRouter

    protected IEventRouter getRouter()

  Accessor for router object.

### getInitializationParms

    protected Map getInitializationParms()

  Accessor for initialization parms

### getSleepCount

    protected long getSleepCount()

  Accessor for sleep count

### getLogContext

    public LogContext getLogContext()

  Retrieves an object that determines the logging configuration for this instance in the logging framework.

  Returns:
    an object that determines the logging configuration for this instance.

### getLogger

    public ILogger getLogger()

  Retrieves an object used to log information to. This uses the adapter's logical name to determine its logger. Adapter developers can override this to return a logger that is not based solely on the supplied logging context.

  Returns:
    an object used to log information to.

### doCleanUpOnQuit

    protected abstract 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.

  Throws:
    `Exception` - - an exceptional condition was encountered while attempting to clean-up resources used by this instance.

### isEventTypeKnownToRouter

    protected boolean isEventTypeKnownToRouter(String strEventType)

  Returns:
    true if `strEventType` is known to the event router. If an event type is known to the router, it should be posted to the router.

### getEventDefinition

    protected com.bea.wlai.common.IEventDefinition getEventDefinition(String strEventType)

  Returns:
    the event definition object with name `strEventType` if present in our set of event types; null if not.

### getEventTypes

    protected Iterator getEventTypes()

  Returns:
    an iterator over all event types known to the router; the iterator is generated from a clone of the underlying set of event types to prevent concurrent modification problems.

### logEventTypes

    protected void logEventTypes(ILogger logger,
                                 Set setOfEventTypes)

  Convenience method for event type logging

### logNewTypes

    protected void logNewTypes(List listOfNewTypes)

  Logs the list of new types as information

### logDeadTypes

    protected void logDeadTypes(List listOfDeadTypes)

  Logs the list of dead types as information

### createSetOfEventTypes

    protected HashSet createSetOfEventTypes(Set currentSetOfEventTypes,
                                            List listOfNewTypes,
                                            List listOfDeadTypes)

  Creates a set of event types that are known to the router.

  Parameters:
    `currentSetOfEventTypes` - - a snapshot of the current set of event types configured for this event generator; can be null
    `listOfNewTypes` - - this method will add any types found in the list provided by the router not currently in the set of types known to this worker if this parameter is not null.
    `listOfDeadTypes` - - this method will add any types not found in the list of event types provided by the router and were in the set maintained by this instance prior to the refresh.

### refresh

    public void refresh()
                 throws Exception

  Refreshes the set of event types known to this worker. If there are any new event types (a new event type is one that was not previously known to this worker), this method passes the set of new types to `setupNewTypes`. Similarly, if there are any event types that were previously known this worker that are no longer used by the router, this method invokes the `removeDeadTypes` method.

  Specified by:
    `refresh` in interface `IEventGenerator`
  Throws:
    `Exception` - If any error occurs while starting up.
  See Also:
    `setupNewTypes`, `removeDeadTypes`

### handlePostEventException

    protected void handlePostEventException(com.bea.wlai.common.IEvent event,
                                            Exception exc)

  Convenience method to handle an exception while posting an event; currently this method invokes logPostEventException. Adapter developers can override this method to perform any adapter specific behavior for handling exceptions during a post to the router.

### logPostEventException

    protected void logPostEventException(com.bea.wlai.common.IEvent event,
                                         Exception exc)

  Convenience method for logging an exception that occured while attempting to post an event to the event router.

### assertValidLicense

    protected void assertValidLicense()
                               throws Exception

  Verifies the existence of a valid license for this adapter; if there is no valid license available, this method throws an exception to prevent the instantiation of a `ManagedConnectionFactory` object. Adapter developers should override the `checkLicense` method to perform the adapter specific license check.

  Throws:
    `Exception` - - license verification failed for this adapter.
  See Also:
    `checkLicense method`

### checkLicense

    protected ValidationResult checkLicense()

  Returns true if the adapter can locate a valid license in the runtime environment. Currently, this method always returns VALID for the license check. Adapter developers should override this method to perform an actual license check.

  Returns:
    ValidationResult - an object that describes the result of a validation check; a `ValidationResult` object may or may not have additional information associated with it. The additional information is used to generate a "better" exception on a failed validation attempt.

### start

    public abstract void start()
                        throws Exception

  Starts the EventGenerator

  Specified by:
    `start` in interface `IEventGenerator`
  Throws:
    `Exception` - If any error occurs while starting up.

### stop

    public abstract void stop()
                       throws Exception

  Stops the Event Generator

  Specified by:
    `stop` in interface `IEventGenerator`
  Throws:
    `Exception` - If any error occurs while stopping.

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

  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.

  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