diff options
Diffstat (limited to 'contrib/java/apache-commons/org/uscxml/apache/commons/scxml2')
7 files changed, 108 insertions, 0 deletions
diff --git a/contrib/java/apache-commons/org/uscxml/apache/commons/scxml2/Context.java b/contrib/java/apache-commons/org/uscxml/apache/commons/scxml2/Context.java new file mode 100644 index 0000000..a0208c9 --- /dev/null +++ b/contrib/java/apache-commons/org/uscxml/apache/commons/scxml2/Context.java @@ -0,0 +1,7 @@ +package org.uscxml.apache.commons.scxml2; + +import org.uscxml.DataModel; + +public class Context { + public DataModel dm = null; +} diff --git a/contrib/java/apache-commons/org/uscxml/apache/commons/scxml2/Evaluator.java b/contrib/java/apache-commons/org/uscxml/apache/commons/scxml2/Evaluator.java new file mode 100644 index 0000000..5bd5642 --- /dev/null +++ b/contrib/java/apache-commons/org/uscxml/apache/commons/scxml2/Evaluator.java @@ -0,0 +1,7 @@ +package org.uscxml.apache.commons.scxml2; + +public abstract class Evaluator { + + public abstract Context newContext(Object object); + +} diff --git a/contrib/java/apache-commons/org/uscxml/apache/commons/scxml2/JexlEvaluator.java b/contrib/java/apache-commons/org/uscxml/apache/commons/scxml2/JexlEvaluator.java new file mode 100644 index 0000000..127bed3 --- /dev/null +++ b/contrib/java/apache-commons/org/uscxml/apache/commons/scxml2/JexlEvaluator.java @@ -0,0 +1,19 @@ +package org.uscxml.apache.commons.scxml2; + +import org.uscxml.Factory; +import org.uscxml.dm.jexl.JexlDataModel; + +public class JexlEvaluator extends Evaluator { + + public JexlEvaluator() { + + } + + @Override + public Context newContext(Object object) { + // TODO Auto-generated method stub + Context ctx = new Context(); + ctx.dm = new JexlDataModel(); + return ctx; + } +} diff --git a/contrib/java/apache-commons/org/uscxml/apache/commons/scxml2/SCXML.java b/contrib/java/apache-commons/org/uscxml/apache/commons/scxml2/SCXML.java new file mode 100644 index 0000000..67e5b1f --- /dev/null +++ b/contrib/java/apache-commons/org/uscxml/apache/commons/scxml2/SCXML.java @@ -0,0 +1,8 @@ +package org.uscxml.apache.commons.scxml2; + +import java.net.URL; + +public class SCXML { + public URL url = null; + +} diff --git a/contrib/java/apache-commons/org/uscxml/apache/commons/scxml2/SCXMLExecutor.java b/contrib/java/apache-commons/org/uscxml/apache/commons/scxml2/SCXMLExecutor.java new file mode 100644 index 0000000..704e897 --- /dev/null +++ b/contrib/java/apache-commons/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(); + } + + } + +} diff --git a/contrib/java/apache-commons/org/uscxml/apache/commons/scxml2/SCXMLReader.java b/contrib/java/apache-commons/org/uscxml/apache/commons/scxml2/SCXMLReader.java new file mode 100644 index 0000000..45c2a54 --- /dev/null +++ b/contrib/java/apache-commons/org/uscxml/apache/commons/scxml2/SCXMLReader.java @@ -0,0 +1,13 @@ +package org.uscxml.apache.commons.scxml2; + +import java.net.URL; + +public class SCXMLReader { + + public static SCXML read(URL scxml) { + SCXML foo = new SCXML(); + foo.url = scxml; + return foo; + } + +} diff --git a/contrib/java/apache-commons/org/uscxml/apache/commons/scxml2/SimpleErrorReporter.java b/contrib/java/apache-commons/org/uscxml/apache/commons/scxml2/SimpleErrorReporter.java new file mode 100644 index 0000000..06187f8 --- /dev/null +++ b/contrib/java/apache-commons/org/uscxml/apache/commons/scxml2/SimpleErrorReporter.java @@ -0,0 +1,5 @@ +package org.uscxml.apache.commons.scxml2; + +public class SimpleErrorReporter { + +} |