diff options
author | Stefan Radomski <github@mintwerk.de> | 2016-08-22 14:53:14 (GMT) |
---|---|---|
committer | Stefan Radomski <github@mintwerk.de> | 2016-08-22 14:53:14 (GMT) |
commit | e5782b214d839fe5d8b2f527ae331a246c6e012f (patch) | |
tree | 246e5bf1143b72267791e682b1ac37991d26adbe /test/bindings/java/org/uscxml/apache/commons/scxml2/SCXMLExecutor.java | |
parent | db8418fb9f733ca0147cc225ce0988d7866f15cd (diff) | |
download | uscxml-e5782b214d839fe5d8b2f527ae331a246c6e012f.zip uscxml-e5782b214d839fe5d8b2f527ae331a246c6e012f.tar.gz uscxml-e5782b214d839fe5d8b2f527ae331a246c6e012f.tar.bz2 |
Progress on the apache-commons wrapper
Diffstat (limited to 'test/bindings/java/org/uscxml/apache/commons/scxml2/SCXMLExecutor.java')
-rw-r--r-- | test/bindings/java/org/uscxml/apache/commons/scxml2/SCXMLExecutor.java | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/test/bindings/java/org/uscxml/apache/commons/scxml2/SCXMLExecutor.java b/test/bindings/java/org/uscxml/apache/commons/scxml2/SCXMLExecutor.java new file mode 100644 index 0000000..704e897 --- /dev/null +++ b/test/bindings/java/org/uscxml/apache/commons/scxml2/SCXMLExecutor.java @@ -0,0 +1,49 @@ +package org.uscxml.apache.commons.scxml2; + +import java.net.URL; + +import org.uscxml.ActionLanguage; +import org.uscxml.Factory; +import org.uscxml.Interpreter; +import org.uscxml.InterpreterException; +import org.uscxml.InterpreterState; +import org.uscxml.helper.TestMonitor; + +public class SCXMLExecutor { + + public Interpreter interpreter = null; + public URL sourceURL = null; + public ActionLanguage al = new ActionLanguage(); + + public SCXMLExecutor(Evaluator evaluator, Object object, SimpleErrorReporter simpleErrorReporter) { + // TODO Auto-generated constructor stub + } + + public void setStateMachine(SCXML scxml) { + sourceURL = scxml.url; + } + + public void setRootContext(Context rootContext) { + al.setDataModel(rootContext.dm); + } + + public void go() { + try { + interpreter = Interpreter.fromURL(sourceURL.toString()); + interpreter.setActionLanguage(al); + + TestMonitor tm = new TestMonitor(); + interpreter.addMonitor(tm); + + InterpreterState state = InterpreterState.USCXML_UNDEF; + while(state != InterpreterState.USCXML_FINISHED) { + interpreter.step(); + } + + } catch (InterpreterException e) { + e.printStackTrace(); + } + + } + +} |