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

com.ibm.able.agents
Class AbleJavaScriptAgent

java.lang.Object
  |
  +--com.ibm.able.AbleObject
        |
        +--com.ibm.able.AbleDefaultAgent
              |
              +--com.ibm.able.agents.AbleScriptAgent
                    |
                    +--com.ibm.able.agents.AbleJavaScriptAgent
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 AbleJavaScriptAgent
extends AbleScriptAgent

An Agent whose behavior can be specified using JavaScript scripts.

See Also:
Serialized Form

Field Summary
static java.lang.String defaultName
          Value assigned to name by default.
protected  java.lang.String initScript
          The initScript object is created from a JavaScript named by the initScriptFileName when the agent is initialized.
protected  com.ibm.bsf.BSFManager mgr
           
protected  java.lang.String processScript
          The processScript object is created from a JavaScript named by the processScriptFileName when the agent is initialized.
protected  java.lang.String processTimerScript
          The processTimerScript object is created from a JavaScript named by the processTimerScriptFileName when the agent is initialized.
protected  com.ibm.bsf.BSFEngine rhinoEngine
           
protected static long serialVersionUID
          Serialized version identifier in form YYYYMMDDVerRelModxx
 
Fields inherited from class com.ibm.able.agents.AbleScriptAgent
initScriptFileName, processScriptFileName, processTimerScriptFileName
 
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
AbleJavaScriptAgent()
           
 
Method Summary
 void addBean(AbleBean theAbleBean)
          Register the bean with the manager and then call super.addBean.
static java.lang.String Copyright()
          Determine the copyright of this class.
 void init()
          Create the scripting engine to process the scripts.
 void process()
          Execute the processScript.
 void processTimerEvent()
          Execute the processTimerScript.
 void removeBean(AbleBean theAbleBean)
          De-register the bean with the manager and then call super.removeBean.
 
Methods inherited from class com.ibm.able.agents.AbleScriptAgent
getInitScript, getInitScriptFileName, getProcessScript, getProcessScriptFileName, getProcessTimerScript, getProcessTimerScriptFileName, reset, setDefaults, setInitScriptFileName, setProcessScriptFileName, setProcessTimerScriptFileName
 
Methods inherited from class com.ibm.able.AbleDefaultAgent
addBeans, addEventConnection, addUserDefinedFunction, buildProcessList, clsNm, containsBean, containsBean, containsUserDefinedFunction, debugTrace, generateUniqueName, getBean, getBeans, getDataSource, getNumEpochs, getProcessList, getUserDefinedFunction, getUserDefinedFunctions, handleAbleEvent, invokeUserDefinedFunction, isActiveDataSource, propertyChange, quitAll, quitEnabledEventProcessing, removeAllBeans, removeAllConnections, removeAllEventConnections, 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, process, processAbleEvent, 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, process, 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
processAbleEvent, 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

mgr

protected transient com.ibm.bsf.BSFManager mgr

rhinoEngine

protected transient com.ibm.bsf.BSFEngine rhinoEngine

initScript

protected java.lang.String initScript
The initScript object is created from a JavaScript named by the initScriptFileName when the agent is initialized.

processScript

protected java.lang.String processScript
The processScript object is created from a JavaScript named by the processScriptFileName when the agent is initialized.

processTimerScript

protected java.lang.String processTimerScript
The processTimerScript object is created from a JavaScript named by the processTimerScriptFileName when the agent is initialized.
Constructor Detail

AbleJavaScriptAgent

public AbleJavaScriptAgent()
                    throws AbleException
Method Detail

init

public void init()
          throws AbleException
Create the scripting engine to process the scripts. Register this agent and all the beans it contains with the script manager so it can access any of the beans. Read any of the init, process, and processTimer scripts specified. Finally, run the init script.
Overrides:
init in class AbleScriptAgent
Following copied from interface: com.ibm.able.AbleBean
Throws:
AbleException - If an error occurs.

process

public void process()
             throws AbleException
Execute the processScript.
Overrides:
process in class AbleScriptAgent
Following copied from class: com.ibm.able.AbleDefaultAgent
Throws:
AbleException - If an error occurs. Errors from each contained bean are accumulated.

processTimerEvent

public void processTimerEvent()
                       throws AbleException
Execute the processTimerScript.
Overrides:
processTimerEvent in class AbleScriptAgent
Following copied from interface: com.ibm.able.AbleEventQueueProcessor
Throws:
AbleException - If an error occurs.

addBean

public void addBean(AbleBean theAbleBean)
             throws AbleException
Register the bean with the manager and then call super.addBean.
Overrides:
addBean in class AbleDefaultAgent
Following copied from class: com.ibm.able.AbleDefaultAgent
Parameters:
theAbleBean - The bean to be added to this container.
Throws:
AbleException - If an error occurs.

removeBean

public void removeBean(AbleBean theAbleBean)
                throws AbleException
De-register the bean with the manager and then call super.removeBean.
Overrides:
removeBean in class AbleDefaultAgent
Following copied from class: com.ibm.able.AbleDefaultAgent
Parameters:
theAbleBean - A bean that is to be removed from this container.
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