You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ode.apache.org by ka...@apache.org on 2009/01/09 21:10:56 UTC
svn commit: r733141 - in /ode/trunk:
bpel-api/src/main/java/org/apache/ode/bpel/rapi/
bpel-test/src/test/resources/bpel/2.0/TestCorrelationUnique/
dao-hibernate/src/main/java/org/apache/ode/daohib/bpel/
engine/src/main/java/org/apache/ode/bpel/engine/ ...
Author: karthick
Date: Fri Jan 9 12:10:55 2009
New Revision: 733141
URL: http://svn.apache.org/viewvc?rev=733141&view=rev
Log:
ODE-262 Enable Unique Correlation Sets On All Message Activities
Added:
ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestCorrelationUnique/test4.properties
ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestCorrelationUnique/test5.properties
ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestCorrelationUnique/test6.properties
ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestCorrelationUnique/test7.properties
Modified:
ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/rapi/CorrelationSet.java
ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/rapi/VariableContext.java
ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestCorrelationUnique/counter.bpel
ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestCorrelationUnique/counter.wsdl
ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestCorrelationUnique/test1.properties
ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestCorrelationUnique/test2.properties
ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestCorrelationUnique/test3.properties
ode/trunk/dao-hibernate/src/main/java/org/apache/ode/daohib/bpel/ProcessDaoImpl.java
ode/trunk/engine/src/main/java/org/apache/ode/bpel/engine/BpelRuntimeContextImpl.java
ode/trunk/engine/src/main/java/org/apache/ode/bpel/engine/PartnerLinkMyRoleImpl.java
ode/trunk/engine/src/main/java/org/apache/ode/bpel/memdao/ProcessDaoImpl.java
ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v1/CorrelationSetInstance.java
ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v1/OdeInternalInstance.java
ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v1/RuntimeInstanceImpl.java
ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v2/CorrelationSetInstance.java
ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v2/OdeInternalInstance.java
ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v2/RuntimeInstanceImpl.java
Modified: ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/rapi/CorrelationSet.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/rapi/CorrelationSet.java?rev=733141&r1=733140&r2=733141&view=diff
==============================================================================
--- ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/rapi/CorrelationSet.java (original)
+++ ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/rapi/CorrelationSet.java Fri Jan 9 12:10:55 2009
@@ -3,4 +3,6 @@
public interface CorrelationSet extends org.apache.ode.bpel.rapi.ScopedObject {
String getName();
+
+ ProcessModel getOwner();
}
Modified: ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/rapi/VariableContext.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/rapi/VariableContext.java?rev=733141&r1=733140&r2=733141&view=diff
==============================================================================
--- ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/rapi/VariableContext.java (original)
+++ ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/rapi/VariableContext.java Fri Jan 9 12:10:55 2009
@@ -156,7 +156,7 @@
CorrelationKey readCorrelation(CorrelationSet cset);
void writeCorrelation(CorrelationSet cset, QName[] propNames,
- CorrelationKey correlation);
+ CorrelationKey correlation) throws FaultException;
public class ValueReferencePair {
public Node value;
Modified: ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestCorrelationUnique/counter.bpel
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestCorrelationUnique/counter.bpel?rev=733141&r1=733140&r2=733141&view=diff
==============================================================================
--- ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestCorrelationUnique/counter.bpel (original)
+++ ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestCorrelationUnique/counter.bpel Fri Jan 9 12:10:55 2009
@@ -16,26 +16,32 @@
</b:partnerLinks>
<b:variables>
- <b:variable name="counter" messageType="t:responseMessage" />
- <b:variable name="initiation" messageType="t:requestMessage" />
+ <b:variable name="response" messageType="t:responseMessage" />
+ <b:variable name="request" messageType="t:requestMessage" />
<b:variable name="empty" messageType="t:emptyResponse" />
</b:variables>
<b:correlationSets>
- <b:correlationSet name="name" properties="t:counterProp" unique="yes"/>
+ <b:correlationSet name="init" properties="t:initProp" unique="yes"/>
+ <b:correlationSet name="incr" properties="t:incrProp" unique="yes"/>
+ <b:correlationSet name="get" properties="t:getProp" unique="yes"/>
</b:correlationSets>
<b:sequence>
<b:receive partnerLink="operations" createInstance="yes" operation="init" portType="t:port"
- variable="initiation">
+ variable="request">
<b:correlations>
- <b:correlation set="name" initiate="yes"/>
+ <b:correlation set="init" initiate="yes"/>
</b:correlations>
</b:receive>
<b:assign>
<b:copy>
<b:from>0</b:from>
- <b:to variable="counter" part="value"></b:to>
+ <b:to variable="response" part="value"></b:to>
+ </b:copy>
+ <b:copy>
+ <b:from variable="request" part="name"></b:from>
+ <b:to variable="response" part="name"></b:to>
</b:copy>
</b:assign>
<b:reply partnerLink="operations" operation="init" variable="empty" />
@@ -44,20 +50,21 @@
<b:condition>true()</b:condition>
<b:scope>
<b:variables>
- <b:variable name="tmp" messageType="t:requestMessage" />
+ <b:variable name="ping" messageType="t:requestMessage" />
</b:variables>
<b:sequence>
<b:receive partnerLink="operations" operation="getAndIncrement" portType="t:port"
- variable="tmp">
+ variable="ping">
<b:correlations>
- <b:correlation set="name" initiate="no" />
+ <b:correlation set="init" initiate="no" />
+ <b:correlation set="incr" initiate="yes" />
</b:correlations>
</b:receive>
- <b:reply partnerLink="operations" operation="getAndIncrement" variable="counter" />
+ <b:reply partnerLink="operations" operation="getAndIncrement" variable="response" />
<b:assign>
<b:copy>
- <b:from>$counter.value+1</b:from>
- <b:to>$counter.value</b:to>
+ <b:from>$response.value+1</b:from>
+ <b:to>$response.value</b:to>
</b:copy>
</b:assign>
</b:sequence>
@@ -67,26 +74,36 @@
<b:condition>true()</b:condition>
<b:scope>
<b:variables>
- <b:variable name="tmp" messageType="t:requestMessage" />
+ <b:variable name="ping" messageType="t:requestMessage" />
</b:variables>
<b:sequence>
- <b:receive partnerLink="operations" operation="get" variable="tmp">
+ <b:receive partnerLink="operations" operation="get" variable="ping">
<b:correlations>
- <b:correlation set="name" initiate="no" />
+ <b:correlation set="init" initiate="no" />
</b:correlations>
</b:receive>
- <b:reply partnerLink="operations" operation="get" variable="counter" />
+ <b:assign>
+ <b:copy>
+ <b:from variable="ping" part="alias"></b:from>
+ <b:to variable="response" part="name"></b:to>
+ </b:copy>
+ </b:assign>
+ <b:reply partnerLink="operations" operation="get" variable="response">
+ <b:correlations>
+ <b:correlation set="get" initiate="yes" />
+ </b:correlations>
+ </b:reply>
</b:sequence>
</b:scope>
</b:while>
<b:scope>
<b:variables>
- <b:variable name="tmp" messageType="t:requestMessage" />
+ <b:variable name="ping" messageType="t:requestMessage" />
</b:variables>
<b:sequence>
- <b:receive partnerLink="operations" operation="close" variable="tmp">
+ <b:receive partnerLink="operations" operation="close" variable="ping">
<b:correlations>
- <b:correlation set="name" initiate="no" />
+ <b:correlation set="init" initiate="no" />
</b:correlations>
</b:receive>
<b:reply partnerLink="operations" operation="close" variable="empty"/>
Modified: ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestCorrelationUnique/counter.wsdl
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestCorrelationUnique/counter.wsdl?rev=733141&r1=733140&r2=733141&view=diff
==============================================================================
--- ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestCorrelationUnique/counter.wsdl (original)
+++ ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestCorrelationUnique/counter.wsdl Fri Jan 9 12:10:55 2009
@@ -10,9 +10,11 @@
<wsdl:message name="requestMessage">
<wsdl:part name="name" type="xsd:string" />
+ <wsdl:part name="alias" type="xsd:string" />
</wsdl:message>
<wsdl:message name="responseMessage">
+ <wsdl:part name="name" type="xsd:string" />
<wsdl:part name="value" type="xsd:int" />
</wsdl:message>
@@ -78,7 +80,13 @@
<p:role name="you" portType="t:port" />
</p:partnerLinkType>
- <v:property name="counterProp" type="xsd:string" />
-
- <v:propertyAlias propertyName="t:counterProp" part="name" messageType="t:requestMessage" />
+ <v:property name="initProp" type="xsd:string" />
+ <v:property name="incrProp" type="xsd:string" />
+ <v:property name="getProp" type="xsd:string" />
+
+ <v:propertyAlias propertyName="t:initProp" part="name" messageType="t:requestMessage" />
+ <v:propertyAlias propertyName="t:incrProp" part="alias" messageType="t:requestMessage" />
+ <v:propertyAlias propertyName="t:incrProp" part="name" messageType="t:responseMessage" />
+ <v:propertyAlias propertyName="t:getProp" part="name" messageType="t:responseMessage" />
+ <v:propertyAlias propertyName="t:getProp" part="alias" messageType="t:requestMessage" />
</wsdl:definitions>
\ No newline at end of file
Modified: ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestCorrelationUnique/test1.properties
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestCorrelationUnique/test1.properties?rev=733141&r1=733140&r2=733141&view=diff
==============================================================================
--- ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestCorrelationUnique/test1.properties (original)
+++ ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestCorrelationUnique/test1.properties Fri Jan 9 12:10:55 2009
@@ -18,5 +18,5 @@
namespace=http://example.com/bpel/counter
service=counter
operation=init
-request1=<message><name>foo</name></message>
+request1=<message><name>foo</name><alias>foo.alias</alias></message>
response1=.*
Modified: ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestCorrelationUnique/test2.properties
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestCorrelationUnique/test2.properties?rev=733141&r1=733140&r2=733141&view=diff
==============================================================================
--- ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestCorrelationUnique/test2.properties (original)
+++ ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestCorrelationUnique/test2.properties Fri Jan 9 12:10:55 2009
@@ -18,5 +18,5 @@
namespace=http://example.com/bpel/counter
service=counter
operation=init
-request1=<message><name>foo</name></message>
+request1=<message><name>foo</name><alias>foo.alias</alias></message>
response1=FAULT
Modified: ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestCorrelationUnique/test3.properties
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestCorrelationUnique/test3.properties?rev=733141&r1=733140&r2=733141&view=diff
==============================================================================
--- ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestCorrelationUnique/test3.properties (original)
+++ ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestCorrelationUnique/test3.properties Fri Jan 9 12:10:55 2009
@@ -18,5 +18,5 @@
namespace=http://example.com/bpel/counter
service=counter
operation=init
-request1=<message><name>bar</name></message>
+request1=<message><name>bar</name><alias>bar.alias</alias></message>
response1=.*
Added: ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestCorrelationUnique/test4.properties
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestCorrelationUnique/test4.properties?rev=733141&view=auto
==============================================================================
--- ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestCorrelationUnique/test4.properties (added)
+++ ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestCorrelationUnique/test4.properties Fri Jan 9 12:10:55 2009
@@ -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://example.com/bpel/counter
+service=counter
+operation=getAndIncrement
+request1=<message><name>foo</name><alias>incr.alias</alias></message>
+response1=.*
Added: ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestCorrelationUnique/test5.properties
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestCorrelationUnique/test5.properties?rev=733141&view=auto
==============================================================================
--- ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestCorrelationUnique/test5.properties (added)
+++ ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestCorrelationUnique/test5.properties Fri Jan 9 12:10:55 2009
@@ -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://example.com/bpel/counter
+service=counter
+operation=getAndIncrement
+request1=<message><name>foo</name><alias>incr.alias</alias></message>
+response1=FAULT
Added: ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestCorrelationUnique/test6.properties
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestCorrelationUnique/test6.properties?rev=733141&view=auto
==============================================================================
--- ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestCorrelationUnique/test6.properties (added)
+++ ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestCorrelationUnique/test6.properties Fri Jan 9 12:10:55 2009
@@ -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://example.com/bpel/counter
+service=counter
+operation=get
+request1=<message><name>bar</name><alias>get.alias</alias></message>
+response1=.*
Added: ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestCorrelationUnique/test7.properties
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestCorrelationUnique/test7.properties?rev=733141&view=auto
==============================================================================
--- ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestCorrelationUnique/test7.properties (added)
+++ ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestCorrelationUnique/test7.properties Fri Jan 9 12:10:55 2009
@@ -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://example.com/bpel/counter
+service=counter
+operation=get
+request1=<message><name>foo</name><alias>get.alias</alias></message>
+response1=FAULT
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=733141&r1=733140&r2=733141&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 Fri Jan 9 12:10:55 2009
@@ -123,7 +123,9 @@
instance.addOrder(Order.desc("created"));
Criteria process = instance.createCriteria("process");
process.add(Restrictions.eq("id", _process.getId()));
- correlationSet.add(Expression.eq("value", ckeyValue.toCanonicalString()));
+ correlationSet.add(Expression.eq("value", ckeyValue.toCanonicalString()));
+ // TODO: compare against the correlation set in question
+ // correlationSet.add(Expression.eq("name", ckeyValue.getCSetId()));
correlationSet.setLockMode(wait ? LockMode.UPGRADE : LockMode.UPGRADE_NOWAIT);
return correlationSet.list();
} catch (HibernateException he) {
Modified: ode/trunk/engine/src/main/java/org/apache/ode/bpel/engine/BpelRuntimeContextImpl.java
URL: http://svn.apache.org/viewvc/ode/trunk/engine/src/main/java/org/apache/ode/bpel/engine/BpelRuntimeContextImpl.java?rev=733141&r1=733140&r2=733141&view=diff
==============================================================================
--- ode/trunk/engine/src/main/java/org/apache/ode/bpel/engine/BpelRuntimeContextImpl.java (original)
+++ ode/trunk/engine/src/main/java/org/apache/ode/bpel/engine/BpelRuntimeContextImpl.java Fri Jan 9 12:10:55 2009
@@ -435,7 +435,17 @@
sendEvent(evt);
}
- public void writeCorrelation(CorrelationSet cset, QName[] propNames, CorrelationKey correlation) {
+ public void writeCorrelation(CorrelationSet cset, QName[] propNames, CorrelationKey correlation) throws FaultException {
+ // enforce unique correlation set constraint
+ ProcessDAO processDAO = _dao.getProcess();
+ if (correlation.isUnique()) {
+ Collection<ProcessInstanceDAO> instances = processDAO.findInstance(correlation, false);
+ if (instances.size() != 0) {
+ __log.debug("Not creating a new instance for process " + processDAO.getProcessId() + "; unique correlation constraint would be violated!");
+ throw new FaultException(cset.getOwner().getConstantsModel().getDuplicateInstance());
+ }
+ }
+
ScopeDAO scopeDAO = _dao.getScope(cset.getScopeId());
CorrelationSetDAO cs = scopeDAO.getCorrelationSet(cset.getName());
cs.setValue(propNames, correlation);
Modified: ode/trunk/engine/src/main/java/org/apache/ode/bpel/engine/PartnerLinkMyRoleImpl.java
URL: http://svn.apache.org/viewvc/ode/trunk/engine/src/main/java/org/apache/ode/bpel/engine/PartnerLinkMyRoleImpl.java?rev=733141&r1=733140&r2=733141&view=diff
==============================================================================
--- ode/trunk/engine/src/main/java/org/apache/ode/bpel/engine/PartnerLinkMyRoleImpl.java (original)
+++ ode/trunk/engine/src/main/java/org/apache/ode/bpel/engine/PartnerLinkMyRoleImpl.java Fri Jan 9 12:10:55 2009
@@ -160,24 +160,26 @@
+ messageRoute.getTargetInstance().getInstanceId());
}
- ProcessInstanceDAO instanceDao = messageRoute.getTargetInstance();
+ ProcessInstanceDAO instanceDAO = messageRoute.getTargetInstance();
+ ProcessDAO processDAO = instanceDAO.getProcess();
+ enforceUniqueConstraint(processDAO, uniqueKeys);
// Reload process instance for DAO.
// Kill the route so some new message does not get routed to
// same process instance.
- correlator.removeRoutes(messageRoute.getGroupId(), instanceDao);
+ correlator.removeRoutes(messageRoute.getGroupId(), instanceDAO);
// send process instance event
CorrelationMatchEvent evt = new CorrelationMatchEvent(_process.getProcessModel().getQName(),
- _process.getProcessDAO().getProcessId(), instanceDao.getInstanceId(), matchedKey);
+ _process.getProcessDAO().getProcessId(), instanceDAO.getInstanceId(), matchedKey);
evt.setPortType(mex.getPortType());
evt.setOperation(operation.getName());
evt.setMexId(mex.getMessageExchangeId());
_process._debugger.onEvent(evt);
// store event
- _process.saveEvent(evt, instanceDao);
+ _process.saveEvent(evt, instanceDAO);
mex.setCorrelationStatus(MyRoleMessageExchange.CorrelationStatus.MATCHED.toString());
mex.setInstance(messageRoute.getTargetInstance());
@@ -225,16 +227,7 @@
// return;
// }
- for (CorrelationKey uniqueKey : uniqueKeys) {
- // double-check that the correlation set is indeed unique
- if (uniqueKey.isUnique()) {
- Collection<ProcessInstanceDAO> instances = processDAO.findInstance(uniqueKey, false);
- if (instances.size() != 0) {
- __log.debug("Not creating a new instance for mex " + mex + "; unique correlation constraint would be violated!");
- throw new InvalidProcessException("Unique process constraint violated", InvalidProcessException.DUPLICATE_CAUSE_CODE);
- }
- }
- }
+ enforceUniqueConstraint(processDAO, uniqueKeys);
ProcessInstanceDAO newInstance = processDAO.createInstance(correlator);
@@ -251,7 +244,20 @@
}
- @SuppressWarnings("unchecked")
+ private void enforceUniqueConstraint(ProcessDAO processDAO, CorrelationKey[] uniqueKeys) {
+ for (CorrelationKey uniqueKey : uniqueKeys) {
+ // double-check that the correlation set is indeed unique
+ if (uniqueKey.isUnique()) {
+ Collection<ProcessInstanceDAO> instances = processDAO.findInstance(uniqueKey, false);
+ if (instances.size() != 0) {
+ __log.debug("Not creating a new instance for process " + processDAO.getProcessId() + "; unique correlation constraint would be violated!");
+ throw new InvalidProcessException("Unique process constraint violated", InvalidProcessException.DUPLICATE_CAUSE_CODE);
+ }
+ }
+ }
+ }
+
+ @SuppressWarnings("unchecked")
private Operation getMyRoleOperation(String operationName) {
return _plinkDef.getMyRoleOperation(operationName);
}
Modified: ode/trunk/engine/src/main/java/org/apache/ode/bpel/memdao/ProcessDaoImpl.java
URL: http://svn.apache.org/viewvc/ode/trunk/engine/src/main/java/org/apache/ode/bpel/memdao/ProcessDaoImpl.java?rev=733141&r1=733140&r2=733141&view=diff
==============================================================================
--- ode/trunk/engine/src/main/java/org/apache/ode/bpel/memdao/ProcessDaoImpl.java (original)
+++ ode/trunk/engine/src/main/java/org/apache/ode/bpel/memdao/ProcessDaoImpl.java Fri Jan 9 12:10:55 2009
@@ -140,7 +140,10 @@
ArrayList<ProcessInstanceDAO> result = new ArrayList<ProcessInstanceDAO>();
for (ProcessInstanceDAO instance : _instances.values()) {
for (CorrelationSetDAO corrSet : instance.getCorrelationSets()) {
- if (corrSet.getValue().equals(key)) result.add(instance);
+ CorrelationKey value = corrSet.getValue();
+ if (value != null) {
+ if (value.equals(key)) result.add(instance);
+ }
}
}
return result;
Modified: ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v1/CorrelationSetInstance.java
URL: http://svn.apache.org/viewvc/ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v1/CorrelationSetInstance.java?rev=733141&r1=733140&r2=733141&view=diff
==============================================================================
--- ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v1/CorrelationSetInstance.java (original)
+++ ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v1/CorrelationSetInstance.java Fri Jan 9 12:10:55 2009
@@ -20,6 +20,7 @@
import org.apache.ode.bpel.rtrep.v1.OScope;
import org.apache.ode.bpel.rapi.CorrelationSet;
+import org.apache.ode.bpel.rapi.ProcessModel;
public class CorrelationSetInstance implements CorrelationSet {
public OScope.CorrelationSet declaration;
@@ -37,4 +38,8 @@
public long getScopeId() {
return scopeInstance;
}
+
+ public ProcessModel getOwner() {
+ return declaration.getOwner();
+ }
}
Modified: ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v1/OdeInternalInstance.java
URL: http://svn.apache.org/viewvc/ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v1/OdeInternalInstance.java?rev=733141&r1=733140&r2=733141&view=diff
==============================================================================
--- ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v1/OdeInternalInstance.java (original)
+++ ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v1/OdeInternalInstance.java Fri Jan 9 12:10:55 2009
@@ -26,7 +26,7 @@
String readProperty(VariableInstance variable, OProcess.OProperty property) throws FaultException;
- void writeCorrelation(CorrelationSetInstance cset, CorrelationKey ckeyVal);
+ void writeCorrelation(CorrelationSetInstance cset, CorrelationKey ckeyVal) throws FaultException;
Node initializeVariable(VariableInstance var, ScopeFrame scopeFrame, Node val)
throws ExternalVariableModuleException;
Modified: ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v1/RuntimeInstanceImpl.java
URL: http://svn.apache.org/viewvc/ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v1/RuntimeInstanceImpl.java?rev=733141&r1=733140&r2=733141&view=diff
==============================================================================
--- ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v1/RuntimeInstanceImpl.java (original)
+++ ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v1/RuntimeInstanceImpl.java Fri Jan 9 12:10:55 2009
@@ -179,7 +179,7 @@
return val;
}
- public void writeCorrelation(CorrelationSetInstance cset, CorrelationKey ckeyVal) {
+ public void writeCorrelation(CorrelationSetInstance cset, CorrelationKey ckeyVal) throws FaultException {
OScope.CorrelationSet csetdef = cset.declaration;
QName[] propNames = new QName[csetdef.properties.size()];
for (int m = 0; m < csetdef.properties.size(); m++) {
Modified: ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v2/CorrelationSetInstance.java
URL: http://svn.apache.org/viewvc/ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v2/CorrelationSetInstance.java?rev=733141&r1=733140&r2=733141&view=diff
==============================================================================
--- ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v2/CorrelationSetInstance.java (original)
+++ ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v2/CorrelationSetInstance.java Fri Jan 9 12:10:55 2009
@@ -19,6 +19,7 @@
package org.apache.ode.bpel.rtrep.v2;
import org.apache.ode.bpel.rapi.CorrelationSet;
+import org.apache.ode.bpel.rapi.ProcessModel;
public class CorrelationSetInstance implements CorrelationSet {
public OScope.CorrelationSet declaration;
@@ -36,4 +37,8 @@
public long getScopeId() {
return scopeInstance;
}
+
+ public ProcessModel getOwner() {
+ return declaration.getOwner();
+ }
}
Modified: ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v2/OdeInternalInstance.java
URL: http://svn.apache.org/viewvc/ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v2/OdeInternalInstance.java?rev=733141&r1=733140&r2=733141&view=diff
==============================================================================
--- ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v2/OdeInternalInstance.java (original)
+++ ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v2/OdeInternalInstance.java Fri Jan 9 12:10:55 2009
@@ -26,7 +26,7 @@
String readProperty(VariableInstance variable, OProcess.OProperty property) throws FaultException;
- void writeCorrelation(CorrelationSetInstance cset, CorrelationKey ckeyVal);
+ void writeCorrelation(CorrelationSetInstance cset, CorrelationKey ckeyVal) throws FaultException;
Node initializeVariable(VariableInstance var, ScopeFrame scopeFrame, Node val)
throws ExternalVariableModuleException;
Modified: ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v2/RuntimeInstanceImpl.java
URL: http://svn.apache.org/viewvc/ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v2/RuntimeInstanceImpl.java?rev=733141&r1=733140&r2=733141&view=diff
==============================================================================
--- ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v2/RuntimeInstanceImpl.java (original)
+++ ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v2/RuntimeInstanceImpl.java Fri Jan 9 12:10:55 2009
@@ -178,7 +178,7 @@
return val;
}
- public void writeCorrelation(CorrelationSetInstance cset, CorrelationKey ckeyVal) {
+ public void writeCorrelation(CorrelationSetInstance cset, CorrelationKey ckeyVal) throws FaultException {
OScope.CorrelationSet csetdef = cset.declaration;
QName[] propNames = new QName[csetdef.properties.size()];
for (int m = 0; m < csetdef.properties.size(); m++) {