ABLE 2.0.0 07/02/2003 10:25:01

com.ibm.able.agents
Class AbleRuleAgent

java.lang.Object
  |
  +--com.ibm.able.AbleObject
        |
        +--com.ibm.able.AbleDefaultAgent
              |
              +--com.ibm.able.agents.AbleRuleAgent
All Implemented Interfaces:
AbleAgent, AbleBean, AbleBeanContainer, AbleDataBufferManager, AbleEventListener, AbleEventListenerManager, AbleEventQueueManager, AbleEventQueueProcessor, AblePropertyChangeManager, AbleSerializable, AbleUserDefinedFunctionManager, java.util.EventListener, java.beans.PropertyChangeListener, java.io.Serializable

public class AbleRuleAgent
extends AbleDefaultAgent

The AbleRuleAgent whose behavior is defined by a single AbleRuleSet bean. The init(), process(), processTimerEvent(), processAbleEvent() behaviors are defined by the corresponding ruleblocks in the ruleset bean. The behavior ruleset can be defined by filename or by reference to the object.

See Also:
Serialized Form

Field Summary
protected  AbleRuleSet behaviorRuleSet
          The behavior ruleset bean used to define the agent's behavior
protected  java.lang.String behaviorRuleSetFileName
          The name of the filename of the ruleset used to define the agent's behavior
static java.lang.String defaultName
          Value assigned to name by default.
protected static long serialVersionUID
          Serialized version identifier in form YYYYMMDDVerRelModxx
 
Fields inherited from class com.ibm.able.AbleDefaultAgent
activeDataSource, eventConnections, myBeans, numEpochs, processList, processListOK, userDefinedFunctions
 
Fields inherited from class com.ibm.able.AbleObject
changed, chgSupport, comment, dataFlowEnabled, destBufferConnections, eventQueue, fileName, inputBuffer, listeners, logger, name, outputBuffer, parent, propertyConnectionMgr, sourceBufferConnections, state, stateChgSupport, trace
 
Constructor Summary
AbleRuleAgent()
           
AbleRuleAgent(java.lang.String aName)
           
 
Method Summary
static java.lang.String Copyright()
          Determine the copyright of this class.
 AbleRuleSet getBehaviorRuleSet()
          Get the ruleset bean which provides the agent behavior.
 java.lang.String getBehaviorRuleSetFileName()
          Get the file name of the ruleset used to define the agent' behavior
 void init()
          Initialize the Rule agent by constructing and initializing the behavior ruleset bean.
 void process()
          Invoke the behaviorRuleSet to process input buffer The AbleRuleAgent inputBuffer is passed to the behaviorRuleSet (if any) The behaviorRuleSet outputBuffer (if any) is passed to the Agent's outputBuffer
 java.lang.Object process(java.lang.Object theArg)
          Invoke the behaviorRuleSet to process input buffer
 void processAbleEvent(AbleEvent theAbleEvent)
          Processes an Able event synchronously; that is, on the same thread as the caller.
 void processTimerEvent()
          Invoke the processTimerEvent method on the behavior ruleset.
 void quitAll()
          Stop all of the bean's asynchronous threads of control.
 void reset()
          Reset the behavior ruleset bean in the agent if it exists.
 void setBehaviorRuleSet(AbleRuleSet theRuleSet)
          Set the ruleset bean which provides the agent behavior
 void setBehaviorRuleSetFileName(java.lang.String fileName)
          Set the file name of the ruleset used to define the agent's behavior
protected  void setDefaults()
          Set processing options to default values.
 
Methods inherited from class com.ibm.able.AbleDefaultAgent
addBean, addBeans, addEventConnection, addUserDefinedFunction, buildProcessList, clsNm, containsBean, containsBean, containsUserDefinedFunction, debugTrace, generateUniqueName, getBean, getBeans, getDataSource, getNumEpochs, getProcessList, getUserDefinedFunction, getUserDefinedFunctions, handleAbleEvent, invokeUserDefinedFunction, isActiveDataSource, propertyChange, quitEnabledEventProcessing, removeAllBeans, removeAllConnections, removeAllEventConnections, removeBean, removeBean, removeBeans, removeEventConnection, removeUserDefinedFunction, resumeAll, setActiveDataSource, setDataFlowEnabled, setProcessList, setUserDefinedFunctions, suspendAll
 
Methods inherited from class com.ibm.able.AbleObject
addAbleEventListener, addDestBufferConnection, addPropertyChangeListener, addPropertyConnection, addSourceBufferConnection, addStateChangeListener, dataChanged, firePropertyChange, flushAbleEventQueue, getAbleEventListeners, getAbleEventProcessingEnabled, getAbleEventQueueSize, getComment, getDestBufferConnections, getFileName, getInputBuffer, getInputBuffer, getInputBufferAsStringArray, getInputBufferContents, getLogger, getName, getOutputBuffer, getOutputBuffer, getOutputBufferAsStringArray, getOutputBufferContents, getParent, getPropertyConnectionManager, getSleepTime, getSourceBufferConnections, getState, getTraceLogger, hasInputBuffer, hasOutputBuffer, init, isAbleEventPostingEnabled, isAbleEventProcessingEnabled, isChanged, isConnectable, isDataFlowEnabled, isTimerEventProcessingEnabled, notifyAbleEventListeners, processBufferConnections, processNoEventProcessingEnabledSituation, removeAbleEventListener, removeAllAbleEventListeners, removeAllBufferConnections, removeAllPropertyConnections, removeDestBufferConnection, removePropertyChangeListener, removePropertyConnection, removeSourceBufferConnection, removeStateChangeListener, restartEnabledEventProcessing, restoreFromFile, restoreFromFile, restoreFromSerializedFile, restoreFromStream, resumeEnabledEventProcessing, saveToFile, saveToFile, setAbleEventProcessingEnabled, setChanged, setComment, setFileName, setInputBuffer, setInputBuffer, setLogger, setName, setOutputBuffer, setOutputBuffer, setParent, setSleepTime, setState, setTimerEventProcessingEnabled, setTraceLogger, sourceConnectionsOK, startEnabledEventProcessing, suspendEnabledEventProcessing
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.ibm.able.AbleBean
getComment, getLogger, getName, getParent, getState, getTraceLogger, init, isChanged, setChanged, setComment, setLogger, setName, setParent, setState, setTraceLogger
 
Methods inherited from interface com.ibm.able.AbleDataBufferManager
addDestBufferConnection, addSourceBufferConnection, getDestBufferConnections, getInputBuffer, getInputBuffer, getInputBufferAsStringArray, getInputBufferContents, getOutputBuffer, getOutputBuffer, getOutputBufferAsStringArray, getOutputBufferContents, getSourceBufferConnections, hasInputBuffer, hasOutputBuffer, isConnectable, isDataFlowEnabled, processBufferConnections, removeAllBufferConnections, removeDestBufferConnection, removeSourceBufferConnection, setInputBuffer, setInputBuffer, setOutputBuffer, setOutputBuffer
 
Methods inherited from interface com.ibm.able.AbleEventListenerManager
addAbleEventListener, dataChanged, getAbleEventListeners, notifyAbleEventListeners, removeAbleEventListener
 
Methods inherited from interface com.ibm.able.AbleEventQueueManager
flushAbleEventQueue, getAbleEventProcessingEnabled, getAbleEventQueueSize, getSleepTime, isAbleEventPostingEnabled, isAbleEventProcessingEnabled, isTimerEventProcessingEnabled, restartEnabledEventProcessing, resumeEnabledEventProcessing, setAbleEventProcessingEnabled, setSleepTime, setTimerEventProcessingEnabled, startEnabledEventProcessing, suspendEnabledEventProcessing
 
Methods inherited from interface com.ibm.able.AbleEventQueueProcessor
processNoEventProcessingEnabledSituation
 
Methods inherited from interface com.ibm.able.AblePropertyChangeManager
addPropertyChangeListener, addPropertyConnection, getPropertyConnectionManager, removeAllPropertyConnections, removePropertyChangeListener, removePropertyConnection
 
Methods inherited from interface com.ibm.able.AbleSerializable
getFileName, restoreFromFile, restoreFromFile, saveToFile, saveToFile, setFileName
 
Methods inherited from interface com.ibm.able.AbleBeanContainer
getName
 

Field Detail

defaultName

public static final java.lang.String defaultName
Value assigned to name by default.

serialVersionUID

protected static final long serialVersionUID
Serialized version identifier in form YYYYMMDDVerRelModxx

behaviorRuleSet

protected AbleRuleSet behaviorRuleSet
The behavior ruleset bean used to define the agent's behavior

behaviorRuleSetFileName

protected java.lang.String behaviorRuleSetFileName
The name of the filename of the ruleset used to define the agent's behavior
Constructor Detail

AbleRuleAgent

public AbleRuleAgent()
              throws AbleException

AbleRuleAgent

public AbleRuleAgent(java.lang.String aName)
              throws AbleException
Method Detail

setBehaviorRuleSetFileName

public void setBehaviorRuleSetFileName(java.lang.String fileName)
Set the file name of the ruleset used to define the agent's behavior

getBehaviorRuleSetFileName

public java.lang.String getBehaviorRuleSetFileName()
Get the file name of the ruleset used to define the agent' behavior

getBehaviorRuleSet

public AbleRuleSet getBehaviorRuleSet()
Get the ruleset bean which provides the agent behavior.

setBehaviorRuleSet

public void setBehaviorRuleSet(AbleRuleSet theRuleSet)
Set the ruleset bean which provides the agent behavior

init

public void init()
          throws AbleException
Initialize the Rule agent by constructing and initializing the behavior ruleset bean.
  1. If behaviorRuleSetFileName is set, create the behaviorRuleSet.
  2. Call the behaviorRuleSet.init() to do initialization of this agent.
The behaviorRuleSet bean is initialized. Other beans in the container are not initialized unless processed by the behaviorRuleSet.
Overrides:
init in class AbleObject
Following copied from interface: com.ibm.able.AbleBean
Throws:
AbleException - If an error occurs.

reset

public void reset()
           throws AbleException
Reset the behavior ruleset bean in the agent if it exists. Restore processing options to default values.
Overrides:
reset in class AbleDefaultAgent
Following copied from class: com.ibm.able.AbleDefaultAgent
Throws:
AbleException - If an error occurs when resetting a contained bean. All errors are collected and insert into the exception so that one bean's error does not prevent another from being reset.

setDefaults

protected void setDefaults()
                    throws AbleException
Set processing options to default values.

process

public void process()
             throws AbleException
Invoke the behaviorRuleSet to process input buffer The AbleRuleAgent inputBuffer is passed to the behaviorRuleSet (if any) The behaviorRuleSet outputBuffer (if any) is passed to the Agent's outputBuffer
Overrides:
process in class AbleDefaultAgent
Following copied from class: com.ibm.able.AbleDefaultAgent
Throws:
AbleException - If an error occurs. Errors from each contained bean are accumulated.

process

public java.lang.Object process(java.lang.Object theArg)
                         throws AbleException
Invoke the behaviorRuleSet to process input buffer
Overrides:
process in class AbleObject
Parameters:
theArg - An Object[] of input values to be bound to the inputBuffer of the behavior ruleset
Returns:
The outputBuffer of the behavior ruleset

processTimerEvent

public void processTimerEvent()
                       throws AbleException
Invoke the processTimerEvent method on the behavior ruleset.
Overrides:
processTimerEvent in class AbleObject
Following copied from interface: com.ibm.able.AbleEventQueueProcessor
Throws:
AbleException - If an error occurs.

processAbleEvent

public void processAbleEvent(AbleEvent theAbleEvent)
                      throws AbleException
Description copied from interface: AbleEventQueueProcessor
Processes an Able event synchronously; that is, on the same thread as the caller.

This method is called by the AbleEventQueue when an event is removed from the queue for asynchronous processing. Note that this method also can be called directly from the handleAbleEvent() method described in the AbleEventListener interface when that method is given a synchronous event to handle.

Overrides:
processAbleEvent in class AbleObject
Following copied from interface: com.ibm.able.AbleEventQueueProcessor
Parameters:
theAbleEvent - The event to process.
Throws:
AbleException - If an error occurs.

quitAll

public void quitAll()
             throws AbleException
Description copied from interface: AbleBean
Stop all of the bean's asynchronous threads of control. The bean's state changes to AbleState.Unknown.

If the bean is a simple AbleBean, this method just calls AbleEventQueueManager.quitEnabledEventProcessing().

A bean implementing AbleBeanContainer should call quitAll on each bean it contains and accumulate errors from each contained bean.

Overrides:
quitAll in class AbleDefaultAgent
Following copied from interface: com.ibm.able.AbleBean
Throws:
AbleException - If an error occurs.

Copyright

public static java.lang.String Copyright()
Determine the copyright of this class.
Returns:
A String containing this class's copyright statement.

ABLE 2.0.0 07/02/2003 10:25:01

(C) Copyright IBM Corporation 1999, 2003