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 2006/11/07 18:32:52 UTC

svn commit: r472176 - in /incubator/ode/trunk: axis2/src/main/java/org/apache/ode/axis2/ bpel-api/src/main/java/org/apache/ode/bpel/iapi/ bpel-dd/src/main/xsd/ bpel-runtime/src/main/java/org/apache/ode/bpel/engine/ bpel-store/src/main/java/org/apache/o...

Author: mriou
Date: Tue Nov  7 09:32:51 2006
New Revision: 472176

URL: http://svn.apache.org/viewvc?view=rev&rev=472176
Log:
Re-introducing events filtering.

Modified:
    incubator/ode/trunk/axis2/src/main/java/org/apache/ode/axis2/ODEServer.java
    incubator/ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/iapi/ProcessStore.java
    incubator/ode/trunk/bpel-dd/src/main/xsd/dd.xsd
    incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelProcess.java
    incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelRuntimeContextImpl.java
    incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/DebuggerSupport.java
    incubator/ode/trunk/bpel-store/src/main/java/org/apache/ode/store/ProcessStoreImpl.java
    incubator/ode/trunk/bpel-store/src/main/java/org/apache/ode/store/dao/ConfStoreConnectionHib.java
    incubator/ode/trunk/bpel-test/src/test/java/org/apache/ode/test/BPELTest.java
    incubator/ode/trunk/jbi/src/main/java/org/apache/ode/jbi/OdeLifeCycle.java

Modified: incubator/ode/trunk/axis2/src/main/java/org/apache/ode/axis2/ODEServer.java
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/axis2/src/main/java/org/apache/ode/axis2/ODEServer.java?view=diff&rev=472176&r1=472175&r2=472176
==============================================================================
--- incubator/ode/trunk/axis2/src/main/java/org/apache/ode/axis2/ODEServer.java (original)
+++ incubator/ode/trunk/axis2/src/main/java/org/apache/ode/axis2/ODEServer.java Tue Nov  7 09:32:51 2006
@@ -397,7 +397,7 @@
     }
 
     private void initProcessStore() {
-        _store = new ProcessStoreImpl(_workRoot, _datasource);
+        _store = new ProcessStoreImpl(_workRoot, _datasource, true);
     }
 
     private void initBpelServer() {

Modified: incubator/ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/iapi/ProcessStore.java
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/iapi/ProcessStore.java?view=diff&rev=472176&r1=472175&r2=472176
==============================================================================
--- incubator/ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/iapi/ProcessStore.java (original)
+++ incubator/ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/iapi/ProcessStore.java Tue Nov  7 09:32:51 2006
@@ -98,4 +98,13 @@
 
     void setProperty(QName processId, String name, String namespace, String value);
     void setProperty(QName processId, String name, String namespace, Node value);
+
+    /**
+     * Gets the event setting for an activity that would be in a given process
+     * and having the provided scope hierarchy.
+     * @param processId
+     * @param scopeNames names of parent scopes starting from the directly enclosing scope to the highest scope
+     * @return enable event types
+     */
+    List<String> getEventsSettings(QName processId, List<String> scopeNames);
 }

Modified: incubator/ode/trunk/bpel-dd/src/main/xsd/dd.xsd
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-dd/src/main/xsd/dd.xsd?view=diff&rev=472176&r1=472175&r2=472176
==============================================================================
--- incubator/ode/trunk/bpel-dd/src/main/xsd/dd.xsd (original)
+++ incubator/ode/trunk/bpel-dd/src/main/xsd/dd.xsd Tue Nov  7 09:32:51 2006
@@ -23,115 +23,148 @@
            xmlns:dd="http://ode.fivesight.com/schemas/2006/06/27/dd"
            elementFormDefault="qualified">
 
-  <xs:element name="deploy" id="deploy" type="dd:tDeployment"/>
+    <xs:element name="deploy" id="deploy" type="dd:tDeployment"/>
 
-  <xs:complexType name="tDeployment">
-    <xs:sequence>
+    <xs:complexType name="tDeployment">
+        <xs:sequence>
 
-      <xs:element name="process"  minOccurs="0" maxOccurs="unbounded">
-        <xs:complexType>
-          <xs:sequence>
-
-            <xs:element name="active" minOccurs="0" maxOccurs="1" type="xs:boolean"
-                        default="true">
-              <xs:annotation>
-                <xs:documentation> Active flag, if set process will be activated once
-                  deployed. </xs:documentation>
-              </xs:annotation>
-            </xs:element>
-            <xs:element name="retired" minOccurs="0" maxOccurs="1" type="xs:boolean"
-                        default="false">
-              <xs:annotation>
-                <xs:documentation> Retired flag, if set process will be retired once
-                  deployed. </xs:documentation>
-              </xs:annotation>
-            </xs:element>
+            <xs:element name="process"  minOccurs="0" maxOccurs="unbounded">
+                <xs:complexType>
+                    <xs:sequence>
+
+                        <xs:element name="active" minOccurs="0" maxOccurs="1" type="xs:boolean"
+                                    default="true">
+                            <xs:annotation>
+                                <xs:documentation> Active flag, if set process will be activated once
+                                    deployed. </xs:documentation>
+                            </xs:annotation>
+                        </xs:element>
+                        <xs:element name="retired" minOccurs="0" maxOccurs="1" type="xs:boolean"
+                                    default="false">
+                            <xs:annotation>
+                                <xs:documentation> Retired flag, if set process will be retired once
+                                    deployed. </xs:documentation>
+                            </xs:annotation>
+                        </xs:element>
+
+                        <xs:element name="property"  minOccurs="0" maxOccurs="unbounded">
+                            <xs:annotation>
+                                <xs:documentation>
+                                    A user-defined property that will be attached to a process upon
+                                    deployment.
+                                </xs:documentation>
+                            </xs:annotation>
+                            <xs:complexType>
+                                <xs:sequence>
+                                    <xs:any namespace="##other" minOccurs="0" maxOccurs="unbounded" processContents="lax"/>
+                                </xs:sequence>
+                                <xs:attribute name="name" type="xs:QName" use="required"/>
+                            </xs:complexType>
+                        </xs:element>
+
+                        <xs:element name="process-events" minOccurs="0" maxOccurs="1" type="dd:tProcessEvents"/>
+
+                        <xs:element name="provide"  minOccurs="0" maxOccurs="unbounded" type="dd:tProvide"/>
+                        <xs:element name="invoke"  minOccurs="0" maxOccurs="unbounded" type="dd:tInvoke"/>
+
+                        <xs:element name="mex-interceptors" minOccurs="0" maxOccurs="1" >
+                            <xs:annotation>
+                                <xs:documentation>
+                                    List of message exchange interceptors that should be registered for this process.
+                                </xs:documentation>
+                            </xs:annotation>
+                            <xs:complexType>
+                                <xs:sequence>
+                                    <xs:element name="mex-interceptor" minOccurs="0" maxOccurs="unbounded" type="dd:tMexInterceptor" />
+                                </xs:sequence>
+                            </xs:complexType>
+                        </xs:element>
+                        <xs:element name="type" minOccurs="0" maxOccurs="1"  type="xs:QName">
+                            <xs:annotation>
+                                <xs:documentation> Process type -- indicates which process defintion should be used
+                                    for the process.</xs:documentation>
+                            </xs:annotation>
+                        </xs:element>
 
-            <xs:element name="property"  minOccurs="0" maxOccurs="unbounded">
-              <xs:annotation>
-                <xs:documentation>
-                  A user-defined property that will be attached to a process upon
-                  deployment.
-                </xs:documentation>
-              </xs:annotation>
-              <xs:complexType>
-                <xs:sequence>
-                  <xs:any namespace="##other" minOccurs="0" maxOccurs="unbounded" processContents="lax"/>
-                </xs:sequence>
-                <xs:attribute name="name" type="xs:QName" use="required"/>
-              </xs:complexType>
+                    </xs:sequence>
+
+                    <xs:attribute name="name" type="xs:QName" use="required"/>
+
+                </xs:complexType>
             </xs:element>
 
-            <xs:element name="provide"  minOccurs="0" maxOccurs="unbounded" type="dd:tProvide"/>
-            <xs:element name="invoke"  minOccurs="0" maxOccurs="unbounded" type="dd:tInvoke"/>
+        </xs:sequence>
+    </xs:complexType>
 
-		  <xs:element name="mex-interceptors" minOccurs="0" maxOccurs="1" >
-		    <xs:annotation>
-    	        <xs:documentation>
-   		         	List of message exchange interceptors that should be registered for this process. 
-  	          </xs:documentation>
-  	       </xs:annotation>
-		     <xs:complexType>
-		       <xs:sequence>
-		         <xs:element name="mex-interceptor" minOccurs="0" maxOccurs="unbounded" type="dd:tMexInterceptor" />
-		       </xs:sequence>
-		     </xs:complexType>
-		  </xs:element>
-	      <xs:element name="type" minOccurs="0" maxOccurs="1"  type="xs:QName">
-              <xs:annotation>
-                <xs:documentation> Process type -- indicates which process defintion should be used
-                for the process.</xs:documentation>
-              </xs:annotation>
-		    </xs:element>
-
-          </xs:sequence>
-
-          <xs:attribute name="name" type="xs:QName" use="required"/>
-          
-        </xs:complexType>
-      </xs:element>
-
-    </xs:sequence>
-  </xs:complexType>
-
-  <xs:complexType name="tProvide">
-    <xs:sequence>
-      <xs:element name="service" minOccurs="1" maxOccurs="1" type="dd:tService"/>
-    </xs:sequence>
-    <xs:attribute name="partnerLink" type="xs:string" use="required"/>
-  </xs:complexType>
-
-  <xs:complexType name="tInvoke">
-    <xs:choice>
-      <xs:element name="service" minOccurs="1" maxOccurs="1" type="dd:tService"/>
-      <xs:element name="binding" minOccurs="1" maxOccurs="1">
-        <xs:complexType>
-          <xs:attribute name="name" type="xs:QName" use="required"/>
-        </xs:complexType>
-      </xs:element>
-    </xs:choice>
-    <xs:attribute name="partnerLink" type="xs:string" use="required"/>
-  </xs:complexType>
-
-  <xs:complexType name="tService">
-    <xs:sequence>
-      <xs:any namespace="##other" minOccurs="0" maxOccurs="unbounded" processContents="lax"/>
-    </xs:sequence>
-    <xs:attribute name="name" type="xs:QName" use="required"/>
-    <xs:attribute name="port" type="xs:NCName" use="required"/>
-  </xs:complexType>
-  
-  <xs:complexType name="tMexInterceptor" >    
-  	<xs:annotation>
-    	<xs:documentation>
-            Message exchange interceptor configuration.
-        </xs:documentation>
-     </xs:annotation>
-  
-     <xs:sequence>
-        <xs:element name="class-name" type="xs:string" />
-     </xs:sequence>
-  </xs:complexType>
-    
+    <xs:complexType name="tProvide">
+        <xs:sequence>
+            <xs:element name="service" minOccurs="1" maxOccurs="1" type="dd:tService"/>
+        </xs:sequence>
+        <xs:attribute name="partnerLink" type="xs:string" use="required"/>
+    </xs:complexType>
+
+    <xs:complexType name="tInvoke">
+        <xs:choice>
+            <xs:element name="service" minOccurs="1" maxOccurs="1" type="dd:tService"/>
+            <xs:element name="binding" minOccurs="1" maxOccurs="1">
+                <xs:complexType>
+                    <xs:attribute name="name" type="xs:QName" use="required"/>
+                </xs:complexType>
+            </xs:element>
+        </xs:choice>
+        <xs:attribute name="partnerLink" type="xs:string" use="required"/>
+    </xs:complexType>
+
+    <xs:complexType name="tService">
+        <xs:sequence>
+            <xs:any namespace="##other" minOccurs="0" maxOccurs="unbounded" processContents="lax"/>
+        </xs:sequence>
+        <xs:attribute name="name" type="xs:QName" use="required"/>
+        <xs:attribute name="port" type="xs:NCName" use="required"/>
+    </xs:complexType>
+
+    <xs:complexType name="tMexInterceptor" >
+        <xs:annotation>
+            <xs:documentation>
+                Message exchange interceptor configuration.
+            </xs:documentation>
+        </xs:annotation>
+
+        <xs:sequence>
+            <xs:element name="class-name" type="xs:string" />
+        </xs:sequence>
+    </xs:complexType>
+
+    <xs:complexType name="tEnableEventList">
+        <xs:sequence>
+            <xs:element name="enable-event" minOccurs="1" maxOccurs="unbounded" type="xs:string"/>
+        </xs:sequence>
+    </xs:complexType>
+
+    <xs:complexType name="tScopeEvents">
+        <xs:complexContent>
+            <xs:extension base="dd:tEnableEventList">
+                <xs:attribute name="name" use="required" type="xs:string"/>
+            </xs:extension>
+        </xs:complexContent>
+    </xs:complexType>
+
+    <xs:complexType name="tProcessEvents">
+        <xs:complexContent>
+            <xs:extension base="dd:tEnableEventList">
+                <xs:sequence>
+                    <xs:element name="scope-events" minOccurs="1" maxOccurs="unbounded" type="dd:tScopeEvents"/>
+                </xs:sequence>
+                <xs:attribute name="generate" use="optional">
+                    <xs:simpleType>
+                        <xs:restriction base="xs:string">
+                            <xs:enumeration value="all"/>
+                            <xs:enumeration value="noneDESer"/>
+                        </xs:restriction>
+                    </xs:simpleType>
+                </xs:attribute>
+            </xs:extension>
+        </xs:complexContent>
+    </xs:complexType>
 
 </xs:schema>

Modified: incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelProcess.java
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelProcess.java?view=diff&rev=472176&r1=472175&r2=472176
==============================================================================
--- incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelProcess.java (original)
+++ incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelProcess.java Tue Nov  7 09:32:51 2006
@@ -27,9 +27,7 @@
 import org.apache.ode.bpel.dao.MessageRouteDAO;
 import org.apache.ode.bpel.dao.ProcessDAO;
 import org.apache.ode.bpel.dao.ProcessInstanceDAO;
-import org.apache.ode.bpel.evt.CorrelationMatchEvent;
-import org.apache.ode.bpel.evt.CorrelationNoMatchEvent;
-import org.apache.ode.bpel.evt.NewProcessInstanceEvent;
+import org.apache.ode.bpel.evt.*;
 import org.apache.ode.bpel.explang.EvaluationException;
 import org.apache.ode.bpel.iapi.*;
 import org.apache.ode.bpel.iapi.MessageExchange.FailureType;
@@ -460,7 +458,7 @@
                 evt.setOperation(operation.getName());
                 evt.setMexId(mex.getMessageExchangeId());
                 _debugger.onEvent(evt);
-                newInstance.insertBpelEvent(evt);
+                saveEvent(evt, newInstance);
                 mex.setCorrelationStatus(CorrelationStatus.CREATE_INSTANCE);
                 mex.getDAO().setInstance(newInstance);
 
@@ -496,7 +494,7 @@
 
                 _debugger.onEvent(evt);
                 // store event
-                instanceDao.insertBpelEvent(evt);
+                saveEvent(evt, instanceDao);
                 
                 // EXPERIMENTAL -- LOCK
                 //instanceDao.lock();
@@ -755,5 +753,31 @@
         if (prole == null)
             throw new IllegalStateException("Unknown partner link " + partnerLink);
         return prole._channel;
+    }
+
+    public void saveEvent(ProcessInstanceEvent event) {
+        boolean enabled = false;
+        List<String> scopeNames = null;
+        if (event instanceof ScopeEvent) {
+            scopeNames = ((ScopeEvent)event).getParentScopesNames();
+        }
+        List<String> eventTypes = _store.getEventsSettings(_pid, scopeNames);
+        if (eventTypes.size() == 1 && eventTypes.get(0).equals("all"))
+            enabled = true;
+        else {
+            for (String eventType : eventTypes) {
+                if (eventType.equals(event.getType().toString()))
+                    enabled = true;
+            }
+        }
+        System.out.println("#### EVENT OF TYPE " + event + " GENERATE : " + enabled);
+        if (enabled) {
+            ProcessInstanceDAO instanceDao = getProcessDAO().getInstance(event.getProcessInstanceId());
+            saveEvent(event, instanceDao);
+        }
+    }
+
+    void saveEvent(ProcessInstanceEvent event, ProcessInstanceDAO instanceDao) {
+        instanceDao.insertBpelEvent(event);
     }
 }

Modified: incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelRuntimeContextImpl.java
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelRuntimeContextImpl.java?view=diff&rev=472176&r1=472175&r2=472176
==============================================================================
--- incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelRuntimeContextImpl.java (original)
+++ incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelRuntimeContextImpl.java Tue Nov  7 09:32:51 2006
@@ -18,63 +18,23 @@
  */
 package org.apache.ode.bpel.engine;
 
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Date;
-import java.util.Iterator;
-import java.util.List;
-
-import javax.wsdl.Operation;
-import javax.xml.namespace.QName;
-
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.ode.bpel.common.CorrelationKey;
 import org.apache.ode.bpel.common.FaultException;
 import org.apache.ode.bpel.common.ProcessState;
-import org.apache.ode.bpel.dao.CorrelationSetDAO;
-import org.apache.ode.bpel.dao.CorrelatorDAO;
-import org.apache.ode.bpel.dao.MessageDAO;
-import org.apache.ode.bpel.dao.MessageExchangeDAO;
-import org.apache.ode.bpel.dao.MessageRouteDAO;
-import org.apache.ode.bpel.dao.PartnerLinkDAO;
-import org.apache.ode.bpel.dao.ProcessDAO;
-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.iapi.BpelEngineException;
-import org.apache.ode.bpel.iapi.ContextException;
-import org.apache.ode.bpel.iapi.EndpointReference;
-import org.apache.ode.bpel.iapi.Message;
-import org.apache.ode.bpel.iapi.MessageExchange;
+import org.apache.ode.bpel.dao.*;
+import org.apache.ode.bpel.evt.*;
+import org.apache.ode.bpel.iapi.*;
 import org.apache.ode.bpel.iapi.MessageExchange.FailureType;
 import org.apache.ode.bpel.iapi.MessageExchange.MessageExchangePattern;
 import org.apache.ode.bpel.o.OMessageVarType;
+import org.apache.ode.bpel.o.OMessageVarType.Part;
 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.OMessageVarType.Part;
-import org.apache.ode.bpel.runtime.BpelJacobRunnable;
-import org.apache.ode.bpel.runtime.BpelRuntimeContext;
-import org.apache.ode.bpel.runtime.CorrelationSetInstance;
-import org.apache.ode.bpel.runtime.ExpressionLanguageRuntimeRegistry;
-import org.apache.ode.bpel.runtime.PROCESS;
-import org.apache.ode.bpel.runtime.PartnerLinkInstance;
-import org.apache.ode.bpel.runtime.Selector;
-import org.apache.ode.bpel.runtime.VariableInstance;
-import org.apache.ode.bpel.runtime.channels.ActivityRecoveryChannel;
-import org.apache.ode.bpel.runtime.channels.FaultData;
-import org.apache.ode.bpel.runtime.channels.InvokeResponseChannel;
-import org.apache.ode.bpel.runtime.channels.PickResponseChannel;
-import org.apache.ode.bpel.runtime.channels.TimerResponseChannel;
+import org.apache.ode.bpel.runtime.*;
+import org.apache.ode.bpel.runtime.channels.*;
 import org.apache.ode.jacob.JacobRunnable;
 import org.apache.ode.jacob.vpu.ExecutionQueueImpl;
 import org.apache.ode.jacob.vpu.JacobVPU;
@@ -85,6 +45,12 @@
 import org.w3c.dom.Element;
 import org.w3c.dom.Node;
 
+import javax.wsdl.Operation;
+import javax.xml.namespace.QName;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.util.*;
+
 class BpelRuntimeContextImpl implements BpelRuntimeContext {
 
     private static final Log __log = LogFactory.getLog(BpelRuntimeContextImpl.class);
@@ -921,7 +887,7 @@
         event.setProcessName(_dao.getProcess().getType());
         event.setProcessInstanceId(_dao.getInstanceId());
         _bpelProcess._debugger.onEvent(event);
-        _dao.insertBpelEvent(event);
+        _bpelProcess.saveEvent(event);
     }
 
     private void initVPU() {

Modified: incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/DebuggerSupport.java
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/DebuggerSupport.java?view=diff&rev=472176&r1=472175&r2=472176
==============================================================================
--- incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/DebuggerSupport.java (original)
+++ incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/DebuggerSupport.java Tue Nov  7 09:32:51 2006
@@ -18,6 +18,8 @@
  */
 package org.apache.ode.bpel.engine;
 
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 import org.apache.ode.bpel.bdi.breaks.Breakpoint;
 import org.apache.ode.bpel.common.ProcessState;
 import org.apache.ode.bpel.dao.BpelDAOConnection;
@@ -32,13 +34,8 @@
 import org.apache.ode.utils.ArrayUtils;
 import org.apache.ode.utils.msg.MessageBundle;
 
-import java.util.*;
-
 import javax.xml.namespace.QName;
-
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
+import java.util.*;
 
 /**
  * Class providing functions used to support debugging funtionality
@@ -50,341 +47,341 @@
  */
 class DebuggerSupport {
 
-  private static final Log __log = LogFactory.getLog(DebuggerSupport.class);
-  private static final Messages __msgs = MessageBundle.getMessages(Messages.class);
+    private static final Log __log = LogFactory.getLog(DebuggerSupport.class);
+    private static final Messages __msgs = MessageBundle.getMessages(Messages.class);
+
+    static final Breakpoint[] EMPTY_BP = new Breakpoint[0];
+
+    private boolean _enabled = true;
+    private Breakpoint[] _globalBreakPoints = EMPTY_BP;
+    private final Set<Long> _step = new HashSet<Long>();
+    private final Map<Long, Breakpoint[]>_instanceBreakPoints = new HashMap<Long, Breakpoint[]>();
+
+    /** BPEL process database */
+    private BpelProcessDatabase _db;
+
+    /** BPEL process. */
+    private BpelProcess _process;
+
+    /**
+     * Constructor.
+     * @param db BPEL process database
+     */
+    DebuggerSupport(BpelProcess process) {
+        _process = process;
+        _db = new BpelProcessDatabase(_process._engine._contexts.dao,
+                _process._engine._contexts.scheduler,
+                _process._pid);
+
+    }
 
-  static final Breakpoint[] EMPTY_BP = new Breakpoint[0];
-  
-  private boolean _enabled = true;
-  private Breakpoint[] _globalBreakPoints = EMPTY_BP;
-  private final Set<Long> _step = new HashSet<Long>();
-  private final Map<Long, Breakpoint[]>_instanceBreakPoints = new HashMap<Long, Breakpoint[]>();
-
-  /** BPEL process database */
-  private BpelProcessDatabase _db;
-
-  /** BPEL process. */
-  private BpelProcess _process;
-
-  /**
-   * Constructor.
-   * @param db BPEL process database
-   */
-  DebuggerSupport(BpelProcess process) {
-    _process = process;
-    _db = new BpelProcessDatabase(_process._engine._contexts.dao,
-        _process._engine._contexts.scheduler,
-        _process._pid);
-    
-	}
-  
-  void enable(boolean enabled){
-  	_enabled = enabled;
-  }
-  
-  Breakpoint[] getGlobalBreakpoints(){
-  	return _globalBreakPoints;
-  }
-  
-  Breakpoint[] getBreakpoints(Long pid){
-  	Breakpoint[] arr = _instanceBreakPoints.get(pid);
-    return (arr == null)
-      ? EMPTY_BP
-      : arr;
-  }
-  
-  void addGlobalBreakpoint(Breakpoint breakpoint){
-  	Collection<Breakpoint> c = ArrayUtils.makeCollection(ArrayList.class, _globalBreakPoints);
-    c.add(breakpoint);
-    _globalBreakPoints = c.toArray(new Breakpoint[c.size()]);
-  }
-  
-  void addBreakpoint(Long pid, Breakpoint breakpoint){
-  	Breakpoint[] bpArr = _instanceBreakPoints.get(pid);
-    if(bpArr == null) {
-      bpArr = new Breakpoint[]{breakpoint};
-    }
-    else{
-      Collection<Breakpoint> c = ArrayUtils.makeCollection(ArrayList.class, bpArr);
-      c.add(breakpoint);
-      bpArr = c.toArray(new Breakpoint[c.size()]);
-    }
-    _instanceBreakPoints.put(pid, bpArr);
-  }
-  
-  void removeGlobalBreakpoint(Breakpoint breakpoint){
-  	Collection<Breakpoint> c = ArrayUtils.makeCollection(ArrayList.class, _globalBreakPoints);
-    c.remove(breakpoint);
-    _globalBreakPoints = c.toArray(new Breakpoint[c.size()]);
-  }
-  
-  void removeBreakpoint(Long pid, Breakpoint breakpoint){
-  	Breakpoint[] bpArr = _instanceBreakPoints.get(pid);
-    if(bpArr != null){
-      Collection<Breakpoint> c = ArrayUtils.makeCollection(ArrayList.class, bpArr);
-      c.remove(breakpoint);
-      bpArr = c.toArray(new Breakpoint[c.size()]);
-      if(bpArr.length == 0) {
-        _instanceBreakPoints.remove(pid);
-      }
-      else {
-      	_instanceBreakPoints.put(pid, bpArr);
-      }
-    }
-  }
-
-  public boolean step(final Long iid) {
-    boolean doit = false;
-
-    try {
-      doit = _db.exec(new BpelDatabase.Callable<Boolean>() {
-        public Boolean run(BpelDAOConnection conn) throws Exception {
-          ProcessInstanceDAO instance = conn.getInstance(iid);
-          if (instance == null)
-            throw new InstanceNotFoundException("" + iid);
-
-          if(ProcessState.STATE_SUSPENDED == instance.getState()){
-            // send event
-            ProcessInstanceStateChangeEvent evt = new ProcessInstanceStateChangeEvent();
-            evt.setOldState(ProcessState.STATE_SUSPENDED);
-            short previousState = instance.getPreviousState();
-            
-            instance.setState(previousState);
-            
-            evt.setNewState(previousState);
-            evt.setProcessInstanceId(iid);
-            evt.setProcessName(instance.getProcess().getType());
-            evt.setProcessId(_db.getProcessId());
-              
-            instance.insertBpelEvent(evt);
-            
-            onEvent(evt);
-            
-            __log.debug("step(" + iid + ") adding step indicator to table.");
-            _step.add(iid);
-            
-            WorkEvent we = new WorkEvent();
-            we.setIID(iid);
-            we.setType(WorkEvent.Type.RESUME);
-            _process._engine._contexts.scheduler.schedulePersistedJob(we.getDetail(), null);
-            
-            return true;
-          }
-          return false;
+    void enable(boolean enabled){
+        _enabled = enabled;
+    }
+
+    Breakpoint[] getGlobalBreakpoints(){
+        return _globalBreakPoints;
+    }
+
+    Breakpoint[] getBreakpoints(Long pid){
+        Breakpoint[] arr = _instanceBreakPoints.get(pid);
+        return (arr == null)
+                ? EMPTY_BP
+                : arr;
+    }
+
+    void addGlobalBreakpoint(Breakpoint breakpoint){
+        Collection<Breakpoint> c = ArrayUtils.makeCollection(ArrayList.class, _globalBreakPoints);
+        c.add(breakpoint);
+        _globalBreakPoints = c.toArray(new Breakpoint[c.size()]);
+    }
+
+    void addBreakpoint(Long pid, Breakpoint breakpoint){
+        Breakpoint[] bpArr = _instanceBreakPoints.get(pid);
+        if(bpArr == null) {
+            bpArr = new Breakpoint[]{breakpoint};
         }
-      });
-      
-    } catch (InstanceNotFoundException infe) {
-      throw infe;
-    } catch (Exception ex) {
-      __log.error("UnexpectedEx", ex);
-      throw new RuntimeException(ex);
-    }
-
-    return doit;
-  }
- 
-  /**
-   * Process BPEL events WRT debugging.
-   * @param event BPEL event
-   */
-	public void onEvent(BpelEvent event) {
-
-    if(_enabled && (event instanceof ProcessInstanceEvent) &&
-        // I have this excluded since we are recursing here when onEvent()
-        // is called from DebugSupport codepath's which change state
-        !(event instanceof ProcessInstanceStateChangeEvent)) {
-
-      final ProcessInstanceEvent evt = (ProcessInstanceEvent)event;
-
-      //
-      // prevent leaking of memory
-      //
-      if(evt instanceof ProcessCompletionEvent ||
-        evt instanceof ProcessTerminationEvent) {
-        _step.remove(evt.getProcessInstanceId());
-        _instanceBreakPoints.remove(evt.getProcessInstanceId());
-        return;
-      }
-
-      boolean suspend = checkStep(evt);
-      if (!suspend) {
-      	suspend = checkBreakPoints(evt, _globalBreakPoints);
-      }
-      if (!suspend){
-      	Breakpoint[] bp = _instanceBreakPoints.get(evt.getProcessInstanceId());
-        if(bp != null) {
-          suspend = checkBreakPoints(evt, bp);
+        else{
+            Collection<Breakpoint> c = ArrayUtils.makeCollection(ArrayList.class, bpArr);
+            c.add(breakpoint);
+            bpArr = c.toArray(new Breakpoint[c.size()]);
         }
-      }
+        _instanceBreakPoints.put(pid, bpArr);
+    }
+
+    void removeGlobalBreakpoint(Breakpoint breakpoint){
+        Collection<Breakpoint> c = ArrayUtils.makeCollection(ArrayList.class, _globalBreakPoints);
+        c.remove(breakpoint);
+        _globalBreakPoints = c.toArray(new Breakpoint[c.size()]);
+    }
+
+    void removeBreakpoint(Long pid, Breakpoint breakpoint){
+        Breakpoint[] bpArr = _instanceBreakPoints.get(pid);
+        if(bpArr != null){
+            Collection<Breakpoint> c = ArrayUtils.makeCollection(ArrayList.class, bpArr);
+            c.remove(breakpoint);
+            bpArr = c.toArray(new Breakpoint[c.size()]);
+            if(bpArr.length == 0) {
+                _instanceBreakPoints.remove(pid);
+            }
+            else {
+                _instanceBreakPoints.put(pid, bpArr);
+            }
+        }
+    }
+
+    public boolean step(final Long iid) {
+        boolean doit = false;
 
-      if(suspend){
-        _step.remove(evt.getProcessInstanceId());
         try {
-          ProcessDAO process = _db.getProcessDAO();
-          ProcessInstanceDAO instance = process.getInstance(evt.getProcessInstanceId());
-          if(ProcessState.canExecute(instance.getState())){
-            // send event
-            ProcessInstanceStateChangeEvent changeEvent = new ProcessInstanceStateChangeEvent();
-            changeEvent.setOldState(instance.getState());
-            instance.setState(ProcessState.STATE_SUSPENDED);
-            changeEvent.setNewState(ProcessState.STATE_SUSPENDED);
-            changeEvent.setProcessInstanceId(instance.getInstanceId());
-            
-            changeEvent.setProcessName(process.getType());
-            changeEvent.setProcessId(_db.getProcessId());
-            
-            instance.insertBpelEvent(changeEvent);
-            onEvent(changeEvent);
-          }
-        } catch (Exception dce) {
-          __log.error(__msgs.msgDbError(), dce);
+            doit = _db.exec(new BpelDatabase.Callable<Boolean>() {
+                public Boolean run(BpelDAOConnection conn) throws Exception {
+                    ProcessInstanceDAO instance = conn.getInstance(iid);
+                    if (instance == null)
+                        throw new InstanceNotFoundException("" + iid);
+
+                    if(ProcessState.STATE_SUSPENDED == instance.getState()){
+                        // send event
+                        ProcessInstanceStateChangeEvent evt = new ProcessInstanceStateChangeEvent();
+                        evt.setOldState(ProcessState.STATE_SUSPENDED);
+                        short previousState = instance.getPreviousState();
+
+                        instance.setState(previousState);
+
+                        evt.setNewState(previousState);
+                        evt.setProcessInstanceId(iid);
+                        evt.setProcessName(instance.getProcess().getType());
+                        evt.setProcessId(_db.getProcessId());
+
+                        _process.saveEvent(evt, instance);
+
+                        onEvent(evt);
+
+                        __log.debug("step(" + iid + ") adding step indicator to table.");
+                        _step.add(iid);
+
+                        WorkEvent we = new WorkEvent();
+                        we.setIID(iid);
+                        we.setType(WorkEvent.Type.RESUME);
+                        _process._engine._contexts.scheduler.schedulePersistedJob(we.getDetail(), null);
+
+                        return true;
+                    }
+                    return false;
+                }
+            });
+
+        } catch (InstanceNotFoundException infe) {
+            throw infe;
+        } catch (Exception ex) {
+            __log.error("UnexpectedEx", ex);
+            throw new RuntimeException(ex);
+        }
+
+        return doit;
+    }
+
+    /**
+     * Process BPEL events WRT debugging.
+     * @param event BPEL event
+     */
+    public void onEvent(BpelEvent event) {
+
+        if(_enabled && (event instanceof ProcessInstanceEvent) &&
+                // I have this excluded since we are recursing here when onEvent()
+                // is called from DebugSupport codepath's which change state
+                !(event instanceof ProcessInstanceStateChangeEvent)) {
+
+            final ProcessInstanceEvent evt = (ProcessInstanceEvent)event;
+
+            //
+            // prevent leaking of memory
+            //
+            if(evt instanceof ProcessCompletionEvent ||
+                    evt instanceof ProcessTerminationEvent) {
+                _step.remove(evt.getProcessInstanceId());
+                _instanceBreakPoints.remove(evt.getProcessInstanceId());
+                return;
+            }
+
+            boolean suspend = checkStep(evt);
+            if (!suspend) {
+                suspend = checkBreakPoints(evt, _globalBreakPoints);
+            }
+            if (!suspend){
+                Breakpoint[] bp = _instanceBreakPoints.get(evt.getProcessInstanceId());
+                if(bp != null) {
+                    suspend = checkBreakPoints(evt, bp);
+                }
+            }
+
+            if(suspend){
+                _step.remove(evt.getProcessInstanceId());
+                try {
+                    ProcessDAO process = _db.getProcessDAO();
+                    ProcessInstanceDAO instance = process.getInstance(evt.getProcessInstanceId());
+                    if(ProcessState.canExecute(instance.getState())){
+                        // send event
+                        ProcessInstanceStateChangeEvent changeEvent = new ProcessInstanceStateChangeEvent();
+                        changeEvent.setOldState(instance.getState());
+                        instance.setState(ProcessState.STATE_SUSPENDED);
+                        changeEvent.setNewState(ProcessState.STATE_SUSPENDED);
+                        changeEvent.setProcessInstanceId(instance.getInstanceId());
+
+                        changeEvent.setProcessName(process.getType());
+                        changeEvent.setProcessId(_db.getProcessId());
+
+                        _process.saveEvent(changeEvent, instance);
+                        onEvent(changeEvent);
+                    }
+                } catch (Exception dce) {
+                    __log.error(__msgs.msgDbError(), dce);
+                }
+            }
+        }
+    }
+
+    private boolean checkStep(ProcessInstanceEvent event){
+        Long pid = event.getProcessInstanceId();
+        return (_step.contains(pid)
+                && (event instanceof ActivityExecStartEvent
+                || event instanceof ScopeCompletionEvent));
+    }
+
+    private boolean checkBreakPoints(ProcessInstanceEvent event, Breakpoint[] breakpoints){
+        boolean suspended = false;
+        for(int i = 0; i < breakpoints.length; ++i){
+            if (((BreakpointImpl)breakpoints[i]).checkBreak(event)){
+                suspended = true;
+                break;
+            }
         }
-      }
+        return suspended;
     }
-	}
-  
-  private boolean checkStep(ProcessInstanceEvent event){
-  	Long pid = event.getProcessInstanceId();
-    return (_step.contains(pid) 
-       && (event instanceof ActivityExecStartEvent
-         || event instanceof ScopeCompletionEvent));
-  }
-  
-  private boolean checkBreakPoints(ProcessInstanceEvent event, Breakpoint[] breakpoints){
-    boolean suspended = false;
-    for(int i = 0; i < breakpoints.length; ++i){
-      if (((BreakpointImpl)breakpoints[i]).checkBreak(event)){
-        suspended = true;
-        break;
-      }
-    }
-    return suspended;
-  }
-  
-  public boolean resume(final Long iid) {
-    boolean doit = false;
-
-    try {
-      doit = _db.exec(new BpelDatabase.Callable<Boolean>() {
-        public Boolean run(BpelDAOConnection conn) throws Exception {
-          ProcessInstanceDAO instance = conn.getInstance(iid);
-          if (instance == null)
-            throw new InstanceNotFoundException("" + iid);
-          
-          if(ProcessState.STATE_SUSPENDED == instance.getState()){
-            // send event
-            ProcessInstanceStateChangeEvent evt = new ProcessInstanceStateChangeEvent();
-            evt.setOldState(ProcessState.STATE_SUSPENDED);
-            short previousState = instance.getPreviousState();
-                
-            instance.setState(previousState);
-            
-            evt.setNewState(previousState);
-            evt.setProcessInstanceId(iid);
-            evt.setProcessName(instance.getProcess().getType());
-            evt.setProcessId(_db.getProcessId());
-            instance.insertBpelEvent(evt);
-            onEvent(evt);
-
-            WorkEvent we = new WorkEvent();
-            we.setType(WorkEvent.Type.RESUME);
-            we.setIID(iid);
-            _process._engine._contexts.scheduler.schedulePersistedJob(we.getDetail(), null);
-            
-                
-            return true;
-          }
-          return false;
+
+    public boolean resume(final Long iid) {
+        boolean doit = false;
+
+        try {
+            doit = _db.exec(new BpelDatabase.Callable<Boolean>() {
+                public Boolean run(BpelDAOConnection conn) throws Exception {
+                    ProcessInstanceDAO instance = conn.getInstance(iid);
+                    if (instance == null)
+                        throw new InstanceNotFoundException("" + iid);
+
+                    if(ProcessState.STATE_SUSPENDED == instance.getState()){
+                        // send event
+                        ProcessInstanceStateChangeEvent evt = new ProcessInstanceStateChangeEvent();
+                        evt.setOldState(ProcessState.STATE_SUSPENDED);
+                        short previousState = instance.getPreviousState();
+
+                        instance.setState(previousState);
+
+                        evt.setNewState(previousState);
+                        evt.setProcessInstanceId(iid);
+                        evt.setProcessName(instance.getProcess().getType());
+                        evt.setProcessId(_db.getProcessId());
+                        _process.saveEvent(evt, instance);
+                        onEvent(evt);
+
+                        WorkEvent we = new WorkEvent();
+                        we.setType(WorkEvent.Type.RESUME);
+                        we.setIID(iid);
+                        _process._engine._contexts.scheduler.schedulePersistedJob(we.getDetail(), null);
+
+
+                        return true;
+                    }
+                    return false;
+                }
+            });
+
+        } catch (InstanceNotFoundException infe) {
+            throw infe;
+        } catch (Exception ex) {
+            __log.error("ProcessingEx", ex);
+            throw new ProcessingException(ex.getMessage(),ex);
         }
-      });
-      
-    } catch (InstanceNotFoundException infe) {
-      throw infe;
-    } catch (Exception ex) {
-      __log.error("ProcessingEx", ex);
-      throw new ProcessingException(ex.getMessage(),ex);
-    }
-
-    return doit;
-  }
-
-  public void suspend(final Long iid) {
-    
-    try {
-      _db.exec(new BpelDatabase.Callable<Object>() {
-        public Object run(BpelDAOConnection conn) throws Exception {
-          ProcessInstanceDAO instance = conn.getInstance(iid);
-          if (instance == null) {
-            throw new InstanceNotFoundException("" + iid);
-          }
-          if (ProcessState.canExecute(instance.getState())) {
-            // send event
-            ProcessInstanceStateChangeEvent evt = new ProcessInstanceStateChangeEvent();
-            evt.setOldState(instance.getState());
-            instance.setState(ProcessState.STATE_SUSPENDED);
-            evt.setNewState(ProcessState.STATE_SUSPENDED);
-            evt.setProcessInstanceId(iid);
-            ProcessDAO process = instance.getProcess();
-            evt.setProcessName(process.getType());
-            evt.setProcessId(process.getProcessId());
-            instance.insertBpelEvent(evt);
-            onEvent(evt);
-          }
-          return null;
+
+        return doit;
+    }
+
+    public void suspend(final Long iid) {
+
+        try {
+            _db.exec(new BpelDatabase.Callable<Object>() {
+                public Object run(BpelDAOConnection conn) throws Exception {
+                    ProcessInstanceDAO instance = conn.getInstance(iid);
+                    if (instance == null) {
+                        throw new InstanceNotFoundException("" + iid);
+                    }
+                    if (ProcessState.canExecute(instance.getState())) {
+                        // send event
+                        ProcessInstanceStateChangeEvent evt = new ProcessInstanceStateChangeEvent();
+                        evt.setOldState(instance.getState());
+                        instance.setState(ProcessState.STATE_SUSPENDED);
+                        evt.setNewState(ProcessState.STATE_SUSPENDED);
+                        evt.setProcessInstanceId(iid);
+                        ProcessDAO process = instance.getProcess();
+                        evt.setProcessName(process.getType());
+                        evt.setProcessId(process.getProcessId());
+                        _process.saveEvent(evt, instance);
+                        onEvent(evt);
+                    }
+                    return null;
+                }
+            });
+        } catch (ManagementException me) {
+            throw me;
+        } catch (Exception ex) {
+            __log.error("DbError", ex);
+            throw new RuntimeException(ex);
         }
-      });
-    } catch (ManagementException me) {
-      throw me;
-    } catch (Exception ex) {
-      __log.error("DbError", ex);
-      throw new RuntimeException(ex);
-    }
-    
-  }
-
-  public void terminate(final Long iid) {
-   try {
-    _db.exec(new BpelDatabase.Callable<Object>() {
-        public Object run(BpelDAOConnection conn) throws Exception {
-          ProcessInstanceDAO instance = conn.getInstance(iid);
-          if (instance == null)
-            throw new ManagementException("InstanceNotFound:" + iid);
-          // send event
-          ProcessInstanceStateChangeEvent evt = new ProcessInstanceStateChangeEvent();
-          evt.setOldState(instance.getState());
-          instance.setState(ProcessState.STATE_TERMINATED);
-          evt.setNewState(ProcessState.STATE_TERMINATED);
-          evt.setProcessInstanceId(iid);
-          ProcessDAO process = instance.getProcess();
-          QName processName = process.getType();
-          evt.setProcessName(processName);
-          QName processId = process.getProcessId();
-          evt.setProcessId(processId);
-          instance.insertBpelEvent(evt);
-          //
-          // TerminationEvent (peer of ProcessCompletionEvent)
-          //
-          ProcessTerminationEvent terminationEvent =
-            new ProcessTerminationEvent();
-          terminationEvent.setProcessInstanceId(iid);
-          terminationEvent.setProcessName(processName);
-          terminationEvent.setProcessId(processId);
-          instance.insertBpelEvent(terminationEvent);
 
-          onEvent(evt);
-          onEvent(terminationEvent);          
+    }
 
-          return null;
+    public void terminate(final Long iid) {
+        try {
+            _db.exec(new BpelDatabase.Callable<Object>() {
+                public Object run(BpelDAOConnection conn) throws Exception {
+                    ProcessInstanceDAO instance = conn.getInstance(iid);
+                    if (instance == null)
+                        throw new ManagementException("InstanceNotFound:" + iid);
+                    // send event
+                    ProcessInstanceStateChangeEvent evt = new ProcessInstanceStateChangeEvent();
+                    evt.setOldState(instance.getState());
+                    instance.setState(ProcessState.STATE_TERMINATED);
+                    evt.setNewState(ProcessState.STATE_TERMINATED);
+                    evt.setProcessInstanceId(iid);
+                    ProcessDAO process = instance.getProcess();
+                    QName processName = process.getType();
+                    evt.setProcessName(processName);
+                    QName processId = process.getProcessId();
+                    evt.setProcessId(processId);
+                    _process.saveEvent(evt, instance);
+                    //
+                    // TerminationEvent (peer of ProcessCompletionEvent)
+                    //
+                    ProcessTerminationEvent terminationEvent =
+                            new ProcessTerminationEvent();
+                    terminationEvent.setProcessInstanceId(iid);
+                    terminationEvent.setProcessName(processName);
+                    terminationEvent.setProcessId(processId);
+                    _process.saveEvent(evt, instance);
+
+                    onEvent(evt);
+                    onEvent(terminationEvent);
+
+                    return null;
+                }
+            });
+        } catch (ManagementException me) {
+            throw me;
+        } catch (Exception e) {
+            __log.error("DbError", e);
+            throw new RuntimeException(e);
         }
-      });
-  } catch (ManagementException me) {
-     throw me;
-  } catch (Exception e) {
-    __log.error("DbError", e);
-    throw new RuntimeException(e);
-  }
 
-    
-  }
+
+    }
 }

Modified: incubator/ode/trunk/bpel-store/src/main/java/org/apache/ode/store/ProcessStoreImpl.java
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-store/src/main/java/org/apache/ode/store/ProcessStoreImpl.java?view=diff&rev=472176&r1=472175&r2=472176
==============================================================================
--- incubator/ode/trunk/bpel-store/src/main/java/org/apache/ode/store/ProcessStoreImpl.java (original)
+++ incubator/ode/trunk/bpel-store/src/main/java/org/apache/ode/store/ProcessStoreImpl.java Tue Nov  7 09:32:51 2006
@@ -46,17 +46,17 @@
     private File _appDir;
     private ConfStoreConnection _conn;
 
-    public ProcessStoreImpl(File appDir, DataSource ds) {
-        this(appDir, ds, new DeploymentManagerImpl(new File(appDir, "processes")));
+    public ProcessStoreImpl(File appDir, DataSource ds, boolean transactional) {
+        this(appDir, ds, new DeploymentManagerImpl(new File(appDir, "processes")), transactional);
     }
 
     // Both appdir and datasource could be null
-    public ProcessStoreImpl(File appDir, DataSource ds, DeploymentManager deployer) {
+    public ProcessStoreImpl(File appDir, DataSource ds, DeploymentManager deployer, boolean transactional) {
         _deploymentManager = deployer;
         _appDir = appDir;
         _ds = ds;
         // TODO in-memory if no datasource given
-        if (_ds != null) _conn = new ConfStoreConnectionHib(_ds, appDir);
+        if (_ds != null) _conn = new ConfStoreConnectionHib(_ds, appDir, transactional);
         else _conn = new ConfStoreConnectionInMem();
 
         reloadDeploymentUnits();
@@ -463,6 +463,42 @@
         } finally {
             _mngmtLock.writeLock().unlock();
         }
+    }
+
+    public List<String> getEventsSettings(QName processId, List<String> scopeNames) {
+        List<String> result = null;
+        TDeployment.Process processInfo = getProcessInfo(processId);
+        TProcessEvents processEvents = processInfo.getProcessEvents();
+        if (processEvents == null || processEvents.getGenerate().equals(TProcessEvents.Generate.ALL)) {
+            result = new ArrayList<String>(1);
+            result.add("all");
+            return result;
+        }
+
+        if (processEvents.getEnableEventList() != null) result = processEvents.getEnableEventList();
+        if (processEvents.getScopeEventsList() != null && scopeNames != null) {
+            List<String> scopeEvents = processScopeEvents(scopeNames, processEvents.getScopeEventsList());
+            if (scopeEvents != null) {
+                result = scopeEvents;
+            }
+        }
+
+        if (result == null) {
+            return new ArrayList<String>(1);
+        } else {
+            return result;
+        }
+    }
+
+    private List<String> processScopeEvents(List<String> scopeNames, List<TScopeEvents> scopeEventsList) {
+        for (String scopeName : scopeNames) {
+            for (TScopeEvents scopeEvents : scopeEventsList) {
+                if (scopeEvents.getName().equals(scopeName)) {
+                    return scopeEvents.getEnableEventList();
+                }
+            }
+        }
+        return null;
     }
 
     private ProcessConf buildConf(ProcessConfDAO dao) {

Modified: incubator/ode/trunk/bpel-store/src/main/java/org/apache/ode/store/dao/ConfStoreConnectionHib.java
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-store/src/main/java/org/apache/ode/store/dao/ConfStoreConnectionHib.java?view=diff&rev=472176&r1=472175&r2=472176
==============================================================================
--- incubator/ode/trunk/bpel-store/src/main/java/org/apache/ode/store/dao/ConfStoreConnectionHib.java (original)
+++ incubator/ode/trunk/bpel-store/src/main/java/org/apache/ode/store/dao/ConfStoreConnectionHib.java Tue Nov  7 09:32:51 2006
@@ -39,9 +39,11 @@
 
     private static DataSource _ds;
     private final SessionFactory _sessionFactory;
+    private boolean _transactional = false;
 
-    public ConfStoreConnectionHib(DataSource _ds, File appRoot) {
+    public ConfStoreConnectionHib(DataSource _ds, File appRoot, boolean transactional) {
         org.apache.ode.store.dao.ConfStoreConnectionHib._ds = _ds;
+        _transactional = transactional;
         Properties properties = new Properties();
         properties.put(Environment.CONNECTION_PROVIDER, DataSourceConnectionProvider.class.getName());
         properties.put(Environment.CURRENT_SESSION_CONTEXT_CLASS, "thread");
@@ -213,12 +215,12 @@
      */
     public <T> T exec(final Callable<T> callable) throws Exception {
         try {
-            _sessionFactory.getCurrentSession().beginTransaction();
+            if (!_transactional) _sessionFactory.getCurrentSession().beginTransaction();
             T result =  callable.run();
-            _sessionFactory.getCurrentSession().getTransaction().commit();
+            if (!_transactional) _sessionFactory.getCurrentSession().getTransaction().commit();
             return result;
         } catch (Exception e) {
-            _sessionFactory.getCurrentSession().getTransaction().rollback();
+            if (!_transactional) _sessionFactory.getCurrentSession().getTransaction().rollback();
             throw e;
         }
     }

Modified: incubator/ode/trunk/bpel-test/src/test/java/org/apache/ode/test/BPELTest.java
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-test/src/test/java/org/apache/ode/test/BPELTest.java?view=diff&rev=472176&r1=472175&r2=472176
==============================================================================
--- incubator/ode/trunk/bpel-test/src/test/java/org/apache/ode/test/BPELTest.java (original)
+++ incubator/ode/trunk/bpel-test/src/test/java/org/apache/ode/test/BPELTest.java Tue Nov  7 09:32:51 2006
@@ -18,23 +18,23 @@
  */
 package org.apache.ode.test;
 
-import java.io.File;
-import java.util.Properties;
-import java.util.regex.Pattern;
-
-import javax.xml.namespace.QName;
-
 import junit.framework.TestCase;
-
 import org.apache.ode.bpel.engine.BpelServerImpl;
-import org.apache.ode.bpel.iapi.*;
+import org.apache.ode.bpel.iapi.BpelEngineException;
+import org.apache.ode.bpel.iapi.Message;
+import org.apache.ode.bpel.iapi.MyRoleMessageExchange;
+import org.apache.ode.bpel.iapi.ProcessStore;
 import org.apache.ode.bpel.memdao.BpelDAOConnectionFactoryImpl;
+import org.apache.ode.store.ProcessStoreImpl;
 import org.apache.ode.test.scheduler.TestScheduler;
 import org.apache.ode.utils.DOMUtils;
-import org.apache.ode.store.ProcessStoreImpl;
 import org.w3c.dom.Element;
 
+import javax.xml.namespace.QName;
+import java.io.File;
 import java.util.Collection;
+import java.util.Properties;
+import java.util.regex.Pattern;
 
 public abstract class BPELTest extends TestCase {
 
@@ -50,7 +50,7 @@
 		server.setScheduler(new TestScheduler());
 		server.setBindingContext(new BindingContextImpl());
 		server.setMessageExchangeContext(mexContext);
-        store = new ProcessStoreImpl(null, null, new DeploymentManagerImpl());
+        store = new ProcessStoreImpl(null, null, new DeploymentManagerImpl(), false);
         server.setProcessStore(store);
         server.init();
 		server.start();

Modified: incubator/ode/trunk/jbi/src/main/java/org/apache/ode/jbi/OdeLifeCycle.java
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/jbi/src/main/java/org/apache/ode/jbi/OdeLifeCycle.java?view=diff&rev=472176&r1=472175&r2=472176
==============================================================================
--- incubator/ode/trunk/jbi/src/main/java/org/apache/ode/jbi/OdeLifeCycle.java (original)
+++ incubator/ode/trunk/jbi/src/main/java/org/apache/ode/jbi/OdeLifeCycle.java Tue Nov  7 09:32:51 2006
@@ -248,7 +248,7 @@
         _ode._scheduler.setDataSource(_ode._dataSource);
         _ode._scheduler.init();
 
-        _ode._store = new ProcessStoreImpl(new File("."), _ode._dataSource);
+        _ode._store = new ProcessStoreImpl(new File("."), _ode._dataSource, true);
 
         _ode._server.setDaoConnectionFactory(_ode._daocf);
         _ode._server.setEndpointReferenceContext(_ode._eprContext);