commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a..@apache.org
Subject svn commit: r1584317 - in /commons/proper/scxml/trunk/src: main/java/org/apache/commons/scxml2/ main/java/org/apache/commons/scxml2/model/ main/java/org/apache/commons/scxml2/semantics/ test/java/org/apache/commons/scxml2/env/javascript/ test/java/org/...
Date Thu, 03 Apr 2014 09:13:22 GMT
Author: ate
Date: Thu Apr  3 09:13:22 2014
New Revision: 1584317

URL: http://svn.apache.org/r1584317
Log:
SCXML-182: Support error event raising to comply the spec "3.12.2 Errors"
The 'error.execution' event now is automatically added to the internal event queue when an
expression error occurs

Modified:
    commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/ActionExecutionContext.java
    commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/SCInstance.java
    commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/SCXMLExecutionContext.java
    commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/SCXMLIOProcessor.java
    commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/TriggerEvent.java
    commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/model/Assign.java
    commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/model/If.java
    commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/model/Raise.java
    commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/model/Send.java
    commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/model/Var.java
    commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/semantics/SCXMLSemanticsImpl.java
    commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/env/javascript/JSExampleTest.java
    commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/model/Hello.java

Modified: commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/ActionExecutionContext.java
URL: http://svn.apache.org/viewvc/commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/ActionExecutionContext.java?rev=1584317&r1=1584316&r2=1584317&view=diff
==============================================================================
--- commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/ActionExecutionContext.java
(original)
+++ commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/ActionExecutionContext.java
Thu Apr  3 09:13:22 2014
@@ -82,11 +82,10 @@ public class ActionExecutionContext {
     }
 
     /**
-     * Add an event to the internal queue
-     * @param event The event
+     * @return Returns the I/O Processor for the internal event queue
      */
-    public void addInternalEvent(TriggerEvent event) {
-        exctx.addInternalEvent(event);
+    public SCXMLIOProcessor getInternalIOProcessor() {
+        return exctx;
     }
 
     /**

Modified: commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/SCInstance.java
URL: http://svn.apache.org/viewvc/commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/SCInstance.java?rev=1584317&r1=1584316&r2=1584317&view=diff
==============================================================================
--- commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/SCInstance.java (original)
+++ commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/SCInstance.java Thu
Apr  3 09:13:22 2014
@@ -77,6 +77,11 @@ public class SCInstance implements Seria
     private final Status currentStatus;
 
     /**
+     * The SCXML I/O Processor for the internal event queue
+     */
+    private transient SCXMLIOProcessor internalIOProcessor;
+
+    /**
      * The Evaluator used for this state machine instance.
      */
     private transient Evaluator evaluator;
@@ -113,11 +118,13 @@ public class SCInstance implements Seria
 
     /**
      * Constructor
-     *
+     * @param internalIOProcessor The I/O Processor for the internal event queue
      * @param evaluator The evaluator
      * @param errorReporter The error reporter
      */
-    protected SCInstance(final Evaluator evaluator, final ErrorReporter errorReporter) {
+    protected SCInstance(final SCXMLIOProcessor internalIOProcessor, final Evaluator evaluator,
+                         final ErrorReporter errorReporter) {
+        this.internalIOProcessor = internalIOProcessor;
         this.evaluator = evaluator;
         this.errorReporter = errorReporter;
         this.currentStatus = new Status();
@@ -153,7 +160,7 @@ public class SCInstance implements Seria
     /**
      * Detach this state machine instance to allow external serialization.
      * <p>
-     * This clears the evaluator and errorReporter members.
+     * This clears the internal I/O processor, evaluator and errorReporter members.
      * </p>
      */
     protected void detach() {
@@ -162,6 +169,14 @@ public class SCInstance implements Seria
     }
 
     /**
+     * Sets the I/O Processor for the internal event queue
+     * @param internalIOProcessor
+     */
+    protected void setInternalIOProcessor(SCXMLIOProcessor internalIOProcessor) {
+        this.internalIOProcessor = internalIOProcessor;
+    }
+
+    /**
      * Set or re-attach the evaluator
      * <p>
      * If this state machine instance has been initialized before, it will be initialized
again, destroying all existing
@@ -259,6 +274,9 @@ public class SCInstance implements Seria
                     value = evaluator.eval(ctx, datum.getExpr());
                     ctx.setLocal(Context.NAMESPACES_KEY, null);
                 } catch (SCXMLExpressionException see) {
+                    if (internalIOProcessor != null) {
+                        internalIOProcessor.addEvent(new TriggerEvent(TriggerEvent.ERROR_EXECUTION,
TriggerEvent.ERROR_EVENT));
+                    }
                     errorReporter.onError(ErrorConstants.EXPRESSION_ERROR, see.getMessage(),
datum);
                 }
                 ctx.setLocal(datum.getId(), value);

Modified: commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/SCXMLExecutionContext.java
URL: http://svn.apache.org/viewvc/commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/SCXMLExecutionContext.java?rev=1584317&r1=1584316&r2=1584317&view=diff
==============================================================================
--- commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/SCXMLExecutionContext.java
(original)
+++ commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/SCXMLExecutionContext.java
Thu Apr  3 09:13:22 2014
@@ -37,7 +37,7 @@ import org.apache.commons.scxml2.model.S
  * SCXMLExecutionContext provides all the services and internal data used during the interpretation
of an SCXML
  * statemachine across micro and macro steps
  */
-public class SCXMLExecutionContext {
+public class SCXMLExecutionContext implements SCXMLIOProcessor {
 
     /**
      * SCXML Execution Logger for the application.
@@ -120,7 +120,7 @@ public class SCXMLExecutionContext {
         this.errorReporter = errorReporter != null ? errorReporter : new SimpleErrorReporter();
         this.notificationRegistry = new NotificationRegistry();
 
-        this.scInstance = new SCInstance(this.evaluator, this.errorReporter);
+        this.scInstance = new SCInstance(this, this.evaluator, this.errorReporter);
         this.actionExecutionContext = new ActionExecutionContext(this);
     }
 
@@ -128,6 +128,10 @@ public class SCXMLExecutionContext {
         return externalIOProcessor;
     }
 
+    public SCXMLIOProcessor getInternalIOProcessor() {
+        return this;
+    }
+
     /**
      * @return Returns the restricted execution context for actions
      */
@@ -407,7 +411,7 @@ public class SCXMLExecutionContext {
                 invokers.get(invokeId).cancel();
             } catch (InvokerException ie) {
                 TriggerEvent te = new TriggerEvent("failed.invoke.cancel."+invokeId, TriggerEvent.ERROR_EVENT);
-                addInternalEvent(te);
+                addEvent(te);
             }
             removeInvoker(invoke);
         }
@@ -417,7 +421,8 @@ public class SCXMLExecutionContext {
      * Add an event to the internal event queue
      * @param event The event
      */
-    public void addInternalEvent(TriggerEvent event) {
+    @Override
+    public void addEvent(TriggerEvent event) {
         internalEventQueue.add(event);
     }
 

Modified: commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/SCXMLIOProcessor.java
URL: http://svn.apache.org/viewvc/commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/SCXMLIOProcessor.java?rev=1584317&r1=1584316&r2=1584317&view=diff
==============================================================================
--- commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/SCXMLIOProcessor.java
(original)
+++ commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/SCXMLIOProcessor.java
Thu Apr  3 09:13:22 2014
@@ -17,13 +17,13 @@
 package org.apache.commons.scxml2;
 
 /**
- * The SCXML I/O Processor provides the interface for an external system or invoked child
SCXML process
- * ({@link org.apache.commons.scxml2.invoke.Invoker}) to asynchronously send events to the
SCXMLExecutor.
+ * The SCXML I/O Processor provides the interface for either an internal process or an external
system or invoked child
+ * SCXML process ({@link org.apache.commons.scxml2.invoke.Invoker}) to send events into the
SCXML processor queue.
  */
 public interface SCXMLIOProcessor {
 
     /**
-     * Send an asynchronous event to the SCXMLExecutor
+     * Send an event into the SCXML processor queue
      * <p>
      * @param event the event to send
      */

Modified: commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/TriggerEvent.java
URL: http://svn.apache.org/viewvc/commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/TriggerEvent.java?rev=1584317&r1=1584316&r2=1584317&view=diff
==============================================================================
--- commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/TriggerEvent.java (original)
+++ commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/TriggerEvent.java Thu
Apr  3 09:13:22 2014
@@ -92,6 +92,37 @@ public class TriggerEvent implements Ser
     public static final int CANCEL_EVENT = 6;
 
     /**
+     * The predefined SCXML 'error.execution' Event name
+     * <p>
+     * Indicates that an error internal to the execution of the document has occurred, such
as one arising from
+     * expression evaluation.
+     * </p>
+     * @see: <a href="http://www.w3.org/TR/2014/CR-scxml-20140313/#errorsAndEvents">
+     *     http://www.w3.org/TR/2014/CR-scxml-20140313/#errorsAndEvents</a>
+     */
+    public static final String ERROR_EXECUTION = "error.execution";
+
+    /**
+     * The predefined SCXML 'error.communication' Event name
+     * <p>
+     * Indicates that an error has occurred while trying to communicate with an external
entity.
+     * </p>
+     * @see: <a href="http://www.w3.org/TR/2014/CR-scxml-20140313/#errorsAndEvents">
+     *     http://www.w3.org/TR/2014/CR-scxml-20140313/#errorsAndEvents</a>
+     */
+    public static final String ERROR_COMMUNICATION = "error.communication";
+
+    /**
+     * The predefined SCXML 'error.platform' Event name
+     * <p>
+     * Indicates that a platform- or application-specific error has occurred.
+     * </p>
+     * @see: <a href="http://www.w3.org/TR/2014/CR-scxml-20140313/#errorsAndEvents">
+     *     http://www.w3.org/TR/2014/CR-scxml-20140313/#errorsAndEvents</a>
+     */
+    public static final String ERROR_PLATFORM = "error.platform";
+
+    /**
      * The event name.
      *
      */

Modified: commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/model/Assign.java
URL: http://svn.apache.org/viewvc/commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/model/Assign.java?rev=1584317&r1=1584316&r2=1584317&view=diff
==============================================================================
--- commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/model/Assign.java (original)
+++ commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/model/Assign.java Thu
Apr  3 09:13:22 2014
@@ -244,7 +244,7 @@ public class Assign extends Action imple
                         + String.valueOf(varObj) + "'");
                 }
                 TriggerEvent ev = new TriggerEvent(name + ".change", TriggerEvent.CHANGE_EVENT);
-                exctx.addInternalEvent(ev);
+                exctx.getInternalIOProcessor().addEvent(ev);
             }
         }
         ctx.setLocal(getNamespacesKey(), null);

Modified: commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/model/If.java
URL: http://svn.apache.org/viewvc/commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/model/If.java?rev=1584317&r1=1584316&r2=1584317&view=diff
==============================================================================
--- commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/model/If.java (original)
+++ commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/model/If.java Thu Apr
 3 09:13:22 2014
@@ -23,6 +23,7 @@ import org.apache.commons.scxml2.ActionE
 import org.apache.commons.scxml2.Context;
 import org.apache.commons.scxml2.Evaluator;
 import org.apache.commons.scxml2.SCXMLExpressionException;
+import org.apache.commons.scxml2.TriggerEvent;
 import org.apache.commons.scxml2.semantics.ErrorConstants;
 
 /**
@@ -131,9 +132,9 @@ public class If extends Action implement
             }
         } catch (SCXMLExpressionException e) {
             rslt = Boolean.FALSE;
+            exctx.getInternalIOProcessor().addEvent(new TriggerEvent(TriggerEvent.ERROR_EXECUTION,
TriggerEvent.ERROR_EVENT));
             exctx.getErrorReporter().onError(ErrorConstants.EXPRESSION_ERROR, "Treating as
false due to error: "
                     + e.getMessage(), this);
-            // TODO: place the error 'error.execution' in the internal event queue. (section
"3.12.2 Errors")
         }
         execute = rslt;
         ctx.setLocal(getNamespacesKey(), null);

Modified: commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/model/Raise.java
URL: http://svn.apache.org/viewvc/commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/model/Raise.java?rev=1584317&r1=1584316&r2=1584317&view=diff
==============================================================================
--- commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/model/Raise.java (original)
+++ commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/model/Raise.java Thu
Apr  3 09:13:22 2014
@@ -73,7 +73,7 @@ public class Raise extends Action {
             exctx.getAppLog().debug("<raise>: Adding event '" + event + "' to list
of derived events.");
         }
         TriggerEvent ev = new TriggerEvent(event, TriggerEvent.SIGNAL_EVENT);
-        exctx.addInternalEvent(ev);
+        exctx.getInternalIOProcessor().addEvent(ev);
 
     }
 }
\ No newline at end of file

Modified: commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/model/Send.java
URL: http://svn.apache.org/viewvc/commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/model/Send.java?rev=1584317&r1=1584316&r2=1584317&view=diff
==============================================================================
--- commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/model/Send.java (original)
+++ commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/model/Send.java Thu
Apr  3 09:13:22 2014
@@ -333,8 +333,8 @@ public class Send extends Action impleme
                         exctx.getAppLog().debug("<send>: Enqueued event '" + eventValue
                             + "' with no delay");
                     }
-                    exctx.addInternalEvent(new TriggerEvent(eventValue,
-                        TriggerEvent.SIGNAL_EVENT, params));
+                    exctx.getInternalIOProcessor().addEvent(
+                            new TriggerEvent(eventValue, TriggerEvent.SIGNAL_EVENT, params));
                     return;
                 }
             } else {
@@ -343,9 +343,8 @@ public class Send extends Action impleme
                     exctx.getAppLog().warn("<send>: Unavailable target - "
                         + targetValue);
                 }
-                exctx.addInternalEvent(new TriggerEvent(
-                    EVENT_ERR_SEND_TARGETUNAVAILABLE,
-                    TriggerEvent.ERROR_EVENT));
+                exctx.getInternalIOProcessor().addEvent(
+                        new TriggerEvent(EVENT_ERR_SEND_TARGETUNAVAILABLE, TriggerEvent.ERROR_EVENT));
                 // short-circuit the EventDispatcher
                 return;
             }

Modified: commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/model/Var.java
URL: http://svn.apache.org/viewvc/commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/model/Var.java?rev=1584317&r1=1584316&r2=1584317&view=diff
==============================================================================
--- commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/model/Var.java (original)
+++ commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/model/Var.java Thu
Apr  3 09:13:22 2014
@@ -105,7 +105,7 @@ public class Var extends Action {
                 + "' with initial value '" + String.valueOf(varObj) + "'");
         }
         TriggerEvent ev = new TriggerEvent(name + ".change", TriggerEvent.CHANGE_EVENT);
-        exctx.addInternalEvent(ev);
+        exctx.getInternalIOProcessor().addEvent(ev);
     }
 }
 

Modified: commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/semantics/SCXMLSemanticsImpl.java
URL: http://svn.apache.org/viewvc/commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/semantics/SCXMLSemanticsImpl.java?rev=1584317&r1=1584316&r2=1584317&view=diff
==============================================================================
--- commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/semantics/SCXMLSemanticsImpl.java
(original)
+++ commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/semantics/SCXMLSemanticsImpl.java
Thu Apr  3 09:13:22 2014
@@ -647,9 +647,9 @@ public class SCXMLSemanticsImpl implemen
                 }
             }
             catch (SCXMLExpressionException e) {
+                exctx.getInternalIOProcessor().addEvent(new TriggerEvent(TriggerEvent.ERROR_EXECUTION,
TriggerEvent.ERROR_EVENT));
                 exctx.getErrorReporter().onError(ErrorConstants.EXPRESSION_ERROR, "Treating
as false due to error: "
                         + e.getMessage(), transition);
-                // TODO: place the error 'error.execution' in the internal event queue. (section
"3.12.2 Errors")
             }
             finally {
                 context.setLocal(Context.NAMESPACES_KEY, null);
@@ -819,6 +819,7 @@ public class SCXMLSemanticsImpl implemen
             try {
                 globalScript.execute(exctx.getActionExecutionContext());
             } catch (SCXMLExpressionException e) {
+                exctx.getInternalIOProcessor().addEvent(new TriggerEvent(TriggerEvent.ERROR_EXECUTION,
TriggerEvent.ERROR_EVENT));
                 exctx.getErrorReporter().onError(ErrorConstants.EXPRESSION_ERROR, e.getMessage(),
exctx.getStateMachine());
             }
         }
@@ -881,7 +882,7 @@ public class SCXMLSemanticsImpl implemen
                 executeContent(exctx, onexit);
                 if (!onexitEventRaised && onexit.isRaiseEvent()) {
                     onexitEventRaised = true;
-                    exctx.addInternalEvent(new TriggerEvent("exit.state."+es.getId(), TriggerEvent.CHANGE_EVENT));
+                    exctx.getInternalIOProcessor().addEvent(new TriggerEvent("exit.state."+es.getId(),
TriggerEvent.CHANGE_EVENT));
                 }
             }
             exctx.getNotificationRegistry().fireOnExit(es, es);
@@ -924,6 +925,7 @@ public class SCXMLSemanticsImpl implemen
                 action.execute(exctx.getActionExecutionContext());
             }
         } catch (SCXMLExpressionException e) {
+            exctx.getInternalIOProcessor().addEvent(new TriggerEvent(TriggerEvent.ERROR_EXECUTION,
TriggerEvent.ERROR_EVENT));
             exctx.getErrorReporter().onError(ErrorConstants.EXPRESSION_ERROR, e.getMessage(),
exec);
         }
         if (exec instanceof Transition) {
@@ -987,7 +989,7 @@ public class SCXMLSemanticsImpl implemen
                 executeContent(exctx, onentry);
                 if (!onentryEventRaised && onentry.isRaiseEvent()) {
                     onentryEventRaised = true;
-                    exctx.addInternalEvent(new TriggerEvent("entry.state."+es.getId(), TriggerEvent.CHANGE_EVENT));
+                    exctx.getInternalIOProcessor().addEvent(new TriggerEvent("entry.state."+es.getId(),
TriggerEvent.CHANGE_EVENT));
                 }
             }
             exctx.getNotificationRegistry().fireOnEntry(es, es);
@@ -1009,7 +1011,7 @@ public class SCXMLSemanticsImpl implemen
                     exctx.stopRunning();
                 }
                 else {
-                    exctx.addInternalEvent(new TriggerEvent("done.state."+parent.getId(),TriggerEvent.CHANGE_EVENT));
+                    exctx.getInternalIOProcessor().addEvent(new TriggerEvent("done.state."+parent.getId(),TriggerEvent.CHANGE_EVENT));
                     if (parent.isRegion()) {
                         if (configuration == null) {
                             // Note: configuration may 'grow' during enterStates, but activation
works downwards
@@ -1019,7 +1021,7 @@ public class SCXMLSemanticsImpl implemen
                             configuration = exctx.getScInstance().getCurrentStatus().getAllStates();
                         }
                         if (isInFinalState(parent.getParent(), configuration)) {
-                            exctx.addInternalEvent(new TriggerEvent("done.state."+parent.getParent().getId()
+                            exctx.getInternalIOProcessor().addEvent(new TriggerEvent("done.state."+parent.getParent().getId()
                                     , TriggerEvent.CHANGE_EVENT));
                         }
                     }
@@ -1054,6 +1056,7 @@ public class SCXMLSemanticsImpl implemen
                         context.setLocal(Context.NAMESPACES_KEY, null);
                         src = String.valueOf(srcObj);
                     } catch (SCXMLExpressionException see) {
+                        exctx.getInternalIOProcessor().addEvent(new TriggerEvent(TriggerEvent.ERROR_EXECUTION,
TriggerEvent.ERROR_EVENT));
                         exctx.getErrorReporter().onError(ErrorConstants.EXPRESSION_ERROR,
see.getMessage(), i);
                     }
                 }
@@ -1066,7 +1069,7 @@ public class SCXMLSemanticsImpl implemen
                 try {
                     inv = exctx.newInvoker(i.getType());
                 } catch (InvokerException ie) {
-                    exctx.addInternalEvent(new TriggerEvent("failed.invoke."+ts.getId(),
TriggerEvent.ERROR_EVENT));
+                    exctx.getInternalIOProcessor().addEvent(new TriggerEvent("failed.invoke."+ts.getId(),
TriggerEvent.ERROR_EVENT));
                     continue;
                 }
                 List<Param> params = i.params();
@@ -1080,6 +1083,7 @@ public class SCXMLSemanticsImpl implemen
                         try {
                             argValue = eval.eval(context, argExpr);
                         } catch (SCXMLExpressionException see) {
+                            exctx.getInternalIOProcessor().addEvent(new TriggerEvent(TriggerEvent.ERROR_EXECUTION,
TriggerEvent.ERROR_EVENT));
                             exctx.getErrorReporter().onError(ErrorConstants.EXPRESSION_ERROR,
see.getMessage(), i);
                         }
                     } else {
@@ -1089,9 +1093,10 @@ public class SCXMLSemanticsImpl implemen
                             argValue = eval.evalLocation(context, p.getName());
                             if (argValue == null) {
                                 // Generate error, 4.3.1 in WD-scxml-20080516
-                                exctx.addInternalEvent(new TriggerEvent(ts.getId() + ERR_ILLEGAL_ALLOC,
TriggerEvent.ERROR_EVENT));
+                                exctx.getInternalIOProcessor().addEvent(new TriggerEvent(ts.getId()
+ ERR_ILLEGAL_ALLOC, TriggerEvent.ERROR_EVENT));
                             }
                         } catch (SCXMLExpressionException see) {
+                            exctx.getInternalIOProcessor().addEvent(new TriggerEvent(TriggerEvent.ERROR_EXECUTION,
TriggerEvent.ERROR_EVENT));
                             exctx.getErrorReporter().onError(ErrorConstants.EXPRESSION_ERROR,
see.getMessage(), i);
                         }
                     }
@@ -1105,7 +1110,7 @@ public class SCXMLSemanticsImpl implemen
                 try {
                     inv.invoke(source, args);
                 } catch (InvokerException ie) {
-                    exctx.addInternalEvent(new TriggerEvent("failed.invoke."+ts.getId(),
TriggerEvent.ERROR_EVENT));
+                    exctx.getInternalIOProcessor().addEvent(new TriggerEvent("failed.invoke."+ts.getId(),
TriggerEvent.ERROR_EVENT));
                     exctx.removeInvoker(i);
                 }
             }

Modified: commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/env/javascript/JSExampleTest.java
URL: http://svn.apache.org/viewvc/commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/env/javascript/JSExampleTest.java?rev=1584317&r1=1584316&r2=1584317&view=diff
==============================================================================
--- commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/env/javascript/JSExampleTest.java
(original)
+++ commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/env/javascript/JSExampleTest.java
Thu Apr  3 09:13:22 2014
@@ -93,7 +93,7 @@ public class JSExampleTest {
 
         @Override
         public void execute(ActionExecutionContext exctx) throws ModelException, SCXMLExpressionException
{
-            exctx.addInternalEvent(new TriggerEvent("ok",TriggerEvent.SIGNAL_EVENT,"and its
ok with me to"));
+            exctx.getInternalIOProcessor().addEvent(new TriggerEvent("ok",TriggerEvent.SIGNAL_EVENT,"and
its ok with me to"));
         }
     }
 

Modified: commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/model/Hello.java
URL: http://svn.apache.org/viewvc/commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/model/Hello.java?rev=1584317&r1=1584316&r2=1584317&view=diff
==============================================================================
--- commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/model/Hello.java (original)
+++ commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/model/Hello.java Thu
Apr  3 09:13:22 2014
@@ -63,7 +63,7 @@ public class Hello extends Action {
         // For derived events payload testing
         TriggerEvent event =
             new TriggerEvent("helloevent", TriggerEvent.SIGNAL_EVENT, name);
-        exctx.addInternalEvent(event);
+        exctx.getInternalIOProcessor().addEvent(event);
         callbacks++;
     }
 }



Mime
View raw message