summaryrefslogtreecommitdiffstats
path: root/embedding/java
diff options
context:
space:
mode:
authorStefan Radomski <radomski@tk.informatik.tu-darmstadt.de>2014-07-03 01:10:03 (GMT)
committerStefan Radomski <radomski@tk.informatik.tu-darmstadt.de>2014-07-03 01:10:03 (GMT)
commitb542369263782dc8b85893e218119ed070efa7b3 (patch)
tree0a18012a0af991755ceab98a457b46b79c14129f /embedding/java
parent193a01614dc3290eec51745a91be65c166c3763b (diff)
downloaduscxml-b542369263782dc8b85893e218119ed070efa7b3.zip
uscxml-b542369263782dc8b85893e218119ed070efa7b3.tar.gz
uscxml-b542369263782dc8b85893e218119ed070efa7b3.tar.bz2
Got ready for cmake3 and some minor fixes
Diffstat (limited to 'embedding/java')
-rw-r--r--embedding/java/src/org/uscxml/datamodel/ecmascript/ECMAScriptDataModel.java21
-rw-r--r--embedding/java/src/org/uscxml/tests/execContent/TestCustomExecContent.java4
-rw-r--r--embedding/java/src/org/uscxml/tests/invoker/TestCustomInvoker.java5
-rw-r--r--embedding/java/src/org/uscxml/tests/ioprocessor/TestCustomIOProc.java3
4 files changed, 19 insertions, 14 deletions
diff --git a/embedding/java/src/org/uscxml/datamodel/ecmascript/ECMAScriptDataModel.java b/embedding/java/src/org/uscxml/datamodel/ecmascript/ECMAScriptDataModel.java
index 0b2b576..679581d 100644
--- a/embedding/java/src/org/uscxml/datamodel/ecmascript/ECMAScriptDataModel.java
+++ b/embedding/java/src/org/uscxml/datamodel/ecmascript/ECMAScriptDataModel.java
@@ -1,6 +1,7 @@
package org.uscxml.datamodel.ecmascript;
import java.lang.reflect.Method;
+import java.util.Map;
import org.mozilla.javascript.Callable;
import org.mozilla.javascript.Context;
@@ -14,8 +15,9 @@ import org.uscxml.Data;
import org.uscxml.DataModel;
import org.uscxml.Event;
import org.uscxml.Interpreter;
+import org.uscxml.NativeIOProcessor;
+import org.uscxml.NativeInvoker;
import org.uscxml.StringList;
-import org.uscxml.StringVector;
public class ECMAScriptDataModel extends DataModel {
@@ -84,6 +86,7 @@ public class ECMAScriptDataModel extends DataModel {
*/
ECMAScriptDataModel newDM = new ECMAScriptDataModel();
+ newDM.swigReleaseOwnership();
newDM.interpreter = interpreter;
newDM.ctx = Context.enter();
@@ -99,11 +102,9 @@ public class ECMAScriptDataModel extends DataModel {
// ioProcessors
{
Data ioProcs = new Data();
- StringVector keys = interpreter.getIOProcessorKeys();
- for (int i = 0; i < keys.size(); i++) {
- ioProcs.put(keys.get(i), interpreter
- .getIOProcessors().get(keys.get(i))
- .getDataModelVariables());
+ Map<String, NativeIOProcessor> ioProcNatives = interpreter.getIOProcessors();
+ for (String key : ioProcNatives.keySet()) {
+ ioProcs.put(key, ioProcNatives.get(key).getDataModelVariables());
}
newDM.scope
.put("_ioprocessors", newDM.scope, new ECMAData(ioProcs));
@@ -112,11 +113,9 @@ public class ECMAScriptDataModel extends DataModel {
// invokers
{
Data invokers = new Data();
- StringVector keys = interpreter.getInvokerKeys();
- for (int i = 0; i < keys.size(); i++) {
- invokers.put(keys.get(i), interpreter
- .getInvokers().get(keys.get(i))
- .getDataModelVariables());
+ Map<String, NativeInvoker> invokersNatives = interpreter.getInvokers();
+ for (String key : invokersNatives.keySet()) {
+ invokers.put(key, invokersNatives.get(key).getDataModelVariables());
}
newDM.scope
.put("_ioprocessors", newDM.scope, new ECMAData(invokers));
diff --git a/embedding/java/src/org/uscxml/tests/execContent/TestCustomExecContent.java b/embedding/java/src/org/uscxml/tests/execContent/TestCustomExecContent.java
index 7a97ab4..805e6f7 100644
--- a/embedding/java/src/org/uscxml/tests/execContent/TestCustomExecContent.java
+++ b/embedding/java/src/org/uscxml/tests/execContent/TestCustomExecContent.java
@@ -42,7 +42,9 @@ public class TestCustomExecContent extends ExecutableContent {
@Override
public ExecutableContent create(Interpreter interpreter) {
- return new TestCustomExecContent();
+ TestCustomExecContent execContent = new TestCustomExecContent();
+ execContent.swigReleaseOwnership();
+ return execContent;
}
/**
diff --git a/embedding/java/src/org/uscxml/tests/invoker/TestCustomInvoker.java b/embedding/java/src/org/uscxml/tests/invoker/TestCustomInvoker.java
index 25420ed..ecbff9b 100644
--- a/embedding/java/src/org/uscxml/tests/invoker/TestCustomInvoker.java
+++ b/embedding/java/src/org/uscxml/tests/invoker/TestCustomInvoker.java
@@ -47,7 +47,9 @@ public class TestCustomInvoker extends Invoker {
@Override
public Invoker create(Interpreter interpreter) {
- return new TestCustomInvoker();
+ TestCustomInvoker invoker = new TestCustomInvoker();
+ invoker.swigReleaseOwnership();
+ return invoker;
}
/**
@@ -73,6 +75,7 @@ public class TestCustomInvoker extends Invoker {
" </state>" +
" <state id=\"s12\">" +
" <onentry>" +
+ " <log label=\"label\" expr=\"foo\" />" +
" <send target=\"#_javainvoker2\" event=\"foo\" />" +
" </onentry>" +
" <transition event=\"received2\" target=\"done\" />" +
diff --git a/embedding/java/src/org/uscxml/tests/ioprocessor/TestCustomIOProc.java b/embedding/java/src/org/uscxml/tests/ioprocessor/TestCustomIOProc.java
index 277c505..8a72abe 100644
--- a/embedding/java/src/org/uscxml/tests/ioprocessor/TestCustomIOProc.java
+++ b/embedding/java/src/org/uscxml/tests/ioprocessor/TestCustomIOProc.java
@@ -89,6 +89,7 @@ public class TestCustomIOProc extends IOProcessor {
public IOProcessor create(Interpreter interpreter) {
TestCustomIOProc ioProc = new TestCustomIOProc();
ioProc.interpreter = interpreter;
+ ioProc.swigReleaseOwnership();
return ioProc;
}
@@ -102,7 +103,7 @@ public class TestCustomIOProc extends IOProcessor {
TestCustomIOProc ioproc = new TestCustomIOProc();
// just register prototype at global factory
Factory.getInstance().registerIOProcessor(ioproc);
-
+
String xml =
"<scxml>" +
" <state id=\"s1\">" +