Package org.frankframework.javascript
Class J2V8
java.lang.Object
org.frankframework.javascript.J2V8
- All Implemented Interfaces:
JavascriptEngine<com.eclipsesource.v8.V8>
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Closes the runtime for the specified engineexecuteFunction
(String name, Object... parameters) Executes a javascript function and returns the result of that functionvoid
executeScript
(String script) Read the functions of a given javascript filecom.eclipsesource.v8.V8
Getter for the runtime of the specified enginevoid
registerCallback
(ISender sender, PipeLineSession session) Allows for senders to be called by the Javascript function.void
setGlobalAlias
(String alias) void
setResultHandler
(ResultHandler resultHandler) Registers the result and error functions to be handled by the given result handler.void
The V8 runtime (DLL/SO files) have to be extracted somewhere, using an absolute path.
-
Constructor Details
-
J2V8
public J2V8()
-
-
Method Details
-
setGlobalAlias
- Specified by:
setGlobalAlias
in interfaceJavascriptEngine<com.eclipsesource.v8.V8>
- Parameters:
alias
- An identifier which describes the script(s) that are being executed.
-
startRuntime
The V8 runtime (DLL/SO files) have to be extracted somewhere, using an absolute path. Defaults to ${ibis.tmpdir}- Specified by:
startRuntime
in interfaceJavascriptEngine<com.eclipsesource.v8.V8>
- Throws:
JavascriptException
-
executeScript
Description copied from interface:JavascriptEngine
Read the functions of a given javascript file- Specified by:
executeScript
in interfaceJavascriptEngine<com.eclipsesource.v8.V8>
- 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:JavascriptEngine
Executes a javascript function and returns the result of that function- Specified by:
executeFunction
in interfaceJavascriptEngine<com.eclipsesource.v8.V8>
- 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:JavascriptEngine
Closes the runtime for the specified engine- Specified by:
closeRuntime
in interfaceJavascriptEngine<com.eclipsesource.v8.V8>
-
getEngine
public com.eclipsesource.v8.V8 getEngine()Description copied from interface:JavascriptEngine
Getter for the runtime of the specified engine- Specified by:
getEngine
in interfaceJavascriptEngine<com.eclipsesource.v8.V8>
- Returns:
- Returns the runtime instance
-
registerCallback
Description copied from interface:JavascriptEngine
Allows 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:
registerCallback
in interfaceJavascriptEngine<com.eclipsesource.v8.V8>
- Parameters:
sender
- The sender given in the adapter configuration
-
setResultHandler
Description copied from interface:JavascriptEngine
Registers the result and error functions to be handled by the given result handler.- Specified by:
setResultHandler
in interfaceJavascriptEngine<com.eclipsesource.v8.V8>
- Parameters:
resultHandler
- Object to handle results and errors.
-