ABLE 2.3.0 07/13/2005 14:21:00

com.ibm.able.agents
Class AbleRuleAgent

java.lang.Object
  extended bycom.ibm.able.AbleObject
      extended bycom.ibm.able.AbleDefaultAgent
          extended bycom.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, properties, propertyConnectionMgr, sourceBufferConnections, state, stateChgSupport, trace
 
Constructor Summary
AbleRuleAgent()
           
AbleRuleAgent(java.lang.String aName)
           
 
Method Summary
 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()
          Quits all forms of processing for this bean.
 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, getEventConnections, getNumEpochs, getProcessList, getUserDefinedFunction, getUserDefinedFunctions, handleAbleEvent, initAllBeans, invokeUserDefinedFunction, isActiveDataSource, propertyChange, quitEnabledEventProcessing, removeAllBeans, removeAllConnections, removeAllEventConnections, removeBean, removeBean, removeBeans, removeEventConnection, removeUserDefinedFunction, resetAllBeans, 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, getInputBufferAsString, getInputBufferAsStringArray, getInputBufferContents, getLogger, getName, getOutputBuffer, getOutputBuffer, getOutputBufferAsString, getOutputBufferAsStringArray, getOutputBufferContents, getParent, getProperties, getProperty, getPropertyChangeListeners, getPropertyConnectionManager, getSleepTime, getSourceBufferConnections, getState, getTraceLogger, hasInputBuffer, hasOutputBuffer, init, isAbleEventPostingEnabled, isAbleEventProcessingEnabled, isChanged, isConnectable, isDataFlowEnabled, isTimerEventProcessingEnabled, notifyAbleEventListeners, processBufferConnections, processNoEventProcessingEnabledSituation, removeAbleEventListener, removeAllAbleEventListeners, removeAllBufferConnections, removeAllPropertyConnections, removeDestBufferConnection, removeProperty, removePropertyChangeListener, removePropertyConnection, removeSourceBufferConnection, removeStateChangeListener, restartEnabledEventProcessing, restoreFromFile, restoreFromFile, restoreFromSerializedFile, restoreFromStream, resumeEnabledEventProcessing, saveToFile, saveToFile, setAbleEventProcessingEnabled, setChanged, setComment, setFileName, setInputBuffer, setInputBuffer, setLogger, setName, setOutputBuffer, setOutputBuffer, setParent, setProperties, setProperty, 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, getProperties, getProperty, getState, getTraceLogger, init, isChanged, removeProperty, setChanged, setComment, setLogger, setName, setParent, setProperties, setProperty, setState, setTraceLogger
 
Methods inherited from interface com.ibm.able.AbleDataBufferManager
addDestBufferConnection, addSourceBufferConnection, getDestBufferConnections, getInputBuffer, getInputBuffer, getInputBufferAsString, getInputBufferAsStringArray, getInputBufferContents, getOutputBuffer, getOutputBuffer, getOutputBufferAsString, 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, getPropertyChangeListeners, 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

See Also:
Constant Field Values

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.

Specified by:
init in interface AbleBean
Overrides:
init in class AbleDefaultAgent
Throws:
AbleException
See Also:
AbleObject.init()

reset

public void reset()
           throws AbleException
Reset the behavior ruleset bean in the agent if it exists. Restore processing options to default values.

Specified by:
reset in interface AbleBean
Overrides:
reset in class 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.

Throws:
AbleException

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

Specified by:
process in interface AbleBean
Overrides:
process in class 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

Specified by:
process in interface AbleBean
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
Throws:
AbleException - In the following situations:
  • the inputBuffer variable is null (usually allocated in the init method)
  • the class of the parameter theArg does not match the class of the inputBuffer variable
  • the length of the parameter theArg array does not match the length of the inputBuffer array
  • the length of the parameter theArg Vector does not match the length of the inputBuffer Vector
  • when the bean has source data connections because the buffers could be overwritten from other threads
  • the outputBuffer variable is null (usually allocated in the init method)
  • the outputBuffer variable is an unsuppported class.
    See Also:
    AbleObject.inputBuffer, AbleObject.outputBuffer, AbleBean.process()

  • processTimerEvent

    public void processTimerEvent()
                           throws AbleException
    Invoke the processTimerEvent method on the behavior ruleset.

    Specified by:
    processTimerEvent in interface AbleEventQueueProcessor
    Overrides:
    processTimerEvent in class AbleObject
    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.

    Specified by:
    processAbleEvent in interface AbleEventQueueProcessor
    Overrides:
    processAbleEvent in class AbleObject
    Parameters:
    theAbleEvent - The event to process.
    Throws:
    AbleException - If an error occurs.
    See Also:
    AbleObject.setAbleEventProcessingEnabled(int), AbleObject.startEnabledEventProcessing(), AbleObject.handleAbleEvent(AbleEvent)

    quitAll

    public void quitAll()
                 throws AbleException
    Description copied from interface: AbleBean
    Quits all forms of processing for this bean. Stop all of the bean's asynchronous threads of control. The bean's state changes to AbleState.Unknown, and it should be considered unusable for further processing.

    A simple AbleBean may just call AbleEventQueueManager.quitEnabledEventProcessing(). A more complex bean may also clear itself of references so that garbage collection can occur.

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

    Specified by:
    quitAll in interface AbleBean
    Overrides:
    quitAll in class AbleDefaultAgent
    Throws:
    AbleException

    ABLE 2.3.0 07/13/2005 14:21:00

    (C) Copyright IBM Corporation 1999, 2005