Added InstanceService in NodeContextImpl ctor and used it in saving
instance data instead of having a local variable "instanceData".
This bug is not obvious when using in-memory persistence.
Chris
Index: src/test/org/apache/agila/impl/NodeContextImplTestCase.java
===================================================================
--- src/test/org/apache/agila/impl/NodeContextImplTestCase.java (revision 57115)
+++ src/test/org/apache/agila/impl/NodeContextImplTestCase.java (working copy)
@@ -19,11 +19,13 @@
import junit.framework.TestCase;
import org.apache.agila.services.TimerService;
+import org.apache.agila.services.InstanceService;
import org.apache.agila.services.notification.NotificationService;
import org.apache.agila.services.task.TaskService;
import org.apache.agila.impl.memory.TimerServiceImpl;
import org.apache.agila.impl.memory.TaskServiceImpl;
import org.apache.agila.impl.memory.NotificationServiceImpl;
+import org.apache.agila.impl.memory.InstanceServiceImpl;
import org.apache.agila.model.node.HelloWorldActivity;
import org.apache.agila.model.Binding;
import org.apache.agila.model.Node;
@@ -105,6 +107,7 @@
TimerService ts = new TimerServiceImpl();
TaskService tskServ = new TaskServiceImpl();
NotificationService notifyService = new NotificationServiceImpl();
+ InstanceService instanceService = new InstanceServiceImpl();
node = new HelloWorldActivity();
@@ -112,7 +115,7 @@
node.addBinding(new Binding("drink", "drink", Binding.EL, true, true));
- context = new NodeContextImpl(node, new InstanceImpl(), ts, tskServ,
notifyService );
+ context = new NodeContextImpl(node, instanceService, new
InstanceImpl(), ts, tskServ, notifyService );
}
protected void tearDown() throws Exception {
Index: src/java/org/apache/agila/impl/NodeContextImpl.java
===================================================================
--- src/java/org/apache/agila/impl/NodeContextImpl.java (revision 57115)
+++ src/java/org/apache/agila/impl/NodeContextImpl.java (working copy)
@@ -21,17 +21,16 @@
import org.apache.agila.model.Binding;
import org.apache.agila.model.Node;
import org.apache.agila.model.NodeContext;
+import org.apache.agila.services.TimerService;
import org.apache.agila.services.InstanceService;
import org.apache.agila.services.notification.NotificationService;
import org.apache.agila.services.task.TaskService;
-import org.apache.agila.services.TimerService;
import org.apache.commons.jexl.Expression;
import org.apache.commons.jexl.ExpressionFactory;
import org.apache.commons.jexl.JexlContext;
import org.apache.commons.jexl.JexlHelper;
import java.util.HashMap;
-import java.util.Iterator;
import java.util.Map;
/**
@@ -43,19 +42,21 @@
protected Token currentToken = null;
protected Token nextToken = null;
+ private InstanceService instanceService;
+ private Instance instance;
private TimerService ts = null;
private TaskService taskService = null;
private NotificationService notificationService = null;
private Node node = null;
- private final Map instanceData;
private Map appData = new HashMap();
- public NodeContextImpl(Node node, Instance instance,
- TimerService timer, TaskService task,
- NotificationService notificationService) {
+ public NodeContextImpl( Node node, InstanceService instanceService,
Instance instance,
+ TimerService timer, TaskService task,
+ NotificationService notificationService ) {
this.node = node;
- this.instanceData = instance.getInstanceVariables();
+ this.instanceService = instanceService;
+ this.instance = instance;
this.ts = timer;
this.taskService = task;
this.notificationService = notificationService;
@@ -117,6 +118,7 @@
*/
this.getInstanceData().put(binding.getName(), value);
+ instanceService.save( instance );
}
catch(Exception e) {
// TODO somethig useful
@@ -178,7 +180,7 @@
this.appData = m;
}
public Map getInstanceData() {
- return instanceData;
+ return instance.getInstanceVariables();
}
protected Object jexlResolver(String expression, Map vars)
Index: src/java/org/apache/agila/services/task/AbstractTaskService.java
===================================================================
--- src/java/org/apache/agila/services/task/AbstractTaskService.java
(revision 57115)
+++ src/java/org/apache/agila/services/task/AbstractTaskService.java
(working copy)
@@ -130,7 +130,7 @@
Node node = getNodeForToken(token);
NodeContextImpl ctx = new NodeContextImpl(node,
- instanceService.getInstanceByID(token.getInstanceID()),
+ instanceService,
instanceService.getInstanceByID(token.getInstanceID()),
timerService, this, notificationService);
ctx.setCurrentExecutionToken(token);
@@ -149,7 +149,7 @@
Node node = getNodeForToken(token);
NodeContextImpl ctx = new NodeContextImpl(node,
- instanceService.getInstanceByID(token.getInstanceID()),
+ instanceService,
instanceService.getInstanceByID(token.getInstanceID()),
timerService, this, notificationService);
ctx.setCurrentExecutionToken(token);
Index: src/java/org/apache/agila/engine/MessageProcessor.java
===================================================================
--- src/java/org/apache/agila/engine/MessageProcessor.java (revision 57115)
+++ src/java/org/apache/agila/engine/MessageProcessor.java (working copy)
@@ -135,7 +135,7 @@
Node n = graph.getNode(tk.getCurrentNodeID());
- NodeContextImpl nc = new NodeContextImpl(n, ei, timerService,
+ NodeContextImpl nc = new NodeContextImpl(n, eiSvc, ei, timerService,
taskService, notificationService);
nc.setAppData(msg.getAppData());
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]