public abstract class AbstractScriptEngine extends Job implements IScriptEngine
| Constructor and Description |
|---|
AbstractScriptEngine(String name)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addExecutionListener(IExecutionListener listener) |
ScriptResult |
executeAsync(Object content)
Execute script code asynchronously.
|
ScriptResult |
executeSync(Object content)
Execute script code synchronously.
|
static String[] |
extractArguments(String arguments) |
EngineDescription |
getDescription()
Get engine description for current engine.
|
PrintStream |
getErrorStream() |
Object |
getExecutedFile()
Get the currently executed file instance.
|
InputStream |
getInputStream() |
PrintStream |
getOutputStream() |
List<IScriptDebugFrame> |
getStackTrace() |
boolean |
getTerminateOnIdle()
Get termination condition when engine is idle.
|
Object |
getVariable(String name)
Get a script variable.
|
Map<String,Object> |
getVariables()
Get all variables from the scope.
|
boolean |
hasVariable(String name)
Check if a variable exists within the scope of the engine.
|
Object |
inject(Object content)
Inject script code and execute synchronously.
|
Object |
injectUI(Object content)
Inject script code and execute synchronously within the UI thread.
|
boolean |
isIdle()
Get idle status of the interpreter.
|
void |
removeExecutionListener(IExecutionListener listener) |
Object |
removeVariable(String name)
Remove a variable from the scope.
|
void |
reset()
Resets the script engine to a fresh state (removes all variables and code history).
|
void |
setCloseStreamsOnTerminate(boolean closeStreams)
Set marker to automatically close I/O streams when engine is terminated.
|
void |
setEngineDescription(EngineDescription description) |
void |
setErrorStream(OutputStream errorStream)
Set the default error stream for the interpreter.
|
void |
setInputStream(InputStream inputStream)
Set the default input stream for the interpreter.
|
void |
setOutputStream(OutputStream outputStream)
Set the default output stream for the interpreter.
|
void |
setTerminateOnIdle(boolean terminate)
Set a marker that the interpreter should terminate instead entering IDLE mode.
|
void |
setVariable(String name,
Object content)
Set a variable in the script engine.
|
void |
terminate()
Terminate this interpreter.
|
addJobChangeListener, belongsTo, cancel, create, done, getJobManager, getName, getPriority, getProperty, getResult, getRule, getState, getThread, isBlocking, isSystem, isUser, join, removeJobChangeListener, schedule, schedule, setName, setPriority, setProgressGroup, setProperty, setRule, setSystem, setThread, setUser, shouldRun, shouldSchedule, sleep, toString, wakeUp, wakeUp, yieldRulegetAdapterequals, getClass, hashCode, notify, notifyAll, wait, wait, waitgetName, getSaveVariableName, registerJar, schedule, terminateCurrentgetAdapterpublic AbstractScriptEngine(String name)
name - name of script engine jobpublic EngineDescription getDescription()
IScriptEnginegetDescription in interface IScriptEnginepublic final ScriptResult executeAsync(Object content)
IScriptEngineReader object, or a File special treatment is done, otherwise the toString() method is used to extract script code.executeAsync in interface IScriptEnginecontent - content to be executed.public final ScriptResult executeSync(Object content) throws InterruptedException
IScriptEngineReader object, or a File special treatment is done, otherwise the toString() method is used to extract script code.
The calling thread is stalled until the script code is processed.executeSync in interface IScriptEnginecontent - content to be executed.InterruptedException - when execution is interruptedpublic final Object inject(Object content)
IScriptEngineinject in interface IScriptEnginecontent - content to be executed.public final Object injectUI(Object content)
IScriptEngineinjectUI in interface IScriptEnginecontent - content to be executed.public void setCloseStreamsOnTerminate(boolean closeStreams)
IScriptEnginesetCloseStreamsOnTerminate in interface IScriptEnginecloseStreams - true to close streamspublic PrintStream getOutputStream()
getOutputStream in interface IScriptEnginepublic void setOutputStream(OutputStream outputStream)
IScriptEnginesetOutputStream in interface IScriptEngineoutputStream - default output streampublic InputStream getInputStream()
getInputStream in interface IScriptEnginepublic void setInputStream(InputStream inputStream)
IScriptEnginesetInputStream in interface IScriptEngineinputStream - default input streampublic PrintStream getErrorStream()
getErrorStream in interface IScriptEnginepublic void setErrorStream(OutputStream errorStream)
IScriptEnginesetErrorStream in interface IScriptEngineerrorStream - default error streampublic final void setTerminateOnIdle(boolean terminate)
IScriptEnginesetTerminateOnIdle in interface IScriptEngineterminate - true to request terminationpublic boolean getTerminateOnIdle()
IScriptEnginegetTerminateOnIdle in interface IScriptEnginetrue when engine is terminated when idlepublic boolean isIdle()
isIdle in interface IScriptEnginepublic void addExecutionListener(IExecutionListener listener)
addExecutionListener in interface IScriptEnginepublic void removeExecutionListener(IExecutionListener listener)
removeExecutionListener in interface IScriptEnginepublic void terminate()
IScriptEngineterminate in interface IScriptEnginepublic void reset()
IScriptEnginereset in interface IScriptEnginepublic List<IScriptDebugFrame> getStackTrace()
public Object getExecutedFile()
IScriptEnginegetExecutedFile in interface IScriptEnginepublic void setEngineDescription(EngineDescription description)
public void setVariable(String name, Object content)
IScriptEnginesetVariable in interface IScriptEnginename - variable namecontent - variable contentpublic Object getVariable(String name)
IScriptEnginegetVariable in interface IScriptEnginename - variable namenullpublic boolean hasVariable(String name)
IScriptEnginenull, IScriptEngine.getVariable(String) might not be
sufficient to query.hasVariable in interface IScriptEnginename - variable nametrue when variable existspublic Object removeVariable(String name)
IScriptEngineremoveVariable in interface IScriptEnginename - variable to be removed.public Map<String,Object> getVariables()
IScriptEnginegetVariables in interface IScriptEngine