public interface ScriptEvaluator extends ScriptContextDAO
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
SCRIPT_LANG_PARAM
Gives the key of the named object in the scripting environment that
contains the name of currecnt scripting language.
|
static java.lang.String |
SCRIPT_PARAMETER_PARAM
Gives the key of the named object in the scripting enviornment that
contains the parameter necessary to correctly wrap an object.
|
| Modifier and Type | Method and Description |
|---|---|
java.lang.Object |
compileExpression(java.lang.String expr)
Compiles an expression into a codebuffer.
|
java.lang.Object |
compileScript(java.lang.Object script)
Compiles the script into a code buffer.
|
void |
dispose()
Force the ScriptEvaluator to release its resources.
|
java.lang.Object |
evaluate(java.lang.String expr)
Evaluates an expression.
|
java.lang.Object |
evaluate(java.lang.String expr,
java.lang.String lang)
This method is for testing to call a specific scripting engine; Host
components should call evaluate(String) instead.
|
void |
execute(java.lang.Object script)
Execute the script object.
|
java.lang.String |
getHostComponentName()
Get the name of the host component that initialized this ScriptEvaluator.
|
void |
initialize(java.lang.String name,
ScriptInterface context)
Initializes the Script host component's script context, populates runtime
context data and load Java scripting objects
|
boolean |
isLanguageSupported(java.lang.String language)
Determines if a specific language is supported with script evaluator
|
addContextItem, addDisposeListener, lookupItem, updateContextItemstatic final java.lang.String SCRIPT_LANG_PARAM
static final java.lang.String SCRIPT_PARAMETER_PARAM
void dispose()
void initialize(java.lang.String name,
ScriptInterface context)
throws ScriptInitializationException
name - The name of the host component. This name is used to look up
various properties for the script framework including which
extensions to load and which interpreter to use.context - The ScriptInterface to pass to each extension while
initializing them. The system must be able to safely cast
context into whatever type a specified extension requires or
an error will occur.ScriptInitializationException - Thrown if anything goes wrong while initializing the
ScriptEvaluator. This includes if context cannot be cast to
the proper type for a specified extension.boolean isLanguageSupported(java.lang.String language)
language - java.lang.Object evaluate(java.lang.String expr)
throws ScriptEvaluationException
expr - Expression as a StringScriptEvaluationExceptionjava.lang.Object evaluate(java.lang.String expr,
java.lang.String lang)
throws ScriptEvaluationException
expr - Expression as a Stringlang - The language to use to evaluate the expression.ScriptEvaluationExceptionjava.lang.Object compileExpression(java.lang.String expr)
throws ScriptCompilationException
expr - Expression as a StringScriptCompilationExceptionvoid execute(java.lang.Object script)
throws ScriptEvaluationException
script - Script objectScriptEvaluationExceptionjava.lang.Object compileScript(java.lang.Object script)
throws ScriptCompilationException
script - the script to cmpileScriptCompilationExceptionjava.lang.String getHostComponentName()