com.ibm.itim.script
Interface ScriptEvaluator

All Superinterfaces:
ScriptContextDAO

public interface ScriptEvaluator
extends ScriptContextDAO

This class defines the interface for expression and script evaluation and compilation.

Since:
ITIM 5.0

Field Summary
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.
 
Method Summary
 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
 
Methods inherited from interface com.ibm.itim.script.ScriptContextDAO
addContextItem, addDisposeListener, lookupItem, updateContextItem
 

Field Detail

SCRIPT_LANG_PARAM

static final 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. This parameter must be set in the scripting environment, and must be a String.

See Also:
Constant Field Values

SCRIPT_PARAMETER_PARAM

static final 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. This parameter must be set in the script enviornment, but can be any type of Object.

See Also:
Constant Field Values
Method Detail

dispose

void dispose()
Force the ScriptEvaluator to release its resources.


initialize

void initialize(java.lang.String name,
                ScriptInterface context)
                throws ScriptInitializationException
Initializes the Script host component's script context, populates runtime context data and load Java scripting objects

Parameters:
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.
Throws:
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.

isLanguageSupported

boolean isLanguageSupported(java.lang.String language)
Determines if a specific language is supported with script evaluator

Parameters:
language -
Returns:
true if the language is supported; and false otherwise

evaluate

java.lang.Object evaluate(java.lang.String expr)
                          throws ScriptEvaluationException
Evaluates an expression. Which script interpreter to use is deterimined based on the inPrefix parameter passed in when the ScriptEvaluator is initialized. If the Object to be returned is an ObjectWrapper, then the object will be automatically unwrapped and the unwrapped Object is returned instead. If Object is an array, then each object in the array will be unwrapped and a new Object[] containing the unwrapped object will be returned instead.

Parameters:
expr - Expression as a String
Returns:
Resulting value
Throws:
ScriptEvaluationException

evaluate

java.lang.Object evaluate(java.lang.String expr,
                          java.lang.String lang)
                          throws ScriptEvaluationException
This method is for testing to call a specific scripting engine; Host components should call evaluate(String) instead. Evaluate an expression with the script interpreter that is mapped to the passed in language. This method works exactly like evaluate(String) and just takes an extra parameter. See the javadoc for evaluate for more information.

Parameters:
expr - Expression as a String
lang - The language to use to evaluate the expression.
Returns:
Resulting value.
Throws:
ScriptEvaluationException

compileExpression

java.lang.Object compileExpression(java.lang.String expr)
                                   throws ScriptCompilationException
Compiles an expression into a codebuffer. Which script interpreter to use is deterimined based on the inPrefix parameter passed in when the ScriptEvaluator is initialized.

Parameters:
expr - Expression as a String
Returns:
the code buffer of the compiled expression
Throws:
ScriptCompilationException

execute

void execute(java.lang.Object script)
             throws ScriptEvaluationException
Execute the script object. Which script interpreter to use is deterimined based on the inPrefix parameter passed in when the ScriptEvaluator is initialized.

Parameters:
script - Script object
Throws:
ScriptEvaluationException

compileScript

java.lang.Object compileScript(java.lang.Object script)
                               throws ScriptCompilationException
Compiles the script into a code buffer. Which script interpreter to use is deterimined based on the inPrefix parameter passed in when the ScriptEvaluator is initialized.

Parameters:
script - the script to cmpile
Returns:
code buffer of the compiled script
Throws:
ScriptCompilationException

getHostComponentName

java.lang.String getHostComponentName()
Get the name of the host component that initialized this ScriptEvaluator. This method returns null until the ScriptEvaluator is initialized.

Returns:
The name of the host component who initialized this ScriptEvaluator.


IBM Security Identity Manager 6.0.0
© Copyright International Business Machines Corporation 2007, 2012. All rights reserved. US Government Users Restricited Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.