public class JavascriptExecutor extends java.lang.Object implements java.lang.AutoCloseable, ScriptExecutor
ScriptExecutor.Installable
Constructor and Description |
---|
JavascriptExecutor(ModuleScriptProvider scriptProvider,
Scriptable baseScope)
create instance.
|
Modifier and Type | Method and Description |
---|---|
AnyMap |
call(java.lang.String scriptFunction,
AnyMap arguments)
execute the function with the given map object.
|
Record |
call(java.lang.String scriptFunction,
Record record)
execute the function with the given record.
|
void |
close() |
void |
install(ScriptExecutor.Installable plugin) |
java.lang.Object |
loadScript(java.lang.String scriptFile)
load and execute file from scripting directory in this executor.
|
public JavascriptExecutor(ModuleScriptProvider scriptProvider, Scriptable baseScope)
public java.lang.Object loadScript(java.lang.String scriptFile) throws ScriptingEngineException
ScriptExecutor
loadScript
in interface ScriptExecutor
scriptFile
- Script file. Relative path some base directory, without suffix.ScriptingEngineException
- error loading or executing scripts.public Record call(java.lang.String scriptFunction, Record record) throws ScriptingEngineException
ScriptExecutor
ScriptExecutor.loadScript(String)
calls.call
in interface ScriptExecutor
scriptFunction
- name of function. The function must be able to take one argument.record
- record to process with the script.ScriptingEngineException
- error processing the script.public AnyMap call(java.lang.String scriptFunction, AnyMap arguments) throws ScriptingEngineException
ScriptExecutor
ScriptExecutor.loadScript(String)
calls.call
in interface ScriptExecutor
scriptFunction
- name of function. The function must be able to take one argument.arguments
- arguments to process.ScriptingEngineException
- error processing the script.public void install(ScriptExecutor.Installable plugin) throws ScriptingEngineException
install
in interface ScriptExecutor
plugin
- the extension to install to the ScriptExecutorScriptingEngineException
public void close()
close
in interface java.lang.AutoCloseable
close
in interface ScriptExecutor