Package org.frankframework.javascript
Class J2V8
java.lang.Object
org.frankframework.javascript.J2V8
- All Implemented Interfaces:
JavascriptEngine<com.eclipsesource.v8.V8>
-
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 filecom.eclipsesource.v8.V8Getter 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.voidThe V8 runtime (DLL/SO files) have to be extracted somewhere, using an absolute path.
-
Constructor Details
-
J2V8
public J2V8()
-
-
Method Details
-
setGlobalAlias
- Specified by:
setGlobalAliasin 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:
startRuntimein interfaceJavascriptEngine<com.eclipsesource.v8.V8>- Throws:
JavascriptException
-
executeScript
Description copied from interface:JavascriptEngineRead the functions of a given javascript file- Specified by:
executeScriptin 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:JavascriptEngineExecutes a javascript function and returns the result of that function- Specified by:
executeFunctionin 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:JavascriptEngineCloses the runtime for the specified engine- Specified by:
closeRuntimein interfaceJavascriptEngine<com.eclipsesource.v8.V8>
-
getEngine
public com.eclipsesource.v8.V8 getEngine()Description copied from interface:JavascriptEngineGetter for the runtime of the specified engine- Specified by:
getEnginein interfaceJavascriptEngine<com.eclipsesource.v8.V8>- 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<com.eclipsesource.v8.V8>- 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<com.eclipsesource.v8.V8>- Parameters:
resultHandler- Object to handle results and errors.
-