You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by ra...@apache.org on 2006/02/05 09:07:02 UTC

svn commit: r374981 - in /jakarta/commons/sandbox/scxml/branches/STATELESS_MODEL/src/main/java/org/apache/commons/scxml/env: jexl/JexlEvaluator.java jsp/ELEvaluator.java

Author: rahul
Date: Sun Feb  5 00:07:00 2006
New Revision: 374981

URL: http://svn.apache.org/viewcvs?rev=374981&view=rev
Log:
Turn off a flat document variable context and turn on per state contexts as now required by the SCXML WD.

Some of the important side-effects brought around by this change are:

1) Variable resolution now bubbles up from local state up to document root.

2) For efficiency, contexts are created only on demand i.e. a state that has no variable declarations of its own does not need a context to store variables and one is not instantiated.

3) The two points above combine to give us an exception for (2) -- an ancestor state which doesn't have variable declarations but one or more of the states in its document subtree do, i.e. in this SCXML document (ASCII art warning)

             root
         /          \
       foo          bar
   /       \       /      \
foo1     foo2     bar1*    bar2

if bar1 is the only state with variable declarations, bar and bar1 are guaranteed to have Contexts instantiated for them via the SCInstance (and the others are guaranteed to not have Contexts instantiated). bar1 since it needs a context for its variables, and a blank context in bar is essential for the recursion in variable resolution.

4) Going one step further, contexts are instantiated only if the owner state is visited in the course of the execution of the state machine. Thus, if the state bar1 above is never visited for a particular execution, then no contexts will be instantiated.


Modified:
    jakarta/commons/sandbox/scxml/branches/STATELESS_MODEL/src/main/java/org/apache/commons/scxml/env/jexl/JexlEvaluator.java
    jakarta/commons/sandbox/scxml/branches/STATELESS_MODEL/src/main/java/org/apache/commons/scxml/env/jsp/ELEvaluator.java

Modified: jakarta/commons/sandbox/scxml/branches/STATELESS_MODEL/src/main/java/org/apache/commons/scxml/env/jexl/JexlEvaluator.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/scxml/branches/STATELESS_MODEL/src/main/java/org/apache/commons/scxml/env/jexl/JexlEvaluator.java?rev=374981&r1=374980&r2=374981&view=diff
==============================================================================
--- jakarta/commons/sandbox/scxml/branches/STATELESS_MODEL/src/main/java/org/apache/commons/scxml/env/jexl/JexlEvaluator.java (original)
+++ jakarta/commons/sandbox/scxml/branches/STATELESS_MODEL/src/main/java/org/apache/commons/scxml/env/jexl/JexlEvaluator.java Sun Feb  5 00:07:00 2006
@@ -81,13 +81,7 @@
      * @see Evaluator#newContext(Context)
      */
     public Context newContext(final Context parent) {
-        //for now, we do not support nested variable contexts
-        //world is flat ;)
-        if (parent != null) {
-            return parent;
-        } else {
-            return new org.apache.commons.scxml.env.jexl.JexlContext();
-        }
+        return new org.apache.commons.scxml.env.jexl.JexlContext(parent);
     }
 
     /**

Modified: jakarta/commons/sandbox/scxml/branches/STATELESS_MODEL/src/main/java/org/apache/commons/scxml/env/jsp/ELEvaluator.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/scxml/branches/STATELESS_MODEL/src/main/java/org/apache/commons/scxml/env/jsp/ELEvaluator.java?rev=374981&r1=374980&r2=374981&view=diff
==============================================================================
--- jakarta/commons/sandbox/scxml/branches/STATELESS_MODEL/src/main/java/org/apache/commons/scxml/env/jsp/ELEvaluator.java (original)
+++ jakarta/commons/sandbox/scxml/branches/STATELESS_MODEL/src/main/java/org/apache/commons/scxml/env/jsp/ELEvaluator.java Sun Feb  5 00:07:00 2006
@@ -97,13 +97,7 @@
      * @see Evaluator#newContext(Context)
      */
     public Context newContext(final Context parent) {
-        //for now, we do not support nested variable contexts
-        //world is flat ;)
-        if (parent != null) {
-            return parent;
-        } else {
-            return new ELContext(null);
-        }
+        return new ELContext(parent);
     }
 
     /**



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org