Author: mriou
Date: Tue Sep 30 18:06:30 2008
New Revision: 700652

URL: http://svn.apache.org/viewvc?rev=700652&view=rev
Log:
Fix for runtime state caching (avoids unserializing). Support for correlation 
based on the result of an expression evaluation. Used by simpel with the result 
of a Javascript function call.

Added:
    
ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/rapi/PropertyExtractor.java
    
ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v2/BoundVariableEvaluationContext.java
    
ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v2/OPropertyVarType.java
Modified:
    
ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/rapi/CorrelationSetModel.java
    ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/rapi/OdeRuntime.java
    
ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/BpelCompilerImpl.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/Messages.java
    ode/trunk/engine/src/main/java/org/apache/ode/bpel/engine/ODEProcess.java
    
ode/trunk/engine/src/main/java/org/apache/ode/bpel/engine/PartnerLinkMyRoleImpl.java
    ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v1/OScope.java
    
ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v1/RuntimeImpl.java
    ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v2/ASSIGN.java
    ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v2/OProcess.java
    ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v2/OScope.java
    ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v2/PROCESS.java
    
ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v2/RuntimeImpl.java
    
ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v2/RuntimeInstanceImpl.java
    
ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v2/ScopeFrame.java
    
ode/trunk/runtimes/src/test/java/org/apache/ode/bpel/rtrep/v2/CoreBpelTest.java

Modified: 
ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/rapi/CorrelationSetModel.java
URL: 
http://svn.apache.org/viewvc/ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/rapi/CorrelationSetModel.java?rev=700652&r1=700651&r2=700652&view=diff
==============================================================================
--- 
ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/rapi/CorrelationSetModel.java
 (original)
+++ 
ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/rapi/CorrelationSetModel.java
 Tue Sep 30 18:06:30 2008
@@ -8,4 +8,6 @@
     int getId();
 
     List<PropertyAliasModel> getAliases(QName messageType);
+
+    List<PropertyExtractor> getExtractors();
 }

Modified: 
ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/rapi/OdeRuntime.java
URL: 
http://svn.apache.org/viewvc/ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/rapi/OdeRuntime.java?rev=700652&r1=700651&r2=700652&view=diff
==============================================================================
--- ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/rapi/OdeRuntime.java 
(original)
+++ ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/rapi/OdeRuntime.java 
Tue Sep 30 18:06:30 2008
@@ -22,5 +22,7 @@
 
     String extractProperty(Element msgData, PropertyAliasModel alias, String 
target) throws FaultException;
 
+    String extractMatch(Element msgData, PropertyExtractor extractor) throws 
FaultException;
+
     void setExtensionRegistry(Map<String, ExtensionBundleRuntime> 
extensionRegistry);
 }

Added: 
ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/rapi/PropertyExtractor.java
URL: 
http://svn.apache.org/viewvc/ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/rapi/PropertyExtractor.java?rev=700652&view=auto
==============================================================================
--- 
ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/rapi/PropertyExtractor.java
 (added)
+++ 
ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/rapi/PropertyExtractor.java
 Tue Sep 30 18:06:30 2008
@@ -0,0 +1,9 @@
+package org.apache.ode.bpel.rapi;
+
+/**
+ * Encapsulates the extraction of a property value for non alias based 
correlation.
+ */
+public interface PropertyExtractor {
+
+    String getMessageVariableName();
+}

Modified: 
ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/BpelCompilerImpl.java
URL: 
http://svn.apache.org/viewvc/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/BpelCompilerImpl.java?rev=700652&r1=700651&r2=700652&view=diff
==============================================================================
--- 
ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/BpelCompilerImpl.java
 (original)
+++ 
ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/BpelCompilerImpl.java
 Tue Sep 30 18:06:30 2008
@@ -711,7 +711,7 @@
         OScope procesScope = new OScope(_oprocess, null);
         procesScope.name = "__PROCESS_SCOPE:" + process.getName();
         procesScope.debugInfo = createDebugInfo(process, null);
-        _oprocess.procesScope = compileScope(procesScope, process, new 
Runnable() {
+        _oprocess.processScope = compileScope(procesScope, process, new 
Runnable() {
             public void run() {
                 if (process.getRootActivity() == null) {
                     throw new 
CompilationException(__cmsgs.errNoRootActivity());

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=700652&r1=700651&r2=700652&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
 Tue Sep 30 18:06:30 2008
@@ -64,6 +64,7 @@
 import org.apache.ode.bpel.evar.ExternalVariableModuleException;
 import org.apache.ode.bpel.evar.ExternalVariableModule.Value;
 import org.apache.ode.bpel.rapi.*;
+import org.apache.ode.bpel.memdao.ProcessInstanceDaoImpl;
 
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
@@ -578,19 +579,26 @@
     }
 
     private void saveState() {
-        ByteArrayOutputStream bos = new ByteArrayOutputStream();
-        Object cachedState;
-        try {
-            cachedState = _rti.saveState(bos);
-        } catch (IOException e) {
-            throw new RuntimeException(e);
-        }
-        int newcount = _dao.getExecutionStateCounter() + 1;
-        _dao.setExecutionStateCounter(newcount);
-        _dao.setExecutionState(bos.toByteArray());
-        _instanceWorker.setCachedState(newcount, cachedState);
-
-        __log.debug("CACHE SAVE: #" + newcount + " for instance " + 
_dao.getInstanceId());
+        if (_bpelProcess.isInMemory()) {
+            try {
+                ((ProcessInstanceDaoImpl)_dao).setSoup(_rti.saveState(null));
+            } catch (IOException e) {
+                throw new RuntimeException(e);
+            }
+        } else {
+            ByteArrayOutputStream bos = new ByteArrayOutputStream();
+            Object cachedState;
+            try {
+                cachedState = _rti.saveState(bos);
+            } catch (IOException e) {
+                throw new RuntimeException(e);
+            }
+            int newcount = _dao.getExecutionStateCounter() + 1;
+            _dao.setExecutionStateCounter(newcount);
+            _dao.setExecutionState(bos.toByteArray());
+            _instanceWorker.setCachedState(newcount, cachedState);
+            __log.debug("CACHE SAVE: #" + newcount + " for instance " + 
_dao.getInstanceId());
+        }
     }
 
     void injectMyRoleMessageExchange(final String responseChannelId, final int 
idx, MessageExchangeDAO mexdao) {

Modified: 
ode/trunk/engine/src/main/java/org/apache/ode/bpel/engine/Messages.java
URL: 
http://svn.apache.org/viewvc/ode/trunk/engine/src/main/java/org/apache/ode/bpel/engine/Messages.java?rev=700652&r1=700651&r2=700652&view=diff
==============================================================================
--- ode/trunk/engine/src/main/java/org/apache/ode/bpel/engine/Messages.java 
(original)
+++ ode/trunk/engine/src/main/java/org/apache/ode/bpel/engine/Messages.java Tue 
Sep 30 18:06:30 2008
@@ -170,6 +170,10 @@
         return this.format("Unable to evaluate apply property alias \"{0}\" to 
incoming message: {1}", aliasDescription, reason);
     }
 
+    String msgMatchExtractionOnMessage(String expression, String reason) {
+        return this.format("Unable extract expression \"{0}\" from incoming 
message: {1}", expression, reason);
+    }
+
     public String msgDeployStarting(File deploymentUnitDirectory) {
         return format("Starting deployment of processes from directory 
\"{0}\". ", deploymentUnitDirectory);
     }

Modified: 
ode/trunk/engine/src/main/java/org/apache/ode/bpel/engine/ODEProcess.java
URL: 
http://svn.apache.org/viewvc/ode/trunk/engine/src/main/java/org/apache/ode/bpel/engine/ODEProcess.java?rev=700652&r1=700651&r2=700652&view=diff
==============================================================================
--- ode/trunk/engine/src/main/java/org/apache/ode/bpel/engine/ODEProcess.java 
(original)
+++ ode/trunk/engine/src/main/java/org/apache/ode/bpel/engine/ODEProcess.java 
Tue Sep 30 18:06:30 2008
@@ -203,7 +203,7 @@
         try {
             markused();
             BpelInstanceWorker iworker = 
_instanceWorkerCache.get(instanceDAO.getInstanceId());
-            final OdeRTInstance rti = 
_runtime.newInstance(getState(instanceDAO));
+            final OdeRTInstance rti = _runtime.newInstance(getState(iworker, 
instanceDAO));
             final BpelRuntimeContextImpl processInstance = new 
BpelRuntimeContextImpl(iworker, instanceDAO, rti);
             try {
                 iworker.execInCurrentThread(new Callable<Void>() {
@@ -327,7 +327,7 @@
         BpelInstanceWorker worker = 
_instanceWorkerCache.get(mexdao.getInstance().getInstanceId());
         assert worker.isWorkerThread();
         BpelRuntimeContextImpl rtictx = new BpelRuntimeContextImpl(
-                worker, mexdao.getInstance(), 
_runtime.newInstance(getState(mexdao.getInstance())));
+                worker, mexdao.getInstance(), 
_runtime.newInstance(getState(worker, mexdao.getInstance())));
         rtictx.executeCreateInstance(mexdao);
     }
 
@@ -337,7 +337,7 @@
         BpelInstanceWorker worker = 
_instanceWorkerCache.get(mexdao.getInstance().getInstanceId());
         assert worker.isWorkerThread();
 
-        OdeRTInstance rti = 
_runtime.newInstance(getState(mexdao.getInstance()));
+        OdeRTInstance rti = _runtime.newInstance(getState(worker, 
mexdao.getInstance()));
         BpelRuntimeContextImpl instance = new BpelRuntimeContextImpl(worker, 
mexdao.getInstance(), rti);
         int amp = mexdao.getChannel().indexOf('&');
         String groupId = mexdao.getChannel().substring(0, amp);
@@ -350,7 +350,7 @@
         BpelInstanceWorker worker = 
_instanceWorkerCache.get(instanceDao.getInstanceId());
         assert worker.isWorkerThread();
 
-        OdeRTInstance rti = _runtime.newInstance(getState(instanceDao));
+        OdeRTInstance rti = _runtime.newInstance(getState(worker, 
instanceDao));
         BpelRuntimeContextImpl brc = new BpelRuntimeContextImpl(worker, 
instanceDao, rti);
         brc.execute();
 
@@ -360,7 +360,7 @@
         BpelInstanceWorker worker = 
_instanceWorkerCache.get(instanceDao.getInstanceId());
         assert worker.isWorkerThread();
 
-        OdeRTInstance rti = _runtime.newInstance(getState(instanceDao));
+        OdeRTInstance rti = _runtime.newInstance(getState(worker, 
instanceDao));
         BpelRuntimeContextImpl brc = new BpelRuntimeContextImpl(worker, 
instanceDao, rti);
         if (brc.injectTimerEvent(timerChannel)) brc.execute();
 
@@ -401,7 +401,7 @@
             BpelInstanceWorker worker = 
_instanceWorkerCache.get(instanceDao.getInstanceId());
             assert worker.isWorkerThread();
 
-            OdeRTInstance rti = 
_runtime.newInstance(getState(mexdao.getInstance()));
+            OdeRTInstance rti = _runtime.newInstance(getState(worker, 
mexdao.getInstance()));
             BpelRuntimeContextImpl brc = new BpelRuntimeContextImpl(worker, 
instanceDao, rti);
             brc.injectMyRoleMessageExchange(mroute.getGroupId(), 
mroute.getIndex(), mexdao);
             brc.execute();
@@ -420,7 +420,7 @@
         BpelInstanceWorker worker = 
_instanceWorkerCache.get(mexdao.getInstance().getInstanceId());
         assert worker.isWorkerThread();
 
-        OdeRTInstance rti = 
_runtime.newInstance(getState(mexdao.getInstance()));
+        OdeRTInstance rti = _runtime.newInstance(getState(worker, 
mexdao.getInstance()));
         BpelRuntimeContextImpl brc = new BpelRuntimeContextImpl(worker, 
mexdao.getInstance(), rti);
         // Canceling invoke check
         String jobId = mexdao.getProperty("invokeCheckJobId");
@@ -517,8 +517,10 @@
         return _server.enqueueTransaction(new ProcessCallable<T>(tx));
     }
 
-    private Object getState(ProcessInstanceDAO instanceDAO) {
-        ExecutionQueueImpl state = null;
+    private Object getState(BpelInstanceWorker worker, ProcessInstanceDAO 
instanceDAO) {
+        ExecutionQueueImpl state = (ExecutionQueueImpl) 
worker.getCachedState(instanceDAO.getExecutionStateCounter());
+        if (state != null) return state;
+
         if (isInMemory()) {
             ProcessInstanceDaoImpl inmem = (ProcessInstanceDaoImpl) 
instanceDAO;
             if (inmem.getSoup() != null) {

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=700652&r1=700651&r2=700652&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
 Tue Sep 30 18:06:30 2008
@@ -44,10 +44,10 @@
 import org.apache.ode.bpel.iapi.MessageExchange.FailureType;
 import org.apache.ode.bpel.iapi.MyRoleMessageExchange.CorrelationStatus;
 import org.apache.ode.bpel.runtime.InvalidProcessException;
-import org.apache.ode.bpel.engine.Messages;
 import org.apache.ode.bpel.rapi.PartnerLinkModel;
 import org.apache.ode.bpel.rapi.CorrelationSetModel;
 import org.apache.ode.bpel.rapi.PropertyAliasModel;
+import org.apache.ode.bpel.rapi.PropertyExtractor;
 import org.apache.ode.utils.CollectionUtils;
 import org.apache.ode.utils.ObjectPrinter;
 import org.apache.ode.utils.msg.MessageBundle;
@@ -84,8 +84,7 @@
     /**
      * Called when an input message has been received.
      * 
-     * @param mex
-     *            exchange to which the message is related
+     * @param mex exchange to which the message is related
      */
     public CorrelationStatus invokeMyRole(MessageExchangeDAO mex) {
         if (__log.isTraceEnabled()) {
@@ -104,121 +103,106 @@
         String correlatorId = ODEProcess.genCorrelatorId(_plinkDef, 
operation.getName());
         CorrelatorDAO correlator = 
_process.getProcessDAO().getCorrelator(correlatorId);
 
-        // Special logic for in-mem processes, only createInstance is allowed, 
so we can skip the
-        // correlation BS to save time.
-        if (_process.isInMemory()) {
-            if (isCreateInstnace)
-                invokeMyRoleCreateInstance(mex, operation, correlatorId, 
correlator);
-            else {
-                MexDaoUtil.setFailed(mex, FailureType.OTHER,
-                        "Invalid in-memory process: non createInstance 
operations are not supported!");
-                return null;
-            }
-
-        } else {
-
-            MessageRouteDAO messageRoute = null;
+        MessageRouteDAO messageRoute = null;
 
-            // now, the tricks begin: when a message arrives we have to see if 
there is anyone waiting for it. Get the correlator, a
-            // persisted communnication-reduction data structure supporting 
correlation correlationKey matching!
+        // now, the tricks begin: when a message arrives we have to see if 
there is anyone waiting for it. Get the correlator, a
+        // persisted communnication-reduction data structure supporting 
correlation correlationKey matching!
 
-            CorrelationKey[] keys;
+        CorrelationKey[] keys;
 
-            // We need to compute the correlation keys (based on the operation
-            // we can infer which correlation keys to compute - this is merely 
a set
-            // consisting of each correlationKey used in each correlation sets
-            // that is ever referenced in an <receive>/<onMessage> on this
-            // partnerlink/operation.
-            try {
-                keys = computeCorrelationKeys(mex, operation);
-            } catch (InvalidMessageException ime) {
-                // We'd like to do a graceful exit here, no sense in rolling 
back due to a
-                // a message format problem.
-                __log.debug("Unable to evaluate correlation keys, invalid 
message format. ", ime);
-                MexDaoUtil.setFailed(mex, FailureType.FORMAT_ERROR,  
ime.getMessage());
-                return null;
-            }
+        // We need to compute the correlation keys (based on the operation
+        // we can infer which correlation keys to compute - this is merely a 
set
+        // consisting of each correlationKey used in each correlation sets
+        // that is ever referenced in an <receive>/<onMessage> on this
+        // partnerlink/operation.
+        try {
+            keys = computeCorrelationKeys(mex, operation);
+        } catch (InvalidMessageException ime) {
+            // We'd like to do a graceful exit here, no sense in rolling back 
due to a
+            // a message format problem.
+            __log.debug("Unable to evaluate correlation keys, invalid message 
format. ", ime);
+            MexDaoUtil.setFailed(mex, FailureType.FORMAT_ERROR,  
ime.getMessage());
+            return null;
+        }
 
-            String mySessionId = 
mex.getProperty(MessageExchange.PROPERTY_SEP_MYROLE_SESSIONID);
-            String partnerSessionId = 
mex.getProperty(MessageExchange.PROPERTY_SEP_PARTNERROLE_SESSIONID);
-            if (__log.isDebugEnabled()) {
-                __log.debug("INPUTMSG: " + correlatorId + ": MSG RCVD keys=" + 
CollectionUtils.makeCollection(HashSet.class, keys)
-                        + " mySessionId=" + mySessionId + " partnerSessionId=" 
+ partnerSessionId);
-            }
+        String mySessionId = 
mex.getProperty(MessageExchange.PROPERTY_SEP_MYROLE_SESSIONID);
+        String partnerSessionId = 
mex.getProperty(MessageExchange.PROPERTY_SEP_PARTNERROLE_SESSIONID);
+        if (__log.isDebugEnabled()) {
+            __log.debug("INPUTMSG: " + correlatorId + ": MSG RCVD keys=" + 
CollectionUtils.makeCollection(HashSet.class, keys)
+                    + " mySessionId=" + mySessionId + " partnerSessionId=" + 
partnerSessionId);
+        }
 
-            CorrelationKey matchedKey = null;
+        CorrelationKey matchedKey = null;
 
-            // Try to find a route for one of our keys.
-            for (CorrelationKey key : keys) {
-                messageRoute = correlator.findRoute(key);
-                if (messageRoute != null) {
-                    if (__log.isDebugEnabled()) {
-                        __log.debug("INPUTMSG: " + correlatorId + ": ckey " + 
key + " ROUTED TO (grp,index,iid) = (" + messageRoute.getGroupId() + "," + 
messageRoute.getIndex() + ", " + 
messageRoute.getTargetInstance().getInstanceId() +  ")");
-                    }
-                    matchedKey = key;
-                    break;
+        // Try to find a route for one of our keys.
+        for (CorrelationKey key : keys) {
+            messageRoute = correlator.findRoute(key);
+            if (messageRoute != null) {
+                if (__log.isDebugEnabled()) {
+                    __log.debug("INPUTMSG: " + correlatorId + ": ckey " + key 
+ " ROUTED TO (grp,index,iid) = (" + messageRoute.getGroupId() + "," + 
messageRoute.getIndex() + ", " + 
messageRoute.getTargetInstance().getInstanceId() +  ")");
                 }
+                matchedKey = key;
+                break;
             }
+        }
 
-            // TODO - ODE-58
+        // TODO - ODE-58
 
-            // If no luck, and this operation qualifies for create-instance
-            // treatment, then create a new process
-            // instance.
-            if (messageRoute == null && isCreateInstnace) {
-                invokeMyRoleCreateInstance(mex, operation, correlatorId, 
correlator);
-            } else if (messageRoute != null) {
-                if (__log.isDebugEnabled()) {
-                    __log.debug("INPUTMSG: " + correlatorId + ": ROUTING to 
instance "
-                            + 
messageRoute.getTargetInstance().getInstanceId());
-                }
+        // If no luck, and this operation qualifies for create-instance
+        // treatment, then create a new process
+        // instance.
+        if (messageRoute == null && isCreateInstnace) {
+            invokeMyRoleCreateInstance(mex, operation, correlatorId, 
correlator);
+        } else if (messageRoute != null) {
+            if (__log.isDebugEnabled()) {
+                __log.debug("INPUTMSG: " + correlatorId + ": ROUTING to 
instance "
+                        + messageRoute.getTargetInstance().getInstanceId());
+            }
 
-                ProcessInstanceDAO instanceDao = 
messageRoute.getTargetInstance();
+            ProcessInstanceDAO instanceDao = messageRoute.getTargetInstance();
 
-                // Reload process instance for DAO.
+            // 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);
-
-                // send process instance event
-                CorrelationMatchEvent evt = new 
CorrelationMatchEvent(_process.getProcessModel().getQName(),
-                        _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);
-
-                
mex.setCorrelationStatus(MyRoleMessageExchange.CorrelationStatus.MATCHED.toString());
-                mex.setInstance(messageRoute.getTargetInstance());
-
-                // We're overloading the channel here to be the PICK response 
channel + index
-                mex.setChannel(messageRoute.getGroupId() + "&" + 
messageRoute.getIndex());
-            } else {
-                if (__log.isDebugEnabled()) {
-                    __log.debug("INPUTMSG: " + correlatorId + ": SAVING to DB 
(no match) ");
-                }
+            // Kill the route so some new message does not get routed to
+            // same process instance.
+            correlator.removeRoutes(messageRoute.getGroupId(), instanceDao);
+
+            // send process instance event
+            CorrelationMatchEvent evt = new 
CorrelationMatchEvent(_process.getProcessModel().getQName(),
+                    _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);
 
-                // TODO: Revist (BART)
-                // if (!mex.isAsynchronous()) {
-                // mex.setFailure(MessageExchange.FailureType.NOMATCH, "No 
process instance matching correlation keys.", null);
-                //
-                // } else {
-                // send event
-                CorrelationNoMatchEvent evt = new 
CorrelationNoMatchEvent(mex.getPortType(), mex.getOperation(), mex
-                        .getMessageExchangeId(), keys);
-
-                evt.setProcessId(_process.getProcessDAO().getProcessId());
-                evt.setProcessName(_process.getProcessModel().getQName());
-                _process._debugger.onEvent(evt);
+            
mex.setCorrelationStatus(MyRoleMessageExchange.CorrelationStatus.MATCHED.toString());
+            mex.setInstance(messageRoute.getTargetInstance());
 
-                
mex.setCorrelationStatus(MyRoleMessageExchange.CorrelationStatus.QUEUED.toString());
-                correlator.enqueueMessage(mex, keys);
+            // We're overloading the channel here to be the PICK response 
channel + index
+            mex.setChannel(messageRoute.getGroupId() + "&" + 
messageRoute.getIndex());
+        } else {
+            if (__log.isDebugEnabled()) {
+                __log.debug("INPUTMSG: " + correlatorId + ": SAVING to DB (no 
match) ");
             }
 
+            // TODO: Revist (BART)
+            // if (!mex.isAsynchronous()) {
+            // mex.setFailure(MessageExchange.FailureType.NOMATCH, "No process 
instance matching correlation keys.", null);
+            //
+            // } else {
+            // send event
+            CorrelationNoMatchEvent evt = new 
CorrelationNoMatchEvent(mex.getPortType(), mex.getOperation(), mex
+                    .getMessageExchangeId(), keys);
+
+            evt.setProcessId(_process.getProcessDAO().getProcessId());
+            evt.setProcessName(_process.getProcessModel().getQName());
+            _process._debugger.onEvent(evt);
+
+            
mex.setCorrelationStatus(MyRoleMessageExchange.CorrelationStatus.QUEUED.toString());
+            correlator.enqueueMessage(mex, keys);
         }
 
         return CorrelationStatus.valueOf(mex.getCorrelationStatus());
@@ -266,7 +250,6 @@
         List<CorrelationKey> keys = new ArrayList<CorrelationKey>();
 
         Set<CorrelationSetModel> csets = 
_plinkDef.getCorrelationSetsForOperation(operation);
-
         for (CorrelationSetModel cset : csets) {
             CorrelationKey key = computeCorrelationKey(cset, 
msgDescription.getQName(), msg);
             keys.add(key);
@@ -281,19 +264,35 @@
     }
 
     private CorrelationKey computeCorrelationKey(CorrelationSetModel cset, 
QName messageName, Element msg) {
-        List<PropertyAliasModel> aliases = cset.getAliases(messageName);
-        String[] values = new String[aliases.size()];
-        int jIdx = 0;
-        for (PropertyAliasModel alias : aliases) {
-            String value;
-            try {
-                value = _process._runtime.extractProperty(msg, alias, 
msg.toString());
-            } catch (FaultException fe) {
-                String emsg = 
__msgs.msgPropertyAliasDerefFailedOnMessage(alias.getDescription(), 
fe.getMessage());
-                __log.error(emsg, fe);
-                throw new InvalidMessageException(emsg, fe);
+        String[] values;
+        if (cset.getExtractors().isEmpty()) {
+            List<PropertyAliasModel> aliases = cset.getAliases(messageName);
+            values = new String[aliases.size()];
+            int jIdx = 0;
+            for (PropertyAliasModel alias : aliases) {
+                String value;
+                try {
+                    value = _process._runtime.extractProperty(msg, alias, 
msg.toString());
+                } catch (FaultException fe) {
+                    String emsg = 
__msgs.msgPropertyAliasDerefFailedOnMessage(alias.getDescription(), 
fe.getMessage());
+                    __log.error(emsg, fe);
+                    throw new InvalidMessageException(emsg, fe);
+                }
+                values[jIdx++] = value;
+            }
+        } else {
+            List<PropertyExtractor> extractors = cset.getExtractors();
+            values = new String[extractors.size()];
+            int jIdx = 0;
+            for (PropertyExtractor extractor : extractors) {
+                try {
+                    values[jIdx++] = _process._runtime.extractMatch(msg, 
extractor);
+                } catch (FaultException e) {
+                    String emsg = 
__msgs.msgPropertyAliasDerefFailedOnMessage(extractor.toString(), 
e.getMessage());
+                    __log.error(emsg, e);
+                    throw new InvalidMessageException(emsg, e);
+                }
             }
-            values[jIdx++] = value;
         }
 
         return new CorrelationKey(cset.getId(), values);

Modified: 
ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v1/OScope.java
URL: 
http://svn.apache.org/viewvc/ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v1/OScope.java?rev=700652&r1=700651&r2=700652&view=diff
==============================================================================
--- ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v1/OScope.java 
(original)
+++ ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v1/OScope.java 
Tue Sep 30 18:06:30 2008
@@ -21,6 +21,7 @@
 
 import org.apache.ode.bpel.rapi.CorrelationSetModel;
 import org.apache.ode.bpel.rapi.PropertyAliasModel;
+import org.apache.ode.bpel.rapi.PropertyExtractor;
 
 import javax.xml.namespace.QName;
 import java.util.ArrayList;
@@ -181,6 +182,9 @@
             return aliases;
         }
 
+        public List<PropertyExtractor> getExtractors() {
+            return new ArrayList();
+        }
     }
 
     public static final class Variable extends OBase {

Modified: 
ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v1/RuntimeImpl.java
URL: 
http://svn.apache.org/viewvc/ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v1/RuntimeImpl.java?rev=700652&r1=700651&r2=700652&view=diff
==============================================================================
--- 
ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v1/RuntimeImpl.java 
(original)
+++ 
ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v1/RuntimeImpl.java 
Tue Sep 30 18:06:30 2008
@@ -11,10 +11,7 @@
 import org.apache.ode.bpel.iapi.BpelEngineException;
 import org.apache.ode.bpel.iapi.ProcessConf;
 import org.apache.ode.bpel.common.FaultException;
-import org.apache.ode.bpel.rapi.OdeRuntime;
-import org.apache.ode.bpel.rapi.ProcessModel;
-import org.apache.ode.bpel.rapi.PropertyAliasModel;
-import org.apache.ode.bpel.rapi.OdeRTInstance;
+import org.apache.ode.bpel.rapi.*;
 import org.apache.ode.bpel.rtrep.common.ConfigurationException;
 import org.apache.ode.bpel.extension.ExtensionBundleRuntime;
 import org.apache.ode.jacob.soup.ReplacementMap;
@@ -124,6 +121,10 @@
             return null;
     }
 
+    public String extractMatch(Element msgData, PropertyExtractor extractor) 
throws FaultException {
+        return null;
+    }
+
     public void clear() {
         _pconf = null;
         _oprocess = null;

Modified: 
ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v2/ASSIGN.java
URL: 
http://svn.apache.org/viewvc/ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v2/ASSIGN.java?rev=700652&r1=700651&r2=700652&view=diff
==============================================================================
--- ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v2/ASSIGN.java 
(original)
+++ ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v2/ASSIGN.java 
Tue Sep 30 18:06:30 2008
@@ -26,9 +26,11 @@
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.ode.bpel.common.FaultException;
+import org.apache.ode.bpel.common.CorrelationKey;
 import org.apache.ode.bpel.evt.PartnerLinkModificationEvent;
 import org.apache.ode.bpel.evt.ScopeEvent;
 import org.apache.ode.bpel.evt.VariableModificationEvent;
+import org.apache.ode.bpel.evt.CorrelationSetWriteEvent;
 import org.apache.ode.bpel.rtrep.v2.channels.FaultData;
 import org.apache.ode.bpel.rtrep.common.extension.ExtensionContext;
 import org.apache.ode.bpel.rtrep.common.extension.ExtensibilityQNames;
@@ -387,10 +389,18 @@
             // For partner link assignmenent, the whole content is assigned.
             if (ocopy.to instanceof OAssign.PartnerLinkRef) {
                 OAssign.PartnerLinkRef pLinkRef = ((OAssign.PartnerLinkRef) 
ocopy.to);
-                PartnerLinkInstance plval = _scopeFrame
-                        .resolve(pLinkRef.partnerLink);
+                PartnerLinkInstance plval = 
_scopeFrame.resolve(pLinkRef.partnerLink);
                 replaceEndpointRefence(plval, rvalue);
                 se = new 
PartnerLinkModificationEvent(((OAssign.PartnerLinkRef) 
ocopy.to).partnerLink.getName());
+            } else if (ocopy.to.getVariable().type instanceof 
OPropertyVarType) {
+                // For poperty assignment, the property, the variable that 
points to it and the correlation set
+                // all have the same name
+                CorrelationSetInstance csetInstance = 
_scopeFrame.resolve(ocopy.to.getVariable().name);
+                CorrelationKey ckey = new 
CorrelationKey(csetInstance.declaration.getId(), new String[] { 
rvalue.getTextContent() });
+                if (__log.isDebugEnabled()) __log.debug("Writing correlation " 
+ csetInstance.getName()
+                        + " using value " + rvalue.getTextContent());
+                getBpelRuntime().writeCorrelation(csetInstance, ckey);
+                se = new 
CorrelationSetWriteEvent(csetInstance.declaration.name, ckey);
             } else {
                 // Sneakily converting the EPR if it's not the format expected 
by the lvalue
                 if (ocopy.from instanceof OAssign.PartnerLinkRef) {

Added: 
ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v2/BoundVariableEvaluationContext.java
URL: 
http://svn.apache.org/viewvc/ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v2/BoundVariableEvaluationContext.java?rev=700652&view=auto
==============================================================================
--- 
ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v2/BoundVariableEvaluationContext.java
 (added)
+++ 
ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v2/BoundVariableEvaluationContext.java
 Tue Sep 30 18:06:30 2008
@@ -0,0 +1,71 @@
+package org.apache.ode.bpel.rtrep.v2;
+
+import org.w3c.dom.Node;
+import org.w3c.dom.Element;
+import org.apache.ode.bpel.common.FaultException;
+import org.apache.ode.bpel.rapi.InvalidProcessException;
+import org.apache.ode.utils.DOMUtils;
+
+import javax.xml.namespace.QName;
+import java.net.URI;
+import java.util.HashMap;
+
+/**
+ * Expression language evaluation context used for expressions referencing a 
predefined variable
+ * bound to a given value. Used for correlation matching based on a message 
value extraction
+ * function (i.e. SimPEL+JS).
+ */
+public class BoundVariableEvaluationContext implements EvaluationContext {
+    private HashMap<String, Element> _boundVars = new HashMap<String, 
Element>();
+
+    public void addBoundVariable(String name, Element value) {
+        _boundVars.put(name, value);
+    }
+
+    public Node readVariable(OScope.Variable variable, OMessageVarType.Part 
partDef) throws FaultException {
+        // We need to tweak the context node based on what kind of variable 
(element vs non-element)
+        Element data = _boundVars.get(variable.name);
+        if (data == null) return null;
+
+        if (partDef != null) {
+            Element part = DOMUtils.findChildByName(data, new QName(null, 
partDef.name),false);
+            if (part != null && partDef.type instanceof OElementVarType) {
+                data = DOMUtils.findChildByName(part, 
((OElementVarType)partDef.type).elementType);
+            } else
+                data = part;
+        }
+        return data;
+    }
+
+    public Node getPartData(Element message, OMessageVarType.Part part) throws 
FaultException {
+        throw new InvalidProcessException("Part data not available in this 
context.");
+    }
+
+    public String readMessageProperty(OScope.Variable variable, 
OProcess.OProperty property) throws FaultException {
+        throw new InvalidProcessException("Message property not available in 
this context.");
+    }
+
+    public boolean isLinkActive(OLink olink) throws FaultException {
+        throw new InvalidProcessException("Links not available in this 
context.");
+    }
+
+    public Node getRootNode() {
+        throw new InvalidProcessException("Root node not available in this 
context.");
+    }
+
+    public Node evaluateQuery(Node root, OExpression expr) throws 
FaultException {
+        throw new InvalidProcessException("Root node querying not available in 
this context.");
+    }
+
+    public Long getProcessId() {
+        throw new InvalidProcessException("Process id not available in this 
context.");
+    }
+
+    public boolean narrowTypes() {
+        throw new InvalidProcessException("Types narrowing not available in 
this context.");
+    }
+
+    public URI getBaseResourceURI() {
+        throw new InvalidProcessException("Base URI not available in this 
context.");
+    }
+}

Modified: 
ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v2/OProcess.java
URL: 
http://svn.apache.org/viewvc/ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v2/OProcess.java?rev=700652&r1=700651&r2=700652&view=diff
==============================================================================
--- ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v2/OProcess.java 
(original)
+++ ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v2/OProcess.java 
Tue Sep 30 18:06:30 2008
@@ -56,7 +56,7 @@
     public String processName;
 
     /** ProcessImpl-level scope. */
-    public OScope procesScope;
+    public OScope processScope;
 
     /** All partner links in the process. */
     public final Set<PartnerLinkModel> allPartnerLinks = new 
HashSet<PartnerLinkModel>();
@@ -72,6 +72,8 @@
     /** Date process was compiled. */
     public Date compileDate;
 
+    public byte[] globalState;
+
     int _childIdCounter = 0;
 
     List<OBase> _children = new ArrayList<OBase>();

Added: 
ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v2/OPropertyVarType.java
URL: 
http://svn.apache.org/viewvc/ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v2/OPropertyVarType.java?rev=700652&view=auto
==============================================================================
--- 
ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v2/OPropertyVarType.java
 (added)
+++ 
ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v2/OPropertyVarType.java
 Tue Sep 30 18:06:30 2008
@@ -0,0 +1,15 @@
+package org.apache.ode.bpel.rtrep.v2;
+
+import org.w3c.dom.Node;
+import org.w3c.dom.Document;
+
+public class OPropertyVarType extends OVarType {
+    
+    public OPropertyVarType(OProcess owner) {
+        super(owner);
+    }
+
+    public Node newInstance(Document doc) {
+        return doc.createTextNode("");
+    }
+}

Modified: 
ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v2/OScope.java
URL: 
http://svn.apache.org/viewvc/ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v2/OScope.java?rev=700652&r1=700651&r2=700652&view=diff
==============================================================================
--- ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v2/OScope.java 
(original)
+++ ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v2/OScope.java 
Tue Sep 30 18:06:30 2008
@@ -21,6 +21,7 @@
 
 import org.apache.ode.bpel.rapi.CorrelationSetModel;
 import org.apache.ode.bpel.rapi.PropertyAliasModel;
+import org.apache.ode.bpel.rapi.PropertyExtractor;
 
 import javax.xml.namespace.QName;
 import java.util.ArrayList;
@@ -161,6 +162,7 @@
         public String name;
         public OScope declaringScope;
         public final List<OProcess.OProperty> properties = new 
ArrayList<OProcess.OProperty>();
+        public final List<PropertyExtractor> extractors = new 
ArrayList<PropertyExtractor>();
 
         public CorrelationSet(OProcess owner) {
             super(owner);
@@ -183,6 +185,10 @@
             }
             return aliases;
         }
+
+        public List<PropertyExtractor> getExtractors() {
+            return extractors;
+        }
     }
 
     public static final class Variable extends OBase {

Modified: 
ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v2/PROCESS.java
URL: 
http://svn.apache.org/viewvc/ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v2/PROCESS.java?rev=700652&r1=700651&r2=700652&view=diff
==============================================================================
--- ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v2/PROCESS.java 
(original)
+++ ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v2/PROCESS.java 
Tue Sep 30 18:06:30 2008
@@ -40,18 +40,18 @@
 
     public void run() {
         OdeInternalInstance ntive = getBpelRuntime();
-        Long scopeInstanceId = ntive.createScopeInstance(null, 
_oprocess.procesScope);
+        Long scopeInstanceId = ntive.createScopeInstance(null, 
_oprocess.processScope);
 
         createGlobals();
         ProcessInstanceStartedEvent evt = new ProcessInstanceStartedEvent();
         evt.setRootScopeId(scopeInstanceId);
-        evt.setScopeDeclarationId(_oprocess.procesScope.getId());
+        evt.setScopeDeclarationId(_oprocess.processScope.getId());
         ntive.sendEvent(evt);
 
         ActivityInfo child = new ActivityInfo(genMonotonic(),
-            _oprocess.procesScope,
+            _oprocess.processScope,
             newChannel(TerminationChannel.class), 
newChannel(ParentScopeChannel.class));
-        ScopeFrame processFrame = new ScopeFrame(_oprocess.procesScope, 
scopeInstanceId, null, null,_globals);
+        ScopeFrame processFrame = new ScopeFrame(_oprocess.processScope, 
scopeInstanceId, null, null,_globals);
         instance(new SCOPE(child, processFrame, new LinkFrame(null)));
 
         object(new ParentScopeChannelListener(child.parent) {

Modified: 
ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v2/RuntimeImpl.java
URL: 
http://svn.apache.org/viewvc/ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v2/RuntimeImpl.java?rev=700652&r1=700651&r2=700652&view=diff
==============================================================================
--- 
ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v2/RuntimeImpl.java 
(original)
+++ 
ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v2/RuntimeImpl.java 
Tue Sep 30 18:06:30 2008
@@ -9,10 +9,7 @@
 import org.apache.ode.bpel.iapi.BpelEngineException;
 import org.apache.ode.bpel.iapi.ProcessConf;
 import org.apache.ode.bpel.common.FaultException;
-import org.apache.ode.bpel.rapi.OdeRuntime;
-import org.apache.ode.bpel.rapi.ProcessModel;
-import org.apache.ode.bpel.rapi.PropertyAliasModel;
-import org.apache.ode.bpel.rapi.OdeRTInstance;
+import org.apache.ode.bpel.rapi.*;
 import org.apache.ode.bpel.rtrep.common.ConfigurationException;
 import org.apache.ode.bpel.extension.ExtensionBundleRuntime;
 import org.apache.ode.jacob.soup.ReplacementMap;
@@ -26,8 +23,8 @@
 import javax.xml.namespace.QName;
 
 public class RuntimeImpl implements OdeRuntime {
-    private static final Log __log = LogFactory.getLog(RuntimeImpl.class);
 
+    private static final Log __log = LogFactory.getLog(RuntimeImpl.class);
     private static final Messages __msgs = 
MessageBundle.getMessages(Messages.class);
 
     ProcessConf _pconf;
@@ -76,7 +73,6 @@
                         + " that is unkown to the engine");
             }
         }
-
     }
 
     /*
@@ -137,6 +133,13 @@
             return null;
     }
 
+    public String extractMatch(Element msgData, PropertyExtractor extractor) 
throws FaultException {
+        OExpression expr = (OExpression) extractor;
+        BoundVariableEvaluationContext ctx = new 
BoundVariableEvaluationContext();
+        ctx.addBoundVariable(extractor.getMessageVariableName(), msgData);
+        return ((Text)_expLangRuntimeRegistry.evaluateNode(expr, 
ctx)).getWholeText();
+    }
+
     public void clear() {
         _pconf = null;
         _oprocess = null;

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=700652&r1=700651&r2=700652&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
 Tue Sep 30 18:06:30 2008
@@ -705,7 +705,7 @@
      * @see org.apache.ode.bpel.engine.rapi.OdeInternalInstance#saveState()
      */
     public Object saveState(OutputStream bos) throws IOException {
-        _soup.write(bos);
+        if (bos != null) _soup.write(bos);
         return _soup;
     }
 

Modified: 
ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v2/ScopeFrame.java
URL: 
http://svn.apache.org/viewvc/ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v2/ScopeFrame.java?rev=700652&r1=700651&r2=700652&view=diff
==============================================================================
--- 
ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v2/ScopeFrame.java 
(original)
+++ 
ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v2/ScopeFrame.java 
Tue Sep 30 18:06:30 2008
@@ -81,7 +81,7 @@
 
 
     public ScopeFrame find(OScope scope) {
-        if (oscope.name.equals(scope.name)) return this;
+        if (oscope.getId() == scope.getId()) return this;
         return (parent != null) ? parent.find(scope) : null;
     }
 
@@ -95,6 +95,13 @@
         return new 
CorrelationSetInstance(find(cset.declaringScope).scopeInstanceId, cset);
     }
 
+    public CorrelationSetInstance resolve(String correlationName) {
+        OScope.CorrelationSet cset = oscope.getCorrelationSet(correlationName);
+        if (cset != null) return new CorrelationSetInstance(scopeInstanceId, 
cset);
+        else if (parent != null) return parent.resolve(correlationName);
+        else return null;
+    }
+
     public PartnerLinkInstance resolve(OPartnerLink partnerLink) {
         return new 
PartnerLinkInstance(find(partnerLink.declaringScope).scopeInstanceId, 
partnerLink);
     }

Modified: 
ode/trunk/runtimes/src/test/java/org/apache/ode/bpel/rtrep/v2/CoreBpelTest.java
URL: 
http://svn.apache.org/viewvc/ode/trunk/runtimes/src/test/java/org/apache/ode/bpel/rtrep/v2/CoreBpelTest.java?rev=700652&r1=700651&r2=700652&view=diff
==============================================================================
--- 
ode/trunk/runtimes/src/test/java/org/apache/ode/bpel/rtrep/v2/CoreBpelTest.java 
(original)
+++ 
ode/trunk/runtimes/src/test/java/org/apache/ode/bpel/rtrep/v2/CoreBpelTest.java 
Tue Sep 30 18:06:30 2008
@@ -170,8 +170,8 @@
 
     public void testEmptyProcess() {
         OProcess proc = new OProcess("2.0");
-        proc.procesScope = new OScope(proc, null);
-        proc.procesScope.activity = new OEmpty(proc, proc.procesScope);
+        proc.processScope = new OScope(proc, null);
+        proc.processScope.activity = new OEmpty(proc, proc.processScope);
 
         run(proc);
 
@@ -182,10 +182,10 @@
 
     public void testThrow() {
         OProcess proc = new OProcess("2.0");
-        proc.procesScope = new OScope(proc, null);
-        OThrow othrow = new OThrow(proc, proc.procesScope);
+        proc.processScope = new OScope(proc, null);
+        OThrow othrow = new OThrow(proc, proc.processScope);
         othrow.faultName = new QName("foo", "bar");
-        proc.procesScope.activity = othrow;
+        proc.processScope.activity = othrow;
 
         run(proc);
 
@@ -196,13 +196,13 @@
 
     public void testFaultHandling() {
         OProcess proc = new OProcess("2.0");
-        proc.procesScope = new OScope(proc, null);
-        OThrow othrow = new OThrow(proc, proc.procesScope);
+        proc.processScope = new OScope(proc, null);
+        OThrow othrow = new OThrow(proc, proc.processScope);
         othrow.faultName = new QName("foo", "bar");
-        proc.procesScope.activity = othrow;
-        proc.procesScope.faultHandler = new OFaultHandler(proc);
-        OCatch ocatch = new OCatch(proc, proc.procesScope);
-        proc.procesScope.faultHandler.catchBlocks.add(ocatch);
+        proc.processScope.activity = othrow;
+        proc.processScope.faultHandler = new OFaultHandler(proc);
+        OCatch ocatch = new OCatch(proc, proc.processScope);
+        proc.processScope.faultHandler.catchBlocks.add(ocatch);
         ocatch.activity = new OEmpty(proc, ocatch);
         run(proc);
 
@@ -213,9 +213,9 @@
 
     public void testOneElementSequence() {
         OProcess proc = new OProcess("2.0");
-        proc.procesScope = new OScope(proc, null);
-        OSequence sequence = new OSequence(proc, proc.procesScope);
-        proc.procesScope.activity = sequence;
+        proc.processScope = new OScope(proc, null);
+        OSequence sequence = new OSequence(proc, proc.processScope);
+        proc.processScope.activity = sequence;
         sequence.sequence.add(new OEmpty(proc, sequence));
 
         run(proc);
@@ -227,9 +227,9 @@
 
     public void testTwoElementSequence() {
         OProcess proc = new OProcess("2.0");
-        proc.procesScope = new OScope(proc, null);
-        OSequence sequence = new OSequence(proc, proc.procesScope);
-        proc.procesScope.activity = sequence;
+        proc.processScope = new OScope(proc, null);
+        OSequence sequence = new OSequence(proc, proc.processScope);
+        proc.processScope.activity = sequence;
         sequence.sequence.add(new OEmpty(proc, sequence));
         sequence.sequence.add(new OEmpty(proc, sequence));
 
@@ -242,8 +242,8 @@
 
     public void testEmptyFlow() {
         OProcess proc = new OProcess("2.0");
-        proc.procesScope = new OScope(proc, null);
-        proc.procesScope.activity = new OFlow(proc, proc.procesScope);
+        proc.processScope = new OScope(proc, null);
+        proc.processScope.activity = new OFlow(proc, proc.processScope);
 
         run(proc);
 
@@ -254,9 +254,9 @@
 
     public void testSingleElementFlow() {
         OProcess proc = new OProcess("2.0");
-        proc.procesScope = new OScope(proc, null);
-        OFlow flow = new OFlow(proc, proc.procesScope);
-        proc.procesScope.activity = flow;
+        proc.processScope = new OScope(proc, null);
+        OFlow flow = new OFlow(proc, proc.processScope);
+        proc.processScope.activity = flow;
         flow.parallelActivities.add(new OEmpty(proc, flow));
 
         run(proc);
@@ -268,9 +268,9 @@
 
     public void testTwoElementFlow() {
         OProcess proc = new OProcess("2.0");
-        proc.procesScope = new OScope(proc, null);
-        OFlow flow = new OFlow(proc, proc.procesScope);
-        proc.procesScope.activity = flow;
+        proc.processScope = new OScope(proc, null);
+        OFlow flow = new OFlow(proc, proc.processScope);
+        proc.processScope.activity = flow;
         flow.parallelActivities.add(new OEmpty(proc, flow));
         flow.parallelActivities.add(new OEmpty(proc, flow));
 
@@ -283,9 +283,9 @@
 
     public void testFlowTermination() {
         OProcess proc = new OProcess("2.0");
-        proc.procesScope = new OScope(proc, null);
-        OFlow flow = new OFlow(proc, proc.procesScope);
-        proc.procesScope.activity = flow;
+        proc.processScope = new OScope(proc, null);
+        OFlow flow = new OFlow(proc, proc.processScope);
+        proc.processScope.activity = flow;
         OThrow othrow = new OThrow(proc, flow);
         othrow.faultName = new QName("foo", "bar");
         flow.parallelActivities.add(othrow);


Reply via email to