diff options
author | Stefan Radomski <radomski@tk.informatik.tu-darmstadt.de> | 2013-08-13 12:38:26 (GMT) |
---|---|---|
committer | Stefan Radomski <radomski@tk.informatik.tu-darmstadt.de> | 2013-08-13 12:38:26 (GMT) |
commit | 422dedee98e956a7f4cffa69a4ba0a34716dec7f (patch) | |
tree | 2e3c4d3b8d851f89a40cc632f2d9472c673aaa01 /contrib/java | |
parent | d35b69b97dead2e50dda697f0fb0d5e574bbf205 (diff) | |
download | uscxml-422dedee98e956a7f4cffa69a4ba0a34716dec7f.zip uscxml-422dedee98e956a7f4cffa69a4ba0a34716dec7f.tar.gz uscxml-422dedee98e956a7f4cffa69a4ba0a34716dec7f.tar.bz2 |
Polished java datamodel example
Diffstat (limited to 'contrib/java')
-rw-r--r-- | contrib/java/src/org/uscxml/tests/TestDataModel.java | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/contrib/java/src/org/uscxml/tests/TestDataModel.java b/contrib/java/src/org/uscxml/tests/TestDataModel.java index e3c8d7a..0721501 100644 --- a/contrib/java/src/org/uscxml/tests/TestDataModel.java +++ b/contrib/java/src/org/uscxml/tests/TestDataModel.java @@ -17,7 +17,7 @@ public class TestDataModel extends JavaDataModel { @Override public JavaDataModel create(Interpreter interpreter) { /** - * An SCXML interpreter wants an instance of this datamodel + * Called when an SCXML interpreter wants an instance of this datamodel */ System.out.println("create"); return new TestDataModel(); @@ -27,7 +27,7 @@ public class TestDataModel extends JavaDataModel { public StringSet getNames() { /** * Register with the following names for the datamodel attribute - * at the scxml element. + * at the scxml element. <scxml datamodel="one of these"> */ System.out.println("getNames"); StringSet ss = new StringSet(); @@ -48,7 +48,7 @@ public class TestDataModel extends JavaDataModel { @Override public void setEvent(Event event) { /** - * Make the event available as the variable _event + * Make the current event available as the variable _event * in the datamodel. */ System.out.println("setEvent " + event); @@ -144,12 +144,17 @@ public class TestDataModel extends JavaDataModel { * @param args */ public static void main(String[] args) { + // load JNI library from build directory System.load("/Users/sradomski/Documents/TK/Code/uscxml/build/cli/lib/libuscxmlNativeJava64_d.jnilib"); + // register java datamodel at factory TestDataModel datamodel = new TestDataModel(); Factory.getInstance().registerDataModel(datamodel); + // instantiate interpreter with document from file Interpreter interpreter = Interpreter.fromURI("/Users/sradomski/Documents/TK/Code/uscxml/test/samples/uscxml/test-java-datamodel.scxml"); + + // wait until interpreter has finished while(true) interpreter.interpret(); } |