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 2005/10/19 04:55:58 UTC
svn commit: r326348 - in
/jakarta/commons/sandbox/scxml/trunk/src/main/java/org/apache/commons/scxml:
SCXMLExecutor.java Step.java
Author: rahul
Date: Tue Oct 18 19:55:55 2005
New Revision: 326348
URL: http://svn.apache.org/viewcvs?rev=326348&view=rev
Log:
1) Modify executor to talk to the semantics interface.
2) Allow Step to be visible for semantics implementations (which may reside outside Commons SCXML as well).
Modified:
jakarta/commons/sandbox/scxml/trunk/src/main/java/org/apache/commons/scxml/SCXMLExecutor.java
jakarta/commons/sandbox/scxml/trunk/src/main/java/org/apache/commons/scxml/Step.java
Modified: jakarta/commons/sandbox/scxml/trunk/src/main/java/org/apache/commons/scxml/SCXMLExecutor.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/scxml/trunk/src/main/java/org/apache/commons/scxml/SCXMLExecutor.java?rev=326348&r1=326347&r2=326348&view=diff
==============================================================================
--- jakarta/commons/sandbox/scxml/trunk/src/main/java/org/apache/commons/scxml/SCXMLExecutor.java (original)
+++ jakarta/commons/sandbox/scxml/trunk/src/main/java/org/apache/commons/scxml/SCXMLExecutor.java Tue Oct 18 19:55:55 2005
@@ -28,11 +28,15 @@
import org.apache.commons.scxml.model.SCXML;
import org.apache.commons.scxml.model.State;
import org.apache.commons.scxml.model.TransitionTarget;
+import org.apache.commons.scxml.semantics.SCXMLSemanticsImpl;
/**
- * The SCXML "engine" that executes SCXML documents. The
+ * <p>The SCXML "engine" that executes SCXML documents. The
* particular semantics used by this engine for executing the SCXML are
- * encapsulated in SCXMLSemantics.
+ * encapsulated in the SCXMLSemantics implementation that it uses.</p>
+ *
+ * <p>The default implementation is
+ * <code>org.apache.commons.scxml.semantics.SCXMLSemanticsImpl</code></p>
*
* @see SCXMLSemantics
*/
@@ -75,10 +79,8 @@
/**
* Interpretation semantics.
- * (not configurable without re-compilation for now,
- * since we have one implementation anyway)
*/
- private SCXMLSemantics semantics = new SCXMLSemantics();
+ private SCXMLSemantics semantics;
/**
* The worker method.
@@ -106,7 +108,8 @@
// UpdateHistoryStates
semantics.updateHistoryStates(step, errorReporter);
// ExecuteActions
- semantics.executeActions(step, this, errorReporter);
+ semantics.executeActions(step, stateMachine, evaluator,
+ eventdispatcher, errorReporter);
// AssignCurrentStatus
updateStatus(step);
// ***Cleanup external events if superStep
@@ -126,19 +129,39 @@
*/
public SCXMLExecutor(final Evaluator expEvaluator,
final EventDispatcher evtDisp, final ErrorReporter errRep) {
- this.evaluator = expEvaluator;
- this.eventdispatcher = evtDisp;
- this.errorReporter = errRep;
- this.currentStatus = null;
- this.stateMachine = null;
- }
+ this(expEvaluator, evtDisp, errRep, null); }
/**
* Convenience constructor.
*/
public SCXMLExecutor() {
- this(null, null, null);
+ this(null, null, null, null);
}
+
+ /**
+ * Constructor.
+ *
+ * @param expEvaluator The expression evaluator
+ * @param evtDisp The event dispatcher
+ * @param errRep The error reporter
+ */
+ public SCXMLExecutor(final Evaluator expEvaluator,
+ final EventDispatcher evtDisp, final ErrorReporter errRep,
+ final SCXMLSemanticsImpl semantics) {
+ this.evaluator = expEvaluator;
+ this.eventdispatcher = evtDisp;
+ this.errorReporter = errRep;
+ this.currentStatus = null;
+ this.stateMachine = null;
+ if (semantics == null) {
+ // Use default semantics, if none provided
+ this.semantics = new SCXMLSemanticsImpl();
+ } else {
+ this.semantics = semantics;
+ }
+ this.currentStatus = null;
+ this.stateMachine = null;
+ }
/**
* Clear all state and begin from "initialstate" indicated
@@ -168,7 +191,8 @@
step.getAfterStatus().getStates(),
step.getEntryList(), errorReporter);
// ExecuteActions
- semantics.executeActions(step, this, errorReporter);
+ semantics.executeActions(step, stateMachine, evaluator,
+ eventdispatcher, errorReporter);
// AssignCurrentStatus
updateStatus(step);
// Execute Immediate Transitions
Modified: jakarta/commons/sandbox/scxml/trunk/src/main/java/org/apache/commons/scxml/Step.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/scxml/trunk/src/main/java/org/apache/commons/scxml/Step.java?rev=326348&r1=326347&r2=326348&view=diff
==============================================================================
--- jakarta/commons/sandbox/scxml/trunk/src/main/java/org/apache/commons/scxml/Step.java (original)
+++ jakarta/commons/sandbox/scxml/trunk/src/main/java/org/apache/commons/scxml/Step.java Tue Oct 18 19:55:55 2005
@@ -25,7 +25,7 @@
* A logical unit of progression in the execution of a SCXML model.
*
*/
-class Step {
+public class Step {
/**
* Constructor.
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org