Package org.frankframework.javascript
Class GraalJS
java.lang.Object
org.frankframework.javascript.GraalJS
- All Implemented Interfaces:
JavascriptEngine<ScriptEngine>
Javascript engine implementation of GraalJS. If high performance execution of JavaScript code is required, enable the following JVM options:
"-XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI" or use the GraalVM Java distribution. Otherwise, the Javascript code is interpreted on every execution.
GraalJS is in Beta phase, so it is not supported by Frank!Framework yet.
- Since:
- 8.2
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidCloses the runtime for the specified engineexecuteFunction(String name, Object... parameters) Executes a javascript function and returns the result of that functionvoidexecuteScript(String script) Read the functions of a given javascript fileGetter for the runtime of the specified enginevoidregisterCallback(ISender sender, PipeLineSession session) Allows for senders to be called by the Javascript function.voidsetGlobalAlias(String alias) voidsetResultHandler(ResultHandler resultHandler) Registers the result and error functions to be handled by the given result handler.voidInitialize the runtime for the specified engine
-
Constructor Details
-
GraalJS
public GraalJS()
-
-
Method Details
-
setGlobalAlias
- Specified by:
setGlobalAliasin interfaceJavascriptEngine<ScriptEngine>- Parameters:
alias- An identifier which describes the script(s) that are being executed.
-
startRuntime
Description copied from interface:JavascriptEngineInitialize the runtime for the specified engine- Specified by:
startRuntimein interfaceJavascriptEngine<ScriptEngine>- Throws:
JavascriptException
-
executeScript
Description copied from interface:JavascriptEngineRead the functions of a given javascript file- Specified by:
executeScriptin interfaceJavascriptEngine<ScriptEngine>- Parameters:
script- String containing the contents of the javascript file in which the function(s) to be executed are specified.- Throws:
JavascriptException
-
executeFunction
Description copied from interface:JavascriptEngineExecutes a javascript function and returns the result of that function- Specified by:
executeFunctionin interfaceJavascriptEngine<ScriptEngine>- Parameters:
name- The name of the javascript function as given in the javascript file.parameters- An array containing the parameters for the javascript function, given in the adapter configuration- Returns:
- The result of the javascript function is returned.
- Throws:
JavascriptException
-
closeRuntime
public void closeRuntime()Description copied from interface:JavascriptEngineCloses the runtime for the specified engine- Specified by:
closeRuntimein interfaceJavascriptEngine<ScriptEngine>
-
getEngine
Description copied from interface:JavascriptEngineGetter for the runtime of the specified engine- Specified by:
getEnginein interfaceJavascriptEngine<ScriptEngine>- Returns:
- Returns the runtime instance
-
registerCallback
Description copied from interface:JavascriptEngineAllows for senders to be called by the Javascript function. Sender needs to be given in the adapter configuration, a Javascript function can call the sender, using the name of the sender as a function call.- Specified by:
registerCallbackin interfaceJavascriptEngine<ScriptEngine>- Parameters:
sender- The sender given in the adapter configuration
-
setResultHandler
Description copied from interface:JavascriptEngineRegisters the result and error functions to be handled by the given result handler.- Specified by:
setResultHandlerin interfaceJavascriptEngine<ScriptEngine>- Parameters:
resultHandler- Object to handle results and errors.
-