com.waveset.workflow
Class ExpressionState

java.lang.Object
  extended bycom.waveset.expression.ExState
      extended bycom.waveset.workflow.ExpressionState
All Implemented Interfaces:
VariableResolver

public class ExpressionState
extends ExState

An expression state object that knows how to resolve external references to workflow case variables. It also provides an implemetation of the "getObject" external function that can be used to access configuration objects from expressions.


Nested Class Summary
 
Nested classes inherited from class com.waveset.expression.ExState
ExState.ExBreakpointContext
 
Field Summary
static java.lang.String code_id
           
 
Constructor Summary
ExpressionState(WorkflowEngine engine)
          Create an expression state object that knows how to resolve workflow case variables, and locate configuration objects.
 
Method Summary
 void breakpointEnd(VariableScope scope, com.sun.idm.debugger.common.Locatable target, java.lang.Object value)
           
 void breakpointStart(VariableScope scope, com.sun.idm.debugger.common.Locatable target)
          Called by WorkflowEngine at it encounters interesting breakpoint targets for the monitor.
protected  ExState.ExBreakpointContext createBreakpointContext()
          Override createBreakpointContext to create a WorkflowBreakpointContext instead.
 VariableScope getVariableScope()
           
 void markBreakpointStack(VariableScope scope)
           
 java.lang.Object resolveCall(java.lang.String name, java.util.List arglist)
          Resolve a call to an external function.
 java.lang.Object resolveObject(java.lang.String path)
          Resolve a reference to an object with the expression.
 java.lang.Object resolveReference(java.lang.String name)
          Resolve a reference to an external variable.
 java.lang.Object resolveRule(java.lang.String name, java.util.Map args)
          Resolve a rule call.
 void setCache(ObjectCache cache)
          Set the cache object.
 void setExternal(java.lang.String name, java.lang.Object value)
          Handle the assignment of an external variable.
 void setTrace(WorkflowTraceBuffer t)
          Set the trace buffer.
 void setVariableScope(VariableScope s)
          Set the object that is the bottom of a variable scope hierarcy.
 
Methods inherited from class com.waveset.expression.ExState
addError, addResolver, beginTrace, beginTrace, breakpoint, breakpointEnd, breakpointEnd, breakpointEndAndTrace, breakpointStart, breakpointStartAndTrace, checkBreak, clearErrors, clearGlobalBindings, clearTrace, endTrace, endTrace, endTrace, enterScope, externalCall, externalReference, externalRule, externalRuleArguments, free, freeState, freeValue, getArgInitializer, getBinding, getBreakpointContext, getErrors, getInvokeInterceptor, getLibraryFunction, getLocale, getRuleArguments, getState, getTrace, getTraceBuffer, initBindings, isAllowExceptions, isConsoleTraceEnabled, isPrintEnabled, isTraceEnabled, leaveScope, loadLibrary, loadLibrary, loadLibrary, markBreakpointStack, newValue, newValue, newValue, print, println, printTrace, promoteValue, removeResolver, resolveVariable, setAllowExceptions, setBinding, setConsoleTraceEnable, setConsoleTraceEnable, setInvokeInterceptor, setLocale, setPrimaryResolver, setPrintEnable, setPrintStream, setTraceEnable, setTraceEnable, signalBreak, trace, unwindBreakpointStack
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

code_id

public static final java.lang.String code_id
See Also:
Constant Field Values
Constructor Detail

ExpressionState

public ExpressionState(WorkflowEngine engine)
Create an expression state object that knows how to resolve workflow case variables, and locate configuration objects.

Method Detail

setCache

public void setCache(ObjectCache cache)
Set the cache object.


setVariableScope

public void setVariableScope(VariableScope s)
Set the object that is the bottom of a variable scope hierarcy.


getVariableScope

public VariableScope getVariableScope()

setTrace

public void setTrace(WorkflowTraceBuffer t)
Set the trace buffer.


resolveReference

public java.lang.Object resolveReference(java.lang.String name)
                                  throws WavesetException
Resolve a reference to an external variable.

Here we recognize case variables, and a few special builtins.

Overrides:
resolveReference in class ExState
Throws:
WavesetException

setExternal

public void setExternal(java.lang.String name,
                        java.lang.Object value)
                 throws WavesetException
Handle the assignment of an external variable.

Overrides:
setExternal in class ExState
Throws:
WavesetException

resolveCall

public java.lang.Object resolveCall(java.lang.String name,
                                    java.util.List arglist)
                             throws WavesetException
Resolve a call to an external function. Here we support invocation of expressions stored in Rule objects.

Overrides:
resolveCall in class ExState
Throws:
WavesetException

resolveRule

public java.lang.Object resolveRule(java.lang.String name,
                                    java.util.Map args)
                             throws WavesetException
Resolve a rule call.

Overrides:
resolveRule in class ExState
Throws:
WavesetException

resolveObject

public java.lang.Object resolveObject(java.lang.String path)
                               throws WavesetException
Resolve a reference to an object with the expression.

This was added after the object interrogation hack in resolveReference, should think about combining these.

We recognize object identifiers of this form:

     Type:name
 
Where "Type" is the name of one of our built-in types, and name is an object name or id.

Example:

     User:fred
 

Overrides:
resolveObject in class ExState
Throws:
WavesetException

createBreakpointContext

protected ExState.ExBreakpointContext createBreakpointContext()
Override createBreakpointContext to create a WorkflowBreakpointContext instead.

Overrides:
createBreakpointContext in class ExState

breakpointStart

public void breakpointStart(VariableScope scope,
                            com.sun.idm.debugger.common.Locatable target)
Called by WorkflowEngine at it encounters interesting breakpoint targets for the monitor. Forward this up to the ExState which may forward it to a registered BreakpointMonitor. We have to save the VariableScope for use later if the BreakpointMonitor calls back to one of our BreakpointContext methods.


breakpointEnd

public void breakpointEnd(VariableScope scope,
                          com.sun.idm.debugger.common.Locatable target,
                          java.lang.Object value)

markBreakpointStack

public void markBreakpointStack(VariableScope scope)