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 2008/05/02 02:40:38 UTC

svn commit: r652723 - in /ode/branches/APACHE_ODE_1.1: ./ axis2-war/src/main/webapp/WEB-INF/classes/ axis2-war/src/test/java/org/apache/ode/axis2/ axis2-war/src/test/java/org/apache/ode/axis2/httpbinding/ axis2-war/src/test/java/org/apache/ode/axis2/ma...

Author: mriou
Date: Thu May  1 17:40:38 2008
New Revision: 652723

URL: http://svn.apache.org/viewvc?rev=652723&view=rev
Log:
Re-added routing to retired processes, with a test case this time.

Added:
    ode/branches/APACHE_ODE_1.1/axis2-war/src/test/java/org/apache/ode/axis2/management/RetireTest.java
    ode/branches/APACHE_ODE_1.1/axis2-war/src/test/resources/TestInstanceRetire/
    ode/branches/APACHE_ODE_1.1/axis2-war/src/test/resources/TestInstanceRetire/1/
    ode/branches/APACHE_ODE_1.1/axis2-war/src/test/resources/TestInstanceRetire/1/TestRetire.bpel
    ode/branches/APACHE_ODE_1.1/axis2-war/src/test/resources/TestInstanceRetire/1/TestRetire.wsdl
    ode/branches/APACHE_ODE_1.1/axis2-war/src/test/resources/TestInstanceRetire/1/deploy.xml
    ode/branches/APACHE_ODE_1.1/axis2-war/src/test/resources/TestInstanceRetire/1/testRequest1.soap
    ode/branches/APACHE_ODE_1.1/axis2-war/src/test/resources/TestInstanceRetire/1/testRequest2.soap
    ode/branches/APACHE_ODE_1.1/axis2-war/src/test/resources/TestInstanceRetire/2/
    ode/branches/APACHE_ODE_1.1/axis2-war/src/test/resources/TestInstanceRetire/2/TestRetire.bpel
    ode/branches/APACHE_ODE_1.1/axis2-war/src/test/resources/TestInstanceRetire/2/TestRetire.wsdl
    ode/branches/APACHE_ODE_1.1/axis2-war/src/test/resources/TestInstanceRetire/2/deploy.xml
Removed:
    ode/branches/APACHE_ODE_1.1/axis2-war/src/main/webapp/WEB-INF/classes/log4j.properties
Modified:
    ode/branches/APACHE_ODE_1.1/Rakefile
    ode/branches/APACHE_ODE_1.1/axis2-war/src/test/java/org/apache/ode/axis2/Axis2TestBase.java
    ode/branches/APACHE_ODE_1.1/axis2-war/src/test/java/org/apache/ode/axis2/ServiceFaultCatchTest.java
    ode/branches/APACHE_ODE_1.1/axis2-war/src/test/java/org/apache/ode/axis2/httpbinding/HttpBindingTest.java
    ode/branches/APACHE_ODE_1.1/axis2/src/main/java/org/apache/ode/axis2/ODEServer.java
    ode/branches/APACHE_ODE_1.1/bpel-obj/src/main/java/org/apache/ode/bpel/o/OExpressionLanguage.java
    ode/branches/APACHE_ODE_1.1/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelEngineImpl.java
    ode/branches/APACHE_ODE_1.1/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelProcess.java
    ode/branches/APACHE_ODE_1.1/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelRuntimeContextImpl.java
    ode/branches/APACHE_ODE_1.1/bpel-store/src/main/java/org/apache/ode/store/ProcessStoreImpl.java
    ode/branches/APACHE_ODE_1.1/dao-hibernate/src/main/java/org/apache/ode/daohib/bpel/CorrelatorDaoImpl.java
    ode/branches/APACHE_ODE_1.1/dao-hibernate/src/main/java/org/apache/ode/daohib/bpel/hobj/HCorrelatorSelector.java
    ode/branches/APACHE_ODE_1.1/dao-jpa/src/main/java/org/apache/ode/dao/jpa/CorrelatorDAOImpl.java

Modified: ode/branches/APACHE_ODE_1.1/Rakefile
URL: http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.1/Rakefile?rev=652723&r1=652722&r2=652723&view=diff
==============================================================================
--- ode/branches/APACHE_ODE_1.1/Rakefile (original)
+++ ode/branches/APACHE_ODE_1.1/Rakefile Thu May  1 17:40:38 2008
@@ -177,15 +177,18 @@
       end
     end
     
-    test.with projects("tools"), libs, AXIS2_TEST, AXIOM, JAVAX.servlet, Buildr::Jetty::REQUIRES
+    test.with projects("tools"), libs, AXIS2_TEST, AXIOM, JAVAX.servlet, Buildr::Jetty::REQUIRES, HIBERNATE, DOM4J
     test.setup task(:prepare_webapp) do |task|
+      webapp_dir = "target/test-classes/webapp"
       cp_r _("src/main/webapp"), _("target/test-classes")
       cp Dir[_("src/main/webapp/WEB-INF/classes/*")], _("target/test-classes")
-      cp Dir[project("axis2").path_to("src/main/wsdl/*")], _("target/test-classes/webapp/WEB-INF")
-      cp project("bpel-schemas").path_to("src/main/xsd/pmapi.xsd"), _("target/test-classes/webapp/WEB-INF")
-      rm_rf Dir[_("target/test-classes/webapp") + "/**/.svn"]
+      cp Dir[project("axis2").path_to("src/main/wsdl/*")], _("#{webapp_dir}/WEB-INF")
+      cp project("bpel-schemas").path_to("src/main/xsd/pmapi.xsd"), _("#{webapp_dir}/WEB-INF")
+      rm_rf Dir[_(webapp_dir) + "/**/.svn"]
+      mkdir _"#{webapp_dir}/WEB-INF/processes" unless File.exist?(_"#{webapp_dir}/WEB-INF/processes")
     end
     test.setup unzip(_("target/test-classes/webapp/WEB-INF")=>project("dao-jpa-ojpa-derby").package(:zip))
+    test.setup unzip(_("target/test-classes/webapp/WEB-INF")=>project("dao-hibernate-db").package(:zip))
   end
 
   desc "ODE APIs"

Modified: ode/branches/APACHE_ODE_1.1/axis2-war/src/test/java/org/apache/ode/axis2/Axis2TestBase.java
URL: http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.1/axis2-war/src/test/java/org/apache/ode/axis2/Axis2TestBase.java?rev=652723&r1=652722&r2=652723&view=diff
==============================================================================
--- ode/branches/APACHE_ODE_1.1/axis2-war/src/test/java/org/apache/ode/axis2/Axis2TestBase.java (original)
+++ ode/branches/APACHE_ODE_1.1/axis2-war/src/test/java/org/apache/ode/axis2/Axis2TestBase.java Thu May  1 17:40:38 2008
@@ -21,6 +21,7 @@
 import java.net.URI;
 import java.net.URISyntaxException;
 import java.util.Iterator;
+import java.util.Collection;
 
 /**
  * @author Matthieu Riou <mr...@apache.org>
@@ -77,8 +78,8 @@
             super.stop();
         }
 
-        public void deployProcess(String bundleName) {
-            _ode.getProcessStore().deploy(new File(getBundleDir(bundleName)));
+        public Collection<QName> deployProcess(String bundleName) {
+            return _ode.getProcessStore().deploy(new File(getBundleDir(bundleName)));
         }
         public void undeployProcess(String bundleName) {
             _ode.getProcessStore().undeploy(new File(getBundleDir(bundleName)));
@@ -147,6 +148,10 @@
             }
             configContext.getAxisConfiguration().getService(serviceName).printWSDL(fos);
         }
+
+        public ODEServer getODEServer() {
+            return _ode;
+        }
     }
 
 }

Modified: ode/branches/APACHE_ODE_1.1/axis2-war/src/test/java/org/apache/ode/axis2/ServiceFaultCatchTest.java
URL: http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.1/axis2-war/src/test/java/org/apache/ode/axis2/ServiceFaultCatchTest.java?rev=652723&r1=652722&r2=652723&view=diff
==============================================================================
--- ode/branches/APACHE_ODE_1.1/axis2-war/src/test/java/org/apache/ode/axis2/ServiceFaultCatchTest.java (original)
+++ ode/branches/APACHE_ODE_1.1/axis2-war/src/test/java/org/apache/ode/axis2/ServiceFaultCatchTest.java Thu May  1 17:40:38 2008
@@ -11,7 +11,7 @@
         String bundleName = "TestStructuredFault";
         // deploy the required service
         server.deployService(DummyService.class.getCanonicalName());
-        if (!server.isDeployed("TestStructuredFault")) server.deployProcess("TestStructuredFault");
+        if (!server.isDeployed(bundleName)) server.deployProcess(bundleName);
 
         try {
             String response = server.sendRequestFile("http://localhost:8080/processes/helloWorld",

Modified: ode/branches/APACHE_ODE_1.1/axis2-war/src/test/java/org/apache/ode/axis2/httpbinding/HttpBindingTest.java
URL: http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.1/axis2-war/src/test/java/org/apache/ode/axis2/httpbinding/HttpBindingTest.java?rev=652723&r1=652722&r2=652723&view=diff
==============================================================================
--- ode/branches/APACHE_ODE_1.1/axis2-war/src/test/java/org/apache/ode/axis2/httpbinding/HttpBindingTest.java (original)
+++ ode/branches/APACHE_ODE_1.1/axis2-war/src/test/java/org/apache/ode/axis2/httpbinding/HttpBindingTest.java Thu May  1 17:40:38 2008
@@ -10,7 +10,7 @@
  * These operations are set up to use the various Http binding configurations.  
  * <p/>
  * From a "business" standpoint:<br/>
- * Let N be the input number, stored in the testRequest.soap file<br/>
+ * Let N be the input number, stored in the testRequest1.soap file<br/>
  * This test will compute the Sum of the first (N + 300) positive integers.
  * <p/>
  * If N=10, the expected result is 310*(310+1)/2 = 48205

Added: ode/branches/APACHE_ODE_1.1/axis2-war/src/test/java/org/apache/ode/axis2/management/RetireTest.java
URL: http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.1/axis2-war/src/test/java/org/apache/ode/axis2/management/RetireTest.java?rev=652723&view=auto
==============================================================================
--- ode/branches/APACHE_ODE_1.1/axis2-war/src/test/java/org/apache/ode/axis2/management/RetireTest.java (added)
+++ ode/branches/APACHE_ODE_1.1/axis2-war/src/test/java/org/apache/ode/axis2/management/RetireTest.java Thu May  1 17:40:38 2008
@@ -0,0 +1,35 @@
+package org.apache.ode.axis2.management;
+
+import org.apache.ode.axis2.Axis2TestBase;
+import org.apache.ode.axis2.DummyService;
+
+import javax.xml.namespace.QName;
+
+/**
+ * @author Matthieu Riou <mr...@apache.org>
+ */
+public class RetireTest extends Axis2TestBase {
+
+    public void testRetiredInstance() throws Exception {
+        String bundleName = "TestInstanceRetire";
+        System.out.println("=> " + server.getODEServer().getProcessStore().getPackages());
+        if (server.isDeployed("1")) server.undeployProcess(bundleName + "/1");
+        if (server.isDeployed("2")) server.undeployProcess(bundleName + "/2");
+        
+        QName deployedQName = server.deployProcess(bundleName + "/1").iterator().next();
+
+        server.sendRequestFile("http://localhost:8080/processes/testretire",
+                bundleName + "/1", "testRequest1.soap");
+
+        server.getODEServer().getProcessManagement().setRetired(deployedQName, true);
+        server.deployProcess(bundleName + "/2");
+        
+        String response = server.sendRequestFile("http://localhost:8080/processes/testretire",
+                bundleName + "/1", "testRequest2.soap");
+
+        System.out.println("###############################################");
+        System.out.println(response);
+        System.out.println("###############################################");
+        assertTrue(response.indexOf("DONE") > 0);
+    }
+}

Added: ode/branches/APACHE_ODE_1.1/axis2-war/src/test/resources/TestInstanceRetire/1/TestRetire.bpel
URL: http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.1/axis2-war/src/test/resources/TestInstanceRetire/1/TestRetire.bpel?rev=652723&view=auto
==============================================================================
--- ode/branches/APACHE_ODE_1.1/axis2-war/src/test/resources/TestInstanceRetire/1/TestRetire.bpel (added)
+++ ode/branches/APACHE_ODE_1.1/axis2-war/src/test/resources/TestInstanceRetire/1/TestRetire.bpel Thu May  1 17:40:38 2008
@@ -0,0 +1,66 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements.  See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership.  The ASF licenses this file
+  ~ to you under the Apache License, Version 2.0 (the
+  ~ "License"); you may not use this file except in compliance
+  ~ with the License.  You may obtain a copy of the License at
+  ~
+  ~    http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing,
+  ~ software distributed under the License is distributed on an
+  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  ~ KIND, either express or implied.  See the License for the
+  ~ specific language governing permissions and limitations
+  ~ under the License.
+  -->
+
+<process name="TestRetire"
+         targetNamespace="http://ode/bpel/test/retire"
+         xmlns="http://docs.oasis-open.org/wsbpel/2.0/process/executable"
+         xmlns:tns="http://ode/bpel/responder"
+         xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+         xmlns:resp="http://ode/bpel/test/retire/responder.wsdl">
+
+    <import location="TestRetire.wsdl" namespace="http://ode/bpel/test/retire.wsdl"
+            importType="http://schemas.xmlsoap.org/wsdl/" />
+
+    <partnerLinks>
+        <partnerLink name="testRetirePartnerLink" partnerLinkType="resp:TestRetirePartnerLinkType" myRole="responder"/>
+    </partnerLinks>
+
+    <variables>
+        <variable name="dummy" messageType="resp:TestRetireMessage"/>
+    </variables>
+
+    <correlationSets>
+        <correlationSet name="dummyCorr" properties="resp:dummyProp" />
+    </correlationSets>
+
+    <sequence>
+        <receive name="start" partnerLink="testRetirePartnerLink" variable="dummy" operation="first" createInstance="yes">
+            <correlations>
+                <correlation set="dummyCorr" initiate="yes"/>
+            </correlations>
+        </receive>
+        <reply name="reply-endpoint" partnerLink="testRetirePartnerLink" operation="first" variable="dummy"/>
+
+
+        <receive name="second" partnerLink="testRetirePartnerLink" variable="dummy" operation="second">
+            <correlations>
+                <correlation set="dummyCorr" initiate="no"/>
+            </correlations>
+        </receive>
+        <assign>
+            <copy>
+                <from><literal>DONE</literal></from>
+                <to>$dummy.TestPart</to>
+            </copy>
+        </assign>
+        <reply name="reply-ack" partnerLink="testRetirePartnerLink" operation="second" variable="dummy"/>
+
+    </sequence>
+</process>
\ No newline at end of file

Added: ode/branches/APACHE_ODE_1.1/axis2-war/src/test/resources/TestInstanceRetire/1/TestRetire.wsdl
URL: http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.1/axis2-war/src/test/resources/TestInstanceRetire/1/TestRetire.wsdl?rev=652723&view=auto
==============================================================================
--- ode/branches/APACHE_ODE_1.1/axis2-war/src/test/resources/TestInstanceRetire/1/TestRetire.wsdl (added)
+++ ode/branches/APACHE_ODE_1.1/axis2-war/src/test/resources/TestInstanceRetire/1/TestRetire.wsdl Thu May  1 17:40:38 2008
@@ -0,0 +1,74 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements.  See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership.  The ASF licenses this file
+  ~ to you under the Apache License, Version 2.0 (the
+  ~ "License"); you may not use this file except in compliance
+  ~ with the License.  You may obtain a copy of the License at
+  ~
+  ~    http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing,
+  ~ software distributed under the License is distributed on an
+  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  ~ KIND, either express or implied.  See the License for the
+  ~ specific language governing permissions and limitations
+  ~ under the License.
+  -->
+
+<wsdl:definitions 
+    targetNamespace="http://ode/bpel/test/retire/responder.wsdl"
+    xmlns="http://schemas.xmlsoap.org/wsdl/"
+    xmlns:tns="http://ode/bpel/test/retire/responder.wsdl"
+    xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" 
+    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+    xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+    xmlns:dummy="http://axis2.ode.apache.org"
+    xmlns:plnk="http://docs.oasis-open.org/wsbpel/2.0/plnktype"
+    xmlns:prop="http://docs.oasis-open.org/wsbpel/2.0/varprop">
+
+    <wsdl:message name="TestRetireMessage">
+        <wsdl:part name="TestPart" type="xsd:string"/>
+    </wsdl:message>
+    
+    <wsdl:portType name="TestRetirePortType">
+        <wsdl:operation name="first">
+            <wsdl:input message="tns:TestRetireMessage" name="TestIn"/>
+            <wsdl:output message="tns:TestRetireMessage" name="TestOut"/>
+        </wsdl:operation>    
+        <wsdl:operation name="second">
+            <wsdl:input message="tns:TestRetireMessage" name="TestIn"/>
+            <wsdl:output message="tns:TestRetireMessage" name="TestOut"/>
+        </wsdl:operation>
+    </wsdl:portType>
+    
+     <wsdl:binding name="TestRetireSoapBinding" type="tns:TestRetirePortType">
+        <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
+        <wsdl:operation name="first">
+            <soap:operation soapAction="" style="rpc"/>
+            <wsdl:input><soap:body namespace="http://ode/bpel/test/retire/responder.wsdl" use="literal"/></wsdl:input>
+            <wsdl:output><soap:body namespace="http://ode/bpel/unit-test.wsdl" use="literal"/></wsdl:output>
+        </wsdl:operation>
+        <wsdl:operation name="second">
+            <soap:operation soapAction="" style="rpc"/>
+            <wsdl:input><soap:body namespace="http://ode/bpel/test/retire/responder.wsdl" use="literal"/></wsdl:input>
+            <wsdl:output><soap:body namespace="http://ode/bpel/unit-test.wsdl" use="literal"/></wsdl:output>
+        </wsdl:operation>
+    </wsdl:binding>
+    <wsdl:service name="TestRetireService">
+		<wsdl:port name="TestRetirePort" binding="tns:TestRetireSoapBinding">
+     		<soap:address location="http://localhost:8080/ode/processes/testretire"/>
+		</wsdl:port>
+    </wsdl:service>
+    
+    <plnk:partnerLinkType name="TestRetirePartnerLinkType">
+        <plnk:role name="responder" portType="tns:TestRetirePortType"/>
+    </plnk:partnerLinkType>
+
+    <prop:property name="dummyProp" type="xsd:string"/>
+    <prop:propertyAlias propertyName="tns:dummyProp" messageType="tns:TestRetireMessage" part="TestPart"/>
+
+</wsdl:definitions>
+

Added: ode/branches/APACHE_ODE_1.1/axis2-war/src/test/resources/TestInstanceRetire/1/deploy.xml
URL: http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.1/axis2-war/src/test/resources/TestInstanceRetire/1/deploy.xml?rev=652723&view=auto
==============================================================================
--- ode/branches/APACHE_ODE_1.1/axis2-war/src/test/resources/TestInstanceRetire/1/deploy.xml (added)
+++ ode/branches/APACHE_ODE_1.1/axis2-war/src/test/resources/TestInstanceRetire/1/deploy.xml Thu May  1 17:40:38 2008
@@ -0,0 +1,29 @@
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements.  See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership.  The ASF licenses this file
+  ~ to you under the Apache License, Version 2.0 (the
+  ~ "License"); you may not use this file except in compliance
+  ~ with the License.  You may obtain a copy of the License at
+  ~
+  ~    http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing,
+  ~ software distributed under the License is distributed on an
+  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  ~ KIND, either express or implied.  See the License for the
+  ~ specific language governing permissions and limitations
+  ~ under the License.
+  -->
+<deploy xmlns="http://www.apache.org/ode/schemas/dd/2007/03"
+	xmlns:pns="http://ode/bpel/test/retire"
+	xmlns:wns="http://ode/bpel/test/retire/responder.wsdl">
+
+	<process name="pns:TestRetire">
+		<active>true</active>
+		<provide partnerLink="testRetirePartnerLink">
+			<service name="wns:TestRetireService" port="TestRetirePort"/>
+		</provide>
+    </process>
+</deploy>

Added: ode/branches/APACHE_ODE_1.1/axis2-war/src/test/resources/TestInstanceRetire/1/testRequest1.soap
URL: http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.1/axis2-war/src/test/resources/TestInstanceRetire/1/testRequest1.soap?rev=652723&view=auto
==============================================================================
--- ode/branches/APACHE_ODE_1.1/axis2-war/src/test/resources/TestInstanceRetire/1/testRequest1.soap (added)
+++ ode/branches/APACHE_ODE_1.1/axis2-war/src/test/resources/TestInstanceRetire/1/testRequest1.soap Thu May  1 17:40:38 2008
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements.  See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership.  The ASF licenses this file
+  ~ to you under the Apache License, Version 2.0 (the
+  ~ "License"); you may not use this file except in compliance
+  ~ with the License.  You may obtain a copy of the License at
+  ~
+  ~    http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing,
+  ~ software distributed under the License is distributed on an
+  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  ~ KIND, either express or implied.  See the License for the
+  ~ specific language governing permissions and limitations
+  ~ under the License.
+  -->
+
+<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
+    <SOAP-ENV:Body>
+        <tns:first xmlns:tns="http://ode/bpel/test/retire/responder.wsdl"><TestPart>XYZ</TestPart></tns:first>
+    </SOAP-ENV:Body>
+</SOAP-ENV:Envelope>

Added: ode/branches/APACHE_ODE_1.1/axis2-war/src/test/resources/TestInstanceRetire/1/testRequest2.soap
URL: http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.1/axis2-war/src/test/resources/TestInstanceRetire/1/testRequest2.soap?rev=652723&view=auto
==============================================================================
--- ode/branches/APACHE_ODE_1.1/axis2-war/src/test/resources/TestInstanceRetire/1/testRequest2.soap (added)
+++ ode/branches/APACHE_ODE_1.1/axis2-war/src/test/resources/TestInstanceRetire/1/testRequest2.soap Thu May  1 17:40:38 2008
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements.  See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership.  The ASF licenses this file
+  ~ to you under the Apache License, Version 2.0 (the
+  ~ "License"); you may not use this file except in compliance
+  ~ with the License.  You may obtain a copy of the License at
+  ~
+  ~    http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing,
+  ~ software distributed under the License is distributed on an
+  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  ~ KIND, either express or implied.  See the License for the
+  ~ specific language governing permissions and limitations
+  ~ under the License.
+  -->
+
+<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
+    <SOAP-ENV:Body>
+        <tns:second xmlns:tns="http://ode/bpel/test/retire/responder.wsdl"><TestPart>XYZ</TestPart></tns:second>
+    </SOAP-ENV:Body>
+</SOAP-ENV:Envelope>

Added: ode/branches/APACHE_ODE_1.1/axis2-war/src/test/resources/TestInstanceRetire/2/TestRetire.bpel
URL: http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.1/axis2-war/src/test/resources/TestInstanceRetire/2/TestRetire.bpel?rev=652723&view=auto
==============================================================================
--- ode/branches/APACHE_ODE_1.1/axis2-war/src/test/resources/TestInstanceRetire/2/TestRetire.bpel (added)
+++ ode/branches/APACHE_ODE_1.1/axis2-war/src/test/resources/TestInstanceRetire/2/TestRetire.bpel Thu May  1 17:40:38 2008
@@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements.  See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership.  The ASF licenses this file
+  ~ to you under the Apache License, Version 2.0 (the
+  ~ "License"); you may not use this file except in compliance
+  ~ with the License.  You may obtain a copy of the License at
+  ~
+  ~    http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing,
+  ~ software distributed under the License is distributed on an
+  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  ~ KIND, either express or implied.  See the License for the
+  ~ specific language governing permissions and limitations
+  ~ under the License.
+  -->
+
+<process name="TestRetire"
+         targetNamespace="http://ode/bpel/test/retire"
+         xmlns="http://docs.oasis-open.org/wsbpel/2.0/process/executable"
+         xmlns:tns="http://ode/bpel/responder"
+         xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+         xmlns:resp="http://ode/bpel/test/retire/responder.wsdl">
+
+  <import location="TestRetire.wsdl" namespace="http://ode/bpel/test/retire.wsdl"
+     importType="http://schemas.xmlsoap.org/wsdl/" />
+
+  <partnerLinks>
+    <partnerLink name="testRetirePartnerLink" partnerLinkType="resp:TestRetirePartnerLinkType" myRole="responder"/>
+  </partnerLinks>
+
+  <variables>
+    <variable name="dummy" messageType="resp:TestRetireMessage"/>
+  </variables>
+
+  <correlationSets>
+    <correlationSet name="dummyCorr" properties="resp:dummyProp" />
+  </correlationSets>
+
+  <sequence>
+    <receive name="start" partnerLink="testRetirePartnerLink" variable="dummy" operation="first" createInstance="yes">
+      <correlations>
+        <correlation set="dummyCorr" initiate="yes"/>
+      </correlations>
+    </receive>
+    <reply name="reply-endpoint" partnerLink="testRetirePartnerLink" operation="first" variable="dummy"/>
+
+    <receive name="second" partnerLink="testRetirePartnerLink" variable="dummy" operation="second">
+      <correlations>
+        <correlation set="dummyCorr" initiate="no"/>
+      </correlations>
+    </receive>
+    <reply name="reply-ack" partnerLink="testRetirePartnerLink" operation="second" variable="dummy"/>
+
+  </sequence>
+</process>
\ No newline at end of file

Added: ode/branches/APACHE_ODE_1.1/axis2-war/src/test/resources/TestInstanceRetire/2/TestRetire.wsdl
URL: http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.1/axis2-war/src/test/resources/TestInstanceRetire/2/TestRetire.wsdl?rev=652723&view=auto
==============================================================================
--- ode/branches/APACHE_ODE_1.1/axis2-war/src/test/resources/TestInstanceRetire/2/TestRetire.wsdl (added)
+++ ode/branches/APACHE_ODE_1.1/axis2-war/src/test/resources/TestInstanceRetire/2/TestRetire.wsdl Thu May  1 17:40:38 2008
@@ -0,0 +1,74 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements.  See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership.  The ASF licenses this file
+  ~ to you under the Apache License, Version 2.0 (the
+  ~ "License"); you may not use this file except in compliance
+  ~ with the License.  You may obtain a copy of the License at
+  ~
+  ~    http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing,
+  ~ software distributed under the License is distributed on an
+  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  ~ KIND, either express or implied.  See the License for the
+  ~ specific language governing permissions and limitations
+  ~ under the License.
+  -->
+
+<wsdl:definitions 
+    targetNamespace="http://ode/bpel/test/retire/responder.wsdl"
+    xmlns="http://schemas.xmlsoap.org/wsdl/"
+    xmlns:tns="http://ode/bpel/test/retire/responder.wsdl"
+    xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" 
+    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+    xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+    xmlns:dummy="http://axis2.ode.apache.org"
+    xmlns:plnk="http://docs.oasis-open.org/wsbpel/2.0/plnktype"
+    xmlns:prop="http://docs.oasis-open.org/wsbpel/2.0/varprop">
+
+    <wsdl:message name="TestRetireMessage">
+        <wsdl:part name="TestPart" type="xsd:string"/>
+    </wsdl:message>
+    
+    <wsdl:portType name="TestRetirePortType">
+        <wsdl:operation name="first">
+            <wsdl:input message="tns:TestRetireMessage" name="TestIn"/>
+            <wsdl:output message="tns:TestRetireMessage" name="TestOut"/>
+        </wsdl:operation>    
+        <wsdl:operation name="second">
+            <wsdl:input message="tns:TestRetireMessage" name="TestIn"/>
+            <wsdl:output message="tns:TestRetireMessage" name="TestOut"/>
+        </wsdl:operation>
+    </wsdl:portType>
+    
+     <wsdl:binding name="TestRetireSoapBinding" type="tns:TestRetirePortType">
+        <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
+        <wsdl:operation name="first">
+            <soap:operation soapAction="" style="rpc"/>
+            <wsdl:input><soap:body namespace="http://ode/bpel/test/retire/responder.wsdl" use="literal"/></wsdl:input>
+            <wsdl:output><soap:body namespace="http://ode/bpel/unit-test.wsdl" use="literal"/></wsdl:output>
+        </wsdl:operation>
+        <wsdl:operation name="second">
+            <soap:operation soapAction="" style="rpc"/>
+            <wsdl:input><soap:body namespace="http://ode/bpel/test/retire/responder.wsdl" use="literal"/></wsdl:input>
+            <wsdl:output><soap:body namespace="http://ode/bpel/unit-test.wsdl" use="literal"/></wsdl:output>
+        </wsdl:operation>
+    </wsdl:binding>
+    <wsdl:service name="TestRetireService">
+		<wsdl:port name="TestRetirePort" binding="tns:TestRetireSoapBinding">
+     		<soap:address location="http://localhost:8080/ode/processes/testretire"/>
+		</wsdl:port>
+    </wsdl:service>
+    
+    <plnk:partnerLinkType name="TestRetirePartnerLinkType">
+        <plnk:role name="responder" portType="tns:TestRetirePortType"/>
+    </plnk:partnerLinkType>
+
+    <prop:property name="dummyProp" type="xsd:string"/>
+    <prop:propertyAlias propertyName="tns:dummyProp" messageType="tns:TestRetireMessage" part="TestPart"/>
+
+</wsdl:definitions>
+

Added: ode/branches/APACHE_ODE_1.1/axis2-war/src/test/resources/TestInstanceRetire/2/deploy.xml
URL: http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.1/axis2-war/src/test/resources/TestInstanceRetire/2/deploy.xml?rev=652723&view=auto
==============================================================================
--- ode/branches/APACHE_ODE_1.1/axis2-war/src/test/resources/TestInstanceRetire/2/deploy.xml (added)
+++ ode/branches/APACHE_ODE_1.1/axis2-war/src/test/resources/TestInstanceRetire/2/deploy.xml Thu May  1 17:40:38 2008
@@ -0,0 +1,29 @@
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements.  See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership.  The ASF licenses this file
+  ~ to you under the Apache License, Version 2.0 (the
+  ~ "License"); you may not use this file except in compliance
+  ~ with the License.  You may obtain a copy of the License at
+  ~
+  ~    http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing,
+  ~ software distributed under the License is distributed on an
+  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  ~ KIND, either express or implied.  See the License for the
+  ~ specific language governing permissions and limitations
+  ~ under the License.
+  -->
+<deploy xmlns="http://www.apache.org/ode/schemas/dd/2007/03"
+	xmlns:pns="http://ode/bpel/test/retire"
+	xmlns:wns="http://ode/bpel/test/retire/responder.wsdl">
+
+	<process name="pns:TestRetire">
+		<active>true</active>
+		<provide partnerLink="testRetirePartnerLink">
+			<service name="wns:TestRetireService" port="TestRetirePort"/>
+		</provide>
+    </process>
+</deploy>

Modified: ode/branches/APACHE_ODE_1.1/axis2/src/main/java/org/apache/ode/axis2/ODEServer.java
URL: http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.1/axis2/src/main/java/org/apache/ode/axis2/ODEServer.java?rev=652723&r1=652722&r2=652723&view=diff
==============================================================================
--- ode/branches/APACHE_ODE_1.1/axis2/src/main/java/org/apache/ode/axis2/ODEServer.java (original)
+++ ode/branches/APACHE_ODE_1.1/axis2/src/main/java/org/apache/ode/axis2/ODEServer.java Thu May  1 17:40:38 2008
@@ -545,11 +545,8 @@
                 // bounce the process
                 _server.unregister(pse.pid);
                 ProcessConf pconf = _store.getProcessConfiguration(pse.pid);
-                if (pconf != null)
-                    _server.register(pconf);
-                else {
-                    __log.debug("slighly odd: recevied event " + pse + " for process not in store!");
-                }
+                if (pconf != null) _server.register(pconf);
+                else __log.debug("slighly odd: recevied event " + pse + " for process not in store!");
                 break;
             case DISABLED:
             case UNDEPLOYED:

Modified: ode/branches/APACHE_ODE_1.1/bpel-obj/src/main/java/org/apache/ode/bpel/o/OExpressionLanguage.java
URL: http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.1/bpel-obj/src/main/java/org/apache/ode/bpel/o/OExpressionLanguage.java?rev=652723&r1=652722&r2=652723&view=diff
==============================================================================
--- ode/branches/APACHE_ODE_1.1/bpel-obj/src/main/java/org/apache/ode/bpel/o/OExpressionLanguage.java (original)
+++ ode/branches/APACHE_ODE_1.1/bpel-obj/src/main/java/org/apache/ode/bpel/o/OExpressionLanguage.java Thu May  1 17:40:38 2008
@@ -34,4 +34,13 @@
         if (properties != null)
             this.properties.putAll(properties);
     }
+
+    public boolean equals(Object obj) {
+        if (obj instanceof OExpressionLanguage) return ((OExpressionLanguage)obj).expressionLanguageUri.equals(expressionLanguageUri);
+        else return super.equals(obj);
+    }
+
+    public int hashCode() {
+        return expressionLanguageUri.hashCode();
+    }
 }

Modified: ode/branches/APACHE_ODE_1.1/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelEngineImpl.java
URL: http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.1/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelEngineImpl.java?rev=652723&r1=652722&r2=652723&view=diff
==============================================================================
--- ode/branches/APACHE_ODE_1.1/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelEngineImpl.java (original)
+++ ode/branches/APACHE_ODE_1.1/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelEngineImpl.java Thu May  1 17:40:38 2008
@@ -260,9 +260,7 @@
     OProcess getOProcess(QName processId) {
         BpelProcess process = _activeProcesses.get(processId);
 
-        if (process == null)
-            return null;
-
+        if (process == null) return null;
         return process.getOProcess();
     }
 

Modified: ode/branches/APACHE_ODE_1.1/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelProcess.java
URL: http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.1/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelProcess.java?rev=652723&r1=652722&r2=652723&view=diff
==============================================================================
--- ode/branches/APACHE_ODE_1.1/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelProcess.java (original)
+++ ode/branches/APACHE_ODE_1.1/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelProcess.java Thu May  1 17:40:38 2008
@@ -620,10 +620,24 @@
         }
     }
 
-    public ReplacementMap getReplacementMap() {
+    public ReplacementMap getReplacementMap(QName processName) {
         try {
             _hydrationLatch.latch(1);
-            return _replacementMap;
+
+            if (processName.equals(_pid)) return _replacementMap;
+            else
+                try {
+                    // We're asked for an older version of this process, fetching it
+                    OProcess oprocess = _engine.getOProcess(processName);
+                    // Older versions may ventually need more expression languages
+                    registerExprLang(oprocess);
+
+                    return new ReplacementMapImpl(oprocess);
+                } catch (Exception e) {
+                    String errmsg = "Error reloading compiled process " + _pid + "; the file appears to be corrupted.";
+                    __log.error(errmsg);
+                    throw new BpelEngineException(errmsg, e);
+                }
         } finally {
             _hydrationLatch.release(1);
         }
@@ -702,7 +716,6 @@
     }
 
     private class HydrationLatch extends NStateLatch {
-
         HydrationLatch() {
             super(new Runnable[2]);
             _transitions[0] = new Runnable() {
@@ -710,13 +723,11 @@
                     doDehydrate();
                 }
             };
-
             _transitions[1] = new Runnable() {
                 public void run() {
                     doHydrate();
                 }
             };
-
         }
 
         private void doDehydrate() {
@@ -742,17 +753,8 @@
             _replacementMap = new ReplacementMapImpl(_oprocess);
 
             // Create an expression language registry for this process
-            ExpressionLanguageRuntimeRegistry elangRegistry = new ExpressionLanguageRuntimeRegistry();
-            for (OExpressionLanguage elang : _oprocess.expressionLanguages) {
-                try {
-                    elangRegistry.registerRuntime(elang);
-                } catch (ConfigurationException e) {
-                    String msg = __msgs.msgExpLangRegistrationError(elang.expressionLanguageUri, elang.properties);
-                    __log.error(msg, e);
-                    throw new BpelEngineException(msg, e);
-                }
-            }
-            _expLangRuntimeRegistry = elangRegistry;
+            _expLangRuntimeRegistry = new ExpressionLanguageRuntimeRegistry();
+            registerExprLang(_oprocess);
 
             setRoles(_oprocess);
     		initExternalVariables();
@@ -812,4 +814,16 @@
         }
 
     }
+
+    private void registerExprLang(OProcess oprocess) {
+        for (OExpressionLanguage elang : oprocess.expressionLanguages) {
+            try {
+                _expLangRuntimeRegistry.registerRuntime(elang);
+            } catch (ConfigurationException e) {
+                String msg = __msgs.msgExpLangRegistrationError(elang.expressionLanguageUri, elang.properties);
+                __log.error(msg, e);
+                throw new BpelEngineException(msg, e);
+            }
+        }
+    }
 }

Modified: ode/branches/APACHE_ODE_1.1/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelRuntimeContextImpl.java
URL: http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.1/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelRuntimeContextImpl.java?rev=652723&r1=652722&r2=652723&view=diff
==============================================================================
--- ode/branches/APACHE_ODE_1.1/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelRuntimeContextImpl.java (original)
+++ ode/branches/APACHE_ODE_1.1/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelRuntimeContextImpl.java Thu May  1 17:40:38 2008
@@ -128,7 +128,7 @@
         _vpu.registerExtension(BpelRuntimeContext.class, this);
 
         _soup = new ExecutionQueueImpl(null);
-        _soup.setReplacementMap(_bpelProcess.getReplacementMap());
+        _soup.setReplacementMap(_bpelProcess.getReplacementMap(dao.getProcess().getProcessId()));
         _outstandingRequests = new OutstandingRequestManager();
         _vpu.setContext(_soup);
 

Modified: ode/branches/APACHE_ODE_1.1/bpel-store/src/main/java/org/apache/ode/store/ProcessStoreImpl.java
URL: http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.1/bpel-store/src/main/java/org/apache/ode/store/ProcessStoreImpl.java?rev=652723&r1=652722&r2=652723&view=diff
==============================================================================
--- ode/branches/APACHE_ODE_1.1/bpel-store/src/main/java/org/apache/ode/store/ProcessStoreImpl.java (original)
+++ ode/branches/APACHE_ODE_1.1/bpel-store/src/main/java/org/apache/ode/store/ProcessStoreImpl.java Thu May  1 17:40:38 2008
@@ -395,8 +395,7 @@
 
     public void setRetiredPackage(String packageName, boolean retired) {
         DeploymentUnitDir duDir = _deploymentUnits.get(packageName);
-        if (duDir == null)
-            throw new ContextException("Could not find package " + packageName);
+        if (duDir == null) throw new ContextException("Could not find package " + packageName);
         for (QName processName : duDir.getProcessNames()) {
             setState(toPid(processName, duDir.getVersion()), retired ? ProcessState.RETIRED : ProcessState.ACTIVE);
         }

Modified: ode/branches/APACHE_ODE_1.1/dao-hibernate/src/main/java/org/apache/ode/daohib/bpel/CorrelatorDaoImpl.java
URL: http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.1/dao-hibernate/src/main/java/org/apache/ode/daohib/bpel/CorrelatorDaoImpl.java?rev=652723&r1=652722&r2=652723&view=diff
==============================================================================
--- ode/branches/APACHE_ODE_1.1/dao-hibernate/src/main/java/org/apache/ode/daohib/bpel/CorrelatorDaoImpl.java (original)
+++ ode/branches/APACHE_ODE_1.1/dao-hibernate/src/main/java/org/apache/ode/daohib/bpel/CorrelatorDaoImpl.java Thu May  1 17:40:38 2008
@@ -41,6 +41,8 @@
 import org.hibernate.LockMode;
 import org.hibernate.Query;
 
+import javax.xml.namespace.QName;
+
 /**
  * Hibernate-based {@link CorrelatorDAO} implementation.
  */
@@ -53,12 +55,11 @@
     private static final String QRY_MESSAGE = " where this.correlationKey = ?".intern();
 
     /** filter for finding a matching selector. */
-    private static final String FLTR_SELECTORS = " where this.correlationKey = ?" + " and " +
-            "(this.instance.state = " + ProcessState.STATE_ACTIVE + " or this.instance.state = " 
-            + ProcessState.STATE_READY + ")".intern();
+    private static final String FLTR_SELECTORS = ("from " + HCorrelatorSelector.class.getName()
+            + " hs where hs.correlationKey = ? and hs.processType = ?").intern();
 
-    private static final String LOCK_SELECTORS = "update " + HCorrelatorSelector.class.getName() + 
-        " set lock = lock+1 where correlationKey = :ckey and correlator= :corr".intern();
+    private static final String LOCK_SELECTORS = "update from " + HCorrelatorSelector.class.getName() +
+        " set lock = lock+1 where correlationKey = ? and processType = ?".intern();
     
     /** Query for removing routes. */
     private static final String QRY_DELSELECTORS = "delete from " + HCorrelatorSelector.class.getName()
@@ -86,9 +87,7 @@
         // We really should consider the possibility of multiple messages matching a criteria.
         // When the message is handled, its not too convenient to attempt to determine if the
         // received message conflicts with one already received.
-
         Iterator mcors = qry.iterate();
-
         try {
             if (!mcors.hasNext()) {
                 __log.debug(hdr + "did not find a MESSAGE entry.");
@@ -96,11 +95,8 @@
             }
     
             HCorrelatorMessage mcor = (HCorrelatorMessage) mcors.next();
-            
-            
             __log.debug(hdr + "found MESSAGE entry " + mcor.getMessageExchange());
             removeEntries(mcor.getMessageExchange());
-    
             return new MessageExchangeDaoImpl(_sm, mcor.getMessageExchange());
         } finally {
             Hibernate.close(mcors);
@@ -116,28 +112,30 @@
         // will not necessarily work, as different DB vendors attach a different meaning to this syntax.
         // In particular it is not clear how long the lock should be held, for the lifetime of the 
         // resulting cursor, or for the lifetime of the transaction. So really, an UPDATE of the row
-        // is a much safer alternative. 
+        // is a much safer alternative.
+        String processType = new QName(_hobj.getProcess().getTypeNamespace(), _hobj.getProcess().getTypeName()).toString();
         Query lockQry = getSession().createQuery(LOCK_SELECTORS);
-        lockQry.setString("ckey", key == null ? null : key.toCanonicalString());
-        lockQry.setEntity("corr",_hobj);
+        lockQry.setString(0, key == null ? null : key.toCanonicalString());
+        lockQry.setString(1, processType);
         if (lockQry.executeUpdate() > 0) {
             
-            Query q = getSession().createFilter(_hobj.getSelectors(), FLTR_SELECTORS);
+            Query q = getSession().createQuery(FLTR_SELECTORS);
             q.setString(0, key == null ? null : key.toCanonicalString());
-            q.setLockMode("this", LockMode.UPGRADE);
+            q.setString(1, processType);
+            q.setLockMode("hs", LockMode.UPGRADE);
 
             HCorrelatorSelector selector;
-            try {
+//            try {
                 selector = (HCorrelatorSelector) q.uniqueResult();
-            } catch (Exception ex) {
-                __log.debug("Strange, could not get a unique result for findRoute, trying to iterate instead.");
-                
-                Iterator i = q.iterate();
-                if (i.hasNext())
-                    selector = (HCorrelatorSelector) i.next();
-                else selector = null;
-                Hibernate.close(i);
-            }
+//            } catch (Exception ex) {
+//                __log.debug("Strange, could not get a unique result for findRoute, trying to iterate instead.");
+//
+//                Iterator i = q.iterate();
+//                if (i.hasNext())
+//                    selector = (HCorrelatorSelector) i.next();
+//                else selector = null;
+//                Hibernate.close(i);
+//            }
     
             __log.debug(hdr + "found " + selector);
             return selector == null ? null : new MessageRouteDaoImpl(_sm, selector);
@@ -187,6 +185,7 @@
         hsel.setLock(0);
         hsel.setCorrelationKey(correlationKey.toCanonicalString());
         hsel.setInstance((HProcessInstance) ((ProcessInstanceDaoImpl) target).getHibernateObj());
+        hsel.setProcessType(target.getProcess().getType().toString());
         hsel.setCorrelator(_hobj);
         hsel.setCreated(new Date());
 //        _hobj.addSelector(hsel);

Modified: ode/branches/APACHE_ODE_1.1/dao-hibernate/src/main/java/org/apache/ode/daohib/bpel/hobj/HCorrelatorSelector.java
URL: http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.1/dao-hibernate/src/main/java/org/apache/ode/daohib/bpel/hobj/HCorrelatorSelector.java?rev=652723&r1=652722&r2=652723&view=diff
==============================================================================
--- ode/branches/APACHE_ODE_1.1/dao-hibernate/src/main/java/org/apache/ode/daohib/bpel/hobj/HCorrelatorSelector.java (original)
+++ ode/branches/APACHE_ODE_1.1/dao-hibernate/src/main/java/org/apache/ode/daohib/bpel/hobj/HCorrelatorSelector.java Thu May  1 17:40:38 2008
@@ -26,14 +26,11 @@
 public class HCorrelatorSelector extends HObject {
 
     private HProcessInstance _instance;
-
     private String _groupId;
-
     private int _idx;
-
     private HCorrelator _correlator;
-
     private String _correlationKey;
+    private String _processType;
     
     /**
      * @hibernate.many-to-one column="PIID" not-null="true"
@@ -93,6 +90,17 @@
     }
 
     /**
+     * @hibernate.property column="PROC_TYPE" not-null="true"
+     */
+    public String getProcessType() {
+        return _processType;
+    }
+
+    public void setProcessType(String _processType) {
+        this._processType = _processType;
+    }
+
+    /**
      * @hibernate.many-to-one not-null="true"
      * @hibernate.column name="CORRELATOR" not-null="true" 
      *          index="IDX_SELECTOR_CORRELATOR" unique-key="UNIQ_SELECTOR"
@@ -104,5 +112,5 @@
     public void setCorrelator(HCorrelator correlator) {
         _correlator = correlator;
     }
-    
+
 }

Modified: ode/branches/APACHE_ODE_1.1/dao-jpa/src/main/java/org/apache/ode/dao/jpa/CorrelatorDAOImpl.java
URL: http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.1/dao-jpa/src/main/java/org/apache/ode/dao/jpa/CorrelatorDAOImpl.java?rev=652723&r1=652722&r2=652723&view=diff
==============================================================================
--- ode/branches/APACHE_ODE_1.1/dao-jpa/src/main/java/org/apache/ode/dao/jpa/CorrelatorDAOImpl.java (original)
+++ ode/branches/APACHE_ODE_1.1/dao-jpa/src/main/java/org/apache/ode/dao/jpa/CorrelatorDAOImpl.java Thu May  1 17:40:38 2008
@@ -25,23 +25,19 @@
 import org.apache.ode.bpel.dao.MessageRouteDAO;
 import org.apache.ode.bpel.dao.ProcessInstanceDAO;
 
-import javax.persistence.Basic;
-import javax.persistence.CascadeType;
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.FetchType;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.ManyToOne;
-import javax.persistence.OneToMany;
-import javax.persistence.Table;
+import javax.persistence.*;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Iterator;
+import java.util.List;
 
 @Entity
 @Table(name="ODE_CORRELATOR")
+@NamedQueries({
+    @NamedQuery(name="RouteByCKey", query="SELECT route " +
+            "FROM MessageRouteDAOImpl as route " +
+            "WHERE route._correlationKey = :ckey and route._correlator._process._processType = :ptype")
+        })
 public class CorrelatorDAOImpl extends OpenJPADAO implements CorrelatorDAO {
 
     @Id @Column(name="CORRELATOR_ID")
@@ -69,8 +65,8 @@
     }
 
     public MessageExchangeDAO dequeueMessage(CorrelationKey correlationKey) {
-        for (Iterator itr=_exchanges.iterator(); itr.hasNext();){
-            MessageExchangeDAOImpl mex = (MessageExchangeDAOImpl)itr.next();
+        for (Iterator<MessageExchangeDAOImpl> itr=_exchanges.iterator(); itr.hasNext();){
+            MessageExchangeDAOImpl mex = itr.next();
             if (mex.getCorrelationKeys().contains(correlationKey)) {
                 itr.remove();
                 return mex;
@@ -91,10 +87,12 @@
     }
 
     public MessageRouteDAO findRoute(CorrelationKey correlationKey) {
-        for (MessageRouteDAOImpl mr : _routes ) {
-            if ( mr.getCorrelationKey().equals(correlationKey)) return mr;
-        }
-        return null;
+        Query qry = getEM().createNamedQuery("RouteByCKey");
+        qry.setParameter("ckey", correlationKey.toCanonicalString());
+        qry.setParameter("ptype", _process.getType().toString());
+        List<MessageRouteDAO> routes = (List<MessageRouteDAO>) qry.getResultList();
+        if (routes.size() > 0) return routes.get(0);
+        else return null;
     }
 
     public String getCorrelatorId() {
@@ -107,8 +105,8 @@
     }
 
     void removeLocalRoutes(String routeGroupId, ProcessInstanceDAO target) {
-        for (Iterator itr=_routes.iterator(); itr.hasNext(); ) {
-            MessageRouteDAOImpl mr = (MessageRouteDAOImpl)itr.next();
+        for (Iterator<MessageRouteDAOImpl> itr=_routes.iterator(); itr.hasNext(); ) {
+            MessageRouteDAOImpl mr = itr.next();
             if ( mr.getGroupId().equals(routeGroupId) && mr.getTargetInstance().equals(target)) {
                 itr.remove();
                 getEM().remove(mr);