Class J2V8

java.lang.Object
org.frankframework.javascript.J2V8
All Implemented Interfaces:
JavascriptEngine<com.eclipsesource.v8.V8>

public class J2V8 extends Object implements JavascriptEngine<com.eclipsesource.v8.V8>
  • Constructor Details

    • J2V8

      public J2V8()
  • Method Details

    • setGlobalAlias

      public void setGlobalAlias(String alias)
      Specified by:
      setGlobalAlias in interface JavascriptEngine<com.eclipsesource.v8.V8>
      Parameters:
      alias - An identifier which describes the script(s) that are being executed.
    • startRuntime

      public void startRuntime() throws JavascriptException
      The V8 runtime (DLL/SO files) have to be extracted somewhere, using an absolute path. Defaults to ${ibis.tmpdir}
      Specified by:
      startRuntime in interface JavascriptEngine<com.eclipsesource.v8.V8>
      Throws:
      JavascriptException
    • executeScript

      public void executeScript(String script) throws JavascriptException
      Description copied from interface: JavascriptEngine
      Read the functions of a given javascript file
      Specified by:
      executeScript in interface JavascriptEngine<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

      public Object executeFunction(String name, Object... parameters) throws JavascriptException
      Description copied from interface: JavascriptEngine
      Executes a javascript function and returns the result of that function
      Specified by:
      executeFunction in interface JavascriptEngine<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 interface JavascriptEngine<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 interface JavascriptEngine<com.eclipsesource.v8.V8>
      Returns:
      Returns the runtime instance
    • registerCallback

      public void registerCallback(ISender sender, PipeLineSession session)
      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 interface JavascriptEngine<com.eclipsesource.v8.V8>
      Parameters:
      sender - The sender given in the adapter configuration
    • setResultHandler

      public void setResultHandler(ResultHandler resultHandler)
      Description copied from interface: JavascriptEngine
      Registers the result and error functions to be handled by the given result handler.
      Specified by:
      setResultHandler in interface JavascriptEngine<com.eclipsesource.v8.V8>
      Parameters:
      resultHandler - Object to handle results and errors.