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/11/20 17:26:28 UTC

svn commit: r719270 [4/4] - in /ode/branches/APACHE_ODE_1.X: axis2-war/src/test/java/org/apache/ode/axis2/correlation/ axis2-war/src/test/java/org/apache/ode/axis2/instancecleanup/ axis2-war/src/test/resources/TestCorrelationJoin/ axis2-war/src/test/re...

Added: ode/branches/APACHE_ODE_1.X/bpel-test/src/test/resources/bpel/2.0/TestCorrelationMultiJoin/test2.properties
URL: http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/bpel-test/src/test/resources/bpel/2.0/TestCorrelationMultiJoin/test2.properties?rev=719270&view=auto
==============================================================================
--- ode/branches/APACHE_ODE_1.X/bpel-test/src/test/resources/bpel/2.0/TestCorrelationMultiJoin/test2.properties (added)
+++ ode/branches/APACHE_ODE_1.X/bpel-test/src/test/resources/bpel/2.0/TestCorrelationMultiJoin/test2.properties Thu Nov 20 08:26:25 2008
@@ -0,0 +1,21 @@
+#
+#    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.
+#
+
+namespace=http://ode/bpel/unit-test/testCorrelation.wsdl
+service=testCorrelationService
+operation=continue
+request1=<message><requestMessageData><correlationID1>CORR1</correlationID1><correlationID2>CORR2</correlationID2><correlationID3>CORR3</correlationID3><requestText>2;</requestText><requestEnd>yes</requestEnd></requestMessageData></message>

Added: ode/branches/APACHE_ODE_1.X/bpel-test/src/test/resources/bpel/2.0/TestCorrelationMultiJoin/test3.properties
URL: http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/bpel-test/src/test/resources/bpel/2.0/TestCorrelationMultiJoin/test3.properties?rev=719270&view=auto
==============================================================================
--- ode/branches/APACHE_ODE_1.X/bpel-test/src/test/resources/bpel/2.0/TestCorrelationMultiJoin/test3.properties (added)
+++ ode/branches/APACHE_ODE_1.X/bpel-test/src/test/resources/bpel/2.0/TestCorrelationMultiJoin/test3.properties Thu Nov 20 08:26:25 2008
@@ -0,0 +1,21 @@
+#
+#    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.
+#
+
+namespace=http://ode/bpel/unit-test/testCorrelation.wsdl
+service=testCorrelationService
+operation=continue
+request1=<message><requestMessageData><correlationID1>CORR1</correlationID1><correlationID2>CORR2</correlationID2><correlationID3>CORR3</correlationID3><requestText>3;</requestText><requestEnd>yes</requestEnd></requestMessageData></message>

Added: ode/branches/APACHE_ODE_1.X/bpel-test/src/test/resources/bpel/2.0/TestCorrelationMultiJoin/testCorrelation.bpel
URL: http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/bpel-test/src/test/resources/bpel/2.0/TestCorrelationMultiJoin/testCorrelation.bpel?rev=719270&view=auto
==============================================================================
--- ode/branches/APACHE_ODE_1.X/bpel-test/src/test/resources/bpel/2.0/TestCorrelationMultiJoin/testCorrelation.bpel (added)
+++ ode/branches/APACHE_ODE_1.X/bpel-test/src/test/resources/bpel/2.0/TestCorrelationMultiJoin/testCorrelation.bpel Thu Nov 20 08:26:25 2008
@@ -0,0 +1,103 @@
+<!--
+	~ 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 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://docs.oasis-open.org/wsbpel/2.0/process/executable ../../../../../../../bpel-schemas/src/main/resources/wsbpel_executable.xsd"
+ xmlns:tns="http://ode/bpel/unit-test/testCorrelation"
+ xmlns:wns="http://ode/bpel/unit-test/testCorrelation.wsdl"
+ xmlns="http://docs.oasis-open.org/wsbpel/2.0/process/executable"
+ name="TestCorrelationProcess"
+ targetNamespace="http://ode/bpel/unit-test/testCorrelation"
+ queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath2.0"
+ expressionLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath2.0"
+ suppressJoinFailure="yes">
+	
+	<import location="testCorrelation.wsdl"
+		namespace="http://ode/bpel/unit-test/testCorrelation.wsdl"
+		importType="http://schemas.xmlsoap.org/wsdl/" />
+	
+	<!-- test correlated receive -->
+	<partnerLinks>
+		<partnerLink name="request" partnerLinkType="wns:testCorrelationRequest" myRole="testCorrelationService"/>
+	</partnerLinks>
+	<variables>
+		<variable name="request" messageType="wns:requestMessage"/>
+		<variable name="reply" messageType="wns:replyMessage"/>
+	</variables>
+	<correlationSets>
+		<correlationSet name="testCorr1" properties="wns:testCorrelationID1"/>
+		<correlationSet name="testCorr2" properties="wns:testCorrelationID2"/>
+		<correlationSet name="testCorr3" properties="wns:testCorrelationID3"/>
+	</correlationSets>
+	<sequence>
+		<receive name="receive1" partnerLink="request" portType="wns:testCorrelationPT" operation="request" variable="request" createInstance="yes">
+			<correlations>
+				<correlation set="testCorr1" initiate="yes"/>
+				<correlation set="testCorr2" initiate="join"/>
+			</correlations>
+		</receive>
+		<!-- Copy input variables to internal accumulators -->
+		<assign name="assign1">
+			<copy>
+				<from variable="request" property="wns:testCorrelationID1"/>
+				<to variable="reply" part="replyID"/>
+			</copy>
+			<copy>
+				<from>
+					$request.requestMessageData/requestText
+				</from>
+				<to variable="reply" part="replyText"/>
+			</copy>
+		</assign>
+
+		<receive name="receive2" partnerLink="request" portType="wns:testCorrelationPT" operation="continue" variable="request">
+			<correlations>
+				<correlation set="testCorr1" initiate="join"/>
+				<correlation set="testCorr2" initiate="join"/>
+				<correlation set="testCorr3" initiate="join"/>
+			</correlations>
+		</receive>
+		<assign>
+			<copy>
+				<from>
+					concat($reply.replyText, $request.requestMessageData/requestText)
+				</from>
+				<to variable="reply" part="replyText"/>
+			</copy>
+		</assign>
+
+		<receive name="receive3" partnerLink="request" portType="wns:testCorrelationPT" operation="continue" variable="request">
+			<correlations>
+				<correlation set="testCorr1" initiate="join"/>
+				<correlation set="testCorr2" initiate="join"/>
+				<correlation set="testCorr3" initiate="join"/>
+			</correlations>
+		</receive>
+		<assign>
+			<copy>
+				<from>
+					concat($reply.replyText, $request.requestMessageData/requestText)
+				</from>
+				<to variable="reply" part="replyText"/>
+			</copy>
+		</assign>
+
+		<reply name="reply" partnerLink="request" portType="wns:testCorrelationPT" operation="request" variable="reply"> </reply>
+	</sequence>
+</process>

Added: ode/branches/APACHE_ODE_1.X/bpel-test/src/test/resources/bpel/2.0/TestCorrelationMultiJoin/testCorrelation.wsdl
URL: http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/bpel-test/src/test/resources/bpel/2.0/TestCorrelationMultiJoin/testCorrelation.wsdl?rev=719270&view=auto
==============================================================================
--- ode/branches/APACHE_ODE_1.X/bpel-test/src/test/resources/bpel/2.0/TestCorrelationMultiJoin/testCorrelation.wsdl (added)
+++ ode/branches/APACHE_ODE_1.X/bpel-test/src/test/resources/bpel/2.0/TestCorrelationMultiJoin/testCorrelation.wsdl Thu Nov 20 08:26:25 2008
@@ -0,0 +1,106 @@
+<!--
+  ~ 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/unit-test/testCorrelation.wsdl"
+        xmlns:tns="http://ode/bpel/unit-test/testCorrelation.wsdl"
+        xmlns:typens="http://ode/bpel/unit-test/testCorrelation.wsdl.types"
+        xmlns="http://ode/bpel/unit-test/testCorrelation.wsdl"
+        xmlns:plnk="http://docs.oasis-open.org/wsbpel/2.0/plnktype"
+        xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+        xmlns:bpws="http://docs.oasis-open.org/wsbpel/2.0/process/executable"
+        xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+        xmlns:prop="http://docs.oasis-open.org/wsbpel/2.0/varprop">
+
+
+    <!-- type defs -->
+    <wsdl:types>
+        <xsd:schema
+                targetNamespace="http://ode/bpel/unit-test/testCorrelation.wsdl.types"
+                xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+
+            <xsd:complexType name="testMessage">
+                <xsd:sequence>
+                    <xsd:element name="correlationID1" type="xsd:string"/>
+                    <xsd:element name="correlationID2" type="xsd:string"/>
+                    <xsd:element name="correlationID3" type="xsd:string"/>
+                    <xsd:element name="requestText" type="xsd:string"/>
+                    <xsd:element name="requestEnd" type="xsd:string"/>
+                </xsd:sequence>
+            </xsd:complexType>
+        </xsd:schema>
+    </wsdl:types>
+
+
+    <wsdl:message name="requestMessage">
+        <wsdl:part name="requestMessageData" type="typens:testMessage"/>
+    </wsdl:message>
+
+    <wsdl:message name="replyMessage">
+        <wsdl:part name="replyID" type="xsd:string"/>
+        <wsdl:part name="replyText" type="xsd:string"/>
+    </wsdl:message>
+
+
+    <wsdl:portType name="testCorrelationPT">
+        <wsdl:operation name="request">
+            <wsdl:input message="requestMessage"/>
+            <wsdl:output message="replyMessage"/>
+        </wsdl:operation>
+        <wsdl:operation name="continue">
+            <wsdl:input message="requestMessage"/>
+        </wsdl:operation>
+    </wsdl:portType>
+
+    <wsdl:binding name="TestCorrelationBinding" type="tns:testCorrelationPT">
+        <wsdl:operation name="request">
+        </wsdl:operation>
+        <wsdl:operation name="continue">
+        </wsdl:operation>
+    </wsdl:binding>
+    <wsdl:service name="TestCorrelationService">
+        <wsdl:port name="TestCorrelationPort" binding="tns:TestCorrelationBinding">
+        </wsdl:port>
+    </wsdl:service>
+
+    <plnk:partnerLinkType name="testCorrelationRequest">
+        <plnk:role name="testCorrelationService" portType="testCorrelationPT"/>
+    </plnk:partnerLinkType>
+
+    <prop:property name="testCorrelationID1" type="xsd:string"/>
+    <prop:propertyAlias propertyName="tns:testCorrelationID1" messageType="tns:requestMessage" part="requestMessageData">
+        <prop:query queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath2.0">
+            correlationID1
+        </prop:query>
+    </prop:propertyAlias>
+
+    <prop:property name="testCorrelationID2" type="xsd:string"/>
+    <prop:propertyAlias propertyName="tns:testCorrelationID2" messageType="tns:requestMessage" part="requestMessageData">
+        <prop:query queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath2.0">
+            correlationID2
+        </prop:query>
+    </prop:propertyAlias>
+
+    <prop:property name="testCorrelationID3" type="xsd:string"/>
+    <prop:propertyAlias propertyName="tns:testCorrelationID3" messageType="tns:requestMessage" part="requestMessageData">
+        <prop:query queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath2.0">
+            correlationID3
+        </prop:query>
+    </prop:propertyAlias>
+</wsdl:definitions>
\ No newline at end of file

Added: ode/branches/APACHE_ODE_1.X/bpel-test/src/test/resources/bpel/2.0/TestCorrelationMultiNegative/deploy.xml
URL: http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/bpel-test/src/test/resources/bpel/2.0/TestCorrelationMultiNegative/deploy.xml?rev=719270&view=auto
==============================================================================
--- ode/branches/APACHE_ODE_1.X/bpel-test/src/test/resources/bpel/2.0/TestCorrelationMultiNegative/deploy.xml (added)
+++ ode/branches/APACHE_ODE_1.X/bpel-test/src/test/resources/bpel/2.0/TestCorrelationMultiNegative/deploy.xml Thu Nov 20 08:26:25 2008
@@ -0,0 +1,32 @@
+<!--
+	~ 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/unit-test/testCorrelation" 
+	xmlns:prns="http://ode/bpel/unit-test/ProbeService.wsdl"
+	xmlns:wns="http://ode/bpel/unit-test/testCorrelation.wsdl">
+
+
+	<process name="pns:TestCorrelationProcess">
+		<active>true</active>
+		<provide partnerLink="request">
+			<service name="wns:testCorrelationService" port="wns:testCorrelationPort"/>
+		</provide>
+	</process>
+</deploy>

Added: ode/branches/APACHE_ODE_1.X/bpel-test/src/test/resources/bpel/2.0/TestCorrelationMultiNegative/test1.properties
URL: http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/bpel-test/src/test/resources/bpel/2.0/TestCorrelationMultiNegative/test1.properties?rev=719270&view=auto
==============================================================================
--- ode/branches/APACHE_ODE_1.X/bpel-test/src/test/resources/bpel/2.0/TestCorrelationMultiNegative/test1.properties (added)
+++ ode/branches/APACHE_ODE_1.X/bpel-test/src/test/resources/bpel/2.0/TestCorrelationMultiNegative/test1.properties Thu Nov 20 08:26:25 2008
@@ -0,0 +1,22 @@
+#
+#    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.
+#
+
+namespace=http://ode/bpel/unit-test/testCorrelation.wsdl
+service=testCorrelationService
+operation=request
+request1=<message><requestMessageData><correlationID1>CORR1</correlationID1><correlationID2>CORR2</correlationID2><correlationID3>CORR3</correlationID3><requestText>1;</requestText><requestEnd>no</requestEnd></requestMessageData></message>
+response1=.*1;3;.*

Added: ode/branches/APACHE_ODE_1.X/bpel-test/src/test/resources/bpel/2.0/TestCorrelationMultiNegative/test2.properties
URL: http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/bpel-test/src/test/resources/bpel/2.0/TestCorrelationMultiNegative/test2.properties?rev=719270&view=auto
==============================================================================
--- ode/branches/APACHE_ODE_1.X/bpel-test/src/test/resources/bpel/2.0/TestCorrelationMultiNegative/test2.properties (added)
+++ ode/branches/APACHE_ODE_1.X/bpel-test/src/test/resources/bpel/2.0/TestCorrelationMultiNegative/test2.properties Thu Nov 20 08:26:25 2008
@@ -0,0 +1,21 @@
+#
+#    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.
+#
+
+namespace=http://ode/bpel/unit-test/testCorrelation.wsdl
+service=testCorrelationService
+operation=continue
+request1=<message><requestMessageData><correlationID1>CORR1</correlationID1><correlationID2>CORR2_DIFFERENT</correlationID2><correlationID3>CORR3</correlationID3><requestText>2;</requestText><requestEnd>yes</requestEnd></requestMessageData></message>

Added: ode/branches/APACHE_ODE_1.X/bpel-test/src/test/resources/bpel/2.0/TestCorrelationMultiNegative/test3.properties
URL: http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/bpel-test/src/test/resources/bpel/2.0/TestCorrelationMultiNegative/test3.properties?rev=719270&view=auto
==============================================================================
--- ode/branches/APACHE_ODE_1.X/bpel-test/src/test/resources/bpel/2.0/TestCorrelationMultiNegative/test3.properties (added)
+++ ode/branches/APACHE_ODE_1.X/bpel-test/src/test/resources/bpel/2.0/TestCorrelationMultiNegative/test3.properties Thu Nov 20 08:26:25 2008
@@ -0,0 +1,21 @@
+#
+#    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.
+#
+
+namespace=http://ode/bpel/unit-test/testCorrelation.wsdl
+service=testCorrelationService
+operation=continue
+request1=<message><requestMessageData><correlationID1>CORR1</correlationID1><correlationID2>CORR2</correlationID2><correlationID3>CORR3</correlationID3><requestText>3;</requestText><requestEnd>yes</requestEnd></requestMessageData></message>

Added: ode/branches/APACHE_ODE_1.X/bpel-test/src/test/resources/bpel/2.0/TestCorrelationMultiNegative/testCorrelation.bpel
URL: http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/bpel-test/src/test/resources/bpel/2.0/TestCorrelationMultiNegative/testCorrelation.bpel?rev=719270&view=auto
==============================================================================
--- ode/branches/APACHE_ODE_1.X/bpel-test/src/test/resources/bpel/2.0/TestCorrelationMultiNegative/testCorrelation.bpel (added)
+++ ode/branches/APACHE_ODE_1.X/bpel-test/src/test/resources/bpel/2.0/TestCorrelationMultiNegative/testCorrelation.bpel Thu Nov 20 08:26:25 2008
@@ -0,0 +1,87 @@
+<!--
+	~ 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 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://docs.oasis-open.org/wsbpel/2.0/process/executable ../../../../../../../bpel-schemas/src/main/resources/wsbpel_executable.xsd"
+ xmlns:tns="http://ode/bpel/unit-test/testCorrelation"
+ xmlns:wns="http://ode/bpel/unit-test/testCorrelation.wsdl"
+ xmlns="http://docs.oasis-open.org/wsbpel/2.0/process/executable"
+ name="TestCorrelationProcess"
+ targetNamespace="http://ode/bpel/unit-test/testCorrelation"
+ queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath2.0"
+ expressionLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath2.0"
+ suppressJoinFailure="yes">
+	
+	<import location="testCorrelation.wsdl"
+		namespace="http://ode/bpel/unit-test/testCorrelation.wsdl"
+		importType="http://schemas.xmlsoap.org/wsdl/" />
+	
+	<!-- test correlated receive -->
+	<partnerLinks>
+		<partnerLink name="request" partnerLinkType="wns:testCorrelationRequest" myRole="testCorrelationService"/>
+	</partnerLinks>
+	<variables>
+		<variable name="request" messageType="wns:requestMessage"/>
+		<variable name="reply" messageType="wns:replyMessage"/>
+	</variables>
+	<correlationSets>
+		<correlationSet name="testCorr1" properties="wns:testCorrelationID1"/>
+		<correlationSet name="testCorr2" properties="wns:testCorrelationID2"/>
+		<correlationSet name="testCorr3" properties="wns:testCorrelationID3"/>
+	</correlationSets>
+	<sequence>
+		<receive name="receive1" partnerLink="request" portType="wns:testCorrelationPT" operation="request" variable="request" createInstance="yes">
+			<correlations>
+				<correlation set="testCorr1" initiate="yes"/>
+				<correlation set="testCorr2" initiate="yes"/>
+			</correlations>
+		</receive>
+		<!-- Copy input variables to internal accumulators -->
+		<assign name="assign1">
+			<copy>
+				<from variable="request" property="wns:testCorrelationID1"/>
+				<to variable="reply" part="replyID"/>
+			</copy>
+			<copy>
+				<from>
+					$request.requestMessageData/requestText
+				</from>
+				<to variable="reply" part="replyText"/>
+			</copy>
+		</assign>
+
+		<receive name="receive2" partnerLink="request" portType="wns:testCorrelationPT" operation="continue" variable="request">
+			<correlations>
+				<correlation set="testCorr1" initiate="no"/>
+				<correlation set="testCorr2" initiate="no"/>
+				<correlation set="testCorr3" initiate="yes"/>
+			</correlations>
+		</receive>
+		<assign>
+			<copy>
+				<from>
+					concat($reply.replyText, $request.requestMessageData/requestText)
+				</from>
+				<to variable="reply" part="replyText"/>
+			</copy>
+		</assign>
+
+		<reply name="reply" partnerLink="request" portType="wns:testCorrelationPT" operation="request" variable="reply"> </reply>
+	</sequence>
+</process>

Added: ode/branches/APACHE_ODE_1.X/bpel-test/src/test/resources/bpel/2.0/TestCorrelationMultiNegative/testCorrelation.wsdl
URL: http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/bpel-test/src/test/resources/bpel/2.0/TestCorrelationMultiNegative/testCorrelation.wsdl?rev=719270&view=auto
==============================================================================
--- ode/branches/APACHE_ODE_1.X/bpel-test/src/test/resources/bpel/2.0/TestCorrelationMultiNegative/testCorrelation.wsdl (added)
+++ ode/branches/APACHE_ODE_1.X/bpel-test/src/test/resources/bpel/2.0/TestCorrelationMultiNegative/testCorrelation.wsdl Thu Nov 20 08:26:25 2008
@@ -0,0 +1,106 @@
+<!--
+  ~ 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/unit-test/testCorrelation.wsdl"
+        xmlns:tns="http://ode/bpel/unit-test/testCorrelation.wsdl"
+        xmlns:typens="http://ode/bpel/unit-test/testCorrelation.wsdl.types"
+        xmlns="http://ode/bpel/unit-test/testCorrelation.wsdl"
+        xmlns:plnk="http://docs.oasis-open.org/wsbpel/2.0/plnktype"
+        xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+        xmlns:bpws="http://docs.oasis-open.org/wsbpel/2.0/process/executable"
+        xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+        xmlns:prop="http://docs.oasis-open.org/wsbpel/2.0/varprop">
+
+
+    <!-- type defs -->
+    <wsdl:types>
+        <xsd:schema
+                targetNamespace="http://ode/bpel/unit-test/testCorrelation.wsdl.types"
+                xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+
+            <xsd:complexType name="testMessage">
+                <xsd:sequence>
+                    <xsd:element name="correlationID1" type="xsd:string"/>
+                    <xsd:element name="correlationID2" type="xsd:string"/>
+                    <xsd:element name="correlationID3" type="xsd:string"/>
+                    <xsd:element name="requestText" type="xsd:string"/>
+                    <xsd:element name="requestEnd" type="xsd:string"/>
+                </xsd:sequence>
+            </xsd:complexType>
+        </xsd:schema>
+    </wsdl:types>
+
+
+    <wsdl:message name="requestMessage">
+        <wsdl:part name="requestMessageData" type="typens:testMessage"/>
+    </wsdl:message>
+
+    <wsdl:message name="replyMessage">
+        <wsdl:part name="replyID" type="xsd:string"/>
+        <wsdl:part name="replyText" type="xsd:string"/>
+    </wsdl:message>
+
+
+    <wsdl:portType name="testCorrelationPT">
+        <wsdl:operation name="request">
+            <wsdl:input message="requestMessage"/>
+            <wsdl:output message="replyMessage"/>
+        </wsdl:operation>
+        <wsdl:operation name="continue">
+            <wsdl:input message="requestMessage"/>
+        </wsdl:operation>
+    </wsdl:portType>
+
+    <wsdl:binding name="TestCorrelationBinding" type="tns:testCorrelationPT">
+        <wsdl:operation name="request">
+        </wsdl:operation>
+        <wsdl:operation name="continue">
+        </wsdl:operation>
+    </wsdl:binding>
+    <wsdl:service name="TestCorrelationService">
+        <wsdl:port name="TestCorrelationPort" binding="tns:TestCorrelationBinding">
+        </wsdl:port>
+    </wsdl:service>
+
+    <plnk:partnerLinkType name="testCorrelationRequest">
+        <plnk:role name="testCorrelationService" portType="testCorrelationPT"/>
+    </plnk:partnerLinkType>
+
+    <prop:property name="testCorrelationID1" type="xsd:string"/>
+    <prop:propertyAlias propertyName="tns:testCorrelationID1" messageType="tns:requestMessage" part="requestMessageData">
+        <prop:query queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath2.0">
+            correlationID1
+        </prop:query>
+    </prop:propertyAlias>
+
+    <prop:property name="testCorrelationID2" type="xsd:string"/>
+    <prop:propertyAlias propertyName="tns:testCorrelationID2" messageType="tns:requestMessage" part="requestMessageData">
+        <prop:query queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath2.0">
+            correlationID2
+        </prop:query>
+    </prop:propertyAlias>
+
+    <prop:property name="testCorrelationID3" type="xsd:string"/>
+    <prop:propertyAlias propertyName="tns:testCorrelationID3" messageType="tns:requestMessage" part="requestMessageData">
+        <prop:query queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath2.0">
+            correlationID3
+        </prop:query>
+    </prop:propertyAlias>
+</wsdl:definitions>
\ No newline at end of file

Modified: ode/branches/APACHE_ODE_1.X/dao-hibernate/src/main/java/org/apache/ode/daohib/bpel/CorrelatorDaoImpl.java
URL: http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/dao-hibernate/src/main/java/org/apache/ode/daohib/bpel/CorrelatorDaoImpl.java?rev=719270&r1=719269&r2=719270&view=diff
==============================================================================
--- ode/branches/APACHE_ODE_1.X/dao-hibernate/src/main/java/org/apache/ode/daohib/bpel/CorrelatorDaoImpl.java (original)
+++ ode/branches/APACHE_ODE_1.X/dao-hibernate/src/main/java/org/apache/ode/daohib/bpel/CorrelatorDaoImpl.java Thu Nov 20 08:26:25 2008
@@ -26,6 +26,7 @@
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.ode.bpel.common.CorrelationKey;
+import org.apache.ode.bpel.common.CorrelationKeySet;
 import org.apache.ode.bpel.dao.CorrelatorDAO;
 import org.apache.ode.bpel.dao.MessageExchangeDAO;
 import org.apache.ode.bpel.dao.MessageRouteDAO;
@@ -36,7 +37,6 @@
 import org.apache.ode.daohib.bpel.hobj.HCorrelatorSelector;
 import org.apache.ode.daohib.bpel.hobj.HMessageExchange;
 import org.apache.ode.daohib.bpel.hobj.HProcessInstance;
-import org.apache.ode.utils.CollectionUtils;
 import org.hibernate.Hibernate;
 import org.hibernate.LockMode;
 import org.hibernate.Query;
@@ -47,28 +47,14 @@
  * Hibernate-based {@link CorrelatorDAO} implementation.
  */
 class CorrelatorDaoImpl extends HibernateDao implements CorrelatorDAO {
-
-    /** 
-     * Note: the hk.messageExchange=null is a hack to get around a Hibernate bug where the query
-     * does not properly discriminate for the proper subclass.
-     */
-    private static final String QRY_MESSAGE = " where this.correlationKey = ?".intern();
+    static Log __log = LogFactory.getLog(CorrelatorDaoImpl.class);
 
     /** filter for finding a matching selector. */
-    private static final String FLTR_SELECTORS = ("from " + HCorrelatorSelector.class.getName()
-            + " hs where hs.correlationKey like ? and hs.processType = ? and hs.correlator.correlatorId = ?").intern();
+    private static final String LOCK_SELECTORS = "update from HCorrelatorSelector as hs set hs.lock = hs.lock+1 where hs.processType = :processType";
+    private static final String FLTR_SELECTORS = "from HCorrelatorSelector as hs where hs.processType = :processType and hs.correlator.correlatorId = :correlatorId";
 
-    private static final String LOCK_SELECTORS = "update from " + HCorrelatorSelector.class.getName() +
-        " set lock = lock+1 where correlationKey like ? and processType = ?".intern();
-    
     /** Query for removing routes. */
-    private static final String QRY_DELSELECTORS = "delete from " + HCorrelatorSelector.class.getName()
-            + " where groupId = ? and instance = ?".intern();
-
-    private static final String QRY_DELMESSAGES = "delete from " + HCorrelatorMessage.class.getName()
-            + " where messageExchange = ?".intern();
-
-    static Log __log = LogFactory.getLog(CorrelatorDaoImpl.class);
+    private static final String QRY_DELSELECTORS = "delete from HCorrelatorSelector where groupId = ? and instance = ?";
 
     private HCorrelator _hobj;
 
@@ -78,13 +64,21 @@
         _hobj = hobj;
     }
 
-    public MessageExchangeDAO dequeueMessage(CorrelationKey key) {
+    @SuppressWarnings("unchecked")
+    public MessageExchangeDAO dequeueMessage(CorrelationKeySet keySet) {
         entering("CorrelatorDaoImpl.dequeueMessage");
-        String hdr = "dequeueMessage(" + key + "): ";
+        
+        MessageExchangeDAO mex = null;
+        
+        String hdr = "dequeueMessage(" + keySet + "): ";
         __log.debug(hdr);
 
-        Query qry = getSession().createFilter(_hobj.getMessageCorrelations(), QRY_MESSAGE);
-        qry.setString(0, key.toCanonicalString());
+        List<CorrelationKeySet> subSets = keySet.findSubSets();
+        Query qry = getSession().createFilter(_hobj.getMessageCorrelations(), 
+        		generateUnmatchedQuery(subSets));
+    	for( int i = 0; i < subSets.size(); i++ ) {
+    		qry.setString("s" + i, subSets.get(i).toCanonicalString());
+    	}
         
         // 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
@@ -93,23 +87,24 @@
         try {
             if (!mcors.hasNext()) {
                 __log.debug(hdr + "did not find a MESSAGE entry.");
-                return null;
+            } else {
+	            HCorrelatorMessage mcor = (HCorrelatorMessage) mcors.next();
+	            __log.debug(hdr + "found MESSAGE entry " + mcor.getMessageExchange());
+	            mex = new MessageExchangeDaoImpl(_sm, mcor.getMessageExchange());
             }
-    
-            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);
         }
+        
+        return mex;
     }
 
-    public List<MessageRouteDAO> findRoute(CorrelationKey key) {
+    @SuppressWarnings("unchecked")
+    public List<MessageRouteDAO> findRoute(CorrelationKeySet keySet) {
     	List<MessageRouteDAO> routes = new ArrayList<MessageRouteDAO>();
     	
         entering("CorrelatorDaoImpl.findRoute");
-        String hdr = "findRoute(key=" + key + "): ";
+        String hdr = "findRoute(keySet=" + keySet + "): ";
         if (__log.isDebugEnabled())
             __log.debug(hdr);
 
@@ -119,15 +114,21 @@
         // resulting cursor, or for the lifetime of the transaction. So really, an UPDATE of the row
         // is a much safer alternative.
         String processType = new QName(_hobj.getProcess().getTypeNamespace(), _hobj.getProcess().getTypeName()).toString();
-        Query lockQry = getSession().createQuery(LOCK_SELECTORS);
-        lockQry.setString(0, key == null ? "%" : key.toCanonicalString());
-        lockQry.setString(1, processType);
+    	List<CorrelationKeySet> subSets = keySet.findSubSets();
+        Query lockQry = getSession().createQuery(generateSelectorQuery(LOCK_SELECTORS, subSets));
+        lockQry.setString("processType", processType);
+    	for( int i = 0; i < subSets.size(); i++ ) {
+    		lockQry.setString("s" + i, subSets.get(i).toCanonicalString());
+    	}
         if (lockQry.executeUpdate() > 0) {
+            Query q = getSession().createQuery(generateSelectorQuery(FLTR_SELECTORS, subSets));
             
-            Query q = getSession().createQuery(FLTR_SELECTORS);
-            q.setString(0, key == null ? "%" : key.toCanonicalString());
-            q.setString(1, processType);
-            q.setString(2, _hobj.getCorrelatorId());
+            q.setString("processType", processType);
+            q.setString("correlatorId", _hobj.getCorrelatorId());
+
+        	for( int i = 0; i < subSets.size(); i++ ) {
+        		q.setString("s" + i, subSets.get(i).toCanonicalString());
+        	}
             q.setLockMode("hs", LockMode.UPGRADE);
 
             HCorrelatorSelector selector;
@@ -160,54 +161,81 @@
         return null;
     }
 
-    public void enqueueMessage(MessageExchangeDAO mex, CorrelationKey[] correlationKeys) {
+    private String generateUnmatchedQuery(List<CorrelationKeySet> subSets) {
+    	StringBuffer filterQuery = new StringBuffer();
+    	
+    	if( subSets.size() == 1 ) {
+    		filterQuery.append(" where this.correlationKey = :s0");
+    	} else if( subSets.size() > 1 ) {
+    		filterQuery.append(" where this.correlationKey in(");
+        	for( int i = 0; i < subSets.size(); i++ ) {
+        		if( i > 0 ) {
+        			filterQuery.append(", ");
+        		}
+        		filterQuery.append(":s").append(i);
+        	}
+        	filterQuery.append(")");
+    	}
+    	
+    	return filterQuery.toString();
+    }
+    
+    private String generateSelectorQuery(String header, List<CorrelationKeySet> subSets) {
+    	StringBuffer filterQuery = new StringBuffer(header);
+    	
+    	if( subSets.size() == 1 ) {
+    		filterQuery.append(" and hs.correlationKey = :s0");
+    	} else if( subSets.size() > 1 ) {
+    		filterQuery.append(" and hs.correlationKey in(");
+        	for( int i = 0; i < subSets.size(); i++ ) {
+        		if( i > 0 ) {
+        			filterQuery.append(", ");
+        		}
+        		filterQuery.append(":s").append(i);
+        	}
+        	filterQuery.append(")");
+    	}
+    	
+    	return filterQuery.toString();
+    }
+    
+    public void enqueueMessage(MessageExchangeDAO mex, CorrelationKeySet correlationKeySet) {
         entering("CorrelatorDaoImpl.enqueueMessage");
-        String[] keys = canonifyKeys(correlationKeys);
-        String hdr = "enqueueMessage(mex=" + ((MessageExchangeDaoImpl) mex)._hobj.getId() + " keys="
-                + CollectionUtils.makeCollection(ArrayList.class, keys) + "): ";
+        String hdr = "enqueueMessage(mex=" + ((MessageExchangeDaoImpl) mex)._hobj.getId() + " keySet="
+                + correlationKeySet.toCanonicalString() + "): ";
 
         if (__log.isDebugEnabled())
             __log.debug(hdr);
 
-        for (String key : keys) {
+        for( CorrelationKeySet aSubSet : correlationKeySet.findSubSets() ) {
             HCorrelatorMessage mcor = new HCorrelatorMessage();
             mcor.setCorrelator(_hobj);
             mcor.setCreated(new Date());
-            mcor.setCorrelationKey(key);
             mcor.setMessageExchange((HMessageExchange) ((MessageExchangeDaoImpl) mex)._hobj);
+            mcor.setCorrelationKey(aSubSet.toCanonicalString());
             getSession().save(mcor);
-
+            
             if (__log.isDebugEnabled())
                 __log.debug(hdr + "saved " + mcor);
         }
-
-    }
-
-    private String[] canonifyKeys(CorrelationKey[] keys) {
-        String[] ret = new String[keys.length];
-        for (int i = 0; i < ret.length; ++i) {
-            ret[i] = keys[i].toCanonicalString();
-        }
-        return ret;
     }
 
-    public void addRoute(String routeGroupId, ProcessInstanceDAO target, int idx, CorrelationKey correlationKey, String routePolicy) {
+    public void addRoute(String routeGroupId, ProcessInstanceDAO target, int idx, CorrelationKeySet correlationKeySet, String routePolicy) {
         entering("CorrelatorDaoImpl.addRoute");
-        String hdr = "addRoute(" + routeGroupId + ", iid=" + target.getInstanceId() + ", idx=" + idx + ", ckey="
-                + correlationKey + "): ";
+        String hdr = "addRoute(" + routeGroupId + ", iid=" + target.getInstanceId() + ", idx=" + idx + ", ckeySet="
+                + correlationKeySet + "): ";
 
         __log.debug(hdr);
         HCorrelatorSelector hsel = new HCorrelatorSelector();
         hsel.setGroupId(routeGroupId);
         hsel.setIndex(idx);
         hsel.setLock(0);
-        hsel.setCorrelationKey(correlationKey.toCanonicalString());
+        hsel.setCorrelationKey(correlationKeySet.toCanonicalString());
         hsel.setInstance((HProcessInstance) ((ProcessInstanceDaoImpl) target).getHibernateObj());
         hsel.setProcessType(target.getProcess().getType().toString());
         hsel.setCorrelator(_hobj);
         hsel.setCreated(new Date());
         hsel.setRoute(routePolicy);
-//        _hobj.addSelector(hsel);
         getSession().save(hsel);
 
         __log.debug(hdr + "saved " + hsel);
@@ -235,18 +263,5 @@
         q.setEntity(1, ((ProcessInstanceDaoImpl) target).getHibernateObj()); // instance
         int updates = q.executeUpdate();
         __log.debug(hdr + "deleted " + updates + " rows");
-
-    }
-
-    public void removeEntries(HMessageExchange mex) {
-        entering("CorrelatorDaoImpl.removeEntries");
-        String hdr = "removeEntries(" + mex + "): ";
-        __log.debug(hdr);
-
-        Query q = getSession().createQuery(QRY_DELMESSAGES);
-        q.setEntity(0, mex); // messageExchange
-        int numMods = q.executeUpdate();
-        __log.debug(hdr + " deleted " + numMods + " rows");
     }
-
-}
+}
\ No newline at end of file

Modified: ode/branches/APACHE_ODE_1.X/dao-hibernate/src/main/java/org/apache/ode/daohib/bpel/MessageRouteDaoImpl.java
URL: http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/dao-hibernate/src/main/java/org/apache/ode/daohib/bpel/MessageRouteDaoImpl.java?rev=719270&r1=719269&r2=719270&view=diff
==============================================================================
--- ode/branches/APACHE_ODE_1.X/dao-hibernate/src/main/java/org/apache/ode/daohib/bpel/MessageRouteDaoImpl.java (original)
+++ ode/branches/APACHE_ODE_1.X/dao-hibernate/src/main/java/org/apache/ode/daohib/bpel/MessageRouteDaoImpl.java Thu Nov 20 08:26:25 2008
@@ -18,6 +18,7 @@
  */
 package org.apache.ode.daohib.bpel;
 
+import org.apache.ode.bpel.common.CorrelationKeySet;
 import org.apache.ode.bpel.dao.MessageRouteDAO;
 import org.apache.ode.bpel.dao.ProcessInstanceDAO;
 import org.apache.ode.daohib.SessionManager;
@@ -74,4 +75,7 @@
     	return _selector.getRoute();
     }
 
+	public CorrelationKeySet getCorrelationKeySet() {
+		return new CorrelationKeySet(_selector.getCorrelationKey());
+	}
 }

Modified: ode/branches/APACHE_ODE_1.X/dao-hibernate/src/main/java/org/apache/ode/daohib/bpel/ProcessInstanceDaoImpl.java
URL: http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/dao-hibernate/src/main/java/org/apache/ode/daohib/bpel/ProcessInstanceDaoImpl.java?rev=719270&r1=719269&r2=719270&view=diff
==============================================================================
--- ode/branches/APACHE_ODE_1.X/dao-hibernate/src/main/java/org/apache/ode/daohib/bpel/ProcessInstanceDaoImpl.java (original)
+++ ode/branches/APACHE_ODE_1.X/dao-hibernate/src/main/java/org/apache/ode/daohib/bpel/ProcessInstanceDaoImpl.java Thu Nov 20 08:26:25 2008
@@ -325,7 +325,9 @@
       entering("ProcessInstanceDaoImpl.delete");
 	  if(__log.isDebugEnabled()) __log.debug("Cleaning up instance data with categories = " + cleanupCategories);
       
-	  getSession().delete(_instance.getJacobState());
+	  if( _instance.getJacobState() != null ) {
+		  getSession().delete(_instance.getJacobState());
+	  }
 	  
       if( cleanupCategories.contains(CLEANUP_CATEGORY.EVENTS) ) {
     	  deleteEvents();
@@ -374,6 +376,11 @@
   	}
 
     private void deleteMessages() {
+    	// there are chances that some unmatched messages are still there
+  		getSession().getNamedQuery(HLargeData.DELETE_UNMATCHED_MESSAGE_LDATA_BY_INSTANCE).setParameter("instance", _instance).setParameter("instance2", _instance).executeUpdate();
+  		getSession().getNamedQuery(HMessageExchange.DELETE_UNMATCHED_MEX_BY_INSTANCE).setParameter("instance", _instance).executeUpdate();
+  		getSession().getNamedQuery(HCorrelatorMessage.DELETE_CORMESSAGES_BY_INSTANCE).setParameter("instance", _instance).executeUpdate();
+
   		getSession().getNamedQuery(HCorrelatorSelector.DELETE_MESSAGE_ROUTES_BY_INSTANCE).setParameter ("instance", _instance).executeUpdate();
   	}
   

Modified: ode/branches/APACHE_ODE_1.X/dao-hibernate/src/main/java/org/apache/ode/daohib/bpel/hobj/HCorrelatorMessage.java
URL: http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/dao-hibernate/src/main/java/org/apache/ode/daohib/bpel/hobj/HCorrelatorMessage.java?rev=719270&r1=719269&r2=719270&view=diff
==============================================================================
--- ode/branches/APACHE_ODE_1.X/dao-hibernate/src/main/java/org/apache/ode/daohib/bpel/hobj/HCorrelatorMessage.java (original)
+++ ode/branches/APACHE_ODE_1.X/dao-hibernate/src/main/java/org/apache/ode/daohib/bpel/hobj/HCorrelatorMessage.java Thu Nov 20 08:26:25 2008
@@ -22,11 +22,13 @@
 /**
  * @hibernate.class table="BPEL_UNMATCHED" lazy="true"
  * @hibernate.query name="DELETE_CORMESSAGES_BY_PROCESS" query="delete from HCorrelatorMessage as m where m.correlator in(select c from HCorrelator as c where c.process = :process)"
+ * @hibernate.query name="DELETE_CORMESSAGES_BY_INSTANCE" query="delete from HCorrelatorMessage as m where m.messageExchange in(select mex from HMessageExchange as mex where mex.instance = :instance)"
  * @hibernate.query name="DELETE_CORMESSAGES_BY_MEX" query="delete from HCorrelatorMessage as m where m.messageExchange = :mex"
  */
 public class HCorrelatorMessage extends HObject {
 	public final static String DELETE_CORMESSAGES_BY_PROCESS = "DELETE_CORMESSAGES_BY_PROCESS";
 	public final static String DELETE_CORMESSAGES_BY_MEX = "DELETE_CORMESSAGES_BY_MEX";
+	public final static String DELETE_CORMESSAGES_BY_INSTANCE = "DELETE_CORMESSAGES_BY_INSTANCE";
 	
     private HMessageExchange _messageExchange;
     private HCorrelator _correlator;

Modified: ode/branches/APACHE_ODE_1.X/dao-hibernate/src/main/java/org/apache/ode/daohib/bpel/hobj/HLargeData.java
URL: http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/dao-hibernate/src/main/java/org/apache/ode/daohib/bpel/hobj/HLargeData.java?rev=719270&r1=719269&r2=719270&view=diff
==============================================================================
--- ode/branches/APACHE_ODE_1.X/dao-hibernate/src/main/java/org/apache/ode/daohib/bpel/hobj/HLargeData.java (original)
+++ ode/branches/APACHE_ODE_1.X/dao-hibernate/src/main/java/org/apache/ode/daohib/bpel/hobj/HLargeData.java Thu Nov 20 08:26:25 2008
@@ -35,6 +35,7 @@
  * 
  * @hibernate.query name="DELETE_EVENT_LDATA_BY_INSTANCE" query="delete from HLargeData as d where d in(select e.data from HBpelEvent as e where e.instance = :instance)"
  * @hibernate.query name="DELETE_MESSAGE_LDATA_BY_MEX" query="delete from HLargeData as d where d in(select m.messageData from HMessage m where m.messageExchange = :mex) or d IN(select m.header from HMessage m where m.messageExchange = :mex2)"
+ * @hibernate.query name="DELETE_UNMATCHED_MESSAGE_LDATA_BY_INSTANCE" query="delete from HLargeData as d where d in(select m.messageData from HMessage m, HCorrelatorMessage cm where m.messageExchange = cm.messageExchange and m.messageExchange.instance = :instance) or d IN(select m.header from HMessage m, HCorrelatorMessage cm where m.messageExchange = cm.messageExchange and m.messageExchange.instance = :instance2)"
  * @hibernate.query name="DELETE_XMLDATA_LDATA_BY_INSTANCE" query="delete from HLargeData as d where d in(select x.data from HXmlData as x where x.instance = :instance)"
  * @hibernate.query name="DELETE_PARTNER_LINK_LDATA_BY_INSTANCE" query="delete from HLargeData as d where d in(select l.myEPR from HPartnerLink as l where l.scope.instance = :instance) or d IN(select l.partnerEPR from HPartnerLink as l where l.scope.instance = :instance2)"
  * @hibernate.query name="DELETE_FAULT_LDATA_BY_INSTANCE_ID" query="delete from HLargeData as d where d in(select f.data from HFaultData as f, HProcessInstance as i where f.id = i.fault and i.id = :instanceId)"
@@ -51,6 +52,7 @@
 
 	public final static String DELETE_EVENT_LDATA_BY_INSTANCE = "DELETE_EVENT_LDATA_BY_INSTANCE";
 	public final static String DELETE_MESSAGE_LDATA_BY_MEX = "DELETE_MESSAGE_LDATA_BY_MEX";
+	public final static String DELETE_UNMATCHED_MESSAGE_LDATA_BY_INSTANCE = "DELETE_UNMATCHED_MESSAGE_LDATA_BY_INSTANCE";
 	public final static String DELETE_XMLDATA_LDATA_BY_INSTANCE = "DELETE_XMLDATA_LDATA_BY_INSTANCE";
 	public final static String DELETE_PARTNER_LINK_LDATA_BY_INSTANCE = "DELETE_PARTNER_LINK_LDATA_BY_INSTANCE";
 	public final static String DELETE_FAULT_LDATA_BY_INSTANCE_ID = "DELETE_FAULT_LDATA_BY_INSTANCE_ID";

Modified: ode/branches/APACHE_ODE_1.X/dao-hibernate/src/main/java/org/apache/ode/daohib/bpel/hobj/HMessageExchange.java
URL: http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/dao-hibernate/src/main/java/org/apache/ode/daohib/bpel/hobj/HMessageExchange.java?rev=719270&r1=719269&r2=719270&view=diff
==============================================================================
--- ode/branches/APACHE_ODE_1.X/dao-hibernate/src/main/java/org/apache/ode/daohib/bpel/hobj/HMessageExchange.java (original)
+++ ode/branches/APACHE_ODE_1.X/dao-hibernate/src/main/java/org/apache/ode/daohib/bpel/hobj/HMessageExchange.java Thu Nov 20 08:26:25 2008
@@ -28,11 +28,13 @@
  * 
  * @hibernate.class table="BPEL_MESSAGE_EXCHANGE" dynamic-update="true"
  * @hibernate.query name="DELETE_MEX_BY_INSTANCE" query="delete from HMessageExchange as m where m.instance = :instance"
+ * @hibernate.query name="DELETE_UNMATCHED_MEX_BY_INSTANCE" query="delete from HMessageExchange as m where m in(select cm.messageExchange from HCorrelatorMessage as cm where cm.messageExchange.instance = :instance)"
  * @hibernate.query name="DELETE_MEX_BY_PROCESS" query="delete from HMessageExchange as m where m.process = :process"
  * hibernate.query name="DELETE_MEX_PROPERTIES_BY_PROCESS" query="delete from HMessageExchange.properties as m where key(m).process = :process"
  */
 public class HMessageExchange extends HObject {
 	public final static String DELETE_MEX_BY_INSTANCE = "DELETE_MEX_BY_INSTANCE";
+	public final static String DELETE_UNMATCHED_MEX_BY_INSTANCE = "DELETE_UNMATCHED_MEX_BY_INSTANCE";
 	public final static String DELETE_MEX_BY_PROCESS = "DELETE_MEX_BY_PROCESS";
 
     private String _channelName;

Modified: ode/branches/APACHE_ODE_1.X/dao-jpa-ojpa-derby/src/test/java/org/apache/ode/dao/jpa/test/InsertObjectTest.java
URL: http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/dao-jpa-ojpa-derby/src/test/java/org/apache/ode/dao/jpa/test/InsertObjectTest.java?rev=719270&r1=719269&r2=719270&view=diff
==============================================================================
--- ode/branches/APACHE_ODE_1.X/dao-jpa-ojpa-derby/src/test/java/org/apache/ode/dao/jpa/test/InsertObjectTest.java (original)
+++ ode/branches/APACHE_ODE_1.X/dao-jpa-ojpa-derby/src/test/java/org/apache/ode/dao/jpa/test/InsertObjectTest.java Thu Nov 20 08:26:25 2008
@@ -21,6 +21,7 @@
 
 import junit.framework.TestCase;
 import org.apache.ode.bpel.common.CorrelationKey;
+import org.apache.ode.bpel.common.CorrelationKeySet;
 import org.apache.ode.bpel.dao.BpelDAOConnection;
 import org.apache.ode.bpel.dao.CorrelationSetDAO;
 import org.apache.ode.bpel.dao.CorrelatorDAO;
@@ -183,8 +184,8 @@
 		
 		MessageExchangeDAO mex = createMessageExchange(process,pi,pl1);
 		
-		corr.addRoute("testRoute", pi, 1, key1, "one");
-		corr.enqueueMessage(mex, corrkeys);
+		corr.addRoute("testRoute", pi, 1, new CorrelationKeySet().add(key1), "one");
+		corr.enqueueMessage(mex, new CorrelationKeySet().add(corrkeys[0]).add(corrkeys[1]));
 		
 		return pi;
 	}

Modified: ode/branches/APACHE_ODE_1.X/dao-jpa-ojpa-derby/src/test/java/org/apache/ode/dao/jpa/test/SelectObjectTest.java
URL: http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/dao-jpa-ojpa-derby/src/test/java/org/apache/ode/dao/jpa/test/SelectObjectTest.java?rev=719270&r1=719269&r2=719270&view=diff
==============================================================================
--- ode/branches/APACHE_ODE_1.X/dao-jpa-ojpa-derby/src/test/java/org/apache/ode/dao/jpa/test/SelectObjectTest.java (original)
+++ ode/branches/APACHE_ODE_1.X/dao-jpa-ojpa-derby/src/test/java/org/apache/ode/dao/jpa/test/SelectObjectTest.java Thu Nov 20 08:26:25 2008
@@ -21,6 +21,7 @@
 
 import junit.framework.TestCase;
 import org.apache.ode.bpel.common.CorrelationKey;
+import org.apache.ode.bpel.common.CorrelationKeySet;
 import org.apache.ode.bpel.dao.ActivityRecoveryDAO;
 import org.apache.ode.bpel.dao.BpelDAOConnection;
 import org.apache.ode.bpel.dao.CorrelationSetDAO;
@@ -106,7 +107,7 @@
 		assertEquals(corr.getCorrelatorId(),CORRELATOR_ID1);
 		
 		// Assert the MessageRouteDAO
-		List<MessageRouteDAO> routes = corr.findRoute(key1);
+		List<MessageRouteDAO> routes = corr.findRoute(new CorrelationKeySet().add(key1));
         MessageRouteDAO route = null;
         if (routes != null && routes.size() > 0) {
             route = routes.get(0);
@@ -202,7 +203,7 @@
 			assertNotNull(ic);
 			assertEquals(ic.getCorrelatorId(),CORRELATOR_ID1);
 			// The message is dequeued but not persisted
-			MessageExchangeDAO me = ic.dequeueMessage(key1);
+			MessageExchangeDAO me = ic.dequeueMessage(new CorrelationKeySet().add(key1));
 			assertNotNull(me);
 			assertEquals(me.getCallee(),new QName(TEST_NS,"testCallee"));
 			assertEquals(me.getPropagateTransactionFlag(),false);

Modified: ode/branches/APACHE_ODE_1.X/dao-jpa/src/main/java/org/apache/ode/dao/jpa/CorrelatorDAOImpl.java
URL: http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/dao-jpa/src/main/java/org/apache/ode/dao/jpa/CorrelatorDAOImpl.java?rev=719270&r1=719269&r2=719270&view=diff
==============================================================================
--- ode/branches/APACHE_ODE_1.X/dao-jpa/src/main/java/org/apache/ode/dao/jpa/CorrelatorDAOImpl.java (original)
+++ ode/branches/APACHE_ODE_1.X/dao-jpa/src/main/java/org/apache/ode/dao/jpa/CorrelatorDAOImpl.java Thu Nov 20 08:26:25 2008
@@ -19,7 +19,7 @@
 
 package org.apache.ode.dao.jpa;
 
-import org.apache.ode.bpel.common.CorrelationKey;
+import org.apache.ode.bpel.common.CorrelationKeySet;
 import org.apache.ode.bpel.dao.CorrelatorDAO;
 import org.apache.ode.bpel.dao.MessageExchangeDAO;
 import org.apache.ode.bpel.dao.MessageRouteDAO;
@@ -34,11 +34,11 @@
 @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 and route._correlator._correlatorKey = :corrkey"),
     @NamedQuery(name=CorrelatorDAOImpl.DELETE_CORRELATORS_BY_PROCESS, query="delete from CorrelatorDAOImpl as c where c._process = :process")
 })
 public class CorrelatorDAOImpl extends OpenJPADAO implements CorrelatorDAO {
 	public final static String DELETE_CORRELATORS_BY_PROCESS = "DELETE_CORRELATORS_BY_PROCESS";
+	private final static String ROUTE_BY_CKEY_HEADER = "select route from MessageRouteDAOImpl as route where route._correlator._process._processType = :ptype and route._correlator._correlatorKey = :corrkey";
 	
     @Id @Column(name="CORRELATOR_ID")
     @GeneratedValue(strategy=GenerationType.AUTO)
@@ -59,16 +59,17 @@
         _process = process;
     }
 
-    public void addRoute(String routeGroupId, ProcessInstanceDAO target, int index, CorrelationKey correlationKey, String routePolicy) {
-        MessageRouteDAOImpl mr = new MessageRouteDAOImpl(correlationKey,
+    public void addRoute(String routeGroupId, ProcessInstanceDAO target, int index, CorrelationKeySet correlationKeySet, String routePolicy) {
+        MessageRouteDAOImpl mr = new MessageRouteDAOImpl(correlationKeySet,
                 routeGroupId, index, (ProcessInstanceDAOImpl) target, this, routePolicy);
         _routes.add(mr);
     }
 
-    public MessageExchangeDAO dequeueMessage(CorrelationKey correlationKey) {
+    public MessageExchangeDAO dequeueMessage(CorrelationKeySet correlationKeySet) {
+    	// TODO: this thing does not seem to be scalable: loading up based on a correlator???
         for (Iterator<MessageExchangeDAOImpl> itr=_exchanges.iterator(); itr.hasNext();){
             MessageExchangeDAOImpl mex = itr.next();
-            if (mex.getCorrelationKeys().contains(correlationKey)) {
+            if (mex.getCorrelationKeySet().isRoutableTo(correlationKeySet, false)) {
                 itr.remove();
                 return mex;
             }
@@ -77,22 +78,24 @@
     }
 
     public void enqueueMessage(MessageExchangeDAO mex,
-                               CorrelationKey[] correlationKeys) {
+                               CorrelationKeySet correlationKeySet) {
         MessageExchangeDAOImpl mexImpl = (MessageExchangeDAOImpl) mex;
-        for (CorrelationKey key : correlationKeys ) {
-            mexImpl.addCorrelationKey(key);
-        }
+        mexImpl.setCorrelationKeySet(correlationKeySet);
         _exchanges.add(mexImpl);
         mexImpl.setCorrelator(this);
 
     }
 
     @SuppressWarnings("unchecked")
-    public List<MessageRouteDAO> findRoute(CorrelationKey correlationKey) {
-        Query qry = getEM().createNamedQuery("RouteByCKey");
-        qry.setParameter("ckey", correlationKey == null ? "%" : correlationKey.toCanonicalString());
+    public List<MessageRouteDAO> findRoute(CorrelationKeySet correlationKeySet) {
+    	List<CorrelationKeySet> subSets = correlationKeySet.findSubSets();
+    	Query qry = getEM().createQuery(generateSelectorQuery(ROUTE_BY_CKEY_HEADER, subSets));
         qry.setParameter("ptype", _process.getType().toString());
         qry.setParameter("corrkey", _correlatorKey);
+    	for( int i = 0; i < subSets.size(); i++ ) {
+    		qry.setParameter("s" + i, subSets.get(i).toCanonicalString());
+    	}
+    	
         List<MessageRouteDAO> routes = (List<MessageRouteDAO>) qry.getResultList();
         if (routes.size() > 0) {
         	List<ProcessInstanceDAO> targets = new ArrayList<ProcessInstanceDAO>();
@@ -111,6 +114,25 @@
         }
     }
 
+    private String generateSelectorQuery(String header, List<CorrelationKeySet> subSets) {
+    	StringBuffer filterQuery = new StringBuffer(header);
+    	
+    	if( subSets.size() == 1 ) {
+    		filterQuery.append(" and route._correlationKey = :s0");
+    	} else if( subSets.size() > 1 ) {
+    		filterQuery.append(" and route._correlationKey in(");
+        	for( int i = 0; i < subSets.size(); i++ ) {
+        		if( i > 0 ) {
+        			filterQuery.append(", ");
+        		}
+        		filterQuery.append(":s").append(i);
+        	}
+        	filterQuery.append(")");
+    	}
+    	
+    	return filterQuery.toString();
+    }
+
     public String getCorrelatorId() {
         return _correlatorKey;
     }

Modified: ode/branches/APACHE_ODE_1.X/dao-jpa/src/main/java/org/apache/ode/dao/jpa/MessageExchangeDAOImpl.java
URL: http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/dao-jpa/src/main/java/org/apache/ode/dao/jpa/MessageExchangeDAOImpl.java?rev=719270&r1=719269&r2=719270&view=diff
==============================================================================
--- ode/branches/APACHE_ODE_1.X/dao-jpa/src/main/java/org/apache/ode/dao/jpa/MessageExchangeDAOImpl.java (original)
+++ ode/branches/APACHE_ODE_1.X/dao-jpa/src/main/java/org/apache/ode/dao/jpa/MessageExchangeDAOImpl.java Thu Nov 20 08:26:25 2008
@@ -21,7 +21,7 @@
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.apache.ode.bpel.common.CorrelationKey;
+import org.apache.ode.bpel.common.CorrelationKeySet;
 import org.apache.ode.bpel.dao.MessageDAO;
 import org.apache.ode.bpel.dao.MessageExchangeDAO;
 import org.apache.ode.bpel.dao.PartnerLinkDAO;
@@ -51,7 +51,6 @@
 import java.util.Date;
 import java.util.HashSet;
 import java.util.Set;
-import java.util.StringTokenizer;
 
 @Entity
 @Table(name="ODE_MESSAGE_EXCHANGE")
@@ -323,25 +322,12 @@
         _pipedMessageExchangeId = pipedMessageExchangeId;
     }
 
-    public void addCorrelationKey(CorrelationKey correlationKey) {
-        if (_correlationKeys == null)
-            _correlationKeys = correlationKey.toCanonicalString();
-        else
-            _correlationKeys = _correlationKeys + "^" + correlationKey.toCanonicalString();
-	}
-
-	public Collection<CorrelationKey> getCorrelationKeys() {
-        ArrayList<CorrelationKey> correlationKeys = new ArrayList<CorrelationKey>();
-        if (_correlationKeys != null) {
-            if (_correlationKeys.indexOf("^") > 0) {
-                for (StringTokenizer tokenizer = new StringTokenizer(_correlationKeys, "^"); tokenizer.hasMoreTokens();) {
-                    String corrStr = tokenizer.nextToken();
-                    correlationKeys.add(new CorrelationKey(corrStr));
-                }
-                return correlationKeys;
-            } else correlationKeys.add(new CorrelationKey(_correlationKeys));
-        }
-        return correlationKeys;
+    void setCorrelationKeySet(CorrelationKeySet correlationKeySet) {
+    	_correlationKeys = correlationKeySet.toCanonicalString();
+	}
+
+	CorrelationKeySet getCorrelationKeySet() {
+		return new CorrelationKeySet(_correlationKeys);
     }
 
 	public void release(boolean doClean) {

Modified: ode/branches/APACHE_ODE_1.X/dao-jpa/src/main/java/org/apache/ode/dao/jpa/MessageRouteDAOImpl.java
URL: http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/dao-jpa/src/main/java/org/apache/ode/dao/jpa/MessageRouteDAOImpl.java?rev=719270&r1=719269&r2=719270&view=diff
==============================================================================
--- ode/branches/APACHE_ODE_1.X/dao-jpa/src/main/java/org/apache/ode/dao/jpa/MessageRouteDAOImpl.java (original)
+++ ode/branches/APACHE_ODE_1.X/dao-jpa/src/main/java/org/apache/ode/dao/jpa/MessageRouteDAOImpl.java Thu Nov 20 08:26:25 2008
@@ -20,6 +20,7 @@
 package org.apache.ode.dao.jpa;
 
 import org.apache.ode.bpel.common.CorrelationKey;
+import org.apache.ode.bpel.common.CorrelationKeySet;
 import org.apache.ode.bpel.dao.MessageRouteDAO;
 import org.apache.ode.bpel.dao.ProcessInstanceDAO;
 
@@ -65,9 +66,9 @@
     private CorrelatorDAOImpl _correlator;
 
     public MessageRouteDAOImpl() {}
-	public MessageRouteDAOImpl(CorrelationKey key, String groupId, int index,
+	public MessageRouteDAOImpl(CorrelationKeySet keySet, String groupId, int index,
                                ProcessInstanceDAOImpl processInst, CorrelatorDAOImpl correlator, String routePolicy) {
-		_correlationKey = key.toCanonicalString();
+		_correlationKey = keySet.toCanonicalString();
 		_groupId = groupId;
 		_index = index;
 		_processInst = processInst;
@@ -98,5 +99,8 @@
 	public String getRoute() {
 		return _routePolicy;
 	}
-
+	
+	public CorrelationKeySet getCorrelationKeySet() {
+		return new CorrelationKeySet(_correlationKey);
+	}
 }