org.enhydra.shark.scripting
Class BshEvaluator

java.lang.Object
  extended by org.enhydra.shark.scripting.BshEvaluator
All Implemented Interfaces:
Evaluator

public class BshEvaluator
extends java.lang.Object
implements Evaluator

Implementation of the evaluator interface which evaluates the condition body as a java expression.


Field Summary
protected  CallbackUtilities cus
           
protected static java.lang.String LOG_CHANNEL
           
 
Constructor Summary
BshEvaluator()
           
 
Method Summary
protected  java.lang.String adjustExpression(WMSessionHandle shandle, java.lang.String expression, java.util.Map context, java.lang.String procId, java.lang.String actId)
           
 void configure(CallbackUtilities cus)
           
 boolean evaluateCondition(WMSessionHandle shandle, java.lang.String procId, java.lang.String actId, java.lang.String condition, java.util.Map context)
          Evaluate the condition using java as the expression language.
 java.lang.Object evaluateExpression(WMSessionHandle shandle, java.lang.String procId, java.lang.String actId, java.lang.String expr, java.util.Map context, java.lang.Class resultClass)
          Evaluates the given expression.
protected  java.lang.String prepareContext(WMSessionHandle shandle, java.lang.String procId, java.lang.String actId, bsh.Interpreter interpreter, java.lang.String expr, java.util.Map context)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOG_CHANNEL

protected static final java.lang.String LOG_CHANNEL
See Also:
Constant Field Values

cus

protected CallbackUtilities cus
Constructor Detail

BshEvaluator

public BshEvaluator()
Method Detail

configure

public void configure(CallbackUtilities cus)
               throws java.lang.Exception
Specified by:
configure in interface Evaluator
Throws:
java.lang.Exception

evaluateCondition

public boolean evaluateCondition(WMSessionHandle shandle,
                                 java.lang.String procId,
                                 java.lang.String actId,
                                 java.lang.String condition,
                                 java.util.Map context)
                          throws java.lang.Exception
Evaluate the condition using java as the expression language. This method returns true if the condition is satisfied.

Specified by:
evaluateCondition in interface Evaluator
Parameters:
condition - The condition
context - The context
Returns:
True if the condition is true
Throws:
java.lang.Exception

evaluateExpression

public java.lang.Object evaluateExpression(WMSessionHandle shandle,
                                           java.lang.String procId,
                                           java.lang.String actId,
                                           java.lang.String expr,
                                           java.util.Map context,
                                           java.lang.Class resultClass)
                                    throws java.lang.Exception
Evaluates the given expression.

Specified by:
evaluateExpression in interface Evaluator
Parameters:
expr - The expression String
context - The workflow context
resultClass - Returned object should be the instance of this Java class
Returns:
The result of the expression evaluation
Throws:
java.lang.Exception

prepareContext

protected java.lang.String prepareContext(WMSessionHandle shandle,
                                          java.lang.String procId,
                                          java.lang.String actId,
                                          bsh.Interpreter interpreter,
                                          java.lang.String expr,
                                          java.util.Map context)
                                   throws java.lang.Exception
Throws:
java.lang.Exception

adjustExpression

protected java.lang.String adjustExpression(WMSessionHandle shandle,
                                            java.lang.String expression,
                                            java.util.Map context,
                                            java.lang.String procId,
                                            java.lang.String actId)
                                     throws java.lang.Exception
Throws:
java.lang.Exception