Class NashornScriptCallable

java.lang.Object
org.wicketstuff.nashorn.resource.NashornScriptCallable
All Implemented Interfaces:
Callable<Object>

public class NashornScriptCallable extends Object implements Callable<Object>
The script callable setup the script environment and evaluates the given script. If the script is running the thread id is going to be determined. This id is used to check the memory usage of the process.
Author:
Tobias Soloschenko
  • Constructor Details

    • NashornScriptCallable

      public NashornScriptCallable(String script, IResource.Attributes attributes, org.openjdk.nashorn.api.scripting.ClassFilter classFilter, Writer writer, Writer errorWriter)
      Creates a script result
      Parameters:
      script - the script to be executed
      attributes - the attributes to
      classFilter - the class filter to be applied
      writer - the writer to output script prints
      errorWriter - the writer to output errors
  • Method Details

    • call

      public Object call() throws Exception
      Specified by:
      call in interface Callable<Object>
      Throws:
      Exception
    • setup

      protected void setup(IResource.Attributes attributes, Bindings bindings)
      Setup the bindings and make information available to the scripting context
      Parameters:
      attributes - the attributes of the request
      bindings - the bindings to add java objects to
    • getScript

      public String getScript()
      Gets the script
      Returns:
      the script
    • getAttributes

      public IResource.Attributes getAttributes()
      Gets the attributes
      Returns:
      the attributes
    • getClassFilter

      public org.openjdk.nashorn.api.scripting.ClassFilter getClassFilter()
      Gets the class filter
      Returns:
      the class filter
    • getWriter

      public Writer getWriter()
      Gets the writer
      Returns:
      the writer
    • getErrorWriter

      public Writer getErrorWriter()
      Gets the error writer
      Returns:
      the error writer
    • getThreadId

      public long getThreadId()
      Gets the script callable thread id
      Returns:
      the script callable script id