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

com.ibm.able.agents
Class AbleJavaScriptAgent

java.lang.Object
  extended bycom.ibm.able.AbleObject
      extended bycom.ibm.able.AbleDefaultAgent
          extended bycom.ibm.able.agents.AbleScriptAgent
              extended bycom.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, properties, 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.
 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, getEventConnections, getNumEpochs, getProcessList, getUserDefinedFunction, getUserDefinedFunctions, handleAbleEvent, initAllBeans, invokeUserDefinedFunction, isActiveDataSource, propertyChange, quitAll, quitEnabledEventProcessing, removeAllBeans, removeAllConnections, removeAllEventConnections, 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, process, processAbleEvent, 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, process, 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
processAbleEvent, 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

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.

Specified by:
init in interface AbleBean
Overrides:
init in class AbleScriptAgent
Throws:
AbleException

process

public void process()
             throws AbleException
Execute the processScript.

Specified by:
process in interface AbleBean
Overrides:
process in class AbleScriptAgent
Throws:
AbleException

processTimerEvent

public void processTimerEvent()
                       throws AbleException
Execute the processTimerScript.

Specified by:
processTimerEvent in interface AbleEventQueueProcessor
Overrides:
processTimerEvent in class AbleScriptAgent
Throws:
AbleException

addBean

public void addBean(AbleBean theAbleBean)
             throws AbleException
Register the bean with the manager and then call super.addBean.

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

Specified by:
removeBean in interface AbleBeanContainer
Overrides:
removeBean in class AbleDefaultAgent
Parameters:
theAbleBean - A bean that is to be removed from this container.
Throws:
AbleException - If an error occurs.

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

(C) Copyright IBM Corporation 1999, 2005