Added: ode/branches/APACHE_ODE_1.X/bpel-test/src/test/resources/bpel/2.0/TestCorrelationUnique/deploy.xml URL: http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/bpel-test/src/test/resources/bpel/2.0/TestCorrelationUnique/deploy.xml?rev=728144&view=auto ============================================================================== --- ode/branches/APACHE_ODE_1.X/bpel-test/src/test/resources/bpel/2.0/TestCorrelationUnique/deploy.xml (added) +++ ode/branches/APACHE_ODE_1.X/bpel-test/src/test/resources/bpel/2.0/TestCorrelationUnique/deploy.xml Fri Dec 19 13:09:17 2008 @@ -0,0 +1,9 @@ +<?xml version='1.0' encoding='UTF-8'?> +<dd:deploy xmlns:dd="http://ode.fivesight.com/schemas/2006/06/27/dd"> +<dd:process xmlns:dd="http://ode.fivesight.com/schemas/2006/06/27/dd" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:this="http://example.com/bpel/counter" name="this:counter" fileName="counter.bpel"> + <dd:property name="PATH">counter</dd:property> + <dd:property name="SVG">counter.svg</dd:property> + <dd:provide partnerLink="operations"> + <dd:service name="this:counter" port="port" /> + </dd:provide> +</dd:process></dd:deploy> \ No newline at end of file
Added: ode/branches/APACHE_ODE_1.X/bpel-test/src/test/resources/bpel/2.0/TestCorrelationUnique/test1.properties URL: http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/bpel-test/src/test/resources/bpel/2.0/TestCorrelationUnique/test1.properties?rev=728144&view=auto ============================================================================== --- ode/branches/APACHE_ODE_1.X/bpel-test/src/test/resources/bpel/2.0/TestCorrelationUnique/test1.properties (added) +++ ode/branches/APACHE_ODE_1.X/bpel-test/src/test/resources/bpel/2.0/TestCorrelationUnique/test1.properties Fri Dec 19 13:09:17 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://example.com/bpel/counter +service=counter +operation=init +request1=<message><name>foo</name></message> +response1=.* Added: ode/branches/APACHE_ODE_1.X/bpel-test/src/test/resources/bpel/2.0/TestCorrelationUnique/test2.properties URL: http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/bpel-test/src/test/resources/bpel/2.0/TestCorrelationUnique/test2.properties?rev=728144&view=auto ============================================================================== --- ode/branches/APACHE_ODE_1.X/bpel-test/src/test/resources/bpel/2.0/TestCorrelationUnique/test2.properties (added) +++ ode/branches/APACHE_ODE_1.X/bpel-test/src/test/resources/bpel/2.0/TestCorrelationUnique/test2.properties Fri Dec 19 13:09:17 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://example.com/bpel/counter +service=counter +operation=init +request1=<message><name>foo</name></message> +response1=FAULT Added: ode/branches/APACHE_ODE_1.X/bpel-test/src/test/resources/bpel/2.0/TestCorrelationUnique/test3.properties URL: http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/bpel-test/src/test/resources/bpel/2.0/TestCorrelationUnique/test3.properties?rev=728144&view=auto ============================================================================== --- ode/branches/APACHE_ODE_1.X/bpel-test/src/test/resources/bpel/2.0/TestCorrelationUnique/test3.properties (added) +++ ode/branches/APACHE_ODE_1.X/bpel-test/src/test/resources/bpel/2.0/TestCorrelationUnique/test3.properties Fri Dec 19 13:09:17 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://example.com/bpel/counter +service=counter +operation=init +request1=<message><name>bar</name></message> +response1=.* 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=728144&r1=728143&r2=728144&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 Fri Dec 19 13:09:17 2008 @@ -26,7 +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.common.CorrelationKeys; import org.apache.ode.bpel.dao.CorrelatorDAO; import org.apache.ode.bpel.dao.MessageExchangeDAO; import org.apache.ode.bpel.dao.MessageRouteDAO; @@ -65,7 +65,7 @@ } @SuppressWarnings("unchecked") - public MessageExchangeDAO dequeueMessage(CorrelationKeySet keySet) { + public MessageExchangeDAO dequeueMessage(CorrelationKeys keySet) { entering("CorrelatorDaoImpl.dequeueMessage"); MessageExchangeDAO mex = null; @@ -73,7 +73,7 @@ String hdr = "dequeueMessage(" + keySet + "): "; __log.debug(hdr); - List<CorrelationKeySet> subSets = keySet.findSubSets(); + List<CorrelationKeys> subSets = keySet.findSubSets(); Query qry = getSession().createFilter(_hobj.getMessageCorrelations(), generateUnmatchedQuery(subSets)); for( int i = 0; i < subSets.size(); i++ ) { @@ -100,7 +100,7 @@ } @SuppressWarnings("unchecked") - public List<MessageRouteDAO> findRoute(CorrelationKeySet keySet) { + public List<MessageRouteDAO> findRoute(CorrelationKeys keySet) { List<MessageRouteDAO> routes = new ArrayList<MessageRouteDAO>(); entering("CorrelatorDaoImpl.findRoute"); @@ -114,7 +114,7 @@ // 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(); - List<CorrelationKeySet> subSets = keySet.findSubSets(); + List<CorrelationKeys> subSets = keySet.findSubSets(); Query lockQry = getSession().createQuery(generateSelectorQuery(LOCK_SELECTORS, subSets)); lockQry.setString("processType", processType); for( int i = 0; i < subSets.size(); i++ ) { @@ -161,7 +161,7 @@ return null; } - private String generateUnmatchedQuery(List<CorrelationKeySet> subSets) { + private String generateUnmatchedQuery(List<CorrelationKeys> subSets) { StringBuffer filterQuery = new StringBuffer(); if( subSets.size() == 1 ) { @@ -180,7 +180,7 @@ return filterQuery.toString(); } - private String generateSelectorQuery(String header, List<CorrelationKeySet> subSets) { + private String generateSelectorQuery(String header, List<CorrelationKeys> subSets) { StringBuffer filterQuery = new StringBuffer(header); if( subSets.size() == 1 ) { @@ -199,7 +199,7 @@ return filterQuery.toString(); } - public void enqueueMessage(MessageExchangeDAO mex, CorrelationKeySet correlationKeySet) { + public void enqueueMessage(MessageExchangeDAO mex, CorrelationKeys correlationKeySet) { entering("CorrelatorDaoImpl.enqueueMessage"); String hdr = "enqueueMessage(mex=" + ((MessageExchangeDaoImpl) mex)._hobj.getId() + " keySet=" + correlationKeySet.toCanonicalString() + "): "; @@ -207,7 +207,7 @@ if (__log.isDebugEnabled()) __log.debug(hdr); - for( CorrelationKeySet aSubSet : correlationKeySet.findSubSets() ) { + for( CorrelationKeys aSubSet : correlationKeySet.findSubSets() ) { HCorrelatorMessage mcor = new HCorrelatorMessage(); mcor.setCorrelator(_hobj); mcor.setCreated(new Date()); @@ -220,7 +220,7 @@ } } - public void addRoute(String routeGroupId, ProcessInstanceDAO target, int idx, CorrelationKeySet correlationKeySet, String routePolicy) { + public void addRoute(String routeGroupId, ProcessInstanceDAO target, int idx, CorrelationKeys correlationKeySet, String routePolicy) { entering("CorrelatorDaoImpl.addRoute"); String hdr = "addRoute(" + routeGroupId + ", iid=" + target.getInstanceId() + ", idx=" + idx + ", ckeySet=" + correlationKeySet + "): "; 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=728144&r1=728143&r2=728144&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 Fri Dec 19 13:09:17 2008 @@ -18,7 +18,7 @@ */ package org.apache.ode.daohib.bpel; -import org.apache.ode.bpel.common.CorrelationKeySet; +import org.apache.ode.bpel.common.CorrelationKeys; import org.apache.ode.bpel.dao.MessageRouteDAO; import org.apache.ode.bpel.dao.ProcessInstanceDAO; import org.apache.ode.daohib.SessionManager; @@ -75,7 +75,7 @@ return _selector.getRoute(); } - public CorrelationKeySet getCorrelationKeySet() { - return new CorrelationKeySet(_selector.getCorrelationKey()); + public CorrelationKeys getCorrelationKeys() { + return new CorrelationKeys(_selector.getCorrelationKey()); } } Modified: ode/branches/APACHE_ODE_1.X/dao-hibernate/src/main/java/org/apache/ode/daohib/bpel/ProcessDaoImpl.java URL: http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/dao-hibernate/src/main/java/org/apache/ode/daohib/bpel/ProcessDaoImpl.java?rev=728144&r1=728143&r2=728144&view=diff ============================================================================== --- ode/branches/APACHE_ODE_1.X/dao-hibernate/src/main/java/org/apache/ode/daohib/bpel/ProcessDaoImpl.java (original) +++ ode/branches/APACHE_ODE_1.X/dao-hibernate/src/main/java/org/apache/ode/daohib/bpel/ProcessDaoImpl.java Fri Dec 19 13:09:17 2008 @@ -18,6 +18,13 @@ */ package org.apache.ode.daohib.bpel; +import java.util.Collection; +import java.util.Collections; +import java.util.Date; +import java.util.Iterator; + +import javax.xml.namespace.QName; + import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.ode.bpel.common.CorrelationKey; @@ -31,7 +38,6 @@ import org.apache.ode.daohib.bpel.hobj.HCorrelationSet; import org.apache.ode.daohib.bpel.hobj.HCorrelator; import org.apache.ode.daohib.bpel.hobj.HCorrelatorMessage; -import org.apache.ode.daohib.bpel.hobj.HCorrelatorMessageKey; import org.apache.ode.daohib.bpel.hobj.HFaultData; import org.apache.ode.daohib.bpel.hobj.HLargeData; import org.apache.ode.daohib.bpel.hobj.HMessage; @@ -45,14 +51,13 @@ import org.apache.ode.daohib.bpel.hobj.HXmlData; import org.hibernate.Criteria; import org.hibernate.Hibernate; +import org.hibernate.HibernateException; +import org.hibernate.LockMode; import org.hibernate.Query; +import org.hibernate.criterion.DetachedCriteria; import org.hibernate.criterion.Expression; import org.hibernate.criterion.Order; - -import javax.xml.namespace.QName; -import java.util.Collection; -import java.util.Date; -import java.util.Iterator; +import org.hibernate.criterion.Restrictions; /** * Hibernate-based {...@link ProcessDAO} implementation. @@ -125,13 +130,20 @@ * @see org.apache.ode.bpel.dao.ProcessDAO#findInstance(CorrelationKey) */ @SuppressWarnings("unchecked") - public Collection<ProcessInstanceDAO> findInstance(CorrelationKey ckeyValue) { - entering("ProcessDaoImpl.findInstance"); - Criteria criteria = getSession().createCriteria(HCorrelationSet.class); - criteria.add(Expression.eq("scope.instance.process.id",_process.getId())); - criteria.add(Expression.eq("value", ckeyValue.toCanonicalString())); - criteria.addOrder(Order.desc("scope.instance.created")); - return criteria.list(); + public Collection<ProcessInstanceDAO> findInstance(CorrelationKey ckeyValue, boolean wait) { + try { + entering("ProcessDaoImpl.findInstance"); + Criteria correlationSet = getSession().createCriteria(HCorrelationSet.class); + Criteria instance = correlationSet.createCriteria("scope").createCriteria("instance"); + 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.setLockMode(LockMode.UPGRADE_NOWAIT); + return correlationSet.list(); + } catch (HibernateException he) { + return Collections.EMPTY_LIST; + } } /** 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=728144&r1=728143&r2=728144&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 Fri Dec 19 13:09:17 2008 @@ -19,7 +19,7 @@ package org.apache.ode.dao.jpa; -import org.apache.ode.bpel.common.CorrelationKeySet; +import org.apache.ode.bpel.common.CorrelationKeys; import org.apache.ode.bpel.dao.CorrelatorDAO; import org.apache.ode.bpel.dao.MessageExchangeDAO; import org.apache.ode.bpel.dao.MessageRouteDAO; @@ -59,13 +59,13 @@ _process = process; } - public void addRoute(String routeGroupId, ProcessInstanceDAO target, int index, CorrelationKeySet correlationKeySet, String routePolicy) { + public void addRoute(String routeGroupId, ProcessInstanceDAO target, int index, CorrelationKeys correlationKeySet, String routePolicy) { MessageRouteDAOImpl mr = new MessageRouteDAOImpl(correlationKeySet, routeGroupId, index, (ProcessInstanceDAOImpl) target, this, routePolicy); _routes.add(mr); } - public MessageExchangeDAO dequeueMessage(CorrelationKeySet correlationKeySet) { + public MessageExchangeDAO dequeueMessage(CorrelationKeys 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(); @@ -78,7 +78,7 @@ } public void enqueueMessage(MessageExchangeDAO mex, - CorrelationKeySet correlationKeySet) { + CorrelationKeys correlationKeySet) { MessageExchangeDAOImpl mexImpl = (MessageExchangeDAOImpl) mex; mexImpl.setCorrelationKeySet(correlationKeySet); _exchanges.add(mexImpl); @@ -87,8 +87,8 @@ } @SuppressWarnings("unchecked") - public List<MessageRouteDAO> findRoute(CorrelationKeySet correlationKeySet) { - List<CorrelationKeySet> subSets = correlationKeySet.findSubSets(); + public List<MessageRouteDAO> findRoute(CorrelationKeys correlationKeySet) { + List<CorrelationKeys> subSets = correlationKeySet.findSubSets(); Query qry = getEM().createQuery(generateSelectorQuery(ROUTE_BY_CKEY_HEADER, subSets)); qry.setParameter("ptype", _process.getType().toString()); qry.setParameter("corrkey", _correlatorKey); @@ -114,7 +114,7 @@ } } - private String generateSelectorQuery(String header, List<CorrelationKeySet> subSets) { + private String generateSelectorQuery(String header, List<CorrelationKeys> subSets) { StringBuffer filterQuery = new StringBuffer(header); if( subSets.size() == 1 ) { 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=728144&r1=728143&r2=728144&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 Fri Dec 19 13:09:17 2008 @@ -21,7 +21,7 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.apache.ode.bpel.common.CorrelationKeySet; +import org.apache.ode.bpel.common.CorrelationKeys; import org.apache.ode.bpel.dao.MessageDAO; import org.apache.ode.bpel.dao.MessageExchangeDAO; import org.apache.ode.bpel.dao.PartnerLinkDAO; @@ -322,12 +322,12 @@ _pipedMessageExchangeId = pipedMessageExchangeId; } - void setCorrelationKeySet(CorrelationKeySet correlationKeySet) { + void setCorrelationKeySet(CorrelationKeys correlationKeySet) { _correlationKeys = correlationKeySet.toCanonicalString(); } - CorrelationKeySet getCorrelationKeySet() { - return new CorrelationKeySet(_correlationKeys); + CorrelationKeys getCorrelationKeySet() { + return new CorrelationKeys(_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=728144&r1=728143&r2=728144&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 Fri Dec 19 13:09:17 2008 @@ -20,7 +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.common.CorrelationKeys; import org.apache.ode.bpel.dao.MessageRouteDAO; import org.apache.ode.bpel.dao.ProcessInstanceDAO; @@ -70,7 +70,7 @@ private CorrelatorDAOImpl _correlator; public MessageRouteDAOImpl() {} - public MessageRouteDAOImpl(CorrelationKeySet keySet, String groupId, int index, + public MessageRouteDAOImpl(CorrelationKeys keySet, String groupId, int index, ProcessInstanceDAOImpl processInst, CorrelatorDAOImpl correlator, String routePolicy) { _correlationKey = keySet.toCanonicalString(); _groupId = groupId; @@ -104,7 +104,7 @@ return _routePolicy; } - public CorrelationKeySet getCorrelationKeySet() { - return new CorrelationKeySet(_correlationKey); + public CorrelationKeys getCorrelationKeys() { + return new CorrelationKeys(_correlationKey); } } Modified: ode/branches/APACHE_ODE_1.X/dao-jpa/src/main/java/org/apache/ode/dao/jpa/ProcessDAOImpl.java URL: http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/dao-jpa/src/main/java/org/apache/ode/dao/jpa/ProcessDAOImpl.java?rev=728144&r1=728143&r2=728144&view=diff ============================================================================== --- ode/branches/APACHE_ODE_1.X/dao-jpa/src/main/java/org/apache/ode/dao/jpa/ProcessDAOImpl.java (original) +++ ode/branches/APACHE_ODE_1.X/dao-jpa/src/main/java/org/apache/ode/dao/jpa/ProcessDAOImpl.java Fri Dec 19 13:09:17 2008 @@ -105,7 +105,7 @@ } @SuppressWarnings("unchecked") - public Collection<ProcessInstanceDAO> findInstance(CorrelationKey ckey) { + public Collection<ProcessInstanceDAO> findInstance(CorrelationKey ckey, boolean wait) { Query qry = getEM().createNamedQuery("InstanceByCKey"); qry.setParameter("ckey", ckey.toCanonicalString()); return qry.getResultList();
