Author: rr
Date: Sun May 23 18:28:57 2010
New Revision: 947459

URL: http://svn.apache.org/viewvc?rev=947459&view=rev
Log:
ODE-829: if process is retired the inflight instances dont work (thanks to 
Anurag Aggarwal)

Added:
    
ode/trunk/axis2-war/src/test/java/org/apache/ode/axis2/management/RedeployTest.java
   (with props)
    
ode/trunk/axis2-war/src/test/java/org/apache/ode/axis2/management/RetireTestVar.java
   (with props)
    ode/trunk/axis2-war/src/test/resources/TestInstanceRetire/noVar/
    
ode/trunk/axis2-war/src/test/resources/TestInstanceRetire/noVar/TestRetire.bpel 
  (with props)
    
ode/trunk/axis2-war/src/test/resources/TestInstanceRetire/noVar/TestRetire.wsdl 
  (with props)
    ode/trunk/axis2-war/src/test/resources/TestInstanceRetire/noVar/deploy.xml  
 (with props)
    ode/trunk/axis2-war/src/test/resources/TestInstanceRetire/withVar/
    
ode/trunk/axis2-war/src/test/resources/TestInstanceRetire/withVar/TestRetire.bpel
   (with props)
    
ode/trunk/axis2-war/src/test/resources/TestInstanceRetire/withVar/TestRetire.wsdl
   (with props)
    
ode/trunk/axis2-war/src/test/resources/TestInstanceRetire/withVar/deploy.xml   
(with props)
Modified:
    ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/iapi/Scheduler.java
    
ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelEngineImpl.java
    
ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelProcess.java
    
ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/PartnerLinkMyRoleImpl.java
    
ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/replayer/Replayer.java
    
ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/replayer/ReplayerBpelRuntimeContextImpl.java
    
ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/replayer/ReplayerContext.java
    
ode/trunk/dao-hibernate/src/main/java/org/apache/ode/daohib/bpel/ProcessDaoImpl.java

Added: 
ode/trunk/axis2-war/src/test/java/org/apache/ode/axis2/management/RedeployTest.java
URL: 
http://svn.apache.org/viewvc/ode/trunk/axis2-war/src/test/java/org/apache/ode/axis2/management/RedeployTest.java?rev=947459&view=auto
==============================================================================
--- 
ode/trunk/axis2-war/src/test/java/org/apache/ode/axis2/management/RedeployTest.java
 (added)
+++ 
ode/trunk/axis2-war/src/test/java/org/apache/ode/axis2/management/RedeployTest.java
 Sun May 23 18:28:57 2010
@@ -0,0 +1,51 @@
+/*
+ * 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.
+ */
+
+package org.apache.ode.axis2.management;
+
+import org.apache.ode.axis2.Axis2TestBase;
+import static org.testng.AssertJUnit.assertTrue;
+import org.testng.annotations.Test;
+
+import javax.xml.namespace.QName;
+
+/**
+ * @author Anurag Aggarwal <[email protected]>
+ */
+public class RedeployTest extends Axis2TestBase {
+
+    // @Test(dataProvider="configs")
+    // not supposed to work, user should not rm .deploy folder maybe ?
+    public void testRedeploy() throws Exception {
+        String bundleName = "TestInstanceRetire";
+        System.out.println("=> " + 
server.getODEServer().getProcessStore().getPackages());
+        if (server.isDeployed("withVar")) server.undeployProcess(bundleName + 
"/withVar");
+        
+        QName deployedQName = server.deployProcess(bundleName + 
"/withVar").iterator().next();
+
+        server.sendRequestFile("http://localhost:8888/processes/testretire";,
+                bundleName + "/1", "testRequest1.soap");
+
+        server.undeployProcess(bundleName + "/withVar");
+        server.deployProcess(bundleName + "/withVar").iterator().next();
+        
+        String response = 
server.sendRequestFile("http://localhost:8888/processes/testretire";,
+                bundleName + "/1", "testRequest2.soap");
+    }
+}

Propchange: 
ode/trunk/axis2-war/src/test/java/org/apache/ode/axis2/management/RedeployTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: 
ode/trunk/axis2-war/src/test/java/org/apache/ode/axis2/management/RetireTestVar.java
URL: 
http://svn.apache.org/viewvc/ode/trunk/axis2-war/src/test/java/org/apache/ode/axis2/management/RetireTestVar.java?rev=947459&view=auto
==============================================================================
--- 
ode/trunk/axis2-war/src/test/java/org/apache/ode/axis2/management/RetireTestVar.java
 (added)
+++ 
ode/trunk/axis2-war/src/test/java/org/apache/ode/axis2/management/RetireTestVar.java
 Sun May 23 18:28:57 2010
@@ -0,0 +1,62 @@
+/*
+ * 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.
+ */
+
+package org.apache.ode.axis2.management;
+
+import org.apache.ode.axis2.Axis2TestBase;
+import static org.testng.AssertJUnit.assertTrue;
+import org.testng.annotations.Test;
+
+import javax.xml.namespace.QName;
+
+/**
+ * @author Anurag Aggarwal <[email protected]>
+ */
+public class RetireTestVar extends Axis2TestBase {
+
+    @Test(dataProvider="configs")
+    public void testRetiredInstance() throws Exception {
+       String response = null;
+        String bundleName = "TestInstanceRetire";
+        System.out.println("=> " + 
server.getODEServer().getProcessStore().getPackages());
+        if (server.isDeployed("withVar")) server.undeployProcess(bundleName + 
"/withVar");
+        if (server.isDeployed("noVar")) server.undeployProcess(bundleName + 
"/noVar");
+        
+        QName deployedQName = server.deployProcess(bundleName + 
"/withVar").iterator().next();
+
+        server.sendRequestFile("http://localhost:8888/processes/testretire";,
+                bundleName + "/1", "testRequest1.soap");
+
+        server.getODEServer().getProcessManagement().setRetired(deployedQName, 
true);
+        server.deployProcess(bundleName + "/noVar");
+        
+        response = 
server.sendRequestFile("http://localhost:8888/processes/testretire";,
+                bundleName + "/1", "testRequest2.soap");
+
+        assertTrue(response.indexOf("DONE") > 0);
+        
+        server.sendRequestFile("http://localhost:8888/processes/testretire";,
+                bundleName + "/1", "testRequest1.soap");
+
+        response = 
server.sendRequestFile("http://localhost:8888/processes/testretire";,
+                bundleName + "/1", "testRequest2.soap");
+
+        assertTrue(response.indexOf("XYZ") > 0);
+    }
+}

Propchange: 
ode/trunk/axis2-war/src/test/java/org/apache/ode/axis2/management/RetireTestVar.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: 
ode/trunk/axis2-war/src/test/resources/TestInstanceRetire/noVar/TestRetire.bpel
URL: 
http://svn.apache.org/viewvc/ode/trunk/axis2-war/src/test/resources/TestInstanceRetire/noVar/TestRetire.bpel?rev=947459&view=auto
==============================================================================
--- 
ode/trunk/axis2-war/src/test/resources/TestInstanceRetire/noVar/TestRetire.bpel 
(added)
+++ 
ode/trunk/axis2-war/src/test/resources/TestInstanceRetire/noVar/TestRetire.bpel 
Sun May 23 18:28:57 2010
@@ -0,0 +1,67 @@
+<?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="testRetirePartnerLink2" 
partnerLinkType="resp:TestRetirePartnerLinkType" myRole="responder"/>
+    </partnerLinks>
+
+    <variables>
+        <variable name="dummy" messageType="resp:TestRetireMessage"/>
+        <variable name="dummy3" messageType="resp:TestRetireMessage"/>
+    </variables>
+
+    <correlationSets>
+        <correlationSet name="dummyCorr" properties="resp:dummyProp" />
+    </correlationSets>
+
+    <sequence>
+        <receive name="start" partnerLink="testRetirePartnerLink2" 
variable="dummy" operation="first" createInstance="yes">
+            <correlations>
+                <correlation set="dummyCorr" initiate="yes"/>
+            </correlations>
+        </receive>
+        <reply name="reply-endpoint" partnerLink="testRetirePartnerLink2" 
operation="first" variable="dummy"/>
+
+
+        <receive name="second" partnerLink="testRetirePartnerLink2" 
variable="dummy" operation="second">
+            <correlations>
+                <correlation set="dummyCorr" initiate="no"/>
+            </correlations>
+        </receive>
+        <assign>
+            <copy>
+                <from><literal>DONE</literal></from>
+                <to>$dummy3.TestPart</to>
+            </copy>
+        </assign>
+        <reply name="reply-ack" partnerLink="testRetirePartnerLink2" 
operation="second" variable="dummy"/>
+
+    </sequence>
+</process>

Propchange: 
ode/trunk/axis2-war/src/test/resources/TestInstanceRetire/noVar/TestRetire.bpel
------------------------------------------------------------------------------
    svn:eol-style = native

Added: 
ode/trunk/axis2-war/src/test/resources/TestInstanceRetire/noVar/TestRetire.wsdl
URL: 
http://svn.apache.org/viewvc/ode/trunk/axis2-war/src/test/resources/TestInstanceRetire/noVar/TestRetire.wsdl?rev=947459&view=auto
==============================================================================
--- 
ode/trunk/axis2-war/src/test/resources/TestInstanceRetire/noVar/TestRetire.wsdl 
(added)
+++ 
ode/trunk/axis2-war/src/test/resources/TestInstanceRetire/noVar/TestRetire.wsdl 
Sun May 23 18:28:57 2010
@@ -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:8888/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>
+

Propchange: 
ode/trunk/axis2-war/src/test/resources/TestInstanceRetire/noVar/TestRetire.wsdl
------------------------------------------------------------------------------
    svn:eol-style = native

Added: 
ode/trunk/axis2-war/src/test/resources/TestInstanceRetire/noVar/deploy.xml
URL: 
http://svn.apache.org/viewvc/ode/trunk/axis2-war/src/test/resources/TestInstanceRetire/noVar/deploy.xml?rev=947459&view=auto
==============================================================================
--- ode/trunk/axis2-war/src/test/resources/TestInstanceRetire/noVar/deploy.xml 
(added)
+++ ode/trunk/axis2-war/src/test/resources/TestInstanceRetire/noVar/deploy.xml 
Sun May 23 18:28:57 2010
@@ -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="testRetirePartnerLink2">
+            <service name="wns:TestRetireService" port="TestRetirePort"/>
+        </provide>
+    </process>
+</deploy>

Propchange: 
ode/trunk/axis2-war/src/test/resources/TestInstanceRetire/noVar/deploy.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: 
ode/trunk/axis2-war/src/test/resources/TestInstanceRetire/withVar/TestRetire.bpel
URL: 
http://svn.apache.org/viewvc/ode/trunk/axis2-war/src/test/resources/TestInstanceRetire/withVar/TestRetire.bpel?rev=947459&view=auto
==============================================================================
--- 
ode/trunk/axis2-war/src/test/resources/TestInstanceRetire/withVar/TestRetire.bpel
 (added)
+++ 
ode/trunk/axis2-war/src/test/resources/TestInstanceRetire/withVar/TestRetire.bpel
 Sun May 23 18:28:57 2010
@@ -0,0 +1,71 @@
+<?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"/>
+        <variable name="dummy2" 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>
+            <copy>
+                <from><literal>DONE</literal></from>
+                <to>$dummy2.TestPart</to>
+            </copy>
+        </assign>
+        <reply name="reply-ack" partnerLink="testRetirePartnerLink" 
operation="second" variable="dummy"/>
+
+    </sequence>
+</process>

Propchange: 
ode/trunk/axis2-war/src/test/resources/TestInstanceRetire/withVar/TestRetire.bpel
------------------------------------------------------------------------------
    svn:eol-style = native

Added: 
ode/trunk/axis2-war/src/test/resources/TestInstanceRetire/withVar/TestRetire.wsdl
URL: 
http://svn.apache.org/viewvc/ode/trunk/axis2-war/src/test/resources/TestInstanceRetire/withVar/TestRetire.wsdl?rev=947459&view=auto
==============================================================================
--- 
ode/trunk/axis2-war/src/test/resources/TestInstanceRetire/withVar/TestRetire.wsdl
 (added)
+++ 
ode/trunk/axis2-war/src/test/resources/TestInstanceRetire/withVar/TestRetire.wsdl
 Sun May 23 18:28:57 2010
@@ -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:8888/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>
+

Propchange: 
ode/trunk/axis2-war/src/test/resources/TestInstanceRetire/withVar/TestRetire.wsdl
------------------------------------------------------------------------------
    svn:eol-style = native

Added: 
ode/trunk/axis2-war/src/test/resources/TestInstanceRetire/withVar/deploy.xml
URL: 
http://svn.apache.org/viewvc/ode/trunk/axis2-war/src/test/resources/TestInstanceRetire/withVar/deploy.xml?rev=947459&view=auto
==============================================================================
--- 
ode/trunk/axis2-war/src/test/resources/TestInstanceRetire/withVar/deploy.xml 
(added)
+++ 
ode/trunk/axis2-war/src/test/resources/TestInstanceRetire/withVar/deploy.xml 
Sun May 23 18:28:57 2010
@@ -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>

Propchange: 
ode/trunk/axis2-war/src/test/resources/TestInstanceRetire/withVar/deploy.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: 
ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/iapi/Scheduler.java
URL: 
http://svn.apache.org/viewvc/ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/iapi/Scheduler.java?rev=947459&r1=947458&r2=947459&view=diff
==============================================================================
--- ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/iapi/Scheduler.java 
(original)
+++ ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/iapi/Scheduler.java 
Sun May 23 18:28:57 2010
@@ -295,7 +295,7 @@ public interface Scheduler {
      * processing.
      * @author mszefler
      */
-    public class JobProcessorException extends Exception {
+    public class JobProcessorException extends RuntimeException {
         private static final long serialVersionUID = 1L;
         public final boolean retry;
 

Modified: 
ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelEngineImpl.java
URL: 
http://svn.apache.org/viewvc/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelEngineImpl.java?rev=947459&r1=947458&r2=947459&view=diff
==============================================================================
--- 
ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelEngineImpl.java
 (original)
+++ 
ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelEngineImpl.java
 Sun May 23 18:28:57 2010
@@ -372,31 +372,52 @@ public class BpelEngineImpl implements B
         if (process == null) return null;
         return process.getOProcess();
     }
+    
+    private List<BpelProcess> getAllProcesses(QName processId) {
+       String qName =  processId.toString();
+       if(qName.lastIndexOf("-") > 0) {
+               qName = qName.substring(0, qName.lastIndexOf("-"));
+       }
+       List<BpelProcess> ret = new ArrayList<BpelProcess>();
+       Iterator<Map.Entry<QName, BpelProcess>> it = 
_activeProcesses.entrySet().iterator();
+       while (it.hasNext()) {
+               Map.Entry<QName, BpelProcess> pairs = it.next();
+               if(pairs.getKey().toString().startsWith(qName)) {
+                       ret.add(pairs.getValue());
+               }
+       }
+       return ret;
+    }
 
-    public void onScheduledJob(Scheduler.JobInfo jobInfo) throws 
Scheduler.JobProcessorException {
-        final JobDetails we = jobInfo.jobDetail;
-
-        if( __log.isTraceEnabled() ) __log.trace("[JOB] onScheduledJob " + 
jobInfo + "" + we.getInstanceId());
-        
+    public void acquireInstanceLock(final Long iid) {
         // We lock the instance to prevent concurrent transactions and prevent 
unnecessary rollbacks,
         // Note that we don't want to wait too long here to get our lock, 
since we are likely holding
         // on to scheduler's locks of various sorts.
         try {
-            _instanceLockManager.lock(we.getInstanceId(), 1, 
TimeUnit.MICROSECONDS);
+            _instanceLockManager.lock(iid, 1, TimeUnit.MICROSECONDS);
             _contexts.scheduler.registerSynchronizer(new 
Scheduler.Synchronizer() {
                 public void afterCompletion(boolean success) {
-                    _instanceLockManager.unlock(we.getInstanceId());
+                    _instanceLockManager.unlock(iid);
                 }
                 public void beforeCompletion() { }
             });
         } catch (InterruptedException e) {
             // Retry later.
-            __log.debug("Thread interrupted, job will be rescheduled: " + 
jobInfo);
+            __log.debug("Thread interrupted, job will be rescheduled");
             throw new Scheduler.JobProcessorException(true);
         } catch 
(org.apache.ode.bpel.engine.InstanceLockManager.TimeoutException e) {
-            __log.debug("Instance " + we.getInstanceId() + " is busy, 
rescheduling job.");
+            __log.debug("Instance " + iid + " is busy, rescheduling job.");
             throw new Scheduler.JobProcessorException(true);
         }
+    }
+
+    public void onScheduledJob(Scheduler.JobInfo jobInfo) throws 
Scheduler.JobProcessorException {
+        final JobDetails we = jobInfo.jobDetail;
+
+        if( __log.isTraceEnabled() ) __log.trace("[JOB] onScheduledJob " + 
jobInfo + "" + we.getInstanceId());
+        
+        acquireInstanceLock(we.getInstanceId());
+        
         // DONT PUT CODE HERE-need this method real tight in a try/catch 
block, we need to handle
         // all types of failure here, the scheduler is not going to know how 
to handle our errors,
         // ALSO we have to release the lock obtained above (IMPORTANT), lest 
the whole system come
@@ -452,11 +473,27 @@ public class BpelEngineImpl implements B
                         }
                     }
                 }
-                process.handleJobDetails(jobInfo.jobDetail);
+                if (we.getType().equals(JobType.INVOKE_INTERNAL)) {
+                       List<BpelProcess> processes = 
getAllProcesses(we.getProcessId());
+                       boolean routed = false;
+                       jobInfo.jobDetail.detailsExt.put("enqueue", false);
+                       for(BpelProcess proc : processes) {
+                        routed = routed || 
proc.handleJobDetails(jobInfo.jobDetail);                           
+                       }
+                       if(!routed) {
+                       jobInfo.jobDetail.detailsExt.put("enqueue", true);
+                        process.handleJobDetails(jobInfo.jobDetail);           
                
+                       }
+                }
+                else {
+                    process.handleJobDetails(jobInfo.jobDetail);
+                }
                 debuggingDelay();
             } finally {
                 Thread.currentThread().setContextClassLoader(cl);
             }
+        } catch (Scheduler.JobProcessorException e) {
+            throw e;
         } catch (BpelEngineException bee) {
             __log.error(__msgs.msgScheduledJobFailed(we), bee);
             throw new Scheduler.JobProcessorException(bee, checkRetry(we));

Modified: 
ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelProcess.java
URL: 
http://svn.apache.org/viewvc/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelProcess.java?rev=947459&r1=947458&r2=947459&view=diff
==============================================================================
--- 
ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelProcess.java
 (original)
+++ 
ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelProcess.java
 Sun May 23 18:28:57 2010
@@ -204,7 +204,7 @@ public class BpelProcess {
         boolean invoke(PartnerLinkMyRoleImpl target, 
PartnerLinkMyRoleImpl.RoutingInfo routingInfo, boolean createInstance);
     }
     
-    public void invokeProcess(MyRoleMessageExchangeImpl mex, InvokeHandler 
invokeHandler) {
+    public boolean invokeProcess(MyRoleMessageExchangeImpl mex, InvokeHandler 
invokeHandler, boolean enqueue) {
         boolean routed = false;
 
         try {
@@ -214,14 +214,14 @@ public class BpelProcess {
                 String errmsg = 
__msgs.msgMyRoleRoutingFailure(mex.getMessageExchangeId());
                 __log.error(errmsg);
                 mex.setFailure(MessageExchange.FailureType.UNKNOWN_ENDPOINT, 
errmsg, null);
-                return;
+                return false;
             }
 
             mex.getDAO().setProcess(getProcessDAO());
 
             if (!processInterceptors(mex, 
InterceptorInvoker.__onProcessInvoked)) {
                 __log.debug("Aborting processing of mex " + mex + " due to 
interceptors.");
-                return;
+                return false;
             }
 
             markused();
@@ -233,7 +233,7 @@ public class BpelProcess {
                 routings = target.findRoute(mex);
                 boolean createInstance = target.isCreateInstance(mex);
 
-                if (mex.getStatus() != MessageExchange.Status.FAILURE) {
+                if (mex.getStatus() != MessageExchange.Status.FAILURE && 
routings!=null) {
                     for (PartnerLinkMyRoleImpl.RoutingInfo routing : routings) 
{
                         routed = routed || invokeHandler.invoke(target, 
routing, createInstance);
                     }
@@ -244,7 +244,7 @@ public class BpelProcess {
             }
 
             // Nothing found, saving for later
-            if (!routed) {
+            if (!routed && enqueue) {
                 // TODO this is kind of hackish when no match and more than 
one myrole is selected.
                 // we save the routing on the last myrole
                 // actually the message queue should be attached to the 
instance instead of the correlator
@@ -268,6 +268,11 @@ public class BpelProcess {
         if 
(mex.getPattern().equals(MessageExchange.MessageExchangePattern.REQUEST_ONLY) 
&& routed && getCleanupCategories(false).contains(CLEANUP_CATEGORY.MESSAGES)) {
             mex.release();
         }
+        return routed;
+    }
+    
+    private boolean isActive() {
+       return _pconf.getState() == 
org.apache.ode.bpel.iapi.ProcessState.ACTIVE;
     }
     
     /**
@@ -275,21 +280,22 @@ public class BpelProcess {
      *
      * @param mex
      */
-    void invokeProcess(final MyRoleMessageExchangeImpl mex) {
-        invokeProcess(mex, new InvokeHandler() {
+    boolean invokeProcess(final MyRoleMessageExchangeImpl mex, boolean 
enqueue) {
+        return invokeProcess(mex, new InvokeHandler() {
             public boolean invoke(PartnerLinkMyRoleImpl target, 
PartnerLinkMyRoleImpl.RoutingInfo routing, boolean createInstance) {
-                  if (routing.messageRoute == null && createInstance) {
+                  if (routing.messageRoute == null && createInstance && 
isActive()) {
                       // No route but we can create a new instance
                       target.invokeNewInstance(mex, routing);
                       return true;
                   } else if (routing.messageRoute != null) {
                       // Found a route, hitting it
+                      
_engine.acquireInstanceLock(routing.messageRoute.getTargetInstance().getInstanceId());
                       target.invokeInstance(mex, routing);
                       return true;
                   }
                   return false;
             }
-        });
+        }, enqueue);
     }
 
     /** Several myroles can use the same service in a given process */
@@ -406,7 +412,8 @@ public class BpelProcess {
     /**
      * @see 
org.apache.ode.bpel.engine.BpelProcess#handleJobDetails(java.util.Map<java.lang.String,java.lang.Object>)
      */
-    public void handleJobDetails(JobDetails jobData) {
+    public boolean handleJobDetails(JobDetails jobData) {
+       boolean ret = true;
         try {
             _hydrationLatch.latch(1);
             markused();
@@ -422,7 +429,7 @@ public class BpelProcess {
                     __log.debug("InvokeInternal event for mexid " + 
we.getMexId());
                 }
                 MyRoleMessageExchangeImpl mex = (MyRoleMessageExchangeImpl) 
_engine.getMessageExchange(we.getMexId());
-                invokeProcess(mex);
+                ret = invokeProcess(mex, (Boolean) 
jobData.detailsExt.get("enqueue"));
             } else {
                 // Instance level events
                 ProcessInstanceDAO procInstance = 
getProcessDAO().getInstance(we.getInstanceId());
@@ -430,7 +437,7 @@ public class BpelProcess {
                     if (__log.isDebugEnabled()) {
                         __log.debug("handleJobDetails: no ProcessInstance 
found with iid " + we.getInstanceId() + "; ignoring.");
                     }
-                    return;
+                    return true;
                 }
 
                 BpelRuntimeContextImpl processInstance = 
createRuntimeContext(procInstance, null, null);
@@ -461,7 +468,7 @@ public class BpelProcess {
                         if( procInstance.getState() == 
ProcessState.STATE_COMPLETED_OK 
                                 || procInstance.getState() == 
ProcessState.STATE_COMPLETED_WITH_FAULT ) {
                             __log.debug("A matcher event was aborted. The 
process is already completed.");
-                            return;
+                            return true;
                         }
                         processInstance.matcherEvent(we.getCorrelatorId(), 
we.getCorrelationKeySet());
                 }
@@ -469,6 +476,7 @@ public class BpelProcess {
         } finally {
             _hydrationLatch.release(1);
         }
+        return ret;
     }
 
     private void setRoles(OProcess oprocess) {

Modified: 
ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/PartnerLinkMyRoleImpl.java
URL: 
http://svn.apache.org/viewvc/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/PartnerLinkMyRoleImpl.java?rev=947459&r1=947458&r2=947459&view=diff
==============================================================================
--- 
ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/PartnerLinkMyRoleImpl.java
 (original)
+++ 
ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/PartnerLinkMyRoleImpl.java
 Sun May 23 18:28:57 2010
@@ -85,6 +85,9 @@ public class PartnerLinkMyRoleImpl exten
 
     public boolean isCreateInstance(MyRoleMessageExchangeImpl mex) {
         Operation operation = getMyRoleOperation(mex.getOperationName());
+        if(operation == null) {
+               return false;
+        }
         return _plinkDef.isCreateInstanceOperation(operation);
     }
 
@@ -98,8 +101,8 @@ public class PartnerLinkMyRoleImpl exten
 
         Operation operation = getMyRoleOperation(mex.getOperationName());
         if (operation == null) {
-            __log.error(__msgs.msgUnknownOperation(mex.getOperationName(), 
_plinkDef.myRolePortType.getQName()));
-            mex.setFailure(MessageExchange.FailureType.UNKNOWN_OPERATION, 
mex.getOperationName(), null);
+//            __log.error(__msgs.msgUnknownOperation(mex.getOperationName(), 
_plinkDef.myRolePortType.getQName()));
+  //          mex.setFailure(MessageExchange.FailureType.UNKNOWN_OPERATION, 
mex.getOperationName(), null);
             return null;
         }
         setMexRole(mex);

Modified: 
ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/replayer/Replayer.java
URL: 
http://svn.apache.org/viewvc/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/replayer/Replayer.java?rev=947459&r1=947458&r2=947459&view=diff
==============================================================================
--- 
ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/replayer/Replayer.java
 (original)
+++ 
ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/replayer/Replayer.java
 Sun May 23 18:28:57 2010
@@ -270,7 +270,7 @@ public class Replayer {
                             }
                             return false;
                         }
-                    });
+                    }, true);
         } else if (we.getType() == JobType.INVOKE_RESPONSE) {
             __log.debug("reply for live communication");
             ReplayerContext ctx = findReplayedInstance(we.getInstanceId());

Modified: 
ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/replayer/ReplayerBpelRuntimeContextImpl.java
URL: 
http://svn.apache.org/viewvc/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/replayer/ReplayerBpelRuntimeContextImpl.java?rev=947459&r1=947458&r2=947459&view=diff
==============================================================================
--- 
ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/replayer/ReplayerBpelRuntimeContextImpl.java
 (original)
+++ 
ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/replayer/ReplayerBpelRuntimeContextImpl.java
 Sun May 23 18:28:57 2010
@@ -308,7 +308,7 @@ public class ReplayerBpelRuntimeContextI
                 }
                 return false;
             }
-        });
+        }, true);
 
     }
 

Modified: 
ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/replayer/ReplayerContext.java
URL: 
http://svn.apache.org/viewvc/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/replayer/ReplayerContext.java?rev=947459&r1=947458&r2=947459&view=diff
==============================================================================
--- 
ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/replayer/ReplayerContext.java
 (original)
+++ 
ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/replayer/ReplayerContext.java
 Sun May 23 18:28:57 2010
@@ -273,7 +273,7 @@ public class ReplayerContext {
                                     }
                                     return false;
                                 }
-                            });
+                            }, true);
 
                     for (int i = 1; i < exchangeList.size(); i++) {
                         Exchange e2 = exchangeList.get(i);

Modified: 
ode/trunk/dao-hibernate/src/main/java/org/apache/ode/daohib/bpel/ProcessDaoImpl.java
URL: 
http://svn.apache.org/viewvc/ode/trunk/dao-hibernate/src/main/java/org/apache/ode/daohib/bpel/ProcessDaoImpl.java?rev=947459&r1=947458&r2=947459&view=diff
==============================================================================
--- 
ode/trunk/dao-hibernate/src/main/java/org/apache/ode/daohib/bpel/ProcessDaoImpl.java
 (original)
+++ 
ode/trunk/dao-hibernate/src/main/java/org/apache/ode/daohib/bpel/ProcessDaoImpl.java
 Sun May 23 18:28:57 2010
@@ -151,10 +151,10 @@ public class ProcessDaoImpl extends Hibe
     @SuppressWarnings("unchecked")
     public void deleteProcessAndRoutes() {
         // delete routes
-        deleteByIds(HCorrelatorSelector.class, 
getSession().getNamedQuery(HCorrelatorSelector.SELECT_MESSAGE_ROUTE_IDS_BY_PROCESS).setParameter("process",
 _process).list());
+//        deleteByIds(HCorrelatorSelector.class, 
getSession().getNamedQuery(HCorrelatorSelector.SELECT_MESSAGE_ROUTE_IDS_BY_PROCESS).setParameter("process",
 _process).list());
 
         // delete process dao
-        deleteByIds(HCorrelator.class, 
getSession().getNamedQuery(HCorrelator.SELECT_CORRELATOR_IDS_BY_PROCESS).setParameter("process",
 _process).list());
+  //      deleteByIds(HCorrelator.class, 
getSession().getNamedQuery(HCorrelator.SELECT_CORRELATOR_IDS_BY_PROCESS).setParameter("process",
 _process).list());
         try {
             getSession().refresh(_process);
             getSession().delete(_process); // this deletes HCorrelator -> 
HCorrelatorSelector
@@ -296,4 +296,5 @@ public class ProcessDaoImpl extends Hibe
     public String getGuid() {
         return _process.getGuid();
     }
+    
 }


Reply via email to