WebLogic Integration


com.bea.adapter.event
Class AbstractEventGenerator

java.lang.Object
  |
  +--com.bea.adapter.event.AbstractEventGenerator
Direct Known Subclasses:
AbstractPullEventGenerator, AbstractPushEventGenerator

public abstract class AbstractEventGenerator
extends java.lang.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.

Author:
Copyright © 2000, 2001 BEA Systems, Inc. All Rights Reserved.

Field Summary
protected  java.util.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  java.util.HashSet createSetOfEventTypes(java.util.Set currentSetOfEventTypes, java.util.List listOfNewTypes, java.util.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(java.util.Map map)
          EIS specific initialization, only called once.
protected  IEventDefinition getEventDefinition(java.lang.String strEventType)
           
protected  java.util.Iterator getEventTypes()
           
protected  java.util.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(IEvent event, java.lang.Exception exc)
          Convenience method to handle an exception while posting an event; currently this method invokes logPostEventException.
 void init(IEventRouter router, java.util.Map map)
          intializes the EventGenerator.
protected  boolean isEventTypeKnownToRouter(java.lang.String strEventType)
           
 boolean isInitialized()
          Validation method.
protected  void logDeadTypes(java.util.List listOfDeadTypes)
          Logs the list of dead types as information
protected  void logEventTypes(ILogger logger, java.util.Set setOfEventTypes)
          Convenience method for event type logging
protected  void logNewTypes(java.util.List listOfNewTypes)
          Logs the list of new types as information
protected  void logPostEventException(IEvent event, java.lang.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(java.util.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(java.util.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 java.util.HashSet m_setOfEventTypes
Constructor Detail

AbstractEventGenerator

public AbstractEventGenerator()
Method Detail

init

public void init(IEventRouter router,
                 java.util.Map map)
          throws java.lang.Exception
intializes the EventGenerator. Extracts initialization parameters from the web.xml used in the EventRouter.war file.
Specified by:
init in interface IEventGenerator

Parameters:
IEventRouter - router
Map - initialization parms

isInitialized

public boolean isInitialized()
Validation method. Validates router and initialization parms for existence.


doInit

protected abstract void doInit(java.util.Map map)
                        throws java.lang.Exception
EIS specific initialization, only called once.


getRouter

protected IEventRouter getRouter()
Accessor for router object.


getInitializationParms

protected java.util.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 java.lang.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:
java.lang.Exception - - an exceptional condition was encountered while attempting to clean-up resources used by this instance.

isEventTypeKnownToRouter

protected boolean isEventTypeKnownToRouter(java.lang.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 IEventDefinition getEventDefinition(java.lang.String strEventType)

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

getEventTypes

protected java.util.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,
                             java.util.Set setOfEventTypes)
Convenience method for event type logging


logNewTypes

protected void logNewTypes(java.util.List listOfNewTypes)
Logs the list of new types as information


logDeadTypes

protected void logDeadTypes(java.util.List listOfDeadTypes)
Logs the list of dead types as information


createSetOfEventTypes

protected java.util.HashSet createSetOfEventTypes(java.util.Set currentSetOfEventTypes,
                                                  java.util.List listOfNewTypes,
                                                  java.util.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 java.lang.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

See Also:
setupNewTypes, removeDeadTypes

handlePostEventException

protected void handlePostEventException(IEvent event,
                                        java.lang.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(IEvent event,
                                     java.lang.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 java.lang.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:
java.lang.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 java.lang.Exception
Starts the EventGenerator
Specified by:
start in interface IEventGenerator


stop

public abstract void stop()
                   throws java.lang.Exception
Stops the Event Generator
Specified by:
stop in interface IEventGenerator


setupNewTypes

protected abstract void setupNewTypes(java.util.List listOfNewTypes)
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.

removeDeadTypes

protected abstract void removeDeadTypes(java.util.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.

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.

WebLogic Integration

WebLogic Integration (WLI)