You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ode.apache.org by mr...@apache.org on 2008/08/30 01:30:16 UTC

svn commit: r690420 [2/4] - in /ode/trunk: ./ axis2-war/lib/ axis2-war/src/test/java/org/apache/ode/axis2/ axis2/src/main/java/org/apache/ode/axis2/ bpel-api/src/main/java/org/apache/ode/bpel/capi/ bpel-api/src/main/java/org/apache/ode/bpel/common/ bpe...

Modified: ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/iapi/ProcessConf.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/iapi/ProcessConf.java?rev=690420&r1=690419&r2=690420&view=diff
==============================================================================
--- ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/iapi/ProcessConf.java (original)
+++ ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/iapi/ProcessConf.java Fri Aug 29 16:30:05 2008
@@ -24,7 +24,6 @@
 import java.util.Date;
 import java.util.List;
 import java.util.Map;
-import java.util.Properties;
 
 import javax.wsdl.Definition;
 import javax.xml.namespace.QName;
@@ -59,6 +58,8 @@
      */
     long getVersion();
 
+    int getRuntimeVersion();
+
     /**
      * Is this a <em>transient</em> process? Transient processes are not persisted in the store.
      * @return <code>true</code> if this is a transient process.
@@ -114,7 +115,6 @@
     
     /**
      * Gets the WSDL definition used in a process into which a service is defined.
-     * @param processId
      * @param serviceName
      * @return definition
      */
@@ -122,14 +122,12 @@
 
     /**
      * Gets the list of endpoints a process should provide.
-     * @param processId
      * @return map of partner link names and associated enpoints
      */
     Map<String, Endpoint> getProvideEndpoints();
 
     /**
      * Gets the list of endpoints a process invokes.
-     * @param processId
      * @return map of partner link names and associated enpoints
      */
     Map<String, Endpoint> getInvokeEndpoints();

Modified: ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/pmapi/BpelManagementFacade.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/pmapi/BpelManagementFacade.java?rev=690420&r1=690419&r2=690420&view=diff
==============================================================================
--- ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/pmapi/BpelManagementFacade.java (original)
+++ ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/pmapi/BpelManagementFacade.java Fri Aug 29 16:30:05 2008
@@ -23,7 +23,6 @@
 import org.apache.ode.bpel.bdi.breaks.VariableModificationBreakpoint;
 import org.apache.ode.bpel.common.CorrelationKey;
 import org.apache.ode.bpel.evt.ProcessInstanceEvent;
-import org.apache.ode.bpel.o.OProcess;
 
 import javax.xml.namespace.QName;
 import java.util.Date;
@@ -128,13 +127,6 @@
   CorrelationKey getCorrelation(Long iid, Long scopeId, String correlationSet) throws ManagementException;
   
   /**
-   * Return the process model.
-   * @return
-   * @param procId
-   */
-  OProcess getProcessDef(String procId) throws ManagementException;
-
-  /**
    * Single step through a process instance.
    * @param iid
    */

Modified: ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/BpelC.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/BpelC.java?rev=690420&r1=690419&r2=690420&view=diff
==============================================================================
--- ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/BpelC.java (original)
+++ ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/BpelC.java Fri Aug 29 16:30:05 2008
@@ -26,7 +26,6 @@
 import java.io.OutputStream;
 import java.net.URI;
 import java.util.Map;
-
 import javax.xml.namespace.QName;
 
 import org.apache.commons.logging.Log;
@@ -34,12 +33,12 @@
 import org.apache.ode.bpel.compiler.api.CompilationException;
 import org.apache.ode.bpel.compiler.api.CompilationMessage;
 import org.apache.ode.bpel.compiler.api.CompileListener;
-import org.apache.ode.bpel.compiler.api.ExtensionValidator;
-import org.apache.ode.bpel.compiler.api.SourceLocation;
+import org.apache.ode.bpel.extension.ExtensionValidator;
 import org.apache.ode.bpel.compiler.bom.BpelObjectFactory;
 import org.apache.ode.bpel.compiler.bom.Process;
-import org.apache.ode.bpel.o.OProcess;
-import org.apache.ode.bpel.o.Serializer;
+import org.apache.ode.bpel.rapi.ProcessModel;
+import org.apache.ode.bpel.rapi.Serializer;
+import org.apache.ode.bpel.rtrep.Serializers;
 import org.apache.ode.utils.StreamUtils;
 import org.apache.ode.utils.msg.MessageBundle;
 import org.w3c.dom.Node;
@@ -47,8 +46,7 @@
 
 /**
  * <p>
- * Wrapper for {@link org.apache.ode.bpel.compiler.BpelCompiler} implementations,
- * providing basic utility methods and auto-detection of BPEL version.
+ * Wrapper for BpelCompiler implementations, providing basic utility methods and auto-detection of BPEL version.
  * </p>
 s */
 public class BpelC {
@@ -196,9 +194,7 @@
 
         logCompilationMessage(__cmsgs.infCompilingProcess());
 
-        BpelCompiler compiler;
         ResourceFinder wf;
-
         if (_wsdlFinder != null) {
             wf = _wsdlFinder;
         } else {
@@ -216,27 +212,25 @@
             }
         };
 
+        BpelCompiler compiler;
         try {
+            compiler = BpelCompilerFactory.latestCompiler(process.getBpelVersion());
+            compiler.setResourceFinder(wf);
+
             switch (process.getBpelVersion()) {
                 case BPEL20:
-                    compiler = new BpelCompiler20();
-                    compiler.setResourceFinder(wf);
                     if (_bpel11wsdl != null) {
                         CompilationMessage cmsg = __cmsgs.warnWsdlUriIgnoredFor20Process();
                         logCompilationMessage(cmsg);
                     }
                     break;
                 case BPEL20_DRAFT:
-                    compiler = new BpelCompiler20Draft();
-                    compiler.setResourceFinder(wf);
                     if (_bpel11wsdl != null) {
                         CompilationMessage cmsg = __cmsgs.warnWsdlUriIgnoredFor20Process();
                         logCompilationMessage(cmsg);
                     }
                     break;
                 case BPEL11:
-                    compiler = new BpelCompiler11();
-                    compiler.setResourceFinder(wf);
                     if (_bpel11wsdl != null) {
                         compiler.addWsdlImport(new URI(_bpelFile.getName()), _bpel11wsdl,null);
                     } else {
@@ -270,9 +264,9 @@
             throw new CompilationException(cmsg,ex);
         }
 
-        OProcess oprocess;
+        ProcessModel pmodel;
         try {
-            oprocess = compiler.compile(process,wf);
+            pmodel = compiler.compile(process, wf);
         }
         catch (CompilationException cex) {
             this.invalidate();
@@ -294,8 +288,8 @@
             }
 
             try {
-                Serializer fileHeader = new Serializer(System.currentTimeMillis());
-                fileHeader.writeOProcess(oprocess, _outputStream);
+                Serializer fileHeader = Serializers.getLatest();
+                fileHeader.writePModel(pmodel, _outputStream);
             } finally {
                 // close & mark myself invalid
                 this.invalidate();
@@ -331,7 +325,7 @@
 
             process = BpelObjectFactory.getInstance().parse(isrc,_bpelFile.toURI());
         } catch (Exception e) {
-            CompilationMessage cmsg = __cmsgs.errBpelParseErr().setSource(new SourceLocationImpl(bpelFile.toURI()));
+            CompilationMessage cmsg = __cmsgs.errBpelParseErr().setSource(new SourceLocation(bpelFile.toURI()));
             this.invalidate();
             throw new CompilationException(cmsg, e);
         }

Modified: ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/LocalEntityResolver.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/LocalEntityResolver.java?rev=690420&r1=690419&r2=690420&view=diff
==============================================================================
--- ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/LocalEntityResolver.java (original)
+++ ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/LocalEntityResolver.java Fri Aug 29 16:30:05 2008
@@ -33,42 +33,42 @@
  * Resolver implementation that restricts us to a known set of resources.
  */
 class LocalEntityResolver implements EntityResolver {
-  private static final Log __log = LogFactory.getLog(LocalEntityResolver.class);
+    private static final Log __log = LogFactory.getLog(LocalEntityResolver.class);
 
-  private final HashMap<String, URL> _mappings = new HashMap<String,URL>();
-  
-  public InputSource resolveEntity(String publicId, String systemId) 
-    throws SAXException, IOException {
-    if (__log.isTraceEnabled())
-      __log.trace("resolveEntity(" + publicId + "," + systemId + ")") ;
-    
-    URL target = _mappings.get(systemId);
-    if (target == null)
-      target = _mappings.get(publicId);
-    
-    if (target == null) {
-      if (__log.isDebugEnabled())
-        __log.debug("resolveEntity(" + publicId + "," + systemId + 
-            ") failed (resource not found) ");
-      throw new IOException("Resource not found: " + publicId + " : "  + systemId);
+    private final HashMap<String, URL> _mappings = new HashMap<String,URL>();
+
+    public InputSource resolveEntity(String publicId, String systemId)
+            throws SAXException, IOException {
+        if (__log.isTraceEnabled())
+            __log.trace("resolveEntity(" + publicId + "," + systemId + ")") ;
+
+        URL target = _mappings.get(systemId);
+        if (target == null)
+            target = _mappings.get(publicId);
+
+        if (target == null) {
+            if (__log.isDebugEnabled())
+                __log.debug("resolveEntity(" + publicId + "," + systemId +
+                        ") failed (resource not found) ");
+            throw new IOException("Resource not found: " + publicId + " : "  + systemId);
+        }
+
+        if (__log.isDebugEnabled())
+            __log.debug("resolveEntity(" + publicId + "," + systemId +
+                    ") ==> target" );
+
+        return new InputSource(target.openStream());
+    }
+
+
+    void register(String id, URL location) {
+        if (id == null)
+            throw new NullPointerException("id arg must not be null!");
+        if (location == null)
+            throw new NullPointerException("location arg must not be null");
+
+        if (__log.isDebugEnabled())
+            __log.debug("mapping " + id + " ==> " + location);
+        _mappings.put(id, location);
     }
-    
-    if (__log.isDebugEnabled())
-       __log.debug("resolveEntity(" + publicId + "," + systemId + 
-            ") ==> target" );
-    
-    return new InputSource(target.openStream());
-  }
-
-  
-  void register(String id, URL location) {
-    if (id == null)
-      throw new NullPointerException("id arg must not be null!");
-    if (location == null)
-      throw new NullPointerException("location arg must not be null");
-    
-    if (__log.isDebugEnabled())
-      __log.debug("mapping " + id + " ==> " + location);
-    _mappings.put(id, location);
-  }
 }

Modified: ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/api/CompilationException.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/api/CompilationException.java?rev=690420&r1=690419&r2=690420&view=diff
==============================================================================
--- ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/api/CompilationException.java (original)
+++ ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/api/CompilationException.java Fri Aug 29 16:30:05 2008
@@ -22,26 +22,26 @@
  * Exception indicating a compilation error. 
  */
 public class CompilationException extends RuntimeException {
-  private static final long serialVersionUID = -4683674811787611083L;
-  private CompilationMessage _msg;
+    private static final long serialVersionUID = -4683674811787611083L;
+    private CompilationMessage _msg;
 
-  public CompilationException(CompilationMessage msg, Throwable cause) {
-    super(msg.toErrorString(),cause);
-    _msg = msg;
-  }
-  /**
-   * @see Exception#Exception(String,Throwable)
-   */
-  public CompilationException(CompilationMessage msg) {
-    this(msg, null);
-  }
+    public CompilationException(CompilationMessage msg, Throwable cause) {
+        super(msg.toErrorString(),cause);
+        _msg = msg;
+    }
+    /**
+     * @see Exception#Exception(String,Throwable)
+     */
+    public CompilationException(CompilationMessage msg) {
+        this(msg, null);
+    }
 
-  public String toErrorMessage() {
-    return _msg.toErrorString();
-  }
+    public String toErrorMessage() {
+        return _msg.toErrorString();
+    }
 
-  /** Get the {@link CompilationMessage} associated with this exception}. */
-  public CompilationMessage getCompilationMessage() {
-    return _msg;
-  }
+    /** Get the {@link CompilationMessage} associated with this exception}. */
+    public CompilationMessage getCompilationMessage() {
+        return _msg;
+    }
 }

Modified: ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/api/CompilationMessage.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/api/CompilationMessage.java?rev=690420&r1=690419&r2=690420&view=diff
==============================================================================
--- ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/api/CompilationMessage.java (original)
+++ ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/api/CompilationMessage.java Fri Aug 29 16:30:05 2008
@@ -20,6 +20,7 @@
 
 import org.apache.ode.utils.msg.CommonMessages;
 import org.apache.ode.utils.msg.MessageBundle;
+import org.apache.ode.bpel.compiler.SourceLocation;
 
 /**
  * Data structure representing messages emitted from the compiler. These
@@ -27,61 +28,61 @@
  * errors and the like).
  */
 public class CompilationMessage {
-  /** Informational message. */
-  public static final short INFO = 0;
-  /** Warning message. */
-  public static final short WARN = 1;
-  /** Error message. */
-  public static final short ERROR = 2;
-
-  /** Compilation phase. */
-  public short phase;
-
-  /** The severity severity. */
-  public short severity;
-
-  /** The message/error code for this message. */
-  public String code;
-
-  /** Internationalized message text. */
-  public String messageText;
-
-  /** The location in the source that caused this error/message/warning */
-  public SourceLocation source;
-
-  /** Common internationalized words. */
-  private static final CommonMessages __commonMsgs = MessageBundle.getMessages(CommonMessages.class);
-
-  private static final String SEVERITY_LEVELS[] = {
-    __commonMsgs.strInfo().toLowerCase() + ": ",
-    __commonMsgs.strWarning().toLowerCase() + ": ",
-    __commonMsgs.strError().toLowerCase() + ": "
-  };
-  
-  public CompilationMessage setSource(SourceLocation source) {
-    this.source = source;
-    return this;
-  }
-
-  /** Convert to a human-readable error string. */
-  public String toErrorString() {
-    StringBuffer buf = new StringBuffer();
-    if (source != null) {
-      buf.append(source.getURI());
-      buf.append(':');
-      buf.append(source.getLineNo());
-      buf.append(": ");
+    /** Informational message. */
+    public static final short INFO = 0;
+    /** Warning message. */
+    public static final short WARN = 1;
+    /** Error message. */
+    public static final short ERROR = 2;
+
+    /** Compilation phase. */
+    public short phase;
+
+    /** The severity severity. */
+    public short severity;
+
+    /** The message/error code for this message. */
+    public String code;
+
+    /** Internationalized message text. */
+    public String messageText;
+
+    /** The location in the source that caused this error/message/warning */
+    public SourceLocation source;
+
+    /** Common internationalized words. */
+    private static final CommonMessages __commonMsgs = MessageBundle.getMessages(CommonMessages.class);
+
+    private static final String SEVERITY_LEVELS[] = {
+            __commonMsgs.strInfo().toLowerCase() + ": ",
+            __commonMsgs.strWarning().toLowerCase() + ": ",
+            __commonMsgs.strError().toLowerCase() + ": "
+    };
+
+    public CompilationMessage setSource(SourceLocation source) {
+        this.source = source;
+        return this;
+    }
+
+    /** Convert to a human-readable error string. */
+    public String toErrorString() {
+        StringBuffer buf = new StringBuffer();
+        if (source != null) {
+            buf.append(source.getURI());
+            buf.append(':');
+            buf.append(source.getLineNo());
+            buf.append(": ");
+        }
+        buf.append(SEVERITY_LEVELS[severity]);
+        buf.append('[');
+        buf.append(code);
+        buf.append("] ");
+        buf.append(messageText);
+        return buf.toString();
+    }
+
+    public String toString() {
+        return "CompilationMessage: " + toErrorString();
     }
-    buf.append(SEVERITY_LEVELS[severity]);
-    buf.append('[');
-    buf.append(code);
-    buf.append("] ");
-    buf.append(messageText);
-    return buf.toString();
-  }
-
-  public String toString() {
-    return "CompilationMessage: " + toErrorString();
-  }
 
 }

Modified: ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/BpelObject.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/BpelObject.java?rev=690420&r1=690419&r2=690420&view=diff
==============================================================================
--- ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/BpelObject.java (original)
+++ ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/BpelObject.java Fri Aug 29 16:30:05 2008
@@ -18,7 +18,7 @@
  */
 package org.apache.ode.bpel.compiler.bom;
 
-import org.apache.ode.bpel.compiler.api.SourceLocation;
+import org.apache.ode.bpel.compiler.SourceLocation;
 import org.apache.ode.utils.DOMUtils;
 import org.apache.ode.utils.NSContext;
 import org.apache.ode.utils.stl.CollectionsX;
@@ -41,7 +41,7 @@
  * location information (i.e. line numbers) and namespace context (XML namespace
  * prefix maps).
  */
-public class BpelObject implements SourceLocation {
+public class BpelObject extends SourceLocation {
 
     public static final QName ATTR_LINENO = new QName("urn:org.apache.ode.bpel.compiler", "lineno");
 

Modified: ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/BpelObjectFactory.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/BpelObjectFactory.java?rev=690420&r1=690419&r2=690420&view=diff
==============================================================================
--- ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/BpelObjectFactory.java (original)
+++ ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/BpelObjectFactory.java Fri Aug 29 16:30:05 2008
@@ -21,6 +21,7 @@
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.ode.bpel.compiler.bom.IfActivity.Case;
+import org.apache.ode.bpel.rtrep.common.extension.ExtensibilityQNames;
 import org.apache.ode.utils.DOMUtils;
 import org.apache.ode.utils.XMLParserUtils;
 import org.w3c.dom.Document;

Modified: ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/ExtensionActivity.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/ExtensionActivity.java?rev=690420&r1=690419&r2=690420&view=diff
==============================================================================
--- ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/ExtensionActivity.java (original)
+++ ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/ExtensionActivity.java Fri Aug 29 16:30:05 2008
@@ -22,6 +22,7 @@
 import java.util.List;
 
 import org.w3c.dom.Element;
+import org.apache.ode.bpel.extension.ExtensibleElement;
 
 /**
  * BOM representation of the BPEL <code>&lt;extensionActivity&gt;</code> activity. The

Modified: ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/ExtensionAssignOperation.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/ExtensionAssignOperation.java?rev=690420&r1=690419&r2=690420&view=diff
==============================================================================
--- ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/ExtensionAssignOperation.java (original)
+++ ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/ExtensionAssignOperation.java Fri Aug 29 16:30:05 2008
@@ -19,6 +19,7 @@
 package org.apache.ode.bpel.compiler.bom;
 
 import org.apache.ode.bpel.compiler.bom.AssignActivity.AssignOperation;
+import org.apache.ode.bpel.extension.ExtensibleElement;
 import org.w3c.dom.Element;
 import org.w3c.dom.Node;
 import org.w3c.dom.NodeList;
@@ -29,7 +30,7 @@
  * @author Tammo van Lessen (University of Stuttgart)
  */
 public class ExtensionAssignOperation extends BpelObject implements AssignOperation,
-																	ExtensibleElement {
+        ExtensibleElement {
 	private Element _childElement;
 	
     public ExtensionAssignOperation(Element el) {

Modified: ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/Process.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/Process.java?rev=690420&r1=690419&r2=690420&view=diff
==============================================================================
--- ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/Process.java (original)
+++ ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/Process.java Fri Aug 29 16:30:05 2008
@@ -23,18 +23,13 @@
 import java.util.Set;
 
 import org.w3c.dom.Element;
+import org.apache.ode.bpel.compiler.BpelCompiler;
 
 /**
  * BPEL Object Model (BOM) representation of a BPEL process.
  */
 public class Process extends Scope {
 
-    public enum Version {
-        BPEL11,
-        BPEL20_DRAFT,
-        BPEL20
-    }
-
     public Process(Element el) {
         super(el);
     }
@@ -51,10 +46,10 @@
     /**
      * Get the BPEL version of this process.
      */
-    public Version getBpelVersion() {
-        if (is11()) return Version.BPEL11;
-        if (is20Draft()) return Version.BPEL20_DRAFT;
-        return Version.BPEL20;
+    public BpelCompiler.Version getBpelVersion() {
+        if (is11()) return BpelCompiler.Version.BPEL11;
+        if (is20Draft()) return BpelCompiler.Version.BPEL20_DRAFT;
+        return BpelCompiler.Version.BPEL20;
     }
 
     /**

Modified: ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/Variable.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/Variable.java?rev=690420&r1=690419&r2=690420&view=diff
==============================================================================
--- ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/Variable.java (original)
+++ ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/Variable.java Fri Aug 29 16:30:05 2008
@@ -21,6 +21,7 @@
 import javax.xml.namespace.QName;
 
 import org.w3c.dom.Element;
+import org.apache.ode.bpel.rtrep.common.extension.ExtensibilityQNames;
 
 /**
  * BPEL Variable declaration.

Copied: ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/xpath10/JaxenBpelHandler.java (from r690063, ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/xpath10/JaxenBpelHandler.java)
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/xpath10/JaxenBpelHandler.java?p2=ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/xpath10/JaxenBpelHandler.java&p1=ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/xpath10/JaxenBpelHandler.java&r1=690063&r2=690420&rev=690420&view=diff
==============================================================================
--- ode/branches/rtver/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/xpath10/JaxenBpelHandler.java (original)
+++ ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/xpath10/JaxenBpelHandler.java Fri Aug 29 16:30:05 2008
@@ -102,12 +102,10 @@
 
   /**
    */
-  public void endFunction()
-                   throws JaxenException {
+  public void endFunction() {
     super.endFunction();
 
-    FunctionCallExpr c = (FunctionCallExpr)peekFrame()
-                                             .getLast();
+    FunctionCallExpr c = (FunctionCallExpr)peekFrame().getLast();
 
     String prefix = c.getPrefix();
 
@@ -122,7 +120,6 @@
       throw new CompilationException(
           __msgs.errUndeclaredFunctionPrefix(prefix,c.getFunctionName()));
     } else if (isBpelNamespace(ns)) {
-      try {
         if (Constants.EXT_FUNCTION_GETVARIABLEDATA.equals(c.getFunctionName())) {
           compileGetVariableData(c);
         } else if (Constants.EXT_FUNCTION_GETVARIABLEPROPRTY.equals(c
@@ -135,9 +132,6 @@
         } else {
           throw new CompilationException(__msgs.errUnknownBpelFunction(c.getFunctionName()));
         }
-      } catch (CompilationException ce) {
-        throw new CompilationExceptionWrapper(ce);
-      }
     }
   }
 

Modified: ode/trunk/bpel-compiler/src/test/java/org/apache/ode/bpel/compiler/CompilationMessageTest.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-compiler/src/test/java/org/apache/ode/bpel/compiler/CompilationMessageTest.java?rev=690420&r1=690419&r2=690420&view=diff
==============================================================================
--- ode/trunk/bpel-compiler/src/test/java/org/apache/ode/bpel/compiler/CompilationMessageTest.java (original)
+++ ode/trunk/bpel-compiler/src/test/java/org/apache/ode/bpel/compiler/CompilationMessageTest.java Fri Aug 29 16:30:05 2008
@@ -36,7 +36,7 @@
   private static String WRONG_PARAMETER_CODE = "WrongParameter";
 
   private CompilationTestMessages _bundle;
-  private SourceLocationImpl sloc;
+  private SourceLocation sloc;
   private Locale oldLocale;
   @Override
   protected void setUp() throws Exception {
@@ -44,7 +44,7 @@
     oldLocale = Locale.getDefault();
     Locale.setDefault(Locale.ENGLISH);
     _bundle = MessageBundle.getMessages(CompilationTestMessages.class);
-    sloc = new SourceLocationImpl(new URI("urn:foo"));
+    sloc = new SourceLocation(new URI("urn:foo"));
   }
 
   @Override

Modified: ode/trunk/bpel-compiler/src/test/java/org/apache/ode/bpel/compiler/WSDLRegistryTest.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-compiler/src/test/java/org/apache/ode/bpel/compiler/WSDLRegistryTest.java?rev=690420&r1=690419&r2=690420&view=diff
==============================================================================
--- ode/trunk/bpel-compiler/src/test/java/org/apache/ode/bpel/compiler/WSDLRegistryTest.java (original)
+++ ode/trunk/bpel-compiler/src/test/java/org/apache/ode/bpel/compiler/WSDLRegistryTest.java Fri Aug 29 16:30:05 2008
@@ -29,6 +29,8 @@
 import org.apache.ode.bpel.compiler.wsdl.Definition4BPEL;
 import org.apache.ode.bpel.compiler.wsdl.WSDLFactory4BPEL;
 import org.apache.ode.bpel.compiler.wsdl.WSDLFactoryBPEL11;
+import org.apache.ode.bpel.compiler.DefaultResourceFinder;
+import org.apache.ode.bpel.compiler.v2.WSDLRegistry;
 import org.apache.ode.utils.xsd.SchemaModel;
 
 public class WSDLRegistryTest extends TestCase {

Modified: ode/trunk/bpel-compiler/src/test/java/org/apache/ode/bpel/compiler/XPathTest.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-compiler/src/test/java/org/apache/ode/bpel/compiler/XPathTest.java?rev=690420&r1=690419&r2=690420&view=diff
==============================================================================
--- ode/trunk/bpel-compiler/src/test/java/org/apache/ode/bpel/compiler/XPathTest.java (original)
+++ ode/trunk/bpel-compiler/src/test/java/org/apache/ode/bpel/compiler/XPathTest.java Fri Aug 29 16:30:05 2008
@@ -19,8 +19,8 @@
 package org.apache.ode.bpel.compiler;
 
 import java.io.IOException;
-import java.util.ArrayList;
 import java.util.HashMap;
+import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
 
@@ -30,35 +30,16 @@
 import junit.framework.TestCase;
 
 import org.apache.ode.bpel.compiler.api.CompilationException;
-import org.apache.ode.bpel.compiler.api.CompilerContext;
-import org.apache.ode.bpel.compiler.api.ExpressionCompiler;
-import org.apache.ode.bpel.compiler.api.ExtensionValidator;
-import org.apache.ode.bpel.compiler.api.SourceLocation;
-import org.apache.ode.bpel.compiler.bom.Activity;
-import org.apache.ode.bpel.compiler.bom.BpelObject;
-import org.apache.ode.bpel.compiler.bom.Expression;
-import org.apache.ode.bpel.compiler.bom.ScopeLikeActivity;
-import org.apache.ode.bpel.elang.xpath10.compiler.XPath10ExpressionCompilerBPEL11;
-import org.apache.ode.bpel.elang.xpath10.compiler.XPath10ExpressionCompilerBPEL20;
-import org.apache.ode.bpel.elang.xpath10.compiler.XPath10ExpressionCompilerBPEL20Draft;
-import org.apache.ode.bpel.elang.xpath20.compiler.XPath20ExpressionCompilerBPEL20;
-import org.apache.ode.bpel.elang.xpath20.compiler.XPath20ExpressionCompilerBPEL20Draft;
-import org.apache.ode.bpel.o.OActivity;
-import org.apache.ode.bpel.o.OElementVarType;
-import org.apache.ode.bpel.o.OExpression;
-import org.apache.ode.bpel.o.OLValueExpression;
-import org.apache.ode.bpel.o.OLink;
-import org.apache.ode.bpel.o.OMessageVarType;
-import org.apache.ode.bpel.o.OPartnerLink;
-import org.apache.ode.bpel.o.OProcess;
-import org.apache.ode.bpel.o.OScope;
-import org.apache.ode.bpel.o.OXsdTypeVarType;
-import org.apache.ode.bpel.o.OXslSheet;
-import org.apache.ode.bpel.o.OMessageVarType.Part;
-import org.apache.ode.bpel.o.OProcess.OProperty;
-import org.apache.ode.bpel.o.OProcess.OPropertyAlias;
-import org.apache.ode.bpel.o.OScope.CorrelationSet;
-import org.apache.ode.bpel.o.OScope.Variable;
+import org.apache.ode.bpel.compiler.v2.CompilerContext;
+import org.apache.ode.bpel.compiler.v2.ExpressionCompiler;
+import org.apache.ode.bpel.extension.ExtensionValidator;
+import org.apache.ode.bpel.compiler.bom.*;
+import org.apache.ode.bpel.compiler.v2.xpath10.XPath10ExpressionCompilerBPEL11;
+import org.apache.ode.bpel.compiler.v2.xpath10.XPath10ExpressionCompilerBPEL20;
+import org.apache.ode.bpel.compiler.v2.xpath10.XPath10ExpressionCompilerBPEL20Draft;
+import org.apache.ode.bpel.compiler.v2.xpath20.XPath20ExpressionCompilerBPEL20;
+import org.apache.ode.bpel.compiler.v2.xpath20.XPath20ExpressionCompilerBPEL20Draft;
+import org.apache.ode.bpel.rtrep.v2.*;
 import org.apache.ode.utils.DOMUtils;
 import org.apache.ode.utils.NSContext;
 import org.w3c.dom.Element;
@@ -119,7 +100,7 @@
 class MockCompilerContext implements CompilerContext {
 	private OProcess _oprocess = new OProcess("20");
 
-	private Map<String, Variable> _vars = new HashMap<String, Variable>();
+	private Map<String, OScope.Variable> _vars = new HashMap<String, OScope.Variable>();
 
 	public OExpression constantExpr(boolean value) {
 		return null;
@@ -148,29 +129,29 @@
 		return null;
 	}
 
-	public OProperty resolveProperty(QName name) throws CompilationException {
+	public OProcess.OProperty resolveProperty(QName name) throws CompilationException {
 		return null;
 	}
 
-	public Variable resolveVariable(String name) throws CompilationException {
+	public OScope.Variable resolveVariable(String name) throws CompilationException {
 		return _vars.get(name);
 	}
 
-	public List<Variable> getAccessibleVariables() {
-		return new ArrayList<Variable>(_vars.values());
+	public List<OScope.Variable> getAccessibleVariables() {
+		return new ArrayList<OScope.Variable>(_vars.values());
 	}
 
-	public Variable resolveMessageVariable(String inputVar)
+	public OScope.Variable resolveMessageVariable(String inputVar)
 			throws CompilationException {
 		return _vars.get(inputVar);
 	}
 
-	public Variable resolveMessageVariable(String inputVar, QName messageType)
+	public OScope.Variable resolveMessageVariable(String inputVar, QName messageType)
 			throws CompilationException {
 		return _vars.get(inputVar);
 	}
 
-	public Part resolvePart(Variable variable, String partname)
+	public OMessageVarType.Part resolvePart(OScope.Variable variable, String partname)
 			throws CompilationException {
 		return ((OMessageVarType) variable.type).parts.get(partname);
 	}
@@ -203,7 +184,7 @@
 		return null;
 	}
 
-	public OPropertyAlias resolvePropertyAlias(Variable variable, QName property)
+	public OProcess.OPropertyAlias resolvePropertyAlias(OScope.Variable variable, QName property)
 			throws CompilationException {
 		// TODO Auto-generated method stub
 		return null;
@@ -226,7 +207,7 @@
 		return _oprocess;
 	}
 
-	public CorrelationSet resolveCorrelationSet(String csetName)
+	public OScope.CorrelationSet resolveCorrelationSet(String csetName)
 			throws CompilationException {
 		return null;
 	}
@@ -261,7 +242,7 @@
 		return null;
 	}
 
-	public OScope compileSLC(ScopeLikeActivity child, Variable[] variables) {
+	public OScope compileSLC(ScopeLikeActivity child, OScope.Variable[] variables) {
 		return null;
 	}
 
@@ -277,7 +258,7 @@
 		return null;
 	}
 
-    public Part resolveHeaderPart(Variable variable, String partname) throws CompilationException {
+    public OMessageVarType.Part resolveHeaderPart(OScope.Variable variable, String partname) throws CompilationException {
         return null;
     }
 }

Modified: ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelInstanceWorker.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelInstanceWorker.java?rev=690420&r1=690419&r2=690420&view=diff
==============================================================================
--- ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelInstanceWorker.java (original)
+++ ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelInstanceWorker.java Fri Aug 29 16:30:05 2008
@@ -20,7 +20,7 @@
 
     private static final Log __log = LogFactory.getLog(BpelInstanceWorker.class);
     
-    final BpelProcess _process;
+    final ODEProcess _process;
 
     final Long _iid;
 
@@ -36,7 +36,7 @@
 
     private CachedState _cachedState;
 
-    BpelInstanceWorker(BpelProcess process, Long iid) {
+    BpelInstanceWorker(ODEProcess process, Long iid) {
         _process = process;
         _iid = iid;
         _contexts = _process._contexts;

Modified: ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelInstanceWorkerCache.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelInstanceWorkerCache.java?rev=690420&r1=690419&r2=690420&view=diff
==============================================================================
--- ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelInstanceWorkerCache.java (original)
+++ ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelInstanceWorkerCache.java Fri Aug 29 16:30:05 2008
@@ -4,7 +4,6 @@
 import java.lang.ref.ReferenceQueue;
 import java.lang.ref.WeakReference;
 import java.util.HashMap;
-import java.util.WeakHashMap;
 
 /**
  * A cache of {@link BpelInstanceWorker} objects. 
@@ -16,9 +15,9 @@
     private HashMap<Long, WeakReference<BpelInstanceWorker>> _cache = new HashMap<Long, WeakReference<BpelInstanceWorker>>();
     private ReferenceQueue<BpelInstanceWorker> _refQ = new ReferenceQueue<BpelInstanceWorker>();
     
-    private BpelProcess _process;
+    private ODEProcess _process;
     
-    public BpelInstanceWorkerCache(BpelProcess process) {
+    public BpelInstanceWorkerCache(ODEProcess process) {
         _process = process;
     }
     

Modified: ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelManagementFacadeImpl.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelManagementFacadeImpl.java?rev=690420&r1=690419&r2=690420&view=diff
==============================================================================
--- ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelManagementFacadeImpl.java (original)
+++ ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelManagementFacadeImpl.java Fri Aug 29 16:30:05 2008
@@ -25,7 +25,6 @@
 import org.apache.ode.bpel.dao.*;
 import org.apache.ode.bpel.iapi.BpelServer;
 import org.apache.ode.bpel.iapi.ProcessStore;
-import org.apache.ode.bpel.o.OProcess;
 import org.apache.ode.bpel.pmapi.*;
 import org.apache.ode.bpel.pmapi.TInstanceInfo.EventInfo;
 import org.apache.ode.bpel.runtime.breaks.ActivityBreakpointImpl;
@@ -180,15 +179,6 @@
         });
     }
 
-    /**
-     * @see BpelManagementFacade#getProcessDef(String)
-     * @param procid
-     */
-    public OProcess getProcessDef(String procid) throws ManagementException {
-
-        return _server.getOProcess(QName.valueOf(procid));
-    }
-
     public void step(final Long iid) throws ManagementException {
         // We need debugger support in order to resume (since we have to force
         // a reduction. If one is not available the getDebugger() method should

Modified: ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelRuntimeContextImpl.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelRuntimeContextImpl.java?rev=690420&r1=690419&r2=690420&view=diff
==============================================================================
--- ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelRuntimeContextImpl.java (original)
+++ ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelRuntimeContextImpl.java Fri Aug 29 16:30:05 2008
@@ -18,15 +18,13 @@
  */
 package org.apache.ode.bpel.engine;
 
-import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
+import java.io.IOException;
 import java.net.URI;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Date;
-import java.util.HashMap;
 import java.util.List;
-import java.util.Map;
 
 import javax.wsdl.Operation;
 import javax.xml.namespace.QName;
@@ -52,60 +50,27 @@
 import org.apache.ode.bpel.evt.ProcessMessageExchangeEvent;
 import org.apache.ode.bpel.evt.ProcessTerminationEvent;
 import org.apache.ode.bpel.evt.ScopeEvent;
-import org.apache.ode.bpel.engine.extvar.ExternalVariableKeyMapSerializer;
 import org.apache.ode.bpel.iapi.BpelEngineException;
 import org.apache.ode.bpel.iapi.ContextException;
 import org.apache.ode.bpel.iapi.EndpointReference;
-import org.apache.ode.bpel.iapi.InvocationStyle;
 import org.apache.ode.bpel.iapi.MessageExchange;
-import org.apache.ode.bpel.iapi.MyRoleMessageExchange;
 import org.apache.ode.bpel.iapi.PartnerRoleChannel;
-import org.apache.ode.bpel.iapi.PartnerRoleMessageExchange;
 import org.apache.ode.bpel.iapi.MessageExchange.AckType;
 import org.apache.ode.bpel.iapi.MessageExchange.FailureType;
 import org.apache.ode.bpel.iapi.MessageExchange.MessageExchangePattern;
 import org.apache.ode.bpel.iapi.MessageExchange.Status;
-import org.apache.ode.bpel.memdao.ProcessInstanceDaoImpl;
-import org.apache.ode.bpel.o.OElementVarType;
-import org.apache.ode.bpel.o.OMessageVarType;
-import org.apache.ode.bpel.o.OMessageVarType.Part;
-import org.apache.ode.bpel.o.OPartnerLink;
-import org.apache.ode.bpel.o.OProcess;
-import org.apache.ode.bpel.o.OScope;
-import org.apache.ode.bpel.o.OScope.Variable;
-import org.apache.ode.bpel.runtime.BpelJacobRunnable;
-import org.apache.ode.bpel.runtime.BpelRuntimeContext;
-import org.apache.ode.bpel.runtime.CorrelationSetInstance;
-import org.apache.ode.bpel.runtime.ExpressionLanguageRuntimeRegistry;
-import org.apache.ode.bpel.runtime.PROCESS;
-import org.apache.ode.bpel.runtime.PartnerLinkInstance;
-import org.apache.ode.bpel.runtime.Selector;
-import org.apache.ode.bpel.runtime.VariableInstance;
-import org.apache.ode.bpel.runtime.channels.ActivityRecoveryChannel;
-import org.apache.ode.bpel.runtime.channels.FaultData;
-import org.apache.ode.bpel.runtime.channels.InvokeResponseChannel;
-import org.apache.ode.bpel.runtime.channels.PickResponseChannel;
-import org.apache.ode.bpel.runtime.channels.TimerResponseChannel;
-import org.apache.ode.bpel.runtime.extension.AbstractExtensionBundle;
-import org.apache.ode.bpel.runtime.extension.ExtensionOperation;
-import org.apache.ode.jacob.JacobRunnable;
-import org.apache.ode.jacob.vpu.ExecutionQueueImpl;
-import org.apache.ode.jacob.vpu.JacobVPU;
-import org.apache.ode.utils.DOMUtils;
-import org.apache.ode.utils.GUID;
-import org.apache.ode.utils.Namespaces;
-import org.apache.ode.utils.ObjectPrinter;
+import org.apache.ode.utils.*;
 
 import org.apache.ode.bpel.evar.ExternalVariableModuleException;
 import org.apache.ode.bpel.evar.ExternalVariableModule.Value;
+import org.apache.ode.bpel.rapi.*;
 
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 import org.w3c.dom.Node;
 import org.w3c.dom.NodeList;
-import org.w3c.dom.Document;
 
-class BpelRuntimeContextImpl implements BpelRuntimeContext {
+class BpelRuntimeContextImpl implements OdeRTInstanceContext {
 
     private static final Log __log = LogFactory.getLog(BpelRuntimeContextImpl.class);
 
@@ -115,85 +80,30 @@
     /** Process Instance ID */
     private final Long _iid;
 
-    /** JACOB VPU */
-    protected JacobVPU _vpu;
-
-    /** JACOB ExecutionQueue (state) */
-    protected ExecutionQueueImpl _soup;
-
     private MessageExchangeDAO _instantiatingMessageExchange;
 
     private BpelInstanceWorker _instanceWorker;
 
-    private BpelProcess _bpelProcess;
-
-    /** Five second maximum for continous execution. */
-    private long _maxReductionTimeMs = 2000000;
+    private ODEProcess _bpelProcess;
 
     private Contexts _contexts;
 
-    private boolean _executed;
-
     private boolean _forceFlush;
 
-    BpelRuntimeContextImpl(BpelInstanceWorker instanceWorker, ProcessInstanceDAO dao) {
-        this(instanceWorker, dao, new ExecutionQueueImpl(null));
+    /** Process instance as represented by runtime. */
+    final OdeRTInstance _rti;
 
-        if (ProcessState.isFinished(dao.getState()))
-            throw new BpelEngineException("Invalid process state (process is finished)!!!");
-        
-        // The following allows us to skip deserialization of the soup if our execution state in memory is the same
-        // as that in the database.
-        
-        Object cachedState = instanceWorker.getCachedState(dao.getExecutionStateCounter());
-        if (cachedState != null) {
-            if (__log.isDebugEnabled())
-                __log.debug("CACHE HIT: Using cached state #" + dao.getExecutionStateCounter() + " to resume instance " + dao.getInstanceId());
-            _soup = (ExecutionQueueImpl) cachedState; 
-            _soup.setReplacementMap(_bpelProcess.getReplacementMap(dao.getProcess().getProcessId()));
-            _vpu.setContext(_soup);
-        } else {
-            if (__log.isDebugEnabled())
-                __log.debug("CACHE MISS: state #" + dao.getExecutionStateCounter() + " is stale; loading state to resume instance " + dao.getInstanceId() + " from database ");
-            byte[] daoState = dao.getExecutionState();
-            ByteArrayInputStream iis = new ByteArrayInputStream(daoState);
-            try {
-                _soup.read(iis);
-            } catch (Exception ex) {
-                throw new RuntimeException(ex);
-            }
-        }
-    }
-
-    BpelRuntimeContextImpl(BpelInstanceWorker instanceWorker, ProcessInstanceDAO dao, PROCESS PROCESS,
-            MessageExchangeDAO instantiatingMessageExchange) {
-
-        this(instanceWorker, dao, new ExecutionQueueImpl(null));
-
-        if (PROCESS == null)
-            throw new NullPointerException();
-        if (instantiatingMessageExchange == null)
-            throw new NullPointerException();
-        _soup.setGlobalData(new OutstandingRequestManager());
-        _instantiatingMessageExchange = instantiatingMessageExchange;
-        _vpu.inject(PROCESS);
-
-    }
+    /** Five second maximum for continous execution. */
+    private long _maxReductionTimeMs = 2000000;
 
-    BpelRuntimeContextImpl(BpelInstanceWorker instanceWorker, ProcessInstanceDAO dao, ExecutionQueueImpl soup) {
+    public BpelRuntimeContextImpl(BpelInstanceWorker instanceWorker, ProcessInstanceDAO instanceDAO, OdeRTInstance rti) {
         _instanceWorker = instanceWorker;
         _bpelProcess = instanceWorker._process;
         _contexts = instanceWorker._contexts;
-        _dao = dao;
-        _iid = dao.getInstanceId();
-        _vpu = new JacobVPU();
-        _vpu.registerExtension(BpelRuntimeContext.class, this);
-        _soup = soup;
-        _soup.setReplacementMap(_bpelProcess.getReplacementMap(dao.getProcess().getProcessId()));
-        _vpu.setContext(_soup);
-        if (BpelProcess.__log.isDebugEnabled()) {
-            __log.debug("BpelRuntimeContextImpl created for instance " + _iid + ". INDEXED STATE=" + _soup.getIndex());
-        }
+        _dao = instanceDAO;
+        _iid = instanceDAO.getInstanceId();
+        _rti = rti;
+        _rti.setContext(this);
     }
 
     public String toString() {
@@ -208,41 +118,40 @@
         return _dao.genMonotonic();
     }
 
-    /**
-     * @see BpelRuntimeContext#isCorrelationInitialized(org.apache.ode.bpel.runtime.CorrelationSetInstance)
-     */
-    public boolean isCorrelationInitialized(CorrelationSetInstance correlationSet) {
-        ScopeDAO scopeDAO = _dao.getScope(correlationSet.scopeInstance);
-        CorrelationSetDAO cs = scopeDAO.getCorrelationSet(correlationSet.declaration.name);
+    public boolean isCorrelationInitialized(CorrelationSet correlationSet) {
+        ScopeDAO scopeDAO = _dao.getScope(correlationSet.getScopeId());
+        CorrelationSetDAO cs = scopeDAO.getCorrelationSet(correlationSet.getName());
 
         return cs.getValue() != null;
     }
 
-    /**
-     * @see BpelRuntimeContext#isVariableInitialized(org.apache.ode.bpel.runtime.VariableInstance)
-     */
-    public boolean isVariableInitialized(VariableInstance var) {
-        ScopeDAO scopeDAO = _dao.getScope(var.scopeInstance);
-        XmlDataDAO dataDAO = scopeDAO.getVariable(var.declaration.name);
+    public boolean isVariableInitialized(Variable var) {
+        ScopeDAO scopeDAO = _dao.getScope(var.getScopeId());
+        XmlDataDAO dataDAO = scopeDAO.getVariable(var.getName());
         return !dataDAO.isNull();
     }
 
-    public boolean isPartnerRoleEndpointInitialized(PartnerLinkInstance pLink) {
+    public Node initializeVariable(Variable variable, Node initData) {
+        ScopeDAO scopeDAO = _dao.getScope(variable.getScopeId());
+        XmlDataDAO dataDAO = scopeDAO.getVariable(variable.getName());
+
+        dataDAO.set(initData);
+        return dataDAO.get();
+    }
+
+    public boolean isPartnerRoleEndpointInitialized(PartnerLink pLink) {
         PartnerLinkDAO spl = fetchPartnerLinkDAO(pLink);
 
-        return spl.getPartnerEPR() != null || _bpelProcess.getInitialPartnerRoleEPR(pLink.partnerLink) != null;
+        return spl.getPartnerEPR() != null || _bpelProcess.getInitialPartnerRoleEPR(pLink.getModel()) != null;
     }
 
-    /**
-     * @see BpelRuntimeContext#completedFault(org.apache.ode.bpel.runtime.channels.FaultData)
-     */
-    public void completedFault(FaultData faultData) {
-        if (BpelProcess.__log.isDebugEnabled()) {
-            BpelProcess.__log.debug("ProcessImpl completed with fault '" + faultData.getFaultName() + "'");
+    public void completedFault(FaultInfo faultData) {
+        if (ODEProcess.__log.isDebugEnabled()) {
+            ODEProcess.__log.debug("ProcessImpl completed with fault '" + faultData.getFaultName() + "'");
         }
 
-        _dao.setFault(faultData.getFaultName(), faultData.getExplanation(), faultData.getFaultLineNo(), faultData.getActivityId(),
-                faultData.getFaultMessage());
+        _dao.setFault(faultData.getFaultName(), faultData.getExplanation(), faultData.getFaultLineNo(),
+                faultData.getActivityId(), faultData.getFaultMessage());
 
         // send event
         ProcessInstanceStateChangeEvent evt = new ProcessInstanceStateChangeEvent();
@@ -253,16 +162,11 @@
 
         sendEvent(new ProcessCompletionEvent(faultData.getFaultName()));
         _dao.finishCompletion();
-
-        cleanupOutstandingMyRoleExchanges(faultData);
     }
 
-    /**
-     * @see BpelRuntimeContext#completedOk()
-     */
     public void completedOk() {
-        if (BpelProcess.__log.isDebugEnabled()) {
-            BpelProcess.__log.debug("ProcessImpl " + _bpelProcess.getPID() + " completed OK.");
+        if (ODEProcess.__log.isDebugEnabled()) {
+            ODEProcess.__log.debug("ProcessImpl " + _bpelProcess.getPID() + " completed OK.");
         }
 
         // send event
@@ -274,18 +178,12 @@
 
         sendEvent(new ProcessCompletionEvent(null));
         _dao.finishCompletion();
-
-        cleanupOutstandingMyRoleExchanges();
     }
 
-    /**
-     * @see BpelRuntimeContext#createScopeInstance(Long, org.apache.ode.bpel.o.OScope)
-     */
-    public Long createScopeInstance(Long parentScopeId, OScope scope) {
-        if (BpelProcess.__log.isTraceEnabled()) {
-            BpelProcess.__log.trace(ObjectPrinter.stringifyMethodEnter("createScopeInstance", new Object[] { "parentScopeId",
-                    parentScopeId, "scope", scope }));
-        }
+    public Long createScopeInstance(Long parentScopeId, String name, int modelId) {
+        if (ODEProcess.__log.isTraceEnabled())
+            ODEProcess.__log.trace(ObjectPrinter.stringifyMethodEnter("createScopeInstance", new Object[] { "parentScopeId",
+                    parentScopeId, "name", name }));
 
         ScopeDAO parent = null;
 
@@ -293,38 +191,34 @@
             parent = _dao.getScope(parentScopeId);
         }
 
-        ScopeDAO scopeDao = _dao.createScope(parent, scope.name, scope.getId());
+        ScopeDAO scopeDao = _dao.createScope(parent, name, modelId);
         return scopeDao.getScopeInstanceId();
     }
 
-    public void initializePartnerLinks(Long parentScopeId, Collection<OPartnerLink> partnerLinks) {
-
-        if (BpelProcess.__log.isTraceEnabled()) {
-            BpelProcess.__log.trace(ObjectPrinter.stringifyMethodEnter("initializeEndpointReferences", new Object[] {
+    public void initializePartnerLinks(Long parentScopeId, Collection<? extends PartnerLinkModel> partnerLinks) {
+        if (ODEProcess.__log.isTraceEnabled())
+            ODEProcess.__log.trace(ObjectPrinter.stringifyMethodEnter("initializeEndpointReferences", new Object[] {
                     "parentScopeId", parentScopeId, "partnerLinks", partnerLinks }));
-        }
 
         ScopeDAO parent = _dao.getScope(parentScopeId);
-        for (OPartnerLink partnerLink : partnerLinks) {
-            PartnerLinkDAO pdao = parent.createPartnerLink(partnerLink.getId(), partnerLink.name, partnerLink.myRoleName,
-                    partnerLink.partnerRoleName);
+        for (PartnerLinkModel partnerLink : partnerLinks) {
+            PartnerLinkDAO pdao = parent.createPartnerLink(partnerLink.getId(), partnerLink.getName(),
+                    partnerLink.getMyRoleName(), partnerLink.getPartnerRoleName());
             // If there is a myrole on the link, initialize the session id so it is always
             // available for opaque correlations. The myrole session id should never be changed.
             if (partnerLink.hasMyRole()) pdao.setMySessionId(new GUID().toString());
         }
     }
 
-    public void select(PickResponseChannel pickResponseChannel, Date timeout, boolean createInstance, Selector[] selectors)
-            throws FaultException {
-        if (BpelProcess.__log.isTraceEnabled())
-            BpelProcess.__log.trace(ObjectPrinter.stringifyMethodEnter("select", new Object[] { "pickResponseChannel",
-                    pickResponseChannel, "timeout", timeout, "createInstance", createInstance, "selectors", selectors }));
+    public void select(String selectChannelId, Date timeout, Selector[] selectors) {
+        if (ODEProcess.__log.isTraceEnabled())
+            ODEProcess.__log.trace(ObjectPrinter.stringifyMethodEnter("select", new Object[] { "pickResponseChannel",
+                    selectChannelId, "timeout", timeout, "selectors", selectors }));
 
         ProcessDAO processDao = _dao.getProcess();
 
         // check if this is first pick
         if (_dao.getState() == ProcessState.STATE_NEW) {
-            assert createInstance;
             // send event
             ProcessInstanceStateChangeEvent evt = new ProcessInstanceStateChangeEvent();
             evt.setOldState(ProcessState.STATE_NEW);
@@ -333,36 +227,26 @@
             sendEvent(evt);
         }
 
-        final String pickResponseChannelStr = pickResponseChannel.export();
-
         List<CorrelatorDAO> correlators = new ArrayList<CorrelatorDAO>(selectors.length);
         for (Selector selector : selectors) {
-            String correlatorId = BpelProcess.genCorrelatorId(selector.plinkInstance.partnerLink, selector.opName);
-            if (BpelProcess.__log.isDebugEnabled()) {
-                BpelProcess.__log.debug("SELECT: " + pickResponseChannel + ": USING CORRELATOR " + correlatorId);
+            String correlatorId = ODEProcess.genCorrelatorId(selector.getPartnerLink().getModel(), selector.getOperation());
+            if (ODEProcess.__log.isDebugEnabled()) {
+                ODEProcess.__log.debug("SELECT: " + selectChannelId + ": USING CORRELATOR " + correlatorId);
             }
             correlators.add(processDao.getCorrelator(correlatorId));
         }
 
-        int conflict = getORM().findConflict(selectors);
-        if (conflict != -1)
-            throw new FaultException(_bpelProcess.getOProcess().constants.qnConflictingReceive, selectors[conflict].toString());
-
-        getORM().register(pickResponseChannelStr, selectors);
-
-        // TODO - ODE-58
-
         // First check if we match to a new instance.
         if (_instantiatingMessageExchange != null && _dao.getState() == ProcessState.STATE_READY) {
-            if (BpelProcess.__log.isDebugEnabled()) {
-                BpelProcess.__log.debug("SELECT: " + pickResponseChannel + ": CHECKING for NEW INSTANCE match");
+            if (ODEProcess.__log.isDebugEnabled()) {
+                ODEProcess.__log.debug("SELECT: " + selectChannelId + ": CHECKING for NEW INSTANCE match");
             }
             for (int i = 0; i < correlators.size(); ++i) {
                 CorrelatorDAO ci = correlators.get(i);
                 if (ci.equals(_dao.getInstantiatingCorrelator())) {
-                    injectMyRoleMessageExchange(pickResponseChannelStr, i, _instantiatingMessageExchange);
-                    if (BpelProcess.__log.isDebugEnabled()) {
-                        BpelProcess.__log.debug("SELECT: " + pickResponseChannel + ": FOUND match for NEW instance mexRef="
+                    injectMyRoleMessageExchange(selectChannelId, i, _instantiatingMessageExchange);
+                    if (ODEProcess.__log.isDebugEnabled()) {
+                        ODEProcess.__log.debug("SELECT: " + selectChannelId + ": FOUND match for NEW instance mexRef="
                                 + _instantiatingMessageExchange);
                     }
                     return;
@@ -371,9 +255,9 @@
         }
 
         if (timeout != null) {
-            registerTimer(pickResponseChannel, timeout);
-            if (BpelProcess.__log.isDebugEnabled()) {
-                BpelProcess.__log.debug("SELECT: " + pickResponseChannel + "REGISTERED TIMEOUT for " + timeout);
+            registerTimer(selectChannelId, timeout);
+            if (ODEProcess.__log.isDebugEnabled()) {
+                ODEProcess.__log.debug("SELECT: " + selectChannelId + "REGISTERED TIMEOUT for " + timeout);
             }
         }
 
@@ -381,51 +265,42 @@
             CorrelatorDAO correlator = correlators.get(i);
             Selector selector = selectors[i];
 
-            correlator.addRoute(pickResponseChannel.export(), _dao, i, selector.correlationKey);
-            scheduleCorrelatorMatcher(correlator.getCorrelatorId(), selector.correlationKey);
+            correlator.addRoute(selectChannelId, _dao, i, selector.getCorrelationKey());
+            scheduleCorrelatorMatcher(correlator.getCorrelatorId(), selector.getCorrelationKey());
 
-            if (BpelProcess.__log.isDebugEnabled()) {
-                BpelProcess.__log.debug("SELECT: " + pickResponseChannel + ": ADDED ROUTE " + correlator.getCorrelatorId() + ": "
-                        + selector.correlationKey + " --> " + _dao.getInstanceId());
+            if (ODEProcess.__log.isDebugEnabled()) {
+                ODEProcess.__log.debug("SELECT: " + selectChannelId + ": ADDED ROUTE " + correlator.getCorrelatorId() + ": "
+                        + selector.getCorrelationKey() + " --> " + _dao.getInstanceId());
             }
         }
-
     }
 
-    /**
-     * @see BpelRuntimeContext#readCorrelation(org.apache.ode.bpel.runtime.CorrelationSetInstance)
-     */
-    public CorrelationKey readCorrelation(CorrelationSetInstance cset) {
-        ScopeDAO scopeDAO = _dao.getScope(cset.scopeInstance);
-        CorrelationSetDAO cs = scopeDAO.getCorrelationSet(cset.declaration.name);
+    public CorrelationKey readCorrelation(CorrelationSet cset) {
+        ScopeDAO scopeDAO = _dao.getScope(cset.getScopeId());
+        CorrelationSetDAO cs = scopeDAO.getCorrelationSet(cset.getName());
         return cs.getValue();
     }
   
 
-    public Element fetchPartnerRoleEndpointReferenceData(PartnerLinkInstance pLink) throws FaultException {
+    public Element fetchPartnerRoleEndpointReferenceData(PartnerLink pLink) {
         PartnerLinkDAO pl = fetchPartnerLinkDAO(pLink);
         Element epr = pl.getPartnerEPR();
-
         if (epr == null) {
-            EndpointReference e = _bpelProcess.getInitialPartnerRoleEPR(pLink.partnerLink);
+            EndpointReference e = _bpelProcess.getInitialPartnerRoleEPR(pLink.getModel());
             if (e != null)
                 epr = e.toXML().getDocumentElement();
         }
 
-        if (epr == null) {
-            throw new FaultException(_bpelProcess.getOProcess().constants.qnUninitializedPartnerRole);
-        }
-
         return epr;
     }
 
-    public Element fetchMyRoleEndpointReferenceData(PartnerLinkInstance pLink) {
-        return _bpelProcess.getInitialMyRoleEPR(pLink.partnerLink).toXML().getDocumentElement();
+    public Element fetchMyRoleEndpointReferenceData(PartnerLink pLink) {
+        return _bpelProcess.getInitialMyRoleEPR(pLink.getModel()).toXML().getDocumentElement();
     }
 
-    private PartnerLinkDAO fetchPartnerLinkDAO(PartnerLinkInstance pLink) {
-        ScopeDAO scopeDAO = _dao.getScope(pLink.scopeInstanceId);
-        return scopeDAO.getPartnerLink(pLink.partnerLink.getId());
+    private PartnerLinkDAO fetchPartnerLinkDAO(PartnerLink pLink) {
+        ScopeDAO scopeDAO = _dao.getScope(pLink.getScopeId());
+        return scopeDAO.getPartnerLink(pLink.getModel().getId());
     }
 
     /**
@@ -440,30 +315,32 @@
      * @throws org.apache.ode.bpel.common.FaultException
      *             in case of selection or other fault
      */
-    public String readProperty(VariableInstance variable, OProcess.OProperty property) throws FaultException {
-        Node varData = readVariable(variable.scopeInstance, variable.declaration.name, false);
-
-        OProcess.OPropertyAlias alias = property.getAlias(variable.declaration.type);
-        String val = _bpelProcess.extractProperty((Element) varData, alias, variable.declaration.getDescription());
-
-        if (BpelProcess.__log.isTraceEnabled()) {
-            BpelProcess.__log.trace("readPropertyAlias(variable=" + variable + ", alias=" + alias + ") = " + val.toString());
-        }
+    public String readVariableProperty(Variable variable, QName property) throws UninitializedVariableException {
+        ScopeDAO scopeDAO = _dao.getScope(variable.getScopeId());
+        XmlDataDAO dataDAO = scopeDAO.getVariable(variable.getName());
+        if (dataDAO.isNull()) throw new UninitializedVariableException();
+        return dataDAO.getProperty(QNameUtils.fromQName(property));
+    }
 
-        return val;
+    public Node fetchVariableData(Variable variable, boolean forWriting) {
+        ScopeDAO scopeDAO = _dao.getScope(variable.getScopeId());
+        XmlDataDAO dataDAO = scopeDAO.getVariable(variable.getName());
+        if (dataDAO.isNull()) return null;
+        return dataDAO.get();
     }
 
-    public void writeEndpointReference(PartnerLinkInstance variable, Element data) throws FaultException {
+
+    public void writeEndpointReference(PartnerLink partnerLink, Element data) {
         if (__log.isDebugEnabled()) {
-            __log.debug("Writing endpoint reference " + variable.partnerLink.getName() + " with value "
+            __log.debug("Writing endpoint reference " + partnerLink.getName() + " with value "
                     + DOMUtils.domToString(data));
         }
 
-        PartnerLinkDAO eprDAO = fetchPartnerLinkDAO(variable);
+        PartnerLinkDAO eprDAO = fetchPartnerLinkDAO(partnerLink);
         eprDAO.setPartnerEPR(data);
     }
 
-    public String fetchEndpointSessionId(PartnerLinkInstance pLink, boolean isMyEPR) throws FaultException {
+    public String fetchEndpointSessionId(PartnerLink pLink, boolean isMyEPR) throws FaultException {
         PartnerLinkDAO dao = fetchPartnerLinkDAO(pLink);
         return isMyEPR ? dao.getMySessionId() : dao.getPartnerSessionId();
     }
@@ -479,53 +356,36 @@
         return _contexts.eprContext.convertEndpoint(nodeQName, sourceNode).toXML();
     }
 
-
-	public Node readVariable(Long scopeInstanceId, String varname, boolean forWriting) throws FaultException {
-		ScopeDAO scopedao = _dao.getScope(scopeInstanceId);
-		XmlDataDAO var = scopedao.getVariable(varname);
-		return (var == null || var.isNull()) ? null : var.get();
-	}
-	
-    public Node writeVariable(VariableInstance variable, Node changes) {
-        ScopeDAO scopeDAO = _dao.getScope(variable.scopeInstance);
-        XmlDataDAO dataDAO = scopeDAO.getVariable(variable.declaration.name);
+    public void commitChanges(Variable variable, Node changes) {
+        ScopeDAO scopeDAO = _dao.getScope(variable.getScopeId());
+        XmlDataDAO dataDAO = scopeDAO.getVariable(variable.getName());
         dataDAO.set(changes);
-
-        writeProperties(variable, changes, dataDAO);
-        return dataDAO.get();
     }
 
-    public void reply(final PartnerLinkInstance plinkInstnace, final String opName, final String mexId, Element msg, QName fault)
-            throws FaultException {
-        String mexRef = getORM().release(plinkInstnace, opName, mexId);
-
-        if (mexRef == null) {
-            throw new FaultException(_bpelProcess.getOProcess().constants.qnMissingRequest);
-        }
+    public void writeVariableProperty(Variable variable, QName property, String value) throws UninitializedVariableException {
+        ScopeDAO scopeDAO = _dao.getScope(variable.getScopeId());
+        XmlDataDAO dataDAO = scopeDAO.getVariable(variable.getName());
+        if (dataDAO.isNull()) throw new UninitializedVariableException();
+        dataDAO.setProperty(QNameUtils.fromQName(property), value);
+    }
 
+    public void reply(String mexId, final PartnerLink plink, final String opName, Element msg, QName fault)
+            throws NoSuchOperationException {
         // prepare event
         ProcessMessageExchangeEvent evt = new ProcessMessageExchangeEvent();
         evt.setMexId(mexId);
         evt.setOperation(opName);
-        evt.setPortType(plinkInstnace.partnerLink.myRolePortType.getQName());
+        evt.setPortType(plink.getModel().getMyRolePortType().getQName());
 
         // Get the "my-role" mex from the DB.
-        MessageExchangeDAO myrolemex = _dao.getConnection().getMessageExchange(mexRef);
+        MessageExchangeDAO myrolemex = _dao.getConnection().getMessageExchange(mexId);
+
+        Operation operation = plink.getModel().getMyRoleOperation(opName);
+        if (operation == null || operation.getOutput() == null) throw new NoSuchOperationException();
 
-        Operation operation = plinkInstnace.partnerLink.getMyRoleOperation(opName);
-        if (operation == null || operation.getOutput() == null) {
-            // reply to operation that is either not defined or one-way
-            // Perhaps this should be detected at compile time? 
-            throw new FaultException(_bpelProcess.getOProcess().constants.qnMissingRequest,
-                    "Undefined two-way operation \"" + opName + "\".");
-            
-        }
-        
         // TODO what if msg==null? i.e. for a reply-with-fault.
-        
-        MessageDAO message = myrolemex.createMessage(
-                operation.getOutput().getMessage()
-                .getQName());
+
+        MessageDAO message = myrolemex.createMessage(operation.getOutput().getMessage().getQName());
         buildOutgoingMessage(message, msg);
 
         myrolemex.setResponse(message);
@@ -547,72 +407,16 @@
         sendEvent(evt);
     }
 
-
-    /**
-     * @see BpelRuntimeContext#writeCorrelation(org.apache.ode.bpel.runtime.CorrelationSetInstance,
-     *      org.apache.ode.bpel.common.CorrelationKey)
-     */
-    public void writeCorrelation(CorrelationSetInstance cset, CorrelationKey correlation) {
-        ScopeDAO scopeDAO = _dao.getScope(cset.scopeInstance);
-        CorrelationSetDAO cs = scopeDAO.getCorrelationSet(cset.declaration.name);
-        OScope.CorrelationSet csetdef = (OScope.CorrelationSet) _bpelProcess.getOProcess().getChild(correlation.getCSetId());
-        QName[] propNames = new QName[csetdef.properties.size()];
-        for (int m = 0; m < csetdef.properties.size(); m++) {
-            OProcess.OProperty oProperty = csetdef.properties.get(m);
-            propNames[m] = oProperty.name;
-        }
+    public void writeCorrelation(CorrelationSet cset, QName[] propNames, CorrelationKey correlation) {
+        ScopeDAO scopeDAO = _dao.getScope(cset.getScopeId());
+        CorrelationSetDAO cs = scopeDAO.getCorrelationSet(cset.getName());
         cs.setValue(propNames, correlation);
 
-        CorrelationSetWriteEvent cswe = new CorrelationSetWriteEvent(cset.declaration.name, correlation);
-        cswe.setScopeId(cset.scopeInstance);
+        CorrelationSetWriteEvent cswe = new CorrelationSetWriteEvent(cset.getName(), correlation);
+        cswe.setScopeId(cset.getScopeId());
         sendEvent(cswe);
-
     }
 
-    /**
-     * Common functionality to initialize a correlation set based on data available in a variable.
-     * 
-     * @param cset
-     *            the correlation set instance
-     * @param variable
-     *            variable instance
-     * 
-     * @throws IllegalStateException
-     *             DOCUMENTME
-     */
-    public void initializeCorrelation(CorrelationSetInstance cset, VariableInstance variable) throws FaultException {
-        if (BpelProcess.__log.isDebugEnabled()) {
-            BpelProcess.__log.debug("Initializing correlation set " + cset.declaration.name);
-        }
-        // if correlation set is already initialized, then skip
-        if (isCorrelationInitialized(cset)) {
-            // if already set, we ignore
-            if (BpelProcess.__log.isDebugEnabled()) {
-                BpelProcess.__log.debug("OCorrelation set " + cset + " is already set: ignoring");
-            }
-            return;
-        }
-
-        String[] propNames = new String[cset.declaration.properties.size()];
-        String[] propValues = new String[cset.declaration.properties.size()];
-
-        for (int i = 0; i < cset.declaration.properties.size(); ++i) {
-            OProcess.OProperty property = cset.declaration.properties.get(i);
-            propValues[i] = readProperty(variable, property);
-            propNames[i] = property.name.toString();
-        }
-
-        CorrelationKey ckeyVal = new CorrelationKey(cset.declaration.getId(), propValues);
-        writeCorrelation(cset, ckeyVal);
-    }
-
-    public ExpressionLanguageRuntimeRegistry getExpLangRuntime() {
-        return _bpelProcess._expLangRuntimeRegistry;
-    }
-
-    /**
-     * @see BpelRuntimeContext#terminate()
-     */
     public void terminate() {
         // send event
         ProcessInstanceStateChangeEvent evt = new ProcessInstanceStateChangeEvent();
@@ -623,14 +427,13 @@
         sendEvent(new ProcessTerminationEvent());
 
         _dao.finishCompletion();
-        cleanupOutstandingMyRoleExchanges();
     }
 
-    public void registerTimer(TimerResponseChannel timerChannel, Date timeToFire) {
+    public void registerTimer(String timerChannelId, Date timeToFire) {
         WorkEvent we = new WorkEvent();
         we.setIID(_dao.getInstanceId());
         we.setProcessId(_bpelProcess.getPID());
-        we.setChannel(timerChannel.export());
+        we.setChannel(timerChannelId);
         we.setType(WorkEvent.Type.TIMER);
         _bpelProcess.scheduleWorkEvent(we, timeToFire);
     }
@@ -646,18 +449,18 @@
         _bpelProcess.scheduleWorkEvent(we, null);
     }
 
-    public String invoke(PartnerLinkInstance partnerLink, Operation operation, Element outgoingMessage,
-            InvokeResponseChannel channel) throws FaultException {
+    public String invoke(String requestId, PartnerLink partnerLink, Operation operation, Element outgoingMessage)
+            throws UninitializedPartnerEPR {
 
         // TODO: think we should move the dao creation into bpelprocess --mbs
         MessageExchangeDAO mexDao = _dao.getConnection().createMessageExchange(new GUID().toString(),
                 MessageExchangeDAO.DIR_BPEL_INVOKES_PARTNERROLE);
         mexDao.setStatus(MessageExchange.Status.REQ);
         mexDao.setOperation(operation.getName());
-        mexDao.setPortType(partnerLink.partnerLink.partnerRolePortType.getQName());
-        mexDao.setPartnerLinkModelId(partnerLink.partnerLink.getId());
+        mexDao.setPortType(partnerLink.getModel().getPartnerRolePortType().getQName());
+        mexDao.setPartnerLinkModelId(partnerLink.getModel().getId());
 
-        PartnerRoleChannel partnerRoleChannel = _bpelProcess.getPartnerRoleChannel(partnerLink.partnerLink);
+        PartnerRoleChannel partnerRoleChannel = _bpelProcess.getPartnerRoleChannel(partnerLink.getModel());
         PartnerLinkDAO plinkDAO = fetchPartnerLinkDAO(partnerLink);
 
         Element partnerEPR = plinkDAO.getPartnerEPR();
@@ -666,8 +469,7 @@
         if (partnerEPR == null) {
             partnerEpr = partnerRoleChannel.getInitialEndpointReference();
             // In this case, the partner link has not been initialized.
-            if (partnerEpr == null)
-                throw new FaultException(partnerLink.partnerLink.getOwner().constants.qnUninitializedPartnerRole);
+            if (partnerEpr == null) throw new UninitializedPartnerEPR();
         } else {
             partnerEpr = _contexts.eprContext.resolveEndpointReference(partnerEPR);
         }
@@ -678,7 +480,7 @@
         mexDao.setInstance(_dao);
         mexDao.setPattern((operation.getOutput() != null ? MessageExchangePattern.REQUEST_RESPONSE
                 : MessageExchangePattern.REQUEST_ONLY));
-        mexDao.setChannel(channel == null ? null : channel.export());
+        mexDao.setChannel(requestId);
 
         MessageDAO message = mexDao.createMessage(operation.getInput().getMessage().getQName());
         mexDao.setRequest(message);
@@ -689,14 +491,14 @@
         // prepare event
         ProcessMessageExchangeEvent evt = new ProcessMessageExchangeEvent();
         evt.setOperation(operation.getName());
-        evt.setPortType(partnerLink.partnerLink.partnerRolePortType.getQName());
+        evt.setPortType(partnerLink.getModel().getPartnerRolePortType().getQName());
         evt.setAspect(ProcessMessageExchangeEvent.PARTNER_INPUT);
         evt.setMexId(mexDao.getMessageExchangeId());
         sendEvent(evt);
 
         if (__log.isDebugEnabled()) {
-            __log.debug("INVOKING PARTNER: partnerLink=" + partnerLink + ", op=" + operation.getName() + " channel="
-                    + channel + ")");
+            __log.debug("INVOKING PARTNER: partnerLink=" + partnerLink + ", op=" +
+                    operation.getName() + " channel=" + requestId + ")");
         }
         _bpelProcess.invokePartner(mexDao);
 
@@ -733,18 +535,23 @@
         message.setHeader(header);
     }
 
+    public void executeCreateInstance(MessageExchangeDAO instantiatingMessageExchange) {
+        if (instantiatingMessageExchange == null) throw new NullPointerException();
+        _instantiatingMessageExchange = instantiatingMessageExchange;
+        _rti.onCreateInstance(instantiatingMessageExchange.getMessageExchangeId());
+        execute();
+    }
+
     void execute() {
         if (!_contexts.isTransacted())
             throw new BpelEngineException("MUST RUN IN TRANSACTION!");
-        if (_executed)
-            throw new IllegalStateException("cannot call execute() twice!");
 
         long maxTime = System.currentTimeMillis() + _maxReductionTimeMs;
 
         // Execute the process state reductions
         boolean canReduce = true;
         while (ProcessState.canExecute(_dao.getState()) && System.currentTimeMillis() < maxTime && canReduce && !_forceFlush) {
-            canReduce = _vpu.execute();
+            canReduce = _rti.execute();
         }
 
         _dao.setLastActiveTime(new Date());
@@ -771,28 +578,27 @@
     }
 
     private void saveState() {
-        ByteArrayOutputStream bos = new ByteArrayOutputStream(10000);
+        ByteArrayOutputStream bos = new ByteArrayOutputStream();
+        Object cachedState;
         try {
-            _soup.write(bos);
-            bos.close();
-        } catch (Exception ex) {
-            throw new RuntimeException(ex);
+            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, _soup);
-        
+        _instanceWorker.setCachedState(newcount, cachedState);
+
         __log.debug("CACHE SAVE: #" + newcount + " for instance " + _dao.getInstanceId());
     }
 
-    void injectMyRoleMessageExchange(final String responsechannel, final int idx, MessageExchangeDAO mexdao) {
+    void injectMyRoleMessageExchange(final String responseChannelId, final int idx, MessageExchangeDAO mexdao) {
         // if we have a message match, this instance should be marked
         // active if it isn't already
         if (_dao.getState() == ProcessState.STATE_READY) {
-            if (BpelProcess.__log.isDebugEnabled()) {
-                BpelProcess.__log.debug("INPUTMSGMATCH: Changing process instance state from ready to active");
+            if (ODEProcess.__log.isDebugEnabled()) {
+                ODEProcess.__log.debug("INPUTMSGMATCH: Changing process instance state from ready to active");
             }
 
             _dao.setState(ProcessState.STATE_ACTIVE);
@@ -804,86 +610,40 @@
             sendEvent(evt);
         }
 
-        getORM().associate(responsechannel, mexdao.getMessageExchangeId());
-
-        final String mexId = mexdao.getMessageExchangeId();
-        _vpu.inject(new JacobRunnable() {
-            private static final long serialVersionUID = 3168964409165899533L;
-
-            public void run() {
-                PickResponseChannel responseChannel = importChannel(responsechannel, PickResponseChannel.class);
-                responseChannel.onRequestRcvd(idx, mexId);
-            }
-        });
+        _rti.onSelectEvent(responseChannelId, mexdao.getMessageExchangeId(), idx);
     }
 
     boolean injectTimerEvent(final String timerResponseChannel) {
         // In case this is a pick event, we remove routes,
         // and cancel the outstanding requests.
         _dao.getProcess().removeRoutes(timerResponseChannel, _dao);
-        getORM().cancel(timerResponseChannel);
 
         // Ignore timer events after the process is finished.
-        if (ProcessState.isFinished(_dao.getState())) {
-            return false;
-        }
+        if (ProcessState.isFinished(_dao.getState())) return false;
 
-        _vpu.inject(new JacobRunnable() {
-            private static final long serialVersionUID = -7767141033611036745L;
+        _rti.onTimerEvent(timerResponseChannel);
+        return true;
+    }
 
-            public void run() {
-                TimerResponseChannel responseChannel = importChannel(timerResponseChannel, TimerResponseChannel.class);
-                responseChannel.onTimeout();
-            }
-        });
-        
+    public boolean cancelTimer(String timerId) {
+        // TODO No way to cancel these now.
         return true;
     }
 
-    public void cancel(final TimerResponseChannel timerResponseChannel) {
-        // In case this is a pick response channel, we need to cancel routes and
-        // receive/reply association.
-        final String id = timerResponseChannel.export();
-        _dao.getProcess().removeRoutes(id, _dao);
-        getORM().cancel(id);
-
-        _vpu.inject(new JacobRunnable() {
-            private static final long serialVersionUID = 6157913683737696396L;
-
-            public void run() {
-                TimerResponseChannel responseChannel = importChannel(id, TimerResponseChannel.class);
-                responseChannel.onCancel();
-            }
-        });
+    public void cancelSelect(String selectId) {
+        _dao.getProcess().removeRoutes(selectId, _dao);
     }
 
-    void injectPartnerResponse(final String mexid, final String responseChannelId) {
-        if (responseChannelId == null)
+    void injectPartnerResponse(final String mexid, final String invokeId) {
+        if (invokeId == null)
             throw new NullPointerException("Null responseChannelId");
         if (mexid == null)
             throw new NullPointerException("Null mexId");
 
-        if (BpelProcess.__log.isDebugEnabled()) {
-            __log.debug("<invoke> response for mexid " + mexid + " and channel " + responseChannelId);
+        if (ODEProcess.__log.isDebugEnabled()) {
+            __log.debug("<invoke> response for mexid " + mexid + " and channel " + invokeId);
         }
-        _vpu.inject(new BpelJacobRunnable() {
-            private static final long serialVersionUID = -1095444335740879981L;
-
-            public void run() {
-                ((BpelRuntimeContextImpl) getBpelRuntimeContext()).invocationResponse2(mexid, importChannel(responseChannelId,
-                        InvokeResponseChannel.class));
-            }
-        });
-    }
 
-    /**
-     * Continuation of the above.
-     * 
-     * @param mexid
-     * @param responseChannel
-     */
-    private void invocationResponse2(String mexid, InvokeResponseChannel responseChannel) {
-        __log.debug("Triggering response");
         MessageExchangeDAO mex = _dao.getConnection().getMessageExchange(mexid);
 
         ProcessMessageExchangeEvent evt = new ProcessMessageExchangeEvent();
@@ -893,28 +653,30 @@
 
         MessageExchange.Status status = mex.getStatus();
 
+        OdeRTInstance.InvokeResponseType  irt;
         switch (mex.getAckType()) {
         case FAULT:
+            irt = OdeRTInstance.InvokeResponseType.FAULT;
             evt.setAspect(ProcessMessageExchangeEvent.PARTNER_FAULT);
-            responseChannel.onFault();
             break;
         case RESPONSE:
+            irt = OdeRTInstance.InvokeResponseType.REPLY;
             evt.setAspect(ProcessMessageExchangeEvent.PARTNER_OUTPUT);
-            responseChannel.onResponse();
             break;
         case FAILURE:
+            irt = OdeRTInstance.InvokeResponseType.FAILURE;
             evt.setAspect(ProcessMessageExchangeEvent.PARTNER_FAILURE);
-            responseChannel.onFailure();
             break;
         default:
-            __log.error("Invalid response state for mex " + mexid + ": " + status);
+            String msg = "Invalid response state for mex " + mexid + ": " + status;
+            __log.error(msg);
+            return;
         }
         sendEvent(evt);
+
+        _rti.onInvokeResponse(invokeId, irt, mexid);
     }
 
-    /**
-     * @see BpelRuntimeContext#sendEvent(org.apache.ode.bpel.evt.ProcessInstanceEvent)
-     */
     public void sendEvent(ProcessInstanceEvent event) {
         // fill in missing pieces
         event.setProcessId(_dao.getProcess().getProcessId());
@@ -937,68 +699,27 @@
         }
     }
 
-    /**
-     * We record all values of properties of a 'MessageType' variable for efficient lookup.
-     */
-    private void writeProperties(VariableInstance variable, Node value, XmlDataDAO dao) {
-        if (variable.declaration.type instanceof OMessageVarType) {
-            for (OProcess.OProperty property : variable.declaration.getOwner().properties) {
-                OProcess.OPropertyAlias alias = property.getAlias(variable.declaration.type);
-                if (alias != null) {
-                    try {
-                        String val = _bpelProcess.extractProperty((Element) value, alias, variable.declaration.getDescription());
-                        if (val != null) {
-                            dao.setProperty(property.name.toString(), val);
-                        }
-                    } catch (FaultException e) {
-                        // This will fail as we're basically trying to extract properties on all
-                        // received messages for optimization purposes.
-                        if (__log.isDebugEnabled())
-                            __log.debug("Couldn't extract property '" + property.toString() + "' in property pre-extraction: "
-                                    + e.toString());
-                    }
-                }
-            }
+    public void noreply(String mexId, FaultInfo optionalFaultData) {
+        MessageExchangeDAO mexDao = _dao.getConnection().getMessageExchange(mexId);
+        if (mexDao != null) {
+            Status status = mexDao.getStatus();
+            if (mexDao.getPattern() == MessageExchangePattern.REQUEST_ONLY) {
+                mexDao.setAckType(AckType.ONEWAY);
+                mexDao.setStatus(Status.COMPLETED);
+                return;
+            }
+
+            mexDao.setAckType(AckType.FAILURE);
+            mexDao.setFailureType(FailureType.NO_RESPONSE);
+            if (optionalFaultData != null) {
+                mexDao.setFaultExplanation(optionalFaultData.toString());
+            }
+            mexDao.setFaultExplanation("Process did not respond.");
+            mexDao.setStatus(Status.ACK);
+            _bpelProcess.onMyRoleMexAck(mexDao, status);
         }
     }
 
-    /**
-     * Called when the process completes to clean up any outstanding message exchanges.
-     * 
-     */
-    private void cleanupOutstandingMyRoleExchanges(FaultData optionalFaultData) {
-        String[] mexRefs = getORM().releaseAll();
-        for (String mexId : mexRefs) {
-            MessageExchangeDAO mexDao = _dao.getConnection().getMessageExchange(mexId);
-            if (mexDao != null) {
-                Status status = mexDao.getStatus();
-                InvocationStyle istyle = mexDao.getInvocationStyle();
-                if (mexDao.getPattern() == MessageExchangePattern.REQUEST_ONLY) {
-                    mexDao.setAckType(AckType.ONEWAY);
-                    mexDao.setStatus(Status.COMPLETED);
-                    continue;
-                }
-
-                mexDao.setAckType(AckType.FAILURE);
-                mexDao.setFailureType(FailureType.NO_RESPONSE);
-                if (optionalFaultData != null) {
-                    mexDao.setFaultExplanation(optionalFaultData.toString());
-                }
-                mexDao.setFaultExplanation("Process completed without responding.");
-                mexDao.setStatus(Status.ACK);
-                _bpelProcess.onMyRoleMexAck(mexDao, status);
-            }
-        }
-    }
-
-    private OutstandingRequestManager getORM() {
-        return (OutstandingRequestManager) _soup.getGlobalData();
-    }
-
-    private void cleanupOutstandingMyRoleExchanges() {
-        cleanupOutstandingMyRoleExchanges(null);
-    }
-
     public Element getPartnerResponse(String mexId) {
         return mergeHeaders(_getPartnerResponse(mexId));
     }
@@ -1118,8 +839,7 @@
         if (epr == null)
             return null;
         try {
-            Element eepr = DOMUtils.stringToDOM(epr);
-            return eepr;
+            return DOMUtils.stringToDOM(epr);
         } catch (Exception ex) {
             __log.error("Invalid value for SEP property " + MessageExchange.PROPERTY_SEP_PARTNERROLE_EPR + ": " + epr);
         }
@@ -1132,83 +852,49 @@
         return dao.getProperty(MessageExchange.PROPERTY_SEP_PARTNERROLE_SESSIONID);
     }
 
-    public void registerActivityForRecovery(ActivityRecoveryChannel channel, long activityId, String reason, Date dateTime,
+    public void registerActivityForRecovery(String channel, long activityId, String reason, Date dateTime,
             Element details, String[] actions, int retries) {
         if (reason == null)
             reason = "Unspecified";
         if (dateTime == null)
             dateTime = new Date();
-        __log.info("ActivityRecovery: Registering activity " + activityId + ", failure reason: " + reason + " on channel "
-                + channel.export());
-        _dao.createActivityRecovery(channel.export(), (int) activityId, reason, dateTime, details, actions, retries);
-    }
-
-    public void unregisterActivityForRecovery(ActivityRecoveryChannel channel) {
-        _dao.deleteActivityRecovery(channel.export());
-    }
-
-    public void recoverActivity(final String channel, final long activityId, final String action, final FaultData fault) {
-        _vpu.inject(new JacobRunnable() {
-            private static final long serialVersionUID = 3168964409165899533L;
-
-            public void run() {
-                ActivityRecoveryChannel recovery = importChannel(channel, ActivityRecoveryChannel.class);
-                __log.info("ActivityRecovery: Recovering activity " + activityId + " with action " + action + " on channel "
-                        + recovery);
-                if (recovery != null) {
-                    if ("cancel".equals(action))
-                        recovery.cancel();
-                    else if ("retry".equals(action))
-                        recovery.retry();
-                    else if ("fault".equals(action))
-                        recovery.fault(fault);
-                }
-            }
-        });
-        // _dao.deleteActivityRecovery(channel);
+        __log.info("ActivityRecovery: Registering activity " + activityId +
+                ", failure reason: " + reason + " on channel " + channel);
+        _dao.createActivityRecovery(channel, (int) activityId, reason, dateTime, details, actions, retries);
+    }
+
+    public void unregisterActivityForRecovery(String channel) {
+        _dao.deleteActivityRecovery(channel);
+    }
+
+    void recoverActivity(final String channel, final long activityId, final String action, final FaultInfo fault) {
+        _rti.recoverActivity(channel, activityId, action, fault);
         execute();
     }
 
     /**
      * Fetch the session-identifier for the partner link from the database.
      */
-    public String fetchMySessionId(PartnerLinkInstance pLink) {
+    public String fetchMySessionId(PartnerLink pLink) {
         String sessionId = fetchPartnerLinkDAO(pLink).getMySessionId();
         assert sessionId != null : "Session ID should always be set!";
         return sessionId;
     }
 
-    public String fetchPartnersSessionId(PartnerLinkInstance pLink) {
+    public String fetchPartnersSessionId(PartnerLink pLink) {
         return fetchPartnerLinkDAO(pLink).getPartnerSessionId();
     }
 
-    public void initializePartnersSessionId(PartnerLinkInstance pLink, String session) {
+    public void initializePartnersSessionId(PartnerLink pLink, String session) {
         if (__log.isDebugEnabled())
             __log.debug("initializing partner " + pLink + "  sessionId to " + session);
         fetchPartnerLinkDAO(pLink).setPartnerSessionId(session);
-
     }
 
     public void forceFlush() {
         _forceFlush = true;
     }
     
-	public ExtensionOperation createExtensionActivityImplementation(QName name) {
-		if (name == null) {
-			return null;
-		}
-		AbstractExtensionBundle bundle = _contexts.extensionRegistry.get(name.getNamespaceURI());
-		if (bundle == null) {
-			return null;
-		} else {
-			try {
-				return (ExtensionOperation)bundle.getExtensionOperationInstance(name.getLocalPart());
-			} catch (Exception e) {
-				return null;
-			}
-        }
-    }
-
 	public Node readExtVar(Variable variable, Node reference) throws ExternalVariableModuleException {
 		Value val = _bpelProcess.getEVM().read(variable, reference, _iid);
 		return val.value;