org.jppf.scripting
Interface ScriptRunner

All Known Implementing Classes:
GroovyScriptRunner, RhinoScriptRunner

public interface ScriptRunner

Common interface for all script runners, allowing access to a scripting engine.

Author:
Laurent Cohen

Method Summary
 void cleanup()
          Perform cleanup after we're done using this script runner.
 Object evaluate(String script, Map<String,Object> variables)
          Evaluate the script specified as input and get the evaluation result.
 Object evaluate(String scriptId, String script, Map<String,Object> variables)
          Evaluate the script specified as input and get the evaluation result.
 void init()
          Initialize the execution environment.
 

Method Detail

evaluate

Object evaluate(String script,
                Map<String,Object> variables)
                throws JPPFScriptingException
Evaluate the script specified as input and get the evaluation result.

Parameters:
script - - a string containing the script to evaluate.
variables - - a mapping of objects to variable names, added within the scope of the script.
Returns:
the result of the evaluation as an object. The actual type of the result depends on the scripting engine that is used.
Throws:
JPPFScriptingException - if an error occurs while evaluating the script.

evaluate

Object evaluate(String scriptId,
                String script,
                Map<String,Object> variables)
                throws JPPFScriptingException
Evaluate the script specified as input and get the evaluation result.

Parameters:
scriptId - - a unique identifer for the script, to be used if the engine generates compiled code which can be later retrieved through this id.
script - - a string containing the script to evaluate.
variables - - a mapping of objects to variable names, added within the scope of the script.
Returns:
the result of the evaluation as an object. The actual type of the result depends on the scripting engine that is used.
Throws:
JPPFScriptingException - if an error occurs while evaluating the script.

init

void init()
Initialize the execution environment.


cleanup

void cleanup()
Perform cleanup after we're done using this script runner.



Copyright © 2005-2010 JPPF Team.