com.ibm.itim.script
Interface ScriptEvaluatorInterface

All Known Implementing Classes:
FESIScriptEvaluator

public interface ScriptEvaluatorInterface

This generic interface represents a script evaluator (interpreter). It is an abstraction to allow different types of script interpreters to be easily plugged in to the platform.


Method Summary
 void createScriptObject(java.lang.String name, java.util.Map properties)
          Creates a named object that can be used in the client's script with a collection of properties.
 void createScriptObject(java.lang.String name, java.lang.Object item)
          Creates a named object that can be used in the client's script.
 java.lang.Object evaluate(java.lang.String scr, boolean evalAsFunction)
          Evaluates the specified script.
 java.lang.Object evaluate(java.lang.String scr, java.util.Map attributes, boolean evalAsFunction)
          Deprecated. use evaluate(String scr, boolean evalAsFunction)
 java.lang.Object evaluate(java.lang.String scr, java.lang.Object[] data, boolean evalAsFunction)
          Deprecated. Use evaluate(String scr, boolean evalAsFunction)
 void setContextItem(java.lang.String name, java.lang.Object item)
          Deprecated. Use createScriptObject(String name, Object item).
 

Method Detail

evaluate

public java.lang.Object evaluate(java.lang.String scr,
                                 java.lang.Object[] data,
                                 boolean evalAsFunction)
                          throws ScriptEvaluatorException
Deprecated. Use evaluate(String scr, boolean evalAsFunction)

Evaluates the specified script with some pre-defined objects for context.
Parameters:
scr - Script to evaluate.
data - Object array of runtime context data.
evalAsFunction - either true for full function support or false for simple expressions not requiring a return statement.
Returns:
Result of the evaluation. The client must cast returned object if expecting something more specific than an Object.
Throws:
ScriptEvaluatorException - Thrown if error(s) encountered during evaluation.

evaluate

public java.lang.Object evaluate(java.lang.String scr,
                                 java.util.Map attributes,
                                 boolean evalAsFunction)
                          throws ScriptEvaluatorException
Deprecated. use evaluate(String scr, boolean evalAsFunction)

Evaluates the specified script with some pre-defined objects for context.
Parameters:
scr - Script to evaluate.
data - Map of runtime context data, where the key is the variable name and the value is the variable value.
evalAsFunction - either true for full function support or false for simple expressions not requiring a return statement.
Returns:
Result of the evaluation. The client must cast returned object if expecting something more specific than an Object.
Throws:
ScriptEvaluatorException - Thrown if error(s) encountered during evaluation.

evaluate

public java.lang.Object evaluate(java.lang.String scr,
                                 boolean evalAsFunction)
                          throws ScriptEvaluatorException
Evaluates the specified script.
Parameters:
scr - Script to evaluate.
evalAsFunction - either true for full function support or false for simple expressions not requiring a return statement.
Returns:
Result of the evaluation. The client must cast returned object if expecting something more specific than an Object.
Throws:
ScriptEvaluatorException - Thrown if error(s) encountered during evaluation.

setContextItem

public void setContextItem(java.lang.String name,
                           java.lang.Object item)
                    throws ScriptEvaluatorException
Deprecated. Use createScriptObject(String name, Object item).

Creates a named variable to be used as context in the interpreter's environment for use by the script.
Parameters:
name - Name of the variable.
item - Object holding the variable's data.
Throws:
ScriptEvaluatorException - Thrown if unable to create the variable.

createScriptObject

public void createScriptObject(java.lang.String name,
                               java.lang.Object item)
                        throws ScriptEvaluatorException
Creates a named object that can be used in the client's script. This method differes from setContextItem in that it will translate the given java object to an object that is compatible with the scripting language implementation and the result can be used in the client scripts, not just by the script engine extensions.
Parameters:
name - name of the object in the scripting environment
item - Object that will be made available as a script object
Throws:
ScriptEvaluatorException - when the object can not be converted into a format that can be used within the script environment

createScriptObject

public void createScriptObject(java.lang.String name,
                               java.util.Map properties)
                        throws ScriptEvaluatorException
Creates a named object that can be used in the client's script with a collection of properties. This method can be used when the client does not posess a single object that can be translated one-to-one to a script object, but instead posesses a list of objects that is desired to be grouped in to one script object.
Parameters:
name - name of the object in the scripting environment
properties - Collection of objects to be used as the created object's properties.
Throws:
ScriptEvaluatorException - when the object can not be converted into a format that can be used within the script environment