public abstract class ScriptEngineActor extends TypedAtomicActor
Entity.ContainedObjectsIterator
Modifier and Type | Field and Description |
---|---|
protected static java.lang.String |
_ACTOR_INSTANCE_NAME
The name of the actor object in the script.
|
protected java.lang.Object |
_actorObject
The actor object in the script.
|
protected TextEditorConfigureFactory |
_editorFactory
Text editor.
|
protected javax.script.ScriptEngine |
_engine
The engine to parse and execute scripts.
|
protected java.lang.Object |
_evaluatedScriptObject
The Object resulting from evaluating the script.
|
protected boolean |
_invokeMethodWithReflection
If true, use reflection to invoke the method.
|
protected javax.script.ScriptEngineManager |
_manager
An object to load script engines.
|
StringParameter |
actorClassName
The name of the class in the script defining the execution methods.
|
StringParameter |
language
The script language.
|
StringAttribute |
script
The contents of the script.
|
_typesValid
_actorFiringListeners, _initializables, _notifyingActorFiring, _stopRequested
_changeListeners, _changeLock, _changeRequests, _debugging, _debugListeners, _deferChangeRequests, _elementName, _isPersistent, _verbose, _workspace, ATTRIBUTES, CLASSNAME, COMPLETE, CONTENTS, DEEP, FULLNAME, LINKS
COMPLETED, NOT_READY, STOP_ITERATING
Constructor and Description |
---|
ScriptEngineActor(CompositeEntity container,
java.lang.String name)
Construct a new ScriptEngineActor with the given container and name.
|
ScriptEngineActor(Workspace workspace)
Construct a new ScriptEngineActor for a specified workspace.
|
Modifier and Type | Method and Description |
---|---|
protected java.lang.Object |
_createActorInstance(java.lang.String actorClassNameStr)
Create an instance of the actor object in the script.
|
protected java.lang.Object |
_evaluateScript()
Evaluate the script.
|
protected void |
_putObjectToActorInstance(java.lang.String name,
java.lang.Object object)
Put the given object to the actor instance in the script.
|
protected void |
_registerEngineFactory()
Register an script engine factory with the scrip engine manager.
|
void |
attributeChanged(Attribute attribute)
React to an attribute change.
|
java.lang.Object |
clone(Workspace workspace)
Clone the actor into the specified workspace.
|
void |
debug(java.lang.String message)
Send the message to all registered debug listeners.
|
void |
error(java.lang.String message)
Set an error message that will be thrown in an exception after the
current or next method is invoked in the script.
|
void |
fire()
Invoke the fire() method in the script.
|
void |
initialize()
Invoke the initialize() method in the script.
|
boolean |
postfire()
Invoke the postfire() method in the script.
|
boolean |
prefire()
Invoke the prefire() method in the script.
|
void |
preinitialize()
Invoke the preinitialize() method of the script.
|
void |
stop()
Invoke the stop() method in the script.
|
void |
stopFire()
Invoke the stopFire() method in the script.
|
void |
terminate()
Invoke the terminate() method in the script.
|
void |
wrapup()
Invoke the wrapup() method in the script.
|
_containedTypeConstraints, _customTypeConstraints, _defaultTypeConstraints, _fireAt, _fireAt, attributeTypeChanged, clone, isBackwardTypeInferenceEnabled, newPort, typeConstraintList, typeConstraints
_actorFiring, _actorFiring, _declareDelayDependency, addActorFiringListener, addInitializable, connectionsChanged, createReceivers, declareDelayDependency, getCausalityInterface, getDirector, getExecutiveDirector, getManager, inputPortList, isFireFunctional, isStrict, iterate, newReceiver, outputPortList, pruneDependencies, recordFiring, removeActorFiringListener, removeDependency, removeInitializable, setContainer
_adjustDeferrals, _checkContainer, _getContainedObject, _propagateExistence, getContainer, instantiate, isAtomic, isOpaque, moveDown, moveToFirst, moveToIndex, moveToLast, moveUp, propagateExistence, setName
_addPort, _description, _exportMoMLContents, _removePort, _validateSettables, connectedPortList, connectedPorts, containedObjectsIterator, getAttribute, getPort, getPorts, linkedRelationList, linkedRelations, portList, removeAllPorts, setClassDefinition, uniqueName
_setParent, exportMoML, getChildren, getElementName, getParent, getPrototypeList, isClassDefinition, isWithinClassDefinition
_addAttribute, _adjustOverride, _attachText, _cloneFixAttributeFields, _containedDecorators, _copyChangeRequestList, _debug, _debug, _debug, _debug, _debug, _executeChangeRequests, _getIndentPrefix, _isMoMLSuppressed, _markContentsDerived, _notifyHierarchyListenersAfterChange, _notifyHierarchyListenersBeforeChange, _propagateValue, _removeAttribute, _splitName, _stripNumericSuffix, addChangeListener, addDebugListener, addHierarchyListener, attributeDeleted, attributeList, attributeList, decorators, deepContains, depthInHierarchy, description, description, event, executeChangeRequests, exportMoML, exportMoML, exportMoML, exportMoML, exportMoMLPlain, getAttribute, getAttributes, getChangeListeners, getClassName, getDecoratorAttribute, getDecoratorAttributes, getDerivedLevel, getDerivedList, getDisplayName, getFullName, getModelErrorHandler, getName, getName, getSource, handleModelError, isDeferringChangeRequests, isOverridden, isPersistent, lazyContainedObjectsIterator, message, notifyOfNameChange, propagateValue, propagateValues, removeAttribute, removeChangeListener, removeDebugListener, removeHierarchyListener, requestChange, setClassName, setDeferringChangeRequests, setDerivedLevel, setDisplayName, setModelErrorHandler, setPersistent, setSource, sortContainedObjects, toplevel, toString, validateSettables, workspace
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
createReceivers, getCausalityInterface, getDirector, getExecutiveDirector, getManager, inputPortList, newReceiver, outputPortList
isFireFunctional, isStrict, iterate
addInitializable, removeInitializable
description, getContainer, getDisplayName, getFullName, getName, getName, setName
getDerivedLevel, getDerivedList, propagateValue
public StringParameter actorClassName
public StringParameter language
public StringAttribute script
protected javax.script.ScriptEngine _engine
protected static final java.lang.String _ACTOR_INSTANCE_NAME
protected java.lang.Object _actorObject
protected boolean _invokeMethodWithReflection
protected java.lang.Object _evaluatedScriptObject
protected javax.script.ScriptEngineManager _manager
protected TextEditorConfigureFactory _editorFactory
public ScriptEngineActor(Workspace workspace)
public ScriptEngineActor(CompositeEntity container, java.lang.String name) throws IllegalActionException, NameDuplicationException
public void attributeChanged(Attribute attribute) throws IllegalActionException
attributeChanged
in class NamedObj
attribute
- The attribute that changed.IllegalActionException
- If the change is not acceptable
to this container (not thrown in this base class).public java.lang.Object clone(Workspace workspace) throws java.lang.CloneNotSupportedException
clone
in class TypedAtomicActor
workspace
- The workspace for the new object.java.lang.CloneNotSupportedException
- If a derived class contains
an attribute that cannot be cloned.NamedObj.exportMoML(Writer, int, String)
,
NamedObj.setDeferringChangeRequests(boolean)
public void debug(java.lang.String message)
message
- The debug message.public void error(java.lang.String message)
message
- The debug message.public void fire() throws IllegalActionException
fire
in interface Executable
fire
in class AtomicActor<TypedIOPort>
IllegalActionException
- Not thrown in this base class.public void initialize() throws IllegalActionException
initialize
in interface Initializable
initialize
in class AtomicActor<TypedIOPort>
IllegalActionException
- If a derived class throws it.public boolean postfire() throws IllegalActionException
postfire
in interface Executable
postfire
in class AtomicActor<TypedIOPort>
IllegalActionException
- Not thrown in this base class.public boolean prefire() throws IllegalActionException
prefire
in interface Executable
prefire
in class AtomicActor<TypedIOPort>
IllegalActionException
- Not thrown in this base class.public void preinitialize() throws IllegalActionException
preinitialize
in interface Initializable
preinitialize
in class AtomicActor<TypedIOPort>
IllegalActionException
- Not thrown in this base class.public void stop()
stop
in interface Executable
stop
in class AtomicActor<TypedIOPort>
public void stopFire()
stopFire
in interface Executable
stopFire
in class AtomicActor<TypedIOPort>
public void terminate()
terminate
in interface Executable
terminate
in class AtomicActor<TypedIOPort>
public void wrapup() throws IllegalActionException
wrapup
in interface Initializable
wrapup
in class AtomicActor<TypedIOPort>
IllegalActionException
- Not thrown in this base class.protected java.lang.Object _createActorInstance(java.lang.String actorClassNameStr) throws javax.script.ScriptException
javax.script.ScriptException
protected java.lang.Object _evaluateScript() throws javax.script.ScriptException, IllegalActionException
javax.script.ScriptException
IllegalActionException
protected void _putObjectToActorInstance(java.lang.String name, java.lang.Object object) throws javax.script.ScriptException
name
- the name of the object to put.object
- the object to put.javax.script.ScriptException
protected void _registerEngineFactory()