commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a..@apache.org
Subject svn commit: r1659109 - in /commons/proper/scxml/trunk/src: main/java/org/apache/commons/scxml2/ main/java/org/apache/commons/scxml2/env/ main/java/org/apache/commons/scxml2/invoke/ main/java/org/apache/commons/scxml2/model/ main/java/org/apache/commons...
Date Wed, 11 Feb 2015 23:49:36 GMT
Author: ate
Date: Wed Feb 11 23:49:35 2015
New Revision: 1659109

URL: http://svn.apache.org/r1659109
Log:
SCXML-226: Support of special send targets #_parent and #_invokeid
- partly based upon a patch contributed by Michael Goerlich

Removed:
    commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/InvokerManager.java
Modified:
    commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/SCXMLExecutionContext.java
    commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/SCXMLExecutor.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/env/SimpleDispatcher.java
    commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/invoke/Invoker.java
    commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/invoke/SimpleSCXMLInvoker.java
    commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/model/Invoke.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/semantics/SCXMLSemanticsImpl.java
    commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/invoke/InvokeParamNameTest.java
    commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/w3c/W3CTests.java
    commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/w3c/tests.xml

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=1659109&r1=1659108&r2=1659109&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
Wed Feb 11 23:49:35 2015
@@ -29,6 +29,7 @@ import org.apache.commons.scxml2.env.Sim
 import org.apache.commons.scxml2.env.SimpleErrorReporter;
 import org.apache.commons.scxml2.invoke.Invoker;
 import org.apache.commons.scxml2.invoke.InvokerException;
+import org.apache.commons.scxml2.invoke.SimpleSCXMLInvoker;
 import org.apache.commons.scxml2.model.Invoke;
 import org.apache.commons.scxml2.model.ModelException;
 import org.apache.commons.scxml2.model.SCXML;
@@ -37,7 +38,16 @@ 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 implements SCXMLIOProcessor, InvokerManager {
+public class SCXMLExecutionContext implements SCXMLIOProcessor {
+
+    /**
+     * Default and required supported SCXML Processor Invoker service URI
+     */
+    public static final String SCXML_INVOKER_TYPE_URI = "http://www.w3.org/TR/scxml/";
+    /**
+     * Alias for {@link #SCXML_INVOKER_TYPE_URI}
+     */
+    public static final String SCXML_INVOKER_TYPE = "scxml";
 
     /**
      * SCXML Execution Logger for the application.
@@ -50,6 +60,11 @@ public class SCXMLExecutionContext imple
     private final ActionExecutionContext actionExecutionContext;
 
     /**
+     * The SCXMLExecutor of this SCXMLExecutionContext
+     */
+    private final SCXMLExecutor scxmlExecutor;
+
+    /**
      * The SCInstance.
      */
     private SCInstance scInstance;
@@ -112,14 +127,15 @@ public class SCXMLExecutionContext imple
     /**
      * Constructor
      *
-     * @param externalIOProcessor The external IO Processor
+     * @param scxmlExecutor The SCXMLExecutor of this SCXMLExecutionContext
      * @param evaluator The evaluator
      * @param eventDispatcher The event dispatcher, if null a SimpleDispatcher instance will
be used
      * @param errorReporter The error reporter, if null a SimpleErrorReporter instance will
be used
      */
-    protected SCXMLExecutionContext(SCXMLIOProcessor externalIOProcessor, Evaluator evaluator,
+    protected SCXMLExecutionContext(SCXMLExecutor scxmlExecutor, Evaluator evaluator,
                                     EventDispatcher eventDispatcher, ErrorReporter errorReporter)
{
-        this.externalIOProcessor = externalIOProcessor;
+        this.scxmlExecutor = scxmlExecutor;
+        this.externalIOProcessor = scxmlExecutor;
         this.evaluator = evaluator;
         this.eventdispatcher = eventDispatcher != null ? eventDispatcher : new SimpleDispatcher();
         this.errorReporter = errorReporter != null ? errorReporter : new SimpleErrorReporter();
@@ -131,7 +147,16 @@ public class SCXMLExecutionContext imple
         ioProcessors.put(SCXMLIOProcessor.DEFAULT_EVENT_PROCESSOR, getExternalIOProcessor());
         ioProcessors.put(SCXMLIOProcessor.SCXML_EVENT_PROCESSOR, getExternalIOProcessor());
         ioProcessors.put(SCXMLIOProcessor.INTERNAL_EVENT_PROCESSOR, getInternalIOProcessor());
+        if (scxmlExecutor.getParentSCXMLExecutor() != null) {
+            ioProcessors.put(SCXMLIOProcessor.PARENT_EVENT_PROCESSOR, scxmlExecutor.getParentSCXMLExecutor());
+        }
         initializeIOProcessors();
+        registerInvokerClass(SCXML_INVOKER_TYPE_URI, SimpleSCXMLInvoker.class);
+        registerInvokerClass(SCXML_INVOKER_TYPE, SimpleSCXMLInvoker.class);
+    }
+
+    public SCXMLExecutor getSCXMLExecutor() {
+        return scxmlExecutor;
     }
 
     public SCXMLIOProcessor getExternalIOProcessor() {

Modified: commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/SCXMLExecutor.java
URL: http://svn.apache.org/viewvc/commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/SCXMLExecutor.java?rev=1659109&r1=1659108&r2=1659109&view=diff
==============================================================================
--- commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/SCXMLExecutor.java
(original)
+++ commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/SCXMLExecutor.java
Wed Feb 11 23:49:35 2015
@@ -52,6 +52,11 @@ public class SCXMLExecutor implements SC
     private Log log = LogFactory.getLog(SCXMLExecutor.class);
 
     /**
+     * Parent SCXMLExecutor
+     */
+    private SCXMLExecutor parentSCXMLExecutor;
+
+    /**
      *  Interpretation semantics.
      */
     private SCXMLSemantics semantics;
@@ -101,6 +106,25 @@ public class SCXMLExecutor implements SC
     }
 
     /**
+     * Constructor using a parent SCXMLExecutor
+     *
+     * @param parentSCXMLExecutor the parent SCXMLExecutor
+     */
+    public SCXMLExecutor(final SCXMLExecutor parentSCXMLExecutor) {
+        this.parentSCXMLExecutor = parentSCXMLExecutor;
+        this.semantics = parentSCXMLExecutor.semantics;
+        this.exctx = new SCXMLExecutionContext(this, parentSCXMLExecutor.getEvaluator(),
+                parentSCXMLExecutor.getEventdispatcher(), parentSCXMLExecutor.getErrorReporter());
+    }
+
+    /**
+     * @return the parent SCXMLExecutor (if any)
+     */
+    protected SCXMLExecutor getParentSCXMLExecutor() {
+        return parentSCXMLExecutor;
+    }
+
+    /**
      * Get the current state machine instance status.
      *
      * @return The current Status

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=1659109&r1=1659108&r2=1659109&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
Wed Feb 11 23:49:35 2015
@@ -38,6 +38,11 @@ public interface SCXMLIOProcessor {
     String INTERNAL_EVENT_PROCESSOR = "#_internal";
 
     /**
+     * The name of the parent Event Processor
+     */
+    String PARENT_EVENT_PROCESSOR = "#_parent";
+
+    /**
      * 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/env/SimpleDispatcher.java
URL: http://svn.apache.org/viewvc/commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/env/SimpleDispatcher.java?rev=1659109&r1=1659108&r2=1659109&view=diff
==============================================================================
--- commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/env/SimpleDispatcher.java
(original)
+++ commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/env/SimpleDispatcher.java
Wed Feb 11 23:49:35 2015
@@ -189,6 +189,10 @@ public class SimpleDispatcher implements
             if (target == null) {
                 ioProcessor = ioProcessors.get(SCXMLIOProcessor.SCXML_EVENT_PROCESSOR);
             }
+            else if (ioProcessors.containsKey(target)) {
+                ioProcessor = ioProcessors.get(target);
+                internal = SCXMLIOProcessor.INTERNAL_EVENT_PROCESSOR.equals(target);
+            }
             else if (SCXMLIOProcessor.INTERNAL_EVENT_PROCESSOR.equals(target)) {
                 ioProcessor = ioProcessors.get(SCXMLIOProcessor.INTERNAL_EVENT_PROCESSOR);
                 internal = true;

Modified: commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/invoke/Invoker.java
URL: http://svn.apache.org/viewvc/commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/invoke/Invoker.java?rev=1659109&r1=1659108&r2=1659109&view=diff
==============================================================================
--- commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/invoke/Invoker.java
(original)
+++ commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/invoke/Invoker.java
Wed Feb 11 23:49:35 2015
@@ -18,8 +18,7 @@ package org.apache.commons.scxml2.invoke
 
 import java.util.Map;
 
-import org.apache.commons.scxml2.Evaluator;
-import org.apache.commons.scxml2.SCXMLIOProcessor;
+import org.apache.commons.scxml2.SCXMLExecutor;
 import org.apache.commons.scxml2.TriggerEvent;
 
 /**
@@ -51,7 +50,7 @@ import org.apache.commons.scxml2.Trigger
  *   <li>Instantiation via {@link Class#newInstance()}
  *       (Invoker implementation requires accessible constructor).</li>
  *   <li>Configuration (setters for invoke ID and
- *       {@link org.apache.commons.scxml2.SCXMLIOProcessor}).</li>
+ *       {@link org.apache.commons.scxml2.SCXMLExecutor}).</li>
  *   <li>Initiation of invoked activity via invoke() method, passing
  *       the source URI and the map of params.</li>
  *   <li>Zero or more bi-directional event triggering.</li>
@@ -83,18 +82,10 @@ public interface Invoker {
     void setInvokeId(String invokeId);
 
     /**
-     * Set I/O Processor of the parent state machine, which provides the
-     * channel.
-     *
-     * @param parentIOProcessor The I/O Processor of the parent state machine.
-     */
-    void setParentIOProcessor(SCXMLIOProcessor parentIOProcessor);
-
-    /**
-     * Set the Evaluator to be used by the child state machine (to ensure/enforce a compatible
data model)
-     * @param evaluator the Evaluator to be used
+     * Sets the parent SCXMLExecutor through which this Invoker is initiated
+     * @param scxmlExecutor the parent SCXMLExecutor
      */
-    void setEvaluator(Evaluator evaluator);
+    void setParentSCXMLExecutor(SCXMLExecutor scxmlExecutor);
 
     /**
      * Begin this invocation.

Modified: commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/invoke/SimpleSCXMLInvoker.java
URL: http://svn.apache.org/viewvc/commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/invoke/SimpleSCXMLInvoker.java?rev=1659109&r1=1659108&r2=1659109&view=diff
==============================================================================
--- commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/invoke/SimpleSCXMLInvoker.java
(original)
+++ commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/invoke/SimpleSCXMLInvoker.java
Wed Feb 11 23:49:35 2015
@@ -24,12 +24,8 @@ import java.util.Map;
 import javax.xml.stream.XMLStreamException;
 
 import org.apache.commons.scxml2.Context;
-import org.apache.commons.scxml2.Evaluator;
 import org.apache.commons.scxml2.SCXMLExecutor;
-import org.apache.commons.scxml2.SCXMLIOProcessor;
 import org.apache.commons.scxml2.TriggerEvent;
-import org.apache.commons.scxml2.env.SimpleDispatcher;
-import org.apache.commons.scxml2.env.SimpleErrorReporter;
 import org.apache.commons.scxml2.env.SimpleSCXMLListener;
 import org.apache.commons.scxml2.io.SCXMLReader;
 import org.apache.commons.scxml2.model.ModelException;
@@ -45,10 +41,8 @@ public class SimpleSCXMLInvoker implemen
     private static final long serialVersionUID = 1L;
     /** Parent state ID. */
     private String parentStateId;
-    /** Invoking document's external I/O Processor */
-    private SCXMLIOProcessor parentIOProcessor;
-    /** The Evaluator provided by the parent executor */
-    private Evaluator evaluator;
+    /** Invoking parent SCXMLExecutor */
+    private SCXMLExecutor parentSCXMLExecutor;
     /** The invoked state machine executor. */
     private SCXMLExecutor executor;
     /** Cancellation status. */
@@ -73,15 +67,8 @@ public class SimpleSCXMLInvoker implemen
     /**
      * {@inheritDoc}.
      */
-    public void setParentIOProcessor(SCXMLIOProcessor parentIOProcessor) {
-        this.parentIOProcessor = parentIOProcessor;
-    }
-
-    /**
-     * {@inheritDoc}.
-     */
-    public void setEvaluator(final Evaluator evaluator) {
-        this.evaluator = evaluator;
+    public void setParentSCXMLExecutor(SCXMLExecutor parentSCXMLExecutor) {
+        this.parentSCXMLExecutor = parentSCXMLExecutor;
     }
 
     /**
@@ -99,20 +86,18 @@ public class SimpleSCXMLInvoker implemen
         } catch (XMLStreamException xse) {
             throw new InvokerException(xse.getMessage(), xse.getCause());
         }
-        executor = new SCXMLExecutor(evaluator, new SimpleDispatcher(), new SimpleErrorReporter());
-        Context rootCtx = evaluator.newContext(null);
-        for (Map.Entry<String, Object> entry : params.entrySet()) {
-            rootCtx.setLocal(entry.getKey(), entry.getValue());
-        }
-        executor.setRootContext(rootCtx);
+        executor = new SCXMLExecutor(parentSCXMLExecutor);
         try {
             executor.setStateMachine(scxml);
         }
         catch (ModelException me) {
             throw new InvokerException(me);
         }
+        Context rootCtx = executor.getRootContext();
+        for (Map.Entry<String, Object> entry : params.entrySet()) {
+            rootCtx.setLocal(entry.getKey(), entry.getValue());
+        }
         executor.addListener(scxml, new SimpleSCXMLListener());
-        executor.registerInvokerClass("scxml", this.getClass());
         try {
             executor.go();
         } catch (ModelException me) {
@@ -120,7 +105,7 @@ public class SimpleSCXMLInvoker implemen
         }
         if (executor.getStatus().isFinal()) {
             TriggerEvent te = new TriggerEvent("done.invoke."+parentStateId, TriggerEvent.SIGNAL_EVENT);
-            new AsyncTrigger(parentIOProcessor, te).start();
+            new AsyncTrigger(parentSCXMLExecutor, te).start();
         }
     }
 
@@ -136,7 +121,7 @@ public class SimpleSCXMLInvoker implemen
         executor.addEvent(evt);
         if (!doneBefore && executor.getStatus().isFinal()) {
             TriggerEvent te = new TriggerEvent("done.invoke."+parentStateId,TriggerEvent.SIGNAL_EVENT);
-            new AsyncTrigger(parentIOProcessor, te).start();
+            new AsyncTrigger(parentSCXMLExecutor, te).start();
         }
     }
 

Modified: commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/model/Invoke.java
URL: http://svn.apache.org/viewvc/commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/model/Invoke.java?rev=1659109&r1=1659108&r2=1659109&view=diff
==============================================================================
--- commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/model/Invoke.java (original)
+++ commons/proper/scxml/trunk/src/main/java/org/apache/commons/scxml2/model/Invoke.java Wed
Feb 11 23:49:35 2015
@@ -22,10 +22,9 @@ import java.util.Map;
 import org.apache.commons.scxml2.ActionExecutionContext;
 import org.apache.commons.scxml2.Context;
 import org.apache.commons.scxml2.Evaluator;
-import org.apache.commons.scxml2.InvokerManager;
 import org.apache.commons.scxml2.PathResolver;
+import org.apache.commons.scxml2.SCXMLExecutionContext;
 import org.apache.commons.scxml2.SCXMLExpressionException;
-import org.apache.commons.scxml2.SCXMLIOProcessor;
 import org.apache.commons.scxml2.SCXMLSystemContext;
 import org.apache.commons.scxml2.TriggerEvent;
 import org.apache.commons.scxml2.invoke.Invoker;
@@ -46,14 +45,9 @@ public class Invoke extends NamelistHold
     private static final long serialVersionUID = 1L;
 
     /**
-     * The default context variable key under which the InvokerManager is provided
+     * The default context variable key under which the current SCXMLExecutionContext is
provided
      */
-    private static final String INVOKER_MANAGER_KEY = "_INVOKER_MANAGER";
-
-    /**
-     * The default target type.
-     */
-    private static final String TYPE_SCXML = "scxml";
+    private static final String CURRENT_EXECUTION_CONTEXT_KEY = "_CURRENT_EXECUTION_CONTEXT";
 
     /**
      * Identifier for this Invoke.
@@ -300,10 +294,10 @@ public class Invoke extends NamelistHold
     }
 
     /**
-     * @return The local context variable name under which the InvokerManager is provided
to the Invoke
+     * @return The local context variable name under which the current SCXMLExecutionContext
is provided to the Invoke
      */
-    public String getInvokerManagerKey() {
-        return INVOKER_MANAGER_KEY;
+    public String getCurrentSCXMLExecutionContextKey() {
+        return CURRENT_EXECUTION_CONTEXT_KEY;
     }
 
     /**
@@ -337,16 +331,16 @@ public class Invoke extends NamelistHold
 
     @SuppressWarnings("unchecked")
     @Override
-    public void execute(final ActionExecutionContext exctx) throws ModelException {
+    public void execute(final ActionExecutionContext axctx) throws ModelException {
         EnterableState parentState = getParentEnterableState();
-        Context ctx = exctx.getContext(parentState);
-        InvokerManager invokerManager = (InvokerManager)ctx.getVars().get(getInvokerManagerKey());
-        if (invokerManager == null) {
-            throw new ModelException("Missing InvokerManager instance in context under key:
"+getInvokerManagerKey());
+        Context ctx = axctx.getContext(parentState);
+        SCXMLExecutionContext exctx = (SCXMLExecutionContext)ctx.getVars().get(getCurrentSCXMLExecutionContextKey());
+        if (exctx == null) {
+            throw new ModelException("Missing current SCXMLExecutionContext instance in context
under key: "+ getCurrentSCXMLExecutionContextKey());
         }
         try {
             ctx.setLocal(getNamespacesKey(), getNamespaces());
-            Evaluator eval = exctx.getEvaluator();
+            Evaluator eval = axctx.getEvaluator();
 
             String typeValue = type;
             if (typeValue == null && typeexpr != null) {
@@ -357,9 +351,9 @@ public class Invoke extends NamelistHold
                 }
             }
             if (typeValue == null) {
-                typeValue = TYPE_SCXML;
+                typeValue = SCXMLExecutionContext.SCXML_INVOKER_TYPE;
             }
-            Invoker invoker = invokerManager.newInvoker(typeValue);
+            Invoker invoker = exctx.newInvoker(typeValue);
 
             String invokeId = getId();
             if (invokeId == null) {
@@ -400,25 +394,22 @@ public class Invoke extends NamelistHold
                         ": no src and no content defined");
             }
             Map<String, Object> payloadDataMap = new HashMap<String, Object>();
-            addNamelistDataToPayload(exctx, payloadDataMap);
-            addParamsToPayload(exctx, payloadDataMap);
-            SCXMLIOProcessor ioProcessor = ((Map<String,SCXMLIOProcessor>)ctx.get(SCXMLSystemContext.IOPROCESSORS_KEY)).
-                    get(SCXMLIOProcessor.SCXML_EVENT_PROCESSOR);
-            invoker.setParentIOProcessor(ioProcessor);
-            invoker.setEvaluator(exctx.getEvaluator());
+            addNamelistDataToPayload(axctx, payloadDataMap);
+            addParamsToPayload(axctx, payloadDataMap);
+            invoker.setParentSCXMLExecutor(exctx.getSCXMLExecutor());
             if (src != null) {
                 invoker.invoke(src, payloadDataMap);
             }
             // TODO: } else { invoker.invoke(srcNode, payloadDataMap); }
-            invokerManager.registerInvoker(this, invoker);
+            exctx.registerInvoker(this, invoker);
         }
         catch (InvokerException e) {
-            exctx.getErrorReporter().onError(ErrorConstants.EXECUTION_ERROR, e.getMessage(),
this);
-            exctx.getInternalIOProcessor().addEvent(new TriggerEvent(TriggerEvent.ERROR_EXECUTION,
TriggerEvent.ERROR_EVENT));
+            axctx.getErrorReporter().onError(ErrorConstants.EXECUTION_ERROR, e.getMessage(),
this);
+            axctx.getInternalIOProcessor().addEvent(new TriggerEvent(TriggerEvent.ERROR_EXECUTION,
TriggerEvent.ERROR_EVENT));
         }
         catch (SCXMLExpressionException e) {
-            exctx.getInternalIOProcessor().addEvent(new TriggerEvent(TriggerEvent.ERROR_EXECUTION,
TriggerEvent.ERROR_EVENT));
-            exctx.getErrorReporter().onError(ErrorConstants.EXPRESSION_ERROR, e.getMessage(),
this);
+            axctx.getInternalIOProcessor().addEvent(new TriggerEvent(TriggerEvent.ERROR_EXECUTION,
TriggerEvent.ERROR_EVENT));
+            axctx.getErrorReporter().onError(ErrorConstants.EXPRESSION_ERROR, e.getMessage(),
this);
         }
         finally {
             ctx.setLocal(getNamespacesKey(), null);

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=1659109&r1=1659108&r2=1659109&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 Wed
Feb 11 23:49:35 2015
@@ -40,11 +40,6 @@ public class Send extends NamelistHolder
     private static final long serialVersionUID = 1L;
 
     /**
-     * The default target type.
-     */
-    private static final String TYPE_SCXML = "scxml";
-
-    /**
      * The suffix in the delay string for milliseconds.
      */
     private static final String MILLIS = "ms";
@@ -386,9 +381,9 @@ public class Send extends NamelistHolder
         }
         if (typeValue == null) {
             // must default to 'scxml' when unspecified
-            typeValue = TYPE_SCXML;
-        } else if (!TYPE_SCXML.equals(typeValue) && typeValue.trim().equalsIgnoreCase(TYPE_SCXML))
{
-            typeValue = TYPE_SCXML;
+            typeValue = SCXMLIOProcessor.DEFAULT_EVENT_PROCESSOR;
+        } else if (!SCXMLIOProcessor.DEFAULT_EVENT_PROCESSOR.equals(typeValue) &&
typeValue.trim().equalsIgnoreCase(SCXMLIOProcessor.SCXML_EVENT_PROCESSOR)) {
+            typeValue = SCXMLIOProcessor.DEFAULT_EVENT_PROCESSOR;
         }
         Object payload = null;
         Map<String, Object> payloadDataMap = new HashMap<String, Object>();
@@ -418,9 +413,9 @@ public class Send extends NamelistHolder
         String eventValue = event;
         if (eventValue == null && eventexpr != null) {
             eventValue = (String) getTextContentIfNodeResult(eval.eval(ctx, eventexpr));
-            if ((eventValue == null || eventValue.trim().length() == 0) && exctx.getAppLog().isWarnEnabled())
{
+            if ((eventValue == null)) {
                 throw new SCXMLExpressionException("<send>: event expression \"" +
eventexpr
-                        + "\" evaluated to null or empty String");
+                        + "\" evaluated to null");
             }
         }
         Map<String, SCXMLIOProcessor> ioProcessors = (Map<String, SCXMLIOProcessor>)
ctx.get(SCXMLSystemContext.IOPROCESSORS_KEY);

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=1659109&r1=1659108&r2=1659109&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
Wed Feb 11 23:49:35 2015
@@ -1054,10 +1054,10 @@ public class SCXMLSemanticsImpl implemen
         for (TransitionalState ts : statesToInvoke) {
             for (Invoke invoke : ts.getInvokes()) {
                 Context ctx = aexctx.getContext(invoke.getParentEnterableState());
-                String invokerManagerKey = invoke.getInvokerManagerKey();
-                ctx.setLocal(invokerManagerKey, exctx);
+                String exctxKey = invoke.getCurrentSCXMLExecutionContextKey();
+                ctx.setLocal(exctxKey, exctx);
                 invoke.execute(aexctx);
-                ctx.setLocal(invokerManagerKey, null);
+                ctx.setLocal(exctxKey, null);
             }
         }
     }

Modified: commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/invoke/InvokeParamNameTest.java
URL: http://svn.apache.org/viewvc/commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/invoke/InvokeParamNameTest.java?rev=1659109&r1=1659108&r2=1659109&view=diff
==============================================================================
--- commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/invoke/InvokeParamNameTest.java
(original)
+++ commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/invoke/InvokeParamNameTest.java
Wed Feb 11 23:49:35 2015
@@ -18,9 +18,7 @@ package org.apache.commons.scxml2.invoke
 
 import java.util.Map;
 
-import org.apache.commons.scxml2.Evaluator;
 import org.apache.commons.scxml2.SCXMLExecutor;
-import org.apache.commons.scxml2.SCXMLIOProcessor;
 import org.apache.commons.scxml2.SCXMLTestHelper;
 import org.apache.commons.scxml2.TriggerEvent;
 import org.apache.commons.scxml2.model.ModelException;
@@ -114,13 +112,9 @@ public class InvokeParamNameTest {
             this.invokeId = invokeId;
         }
 
-        public void setEvaluator(Evaluator evaluator) {
+        public void setParentSCXMLExecutor(SCXMLExecutor parentSCXMLExecutor) {
             // Not needed
         }
-
-        public void setParentIOProcessor(SCXMLIOProcessor parentIOProcessor) {
-            // Not needed    
-        }
     }
 
 }

Modified: commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/w3c/W3CTests.java
URL: http://svn.apache.org/viewvc/commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/w3c/W3CTests.java?rev=1659109&r1=1659108&r2=1659109&view=diff
==============================================================================
--- commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/w3c/W3CTests.java (original)
+++ commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/w3c/W3CTests.java Wed
Feb 11 23:49:35 2015
@@ -40,8 +40,10 @@ import javax.xml.transform.stream.Stream
 import javax.xml.transform.stream.StreamSource;
 
 import org.apache.commons.io.FileUtils;
+import org.apache.commons.scxml2.PathResolver;
 import org.apache.commons.scxml2.SCXMLExecutor;
 import org.apache.commons.scxml2.env.Tracer;
+import org.apache.commons.scxml2.env.URLResolver;
 import org.apache.commons.scxml2.invoke.SimpleSCXMLInvoker;
 import org.apache.commons.scxml2.io.SCXMLReader;
 import org.apache.commons.scxml2.model.Final;
@@ -721,7 +723,9 @@ public class W3CTests {
         try {
             System.out.println("Executing test: "+scxmlFile.getParentFile().getName()+"/"+scxmlFile.getName());
             final Tracer trc = new Tracer();
-            final SCXML doc = SCXMLReader.read(new FileReader(scxmlFile));
+            final PathResolver pathResolver = new URLResolver(scxmlFile.getParentFile().toURI().toURL());
+            final SCXMLReader.Configuration configuration = new SCXMLReader.Configuration(null,
pathResolver);
+            final SCXML doc = SCXMLReader.read(new FileReader(scxmlFile), configuration);
             if (doc == null) {
                 System.out.println("                FAIL: the SCXML file " +
                         scxmlFile.getCanonicalPath() + " can not be parsed!");

Modified: commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/w3c/tests.xml
URL: http://svn.apache.org/viewvc/commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/w3c/tests.xml?rev=1659109&r1=1659108&r2=1659109&view=diff
==============================================================================
--- commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/w3c/tests.xml (original)
+++ commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/w3c/tests.xml Wed Feb
11 23:49:35 2015
@@ -51,7 +51,7 @@
   <test id="525" mandatory="true"  manual="false" enabled="false"                 ecma="fail"
    xpath="pass"/>
   <test id="158" mandatory="true"  manual="false" enabled="true"                  ecma="pass"
    xpath="pass"/>
   <test id="159" mandatory="true"  manual="false" enabled="false"                 ecma="fail"
    xpath="fail"/>
-  <test id="276" mandatory="true"  manual="false" enabled="false"                 ecma=""
        xpath="">Fails to complete</test>
+  <test id="276" mandatory="true"  manual="false" enabled="true"                  ecma="pass"
    xpath="fail"/>
   <test id="277" mandatory="true"  manual="false" enabled="false"                 ecma="fail"
    xpath="fail"/>
   <test id="279" mandatory="true"  manual="false" enabled="false"                 ecma="fail"
    xpath="fail"/>
   <test id="280" mandatory="true"  manual="false" enabled="false"                 ecma="pass"
    xpath="fail"/>



Mime
View raw message