You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ode.apache.org by mr...@apache.org on 2007/08/10 01:51:21 UTC

svn commit: r564430 - in /ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel: engine/BpelRuntimeContextImpl.java runtime/EH_EVENT.java runtime/FOREACH.java runtime/INVOKE.java runtime/PICK.java runtime/SCOPE.java

Author: mriou
Date: Thu Aug  9 16:51:20 2007
New Revision: 564430

URL: http://svn.apache.org/viewvc?view=rev&rev=564430
Log:
ODE-85 Added variable modification events to foreach, invoke, pick, faults variables handling and event handlers.

Modified:
    ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelRuntimeContextImpl.java
    ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/EH_EVENT.java
    ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/FOREACH.java
    ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/INVOKE.java
    ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/PICK.java
    ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/SCOPE.java

Modified: ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelRuntimeContextImpl.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelRuntimeContextImpl.java?view=diff&rev=564430&r1=564429&r2=564430
==============================================================================
--- ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelRuntimeContextImpl.java (original)
+++ ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelRuntimeContextImpl.java Thu Aug  9 16:51:20 2007
@@ -33,12 +33,7 @@
 import org.apache.ode.bpel.dao.ProcessInstanceDAO;
 import org.apache.ode.bpel.dao.ScopeDAO;
 import org.apache.ode.bpel.dao.XmlDataDAO;
-import org.apache.ode.bpel.evt.CorrelationSetWriteEvent;
-import org.apache.ode.bpel.evt.ProcessCompletionEvent;
-import org.apache.ode.bpel.evt.ProcessInstanceEvent;
-import org.apache.ode.bpel.evt.ProcessInstanceStateChangeEvent;
-import org.apache.ode.bpel.evt.ProcessMessageExchangeEvent;
-import org.apache.ode.bpel.evt.ProcessTerminationEvent;
+import org.apache.ode.bpel.evt.*;
 import org.apache.ode.bpel.iapi.BpelEngineException;
 import org.apache.ode.bpel.iapi.ContextException;
 import org.apache.ode.bpel.iapi.Endpoint;
@@ -50,12 +45,8 @@
 import org.apache.ode.bpel.iapi.MyRoleMessageExchange;
 import org.apache.ode.bpel.iapi.PartnerRoleMessageExchange;
 import org.apache.ode.bpel.memdao.ProcessInstanceDaoImpl;
-import org.apache.ode.bpel.o.OMessageVarType;
 import org.apache.ode.bpel.o.OMessageVarType.Part;
-import org.apache.ode.bpel.o.OElementVarType;
-import org.apache.ode.bpel.o.OPartnerLink;
-import org.apache.ode.bpel.o.OProcess;
-import org.apache.ode.bpel.o.OScope;
+import org.apache.ode.bpel.o.*;
 import org.apache.ode.bpel.runtime.BpelJacobRunnable;
 import org.apache.ode.bpel.runtime.BpelRuntimeContext;
 import org.apache.ode.bpel.runtime.CorrelationSetInstance;
@@ -477,9 +468,7 @@
         XmlDataDAO dataDAO = scopeDAO.getVariable(variable.declaration.name);
 
         dataDAO.set(initData);
-
-        writeProperties(variable, initData, dataDAO);
-
+        writeProperties(variable, initData, dataDAO);        
         return dataDAO.get();
     }
 

Modified: ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/EH_EVENT.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/EH_EVENT.java?view=diff&rev=564430&r1=564429&r2=564430
==============================================================================
--- ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/EH_EVENT.java (original)
+++ ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/EH_EVENT.java Thu Aug  9 16:51:20 2007
@@ -36,6 +36,8 @@
 import org.apache.ode.bpel.runtime.channels.PickResponseChannelListener;
 import org.apache.ode.bpel.runtime.channels.TerminationChannel;
 import org.apache.ode.bpel.runtime.channels.TerminationChannelListener;
+import org.apache.ode.bpel.evt.ScopeEvent;
+import org.apache.ode.bpel.evt.VariableModificationEvent;
 import org.apache.ode.jacob.ChannelListener;
 import org.apache.ode.jacob.SynchChannel;
 import org.w3c.dom.Element;
@@ -222,29 +224,27 @@
                                     _scopeFrame,
                                     _comps,
                                     _fault);
-                            
-                            if (_oevent.variable != null) { 
+
+                            if (_oevent.variable != null) {
                                 Element msgEl = getBpelRuntimeContext().getMyRequest(mexId);
-                                
+
                                 if (msgEl != null) {
                                     try {
-                                      getBpelRuntimeContext().initializeVariable(ehScopeFrame.resolve(
-                                              _oevent.variable),msgEl);
+                                        VariableInstance vinst = ehScopeFrame.resolve(_oevent.variable);
+                                        getBpelRuntimeContext().initializeVariable(vinst, msgEl);
+
+                                        ScopeEvent se = new VariableModificationEvent(vinst.declaration.name);
+                                        _scopeFrame.fillEventInfo(se);
+                                        if (_oevent.debugInfo != null)
+                                            se.setLineNo(_oevent.debugInfo.startLine);
+                                        getBpelRuntimeContext().sendEvent(se);
                                     } catch (Exception ex) {
-                                      __log.fatal(ex);
-                                      throw new InvalidProcessException(ex);
+                                        __log.fatal(ex);
+                                        throw new InvalidProcessException(ex);
                                     }
                                 }
                             }
 
-                            
-                            Element msgEl = getBpelRuntimeContext().getMyRequest(mexId);
-                            try {
-                                getBpelRuntimeContext().initializeVariable(ehScopeFrame.resolve(_oevent.variable),msgEl);
-                            } catch (Exception ex) {
-                                __log.error(ex);
-                                throw new InvalidProcessException(ex);
-                            }
 
                             try {
                                 for (OScope.CorrelationSet cset : _oevent.initCorrelations) {
@@ -282,25 +282,25 @@
                             }
 
 
-                            
+
                             // load 'onMessage' activity; we'll do this even if a stop/terminate has been
                             // requested becasue we cannot undo the receipt of the message at this point.
                             ActivityInfo child = new ActivityInfo(genMonotonic(),
                                     _oevent.activity,
                                     newChannel(TerminationChannel.class), newChannel(ParentScopeChannel.class));
 
-                            
+
                             _active.add(child);
 
                             LinkFrame lf = new LinkFrame(null);
 
                             instance(new SCOPE(child,ehScopeFrame, lf));
-                            
+
                             // If we previously terminated the other activiites, then we do the same
                             // here; this is easier then undoing the receive.
                             if (_childrenTerminated)
                                 replication(child.self).terminate();
-                           
+
 
                             if (_terminated || _stopped || _fault != null)
                                 instance(new WAITING(null));

Modified: ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/FOREACH.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/FOREACH.java?view=diff&rev=564430&r1=564429&r2=564430
==============================================================================
--- ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/FOREACH.java (original)
+++ ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/FOREACH.java Thu Aug  9 16:51:20 2007
@@ -31,6 +31,8 @@
 import org.apache.ode.bpel.runtime.channels.ParentScopeChannelListener;
 import org.apache.ode.bpel.runtime.channels.TerminationChannel;
 import org.apache.ode.bpel.runtime.channels.TerminationChannelListener;
+import org.apache.ode.bpel.evt.ScopeEvent;
+import org.apache.ode.bpel.evt.VariableModificationEvent;
 import org.apache.ode.jacob.ChannelListener;
 import org.apache.ode.jacob.SynchChannel;
 import org.apache.ode.utils.DOMUtils;
@@ -207,7 +209,14 @@
         ScopeFrame newFrame = new ScopeFrame(
                 _oforEach.innerScope, getBpelRuntimeContext().createScopeInstance(_scopeFrame.scopeInstanceId,
                 _oforEach.innerScope), _scopeFrame, null);
-        getBpelRuntimeContext().initializeVariable(newFrame.resolve(_oforEach.counterVariable), counterNode);
+        VariableInstance vinst = newFrame.resolve(_oforEach.counterVariable);
+        getBpelRuntimeContext().initializeVariable(vinst, counterNode);
+        // Generating event
+        ScopeEvent se = new VariableModificationEvent(vinst.declaration.name);
+        if (_oforEach.debugInfo != null)
+            se.setLineNo(_oforEach.debugInfo.startLine);
+        sendEvent(se);
+
         instance(new SCOPE(child.activity, newFrame, _linkFrame));
     }
 

Modified: ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/INVOKE.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/INVOKE.java?view=diff&rev=564430&r1=564429&r2=564430
==============================================================================
--- ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/INVOKE.java (original)
+++ ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/INVOKE.java Thu Aug  9 16:51:20 2007
@@ -23,6 +23,8 @@
 import org.apache.ode.bpel.common.FaultException;
 import org.apache.ode.bpel.evt.ActivityFailureEvent;
 import org.apache.ode.bpel.evt.ActivityRecoveryEvent;
+import org.apache.ode.bpel.evt.ScopeEvent;
+import org.apache.ode.bpel.evt.VariableModificationEvent;
 import org.apache.ode.bpel.o.OFailureHandling;
 import org.apache.ode.bpel.o.OInvoke;
 import org.apache.ode.bpel.o.OScope;
@@ -113,6 +115,11 @@
                         }
 
                         getBpelRuntimeContext().initializeVariable(outputVar, response);
+                        // Generating event
+                        ScopeEvent se = new VariableModificationEvent(outputVar.declaration.name);
+                        if (_oinvoke.debugInfo != null)
+                            se.setLineNo(_oinvoke.debugInfo.startLine);
+                        sendEvent(se);
 
                         try {
                             for (OScope.CorrelationSet anInitCorrelationsOutput : _oinvoke.initCorrelationsOutput) {
@@ -140,8 +147,7 @@
                             fault = createFault(e.getQName(), _oinvoke);
                         }
 
-                        // TODO update output variable with data from non-initiate
-                        // correlation sets
+                        // TODO update output variable with data from non-initiate correlation sets
 
                         _self.parent.completed(fault, CompensationHandler.emptySet());
                         getBpelRuntimeContext().releasePartnerMex(mexId);

Modified: ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/PICK.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/PICK.java?view=diff&rev=564430&r1=564429&r2=564430
==============================================================================
--- ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/PICK.java (original)
+++ ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/PICK.java Thu Aug  9 16:51:20 2007
@@ -38,6 +38,8 @@
 import org.apache.ode.bpel.runtime.channels.PickResponseChannel;
 import org.apache.ode.bpel.runtime.channels.PickResponseChannelListener;
 import org.apache.ode.bpel.runtime.channels.TerminationChannelListener;
+import org.apache.ode.bpel.evt.ScopeEvent;
+import org.apache.ode.bpel.evt.VariableModificationEvent;
 import org.apache.ode.utils.DOMUtils;
 import org.apache.ode.utils.xsd.Duration;
 import org.w3c.dom.Element;
@@ -207,8 +209,13 @@
             
         }
 
-        getBpelRuntimeContext().initializeVariable(_scopeFrame.resolve(onMessage.variable), msgEl);
-
+        VariableInstance vinst = _scopeFrame.resolve(onMessage.variable);
+        getBpelRuntimeContext().initializeVariable(vinst, msgEl);
+        // Generating event
+        ScopeEvent se = new VariableModificationEvent(vinst.declaration.name);
+        if (_opick.debugInfo != null)
+            se.setLineNo(_opick.debugInfo.startLine);
+        sendEvent(se);
     }
 
     private class WAITING extends BpelJacobRunnable {

Modified: ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/SCOPE.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/SCOPE.java?view=diff&rev=564430&r1=564429&r2=564430
==============================================================================
--- ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/SCOPE.java (original)
+++ ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/SCOPE.java Thu Aug  9 16:51:20 2007
@@ -22,6 +22,8 @@
 import org.apache.commons.logging.LogFactory;
 import org.apache.ode.bpel.evt.ScopeFaultEvent;
 import org.apache.ode.bpel.evt.ScopeStartEvent;
+import org.apache.ode.bpel.evt.ScopeEvent;
+import org.apache.ode.bpel.evt.VariableModificationEvent;
 import org.apache.ode.bpel.o.*;
 import org.apache.ode.bpel.runtime.channels.*;
 import org.apache.ode.jacob.ChannelListener;
@@ -291,8 +293,14 @@
                                 _fault);
                         if (catchBlock.faultVariable != null) {
                             try {
-                                ntive.initializeVariable(faultHandlerScopeFrame.resolve(catchBlock.faultVariable),
-                                        _fault.getFaultMessage());
+                                VariableInstance vinst =  faultHandlerScopeFrame.resolve(catchBlock.faultVariable);
+                                ntive.initializeVariable(vinst, _fault.getFaultMessage());
+
+                                // Generating event
+                                ScopeEvent se = new VariableModificationEvent(vinst.declaration.name);
+                                if (_oscope.debugInfo != null)
+                                    se.setLineNo(_oscope.debugInfo.startLine);
+                                sendEvent(se);
                             } catch (Exception ex) {
                                 __log.fatal(ex);
                                 throw new InvalidProcessException(ex);