You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ode.apache.org by va...@apache.org on 2009/11/24 02:51:03 UTC

svn commit: r883568 [1/3] - in /ode/trunk: axis2/src/main/java/org/apache/ode/axis2/ bpel-api/src/main/java/org/apache/ode/bpel/evt/ bpel-api/src/main/java/org/apache/ode/bpel/iapi/ bpel-api/src/main/java/org/apache/ode/bpel/rapi/ bpel-compiler/src/mai...

Author: vanto
Date: Tue Nov 24 01:48:48 2009
New Revision: 883568

URL: http://svn.apache.org/viewvc?rev=883568&view=rev
Log:
ODE-710 process context propagation

Added:
    ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/evt/PartnerLinkContextModificationEvent.java
    ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/rapi/ContextData.java
    ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/rapi/PropagationRule.java
    ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/ContextPropagation.java
    ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/ContextVal.java
    ode/trunk/bpel-dao/src/main/java/org/apache/ode/bpel/dao/ContextValueDAO.java
    ode/trunk/bpel-schemas/src/main/xsd/contexts.xsd
    ode/trunk/bpel-scripts/src/main/resources/2.0/good/context/
    ode/trunk/bpel-scripts/src/main/resources/2.0/good/context/ContextPropagation-2.0.bpel
    ode/trunk/bpel-test/src/test/java/org/apache/ode/test/ContextTest.java
    ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestContextAssign/
    ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestContextAssign/TestContextAssign.bpel
    ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestContextAssign/TestContextAssign.wsdl
    ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestContextAssign/deploy.xml
    ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestContextAssign/test.properties
    ode/trunk/dao-hibernate/src/main/java/org/apache/ode/daohib/bpel/ContextValueDaoImpl.java
    ode/trunk/dao-hibernate/src/main/java/org/apache/ode/daohib/bpel/hobj/HContextValue.java
    ode/trunk/dao-jpa/src/main/java/org/apache/ode/dao/jpa/ContextValueDAOImpl.java
    ode/trunk/engine/src/main/java/org/apache/ode/bpel/context/
    ode/trunk/engine/src/main/java/org/apache/ode/bpel/context/AbstractContextInterceptor.java
    ode/trunk/engine/src/main/java/org/apache/ode/bpel/context/ContextDataImpl.java
    ode/trunk/engine/src/main/java/org/apache/ode/bpel/context/ContextInterceptor.java
    ode/trunk/engine/src/main/java/org/apache/ode/bpel/context/TracingContextInterceptor.java
    ode/trunk/engine/src/main/java/org/apache/ode/bpel/memdao/ContextValueDAOImpl.java
    ode/trunk/engine/src/test/java/org/apache/ode/bpel/context/
    ode/trunk/engine/src/test/java/org/apache/ode/bpel/context/ContextDataTest.java
    ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v2/OContextPropagation.java
Modified:
    ode/trunk/axis2/src/main/java/org/apache/ode/axis2/Messages.java
    ode/trunk/axis2/src/main/java/org/apache/ode/axis2/ODEServer.java
    ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/evt/VariableModificationEvent.java
    ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/iapi/ProcessConf.java
    ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/rapi/IOContext.java
    ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/rapi/OdeRTInstanceContext.java
    ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/rapi/PartnerLinkModel.java
    ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/rapi/ScopeModel.java
    ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/rapi/VariableContext.java
    ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/BpelC.java
    ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/CommonCompilationMessages.java
    ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/BpelObject.java
    ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/BpelObjectFactory.java
    ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/ToFrom.java
    ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/AssignGenerator.java
    ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/CompilerContext.java
    ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/DefaultActivityGenerator.java
    ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/InvokeGenerator.java
    ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/InvokeGeneratorMessages.java
    ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/ReplyGenerator.java
    ode/trunk/bpel-compiler/src/test/java/org/apache/ode/bpel/compiler_2_0/GoodCompileTest.java
    ode/trunk/bpel-dao/src/main/java/org/apache/ode/bpel/dao/PartnerLinkDAO.java
    ode/trunk/bpel-schemas/src/main/xsd/dd.xsd
    ode/trunk/bpel-store/src/main/java/org/apache/ode/store/ProcessConfImpl.java
    ode/trunk/bpel-store/src/test/java/org/apache/ode/store/ProcessStoreTest.java
    ode/trunk/bpel-store/src/test/resources/testdd/deploy.xml
    ode/trunk/dao-hibernate/src/main/java/org/apache/ode/daohib/SessionManager.java
    ode/trunk/dao-hibernate/src/main/java/org/apache/ode/daohib/bpel/PartnerLinkDAOImpl.java
    ode/trunk/dao-hibernate/src/main/java/org/apache/ode/daohib/bpel/hobj/HPartnerLink.java
    ode/trunk/dao-jpa/src/main/java/org/apache/ode/dao/jpa/PartnerLinkDAOImpl.java
    ode/trunk/dao-jpa/src/main/resources/META-INF/persistence.xml
    ode/trunk/engine/src/main/java/org/apache/ode/bpel/engine/BpelRuntimeContextImpl.java
    ode/trunk/engine/src/main/java/org/apache/ode/bpel/engine/BpelServerImpl.java
    ode/trunk/engine/src/main/java/org/apache/ode/bpel/engine/Contexts.java
    ode/trunk/engine/src/main/java/org/apache/ode/bpel/engine/DbBackedMessageImpl.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/ODEWSProcess.java
    ode/trunk/engine/src/main/java/org/apache/ode/bpel/memdao/PartnerLinkDAOImpl.java
    ode/trunk/il-common/src/main/java/org/apache/ode/il/config/OdeConfigProperties.java
    ode/trunk/il-common/src/main/java/org/apache/ode/il/epr/WSDL11Endpoint.java
    ode/trunk/jbi/src/main/java/org/apache/ode/jbi/Messages.java
    ode/trunk/jbi/src/main/java/org/apache/ode/jbi/OdeLifeCycle.java
    ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/common/extension/ExtensibilityQNames.java
    ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v1/OPartnerLink.java
    ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v1/RuntimeInstanceImpl.java
    ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v2/ACTIVITY.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/AssignHelper.java
    ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v2/EH_EVENT.java
    ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v2/INVOKE.java
    ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v2/OAssign.java
    ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v2/OInvoke.java
    ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v2/OPartnerLink.java
    ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v2/OReply.java
    ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v2/OdeInternalInstance.java
    ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v2/PICK.java
    ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v2/PartnerLinkInstance.java
    ode/trunk/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v2/REPLY.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/axis2/src/main/java/org/apache/ode/axis2/Messages.java
URL: http://svn.apache.org/viewvc/ode/trunk/axis2/src/main/java/org/apache/ode/axis2/Messages.java?rev=883568&r1=883567&r2=883568&view=diff
==============================================================================
--- ode/trunk/axis2/src/main/java/org/apache/ode/axis2/Messages.java (original)
+++ ode/trunk/axis2/src/main/java/org/apache/ode/axis2/Messages.java Tue Nov 24 01:48:48 2009
@@ -115,6 +115,10 @@
         return format("Registered message exchange interceptor: {0}", interceptorCN);
     }
 
+    public String msgContextInterceptorRegistered(String interceptorCN) {
+        return format("Registered context interceptor: {0}", interceptorCN);
+    }
+
     public String msgOdeShutdownCompleted() {
         return "Shutdown completed. ";
     }

Modified: ode/trunk/axis2/src/main/java/org/apache/ode/axis2/ODEServer.java
URL: http://svn.apache.org/viewvc/ode/trunk/axis2/src/main/java/org/apache/ode/axis2/ODEServer.java?rev=883568&r1=883567&r2=883568&view=diff
==============================================================================
--- ode/trunk/axis2/src/main/java/org/apache/ode/axis2/ODEServer.java (original)
+++ ode/trunk/axis2/src/main/java/org/apache/ode/axis2/ODEServer.java Tue Nov 24 01:48:48 2009
@@ -66,6 +66,7 @@
 import org.apache.ode.bpel.extension.ExtensionBundleRuntime;
 import org.apache.ode.bpel.extension.ExtensionBundleValidation;
 import org.apache.ode.bpel.connector.BpelServerConnector;
+import org.apache.ode.bpel.context.ContextInterceptor;
 import org.apache.ode.bpel.dao.BpelDAOConnectionFactory;
 import org.apache.ode.bpel.engine.BpelServerImpl;
 import org.apache.ode.bpel.engine.CountLRUDehydrationPolicy;
@@ -180,6 +181,7 @@
             // Register BPEL event listeners configured in axis2.properties file.
             registerEventListeners();
             registerMexInterceptors();
+            registerContextInterceptors();
 
             registerExtensionActivityBundles();
 
@@ -649,7 +651,23 @@
                     _bpelServer.registerMessageExchangeInterceptor((MessageExchangeInterceptor) Class.forName(interceptorCN).newInstance());
                     __log.info(__msgs.msgMessageExchangeInterceptorRegistered(interceptorCN));
                 } catch (Exception e) {
-                    __log.warn("Couldn't register the event listener " + interceptorCN + ", the class couldn't be "
+                    __log.warn("Couldn't register the message exchange interceptor " + interceptorCN + ", the class couldn't be "
+                            + "loaded properly: " + e);
+                }
+            }
+        }
+    }
+
+    private void registerContextInterceptors() {
+        String interceptorsStr = _odeConfig.getContextInterceptors();
+        if (interceptorsStr != null) {
+            for (StringTokenizer tokenizer = new StringTokenizer(interceptorsStr, ",;"); tokenizer.hasMoreTokens();) {
+                String interceptorCN = tokenizer.nextToken();
+                try {
+                    _bpelServer.registerContextInterceptor((ContextInterceptor) Class.forName(interceptorCN).newInstance());
+                    __log.info(__msgs.msgContextInterceptorRegistered(interceptorCN));
+                } catch (Exception e) {
+                    __log.warn("Couldn't register the context interceptor " + interceptorCN + ", the class couldn't be "
                             + "loaded properly: " + e);
                 }
             }

Added: ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/evt/PartnerLinkContextModificationEvent.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/evt/PartnerLinkContextModificationEvent.java?rev=883568&view=auto
==============================================================================
--- ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/evt/PartnerLinkContextModificationEvent.java (added)
+++ ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/evt/PartnerLinkContextModificationEvent.java Tue Nov 24 01:48:48 2009
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.ode.bpel.evt;
+
+import org.w3c.dom.Node;
+
+public class PartnerLinkContextModificationEvent extends PartnerLinkEvent {
+    private static final long serialVersionUID = 1L;
+
+    private Node newValue;
+
+    public PartnerLinkContextModificationEvent() {
+        super();
+    }
+
+    public PartnerLinkContextModificationEvent(String plName, Node newValue) {
+        super(plName);
+        this.newValue = newValue;
+    }
+
+    public Node getNewValue() {
+        return newValue;
+    }
+
+    public void setNewValue(Node newValue) {
+        this.newValue = newValue;
+    }
+}

Modified: ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/evt/VariableModificationEvent.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/evt/VariableModificationEvent.java?rev=883568&r1=883567&r2=883568&view=diff
==============================================================================
--- ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/evt/VariableModificationEvent.java (original)
+++ ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/evt/VariableModificationEvent.java Tue Nov 24 01:48:48 2009
@@ -18,7 +18,6 @@
  */
 package org.apache.ode.bpel.evt;
 
-import org.w3c.dom.Element;
 import org.w3c.dom.Node;
 
 public class VariableModificationEvent extends VariableEvent {

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=883568&r1=883567&r2=883568&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 Tue Nov 24 01:48:48 2009
@@ -20,6 +20,7 @@
 
 import java.io.File;
 import java.io.InputStream;
+import java.io.Serializable;
 import java.net.URI;
 import java.util.ArrayList;
 import java.util.Date;
@@ -160,6 +161,22 @@
      * @return list of extension elements 
      */
     List<Element> getExtensionElement(QName qname);
+    
+    /**
+     * Returns the context propagation rules defined in the DD.
+     * @return list of context propagation rules
+     */
+    List<PropagationRule> getPropagationRules();
+    
+    /**
+     * Gets the list of context interceptors defined in the DD.
+     * The key is the full qualified class name of the interceptor to
+     * be loaded, the value is an element containing custom configuration
+     * properties.
+     * 
+     * @return list of context interceptors
+     */
+    Map<String, Element> getContextInterceptors();
 
     boolean isEventEnabled(List<String> scopeNames, BpelEvent.TYPE type);
 
@@ -217,7 +234,7 @@
         }
     }
     
-    public class CleanupInfo implements java.io.Serializable {
+    public class CleanupInfo implements Serializable {
         private List<String> _filters = new ArrayList<String>();
         
         private final Set<CLEANUP_CATEGORY> _categories = EnumSet.noneOf(CLEANUP_CATEGORY.class);
@@ -245,4 +262,30 @@
             return buf.toString();
         }
     }
+    
+    public class PropagationRule implements Serializable {
+        private static final long serialVersionUID = 5496856170262204149L;
+
+        private String fromPL;
+        private String toPL;
+        private List<String> contexts = new ArrayList<String>();
+        public String getFromPL() {
+            return fromPL;
+        }
+        public void setFromPL(String fromPL) {
+            this.fromPL = fromPL;
+        }
+        public String getToPL() {
+            return toPL;
+        }
+        public void setToPL(String toPL) {
+            this.toPL = toPL;
+        }
+        public List<String> getContexts() {
+            return contexts;
+        }
+        public void setContexts(List<String> contexts) {
+            this.contexts = contexts;
+        }
+    }
 }

Added: ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/rapi/ContextData.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/rapi/ContextData.java?rev=883568&view=auto
==============================================================================
--- ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/rapi/ContextData.java (added)
+++ ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/rapi/ContextData.java Tue Nov 24 01:48:48 2009
@@ -0,0 +1,109 @@
+package org.apache.ode.bpel.rapi;
+
+import java.util.List;
+import java.util.Set;
+
+import org.w3c.dom.Element;
+
+public interface ContextData {
+
+    /**
+     * Puts a key/value pair into the context.
+     * 
+     * @param key
+     * @param value
+     */
+    public abstract void put(String context, String key, String value);
+
+    public abstract void put(ContextName name, String value);
+
+    /**
+     * Returns the value for a certain key.
+     * 
+     * @param key
+     * @return
+     */
+    public abstract String get(String context, String key);
+
+    public abstract String get(ContextName name);
+
+    /**
+     * Returns 'true' if a value for a given key is present.
+     * 
+     * @param key
+     * @return
+     */
+    public abstract boolean isSet(String context, String key);
+
+    public abstract boolean isSet(ContextName name);
+
+    /**
+     * Return a list of keys.
+     * 
+     * @return list of keys
+     */
+    public abstract String[] getKeys(String context);
+
+    public abstract String[] getContexts();
+
+    public abstract List<ContextName> getContextNames();
+
+    public abstract void removeContext(String name);
+
+    public abstract Element toXML();
+    public abstract Element toXML(Set<String> contextFilter);
+
+    public static class ContextName {
+
+        private String namespace;
+        private String key;
+        
+        public ContextName(String namespace, String key) {
+            this.namespace = namespace;
+            this.key = key;
+        }
+        
+        public String getNamespace() {
+            return namespace;
+        }
+        public void setNamespace(String namespace) {
+            this.namespace = namespace;
+        }
+        public String getKey() {
+            return key;
+        }
+        public void setKey(String key) {
+            this.key = key;
+        }
+
+        public int hashCode() {
+            final int prime = 31;
+            int result = 1;
+            result = prime * result + ((key == null) ? 0 : key.hashCode());
+            result = prime * result
+                    + ((namespace == null) ? 0 : namespace.hashCode());
+            return result;
+        }
+
+        public boolean equals(Object obj) {
+            if (this == obj)
+                return true;
+            if (obj == null)
+                return false;
+            if (getClass() != obj.getClass())
+                return false;
+            ContextName other = (ContextName) obj;
+            if (key == null) {
+                if (other.key != null)
+                    return false;
+            } else if (!key.equals(other.key))
+                return false;
+            if (namespace == null) {
+                if (other.namespace != null)
+                    return false;
+            } else if (!namespace.equals(other.namespace))
+                return false;
+            return true;
+        }
+    }
+}
\ No newline at end of file

Modified: ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/rapi/IOContext.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/rapi/IOContext.java?rev=883568&r1=883567&r2=883568&view=diff
==============================================================================
--- ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/rapi/IOContext.java (original)
+++ ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/rapi/IOContext.java Tue Nov 24 01:48:48 2009
@@ -2,6 +2,7 @@
 
 import java.util.Date;
 import java.util.Map;
+import java.util.Set;
 
 import javax.wsdl.Operation;
 import javax.xml.namespace.QName;
@@ -10,7 +11,8 @@
 import org.w3c.dom.Element;
 
 public interface IOContext {
-
+    enum Direction { INBOUND, OUTBOUND, INBOUND_REPLY, OUTBOUND_REPLY };
+    
     /**
      * Non-deterministic "select" (used to implement receive/pick) and the like. Calling this method will request that the engine
      * wait for the first message on a certain set of input ports.
@@ -43,7 +45,7 @@
      * @param fault fault type, or <code>null</code> if no fault
      * @throws NoSuchOperationException
      */
-    void reply(String mexId, PartnerLink plink, String opName, Element msg, QName fault) throws NoSuchOperationException;
+    void reply(String mexId, PartnerLink plink, String opName, Element msg, QName fault, Set<org.apache.ode.bpel.rapi.PropagationRule> propagationRules) throws NoSuchOperationException;
 
     void reply(String mexId, Resource resource, Element msg, QName fault) throws NoSuchOperationException;
 
@@ -58,7 +60,7 @@
      * @throws UninitializedPartnerEPR
      * @throws FaultException
      */
-    String /* MexId */invoke(String invokeId, PartnerLink partnerLinkInstance, Operation operation, Element outboundMsg)
+    String /* MexId */invoke(String invokeId, PartnerLink partnerLinkInstance, Operation operation, Element outboundMsg, Set<org.apache.ode.bpel.rapi.PropagationRule> propagationRules)
             throws UninitializedPartnerEPR;
 
     String invoke(String requestId, org.apache.ode.bpel.iapi.Resource resource, Element outgoingMessage);
@@ -120,4 +122,12 @@
      */
     boolean cancelTimer(String timerId);
 
+    /**
+     * Invoke context interceptors for inbound communication
+     * @param mexId
+     * @param pl partner link whose contexts should be processed.
+     * @param dir direction
+     */
+    public void invokeContextInterceptorsInbound(String mexId, PartnerLink pl, Direction dir);
+
 }

Modified: ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/rapi/OdeRTInstanceContext.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/rapi/OdeRTInstanceContext.java?rev=883568&r1=883567&r2=883568&view=diff
==============================================================================
--- ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/rapi/OdeRTInstanceContext.java (original)
+++ ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/rapi/OdeRTInstanceContext.java Tue Nov 24 01:48:48 2009
@@ -18,9 +18,12 @@
  */
 package org.apache.ode.bpel.rapi;
 
+import java.util.List;
+
 import javax.xml.namespace.QName;
 
 import org.apache.ode.bpel.evt.ProcessInstanceEvent;
+import org.apache.ode.bpel.iapi.ProcessConf.PropagationRule;
 import org.w3c.dom.Node;
 
 /**
@@ -75,4 +78,6 @@
     void setAtomicScope(boolean atomicScope);
 
     Node getProcessProperty(QName propertyName);
+
+	List<PropagationRule> getPropagationRules();
 }

Modified: ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/rapi/PartnerLinkModel.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/rapi/PartnerLinkModel.java?rev=883568&r1=883567&r2=883568&view=diff
==============================================================================
--- ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/rapi/PartnerLinkModel.java (original)
+++ ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/rapi/PartnerLinkModel.java Tue Nov 24 01:48:48 2009
@@ -10,6 +10,8 @@
     
     String getName();
     
+    ScopeModel getDeclaringScope();
+    
     boolean hasMyRole();
 
     boolean hasPartnerRole();

Added: ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/rapi/PropagationRule.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/rapi/PropagationRule.java?rev=883568&view=auto
==============================================================================
--- ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/rapi/PropagationRule.java (added)
+++ ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/rapi/PropagationRule.java Tue Nov 24 01:48:48 2009
@@ -0,0 +1,25 @@
+package org.apache.ode.bpel.rapi;
+
+import java.util.HashSet;
+import java.util.Set;
+
+public class PropagationRule {
+	private Set<String> contexts = new HashSet<String>();
+	private PartnerLink fromPL;
+	
+	public Set<String> getContexts() {
+		return contexts;
+	}
+	public void setContexts(Set<String> contexts) {
+		this.contexts = contexts;
+	}
+	public boolean isPropagateAll() {
+		return contexts.contains("*");
+	}
+	public PartnerLink getFromPL() {
+		return fromPL;
+	}
+	public void setFromPL(PartnerLink fromPL) {
+		this.fromPL = fromPL;
+	}
+}

Modified: ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/rapi/ScopeModel.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/rapi/ScopeModel.java?rev=883568&r1=883567&r2=883568&view=diff
==============================================================================
--- ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/rapi/ScopeModel.java (original)
+++ ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/rapi/ScopeModel.java Tue Nov 24 01:48:48 2009
@@ -2,4 +2,5 @@
 
 public interface ScopeModel {
 	public ActivityModel getActivity();
+	public int getId();
 }

Modified: ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/rapi/VariableContext.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/rapi/VariableContext.java?rev=883568&r1=883567&r2=883568&view=diff
==============================================================================
--- ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/rapi/VariableContext.java (original)
+++ ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/rapi/VariableContext.java Tue Nov 24 01:48:48 2009
@@ -1,6 +1,7 @@
 package org.apache.ode.bpel.rapi;
 
 import java.util.Collection;
+import java.util.Set;
 
 import javax.xml.namespace.QName;
 
@@ -165,6 +166,10 @@
     void writeCorrelation(CorrelationSet cset, QName[] propNames,
                           CorrelationKey correlation) throws FaultException;
 
+    
+    ContextData fetchContextData(PartnerLink pLink);
+    void writeContextData(PartnerLink pLink, Node ctxData, Set<String> contextsFilter);
+    
     public class ValueReferencePair {
         public Node value;
         public Node reference;

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=883568&r1=883567&r2=883568&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 Tue Nov 24 01:48:48 2009
@@ -163,7 +163,7 @@
         _outputStream = os;
 
         if (__log.isDebugEnabled()) {
-            __log.debug("Sett output to stream " + os);
+            __log.debug("Set output to stream " + os);
         }
     }
 

Modified: ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/CommonCompilationMessages.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/CommonCompilationMessages.java?rev=883568&r1=883567&r2=883568&view=diff
==============================================================================
--- ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/CommonCompilationMessages.java (original)
+++ ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/CommonCompilationMessages.java Tue Nov 24 01:48:48 2009
@@ -489,7 +489,18 @@
 		return this.formatCompilationMessage("The external variable declaration for \"{0}\" must specify an external variable identifier.", name);
 	}
 
-  public CompilationMessage errEmptyCatch() {
-    return this.formatCompilationMessage("Empty catch faut handlers are forbidden.");
-  }
+	public CompilationMessage errEmptyCatch() {
+	    return this.formatCompilationMessage("Empty catch faut handlers are forbidden.");
+	}
+
+    /** Context propagation must define a context attribute */
+    public CompilationMessage errMissingContextAttribute() {
+        return this.formatCompilationMessage("<propagate> element must define a 'context' attribute.");
+    }
+
+    /** Context propagation must define either a fromVariable or a 
+     * fromPartnerLink attribute */
+    public CompilationMessage errMissingVariableOrPartnerLinkAttribute() {
+        return this.formatCompilationMessage("<propagate> element must define either a 'fromVariable' or a 'fromPartnerLink' attribute.");
+    }
 }

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=883568&r1=883567&r2=883568&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 Tue Nov 24 01:48:48 2009
@@ -23,6 +23,7 @@
 import org.apache.ode.utils.NSContext;
 import org.apache.ode.utils.stl.CollectionsX;
 import org.apache.ode.utils.stl.MemberOfFunction;
+import org.apache.ode.utils.stl.UnaryFunction;
 import org.w3c.dom.Attr;
 import org.w3c.dom.Element;
 import org.w3c.dom.NamedNodeMap;
@@ -130,6 +131,14 @@
         return e.getElement();
     }
 
+    public List<Element> getExtensibilityElements(QName extElName) {
+        return CollectionsX.transform(new ArrayList<Element>(), getChildren(extElName), new UnaryFunction<BpelObject, Element>() {
+			public Element apply(BpelObject x) {
+				return x.getElement();
+			}
+		});
+    }
+
     public Element getFirstExtensibilityElement() {
     	Element child = null;
     	NodeList nl = getElement().getChildNodes();

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=883568&r1=883567&r2=883568&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 Tue Nov 24 01:48:48 2009
@@ -275,7 +275,7 @@
         QName type = new QName(el.getNamespaceURI(), el.getLocalName());
         Class cls = _mappings.get(type);
         if (cls == null) {
-            __log.warn("Unrecognized element in BPEL dom: " + type);
+            __log.info("Unrecognized element in BPEL dom: " + type);
             return new BpelObject(el);
         }
         try {

Added: ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/ContextPropagation.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/ContextPropagation.java?rev=883568&view=auto
==============================================================================
--- ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/ContextPropagation.java (added)
+++ ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/ContextPropagation.java Tue Nov 24 01:48:48 2009
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.ode.bpel.compiler.bom;
+
+import org.apache.ode.bpel.rtrep.common.extension.ExtensibilityQNames;
+import org.w3c.dom.Element;
+
+/**
+ * BOM representation of the context propagation extensibility element for
+ * interaction activities.
+ * 
+ * @author Tammo van Lessen
+ */
+public class ContextPropagation extends BpelObject {
+
+    public ContextPropagation(Element el) {
+        super(el);
+    }
+    
+    public String getFromPartnerLink() {
+        return getAttribute(ExtensibilityQNames.CONTEXT_FROM_PARTNER_LINK, null);
+    }
+    
+    public String getFromVariable() {
+        return getAttribute(ExtensibilityQNames.CONTEXT_FROM_VARIABLE, null);
+    }
+
+    public String getContext() {
+        return getAttribute(ExtensibilityQNames.CONTEXT_CONTEXT, null);   
+    }
+
+}

Added: ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/ContextVal.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/ContextVal.java?rev=883568&view=auto
==============================================================================
--- ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/ContextVal.java (added)
+++ ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/ContextVal.java Tue Nov 24 01:48:48 2009
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.ode.bpel.compiler.bom;
+
+import org.w3c.dom.Element;
+
+/**
+ * Assignment L/R-value defined in terms of a partner link context (non-standard).
+ */
+public class ContextVal extends ToFrom {
+
+    public ContextVal(Element el) {
+        super(el);
+    }
+
+    public String getPartnerLink() {
+        return getAttribute("partnerLink", null);
+    }
+
+    public String getContext() {
+        return getAttribute("context", "*");
+    }
+    
+    public Expression getLocation() {
+        return getFirstChild(Query.class);
+    }
+
+}

Modified: ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/ToFrom.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/ToFrom.java?rev=883568&r1=883567&r2=883568&view=diff
==============================================================================
--- ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/ToFrom.java (original)
+++ ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/ToFrom.java Tue Nov 24 01:48:48 2009
@@ -62,15 +62,25 @@
     }
     
     public PartnerLinkVal getAsPartnerLinkVal() {
-        if (getAttribute("partnerLink",null) != null)
+        if (getAttribute("partnerLink",null) != null && getAttribute("context", null) == null)
             return new PartnerLinkVal(getElement());
         return null;
     }
     
+    public ContextVal getAsContextVal() {
+        if (getAttribute("partnerLink",null) != null && getAttribute("context", null) != null)
+            return new ContextVal(getElement());
+        return null;
+    }
+
     public boolean isPartnerLinkVal() {
         return getAsPartnerLinkVal() != null;
     }
 
+    public boolean isContextVal() {
+        return getAsContextVal() != null;
+    }
+
     public boolean isPropertyVal() {
         return getAsPropertyVal() != null;
     }

Modified: ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/AssignGenerator.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/AssignGenerator.java?rev=883568&r1=883567&r2=883568&view=diff
==============================================================================
--- ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/AssignGenerator.java (original)
+++ ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/AssignGenerator.java Tue Nov 24 01:48:48 2009
@@ -18,6 +18,9 @@
  */
 package org.apache.ode.bpel.compiler.v2;
 
+import java.util.LinkedHashSet;
+import java.util.Set;
+
 import javax.xml.namespace.QName;
 
 import org.apache.commons.logging.Log;
@@ -25,6 +28,7 @@
 import org.apache.ode.bpel.compiler.api.CompilationException;
 import org.apache.ode.bpel.compiler.bom.Activity;
 import org.apache.ode.bpel.compiler.bom.AssignActivity;
+import org.apache.ode.bpel.compiler.bom.ContextVal;
 import org.apache.ode.bpel.compiler.bom.Copy;
 import org.apache.ode.bpel.compiler.bom.ExtensionAssignOperation;
 import org.apache.ode.bpel.compiler.bom.ExtensionVal;
@@ -225,6 +229,15 @@
                 plref.partnerLink = _context.resolvePartnerLink(plv.getPartnerLink());
                 plref.isMyEndpointReference = (plv.getEndpointReference() == PartnerLinkVal.EndpointReference.MYROLE);
                 return plref;
+            } else if (from.isContextVal()) {
+                ContextVal cv = from.getAsContextVal();
+                OAssign.ContextRef cref = new OAssign.ContextRef(_context.getOProcess());
+                cref.partnerLink = _context.resolvePartnerLink(cv.getPartnerLink());
+                cref.contexts = extractContextNames(cv.getContext());
+                if (cv.getLocation() != null && cv.getLocation().getExpression() != null) {
+                    cref.location = _context.compileExpr(cv.getLocation());
+                }
+                return cref;
             } else if (from.getAsExpression() != null) {
                 return new OAssign.Expression(_context.getOProcess(), _context.compileExpr(from.getAsExpression()));
             }
@@ -238,6 +251,19 @@
         }
     }
 
+    private Set<String> extractContextNames(String context) {
+        Set<String> contexts = new LinkedHashSet<String>();
+        for (String c : context.split("\\s+")) {
+            if ("*".equals(c)) {
+                contexts.clear();
+                contexts.add("*");
+            } else {
+                contexts.add(c);
+            }
+        }
+        return contexts;
+    }
+
     /**
      * Compile an extension to/from-spec. Extension to/from-specs are compiled into 
      * "DirectRef"s. 
@@ -290,6 +316,11 @@
                 OAssign.PartnerLinkRef plref = new OAssign.PartnerLinkRef(_context.getOProcess());
                 plref.partnerLink = _context.resolvePartnerLink(to.getAsPartnerLinkVal().getPartnerLink());
                 return plref;
+            } else if (to.isContextVal()) {
+                ContextVal cv = to.getAsContextVal();
+                OAssign.ContextRef cref = new OAssign.ContextRef(_context.getOProcess());
+                cref.partnerLink = _context.resolvePartnerLink(cv.getPartnerLink());
+                return cref;
             } else if (to.getAsExpression() != null){
                 return new OAssign.LValueExpression(_context.getOProcess(), _context
                         .compileLValueExpr(to.getAsExpression()));

Modified: ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/CompilerContext.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/CompilerContext.java?rev=883568&r1=883567&r2=883568&view=diff
==============================================================================
--- ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/CompilerContext.java (original)
+++ ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/CompilerContext.java Tue Nov 24 01:48:48 2009
@@ -27,12 +27,14 @@
 import javax.xml.transform.Source;
 
 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.compiler.SourceLocation;
 import org.apache.ode.bpel.compiler.api.CompilationException;
 import org.apache.ode.bpel.extension.ExtensionValidator;
 import org.apache.ode.bpel.rtrep.v2.OActivity;
+import org.apache.ode.bpel.rtrep.v2.OContextPropagation;
 import org.apache.ode.bpel.rtrep.v2.OExpression;
 import org.apache.ode.bpel.rtrep.v2.OLValueExpression;
 import org.apache.ode.bpel.rtrep.v2.OLink;
@@ -128,7 +130,7 @@
 
     OScope.CorrelationSet resolveCorrelationSet(String csetName)
             throws CompilationException;
-
+    
     String getSourceLocation();
 
     boolean isPartnerLinkAssigned(String plink);

Modified: ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/DefaultActivityGenerator.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/DefaultActivityGenerator.java?rev=883568&r1=883567&r2=883568&view=diff
==============================================================================
--- ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/DefaultActivityGenerator.java (original)
+++ ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/DefaultActivityGenerator.java Tue Nov 24 01:48:48 2009
@@ -18,18 +18,30 @@
  */
 package org.apache.ode.bpel.compiler.v2;
 
+import java.util.Arrays;
+import java.util.LinkedHashSet;
+import java.util.Set;
+
+import org.apache.ode.bpel.compiler.CommonCompilationMessages;
 import org.apache.ode.bpel.compiler.v2.CompilerContext;
+import org.apache.ode.bpel.compiler.api.CompilationException;
 import org.apache.ode.bpel.compiler.bom.BpelObject;
+import org.apache.ode.bpel.compiler.bom.ContextPropagation;
 import org.apache.ode.bpel.compiler.bom.FailureHandling;
 import org.apache.ode.bpel.rtrep.v2.OActivity;
+import org.apache.ode.bpel.rtrep.v2.OContextPropagation;
 import org.apache.ode.bpel.rtrep.v2.OFailureHandling;
 import org.apache.ode.bpel.rtrep.common.extension.ExtensibilityQNames;
+import org.apache.ode.utils.msg.MessageBundle;
 import org.w3c.dom.Element;
 
 /**
  * Base implementation of the {@link ActivityGenerator} interface.
  */
 abstract class DefaultActivityGenerator implements ActivityGenerator {
+    private static final CommonCompilationMessages _cmsgsGeneral =
+        MessageBundle.getMessages(CommonCompilationMessages.class);
+
     protected CompilerContext _context;
 
     public void setContext(CompilerContext context) {
@@ -55,4 +67,29 @@
         output.setFailureHandling(obj);
     }
 
+    protected Set<OContextPropagation> doContextPropagation(BpelObject src) {
+        Set<OContextPropagation> props = new LinkedHashSet<OContextPropagation>();
+        // Context propagation extensibility element.
+        for (Element element : src.getExtensibilityElements(ExtensibilityQNames.CONTEXT_PROPAGATE)) {
+            ContextPropagation extElement = new ContextPropagation(element);
+            OContextPropagation obj = new OContextPropagation();
+            obj.contexts = Arrays.asList(extElement.getContext().split("\\s+"));
+            if (obj.contexts == null) {
+                throw new CompilationException(_cmsgsGeneral.errMissingContextAttribute());
+            }
+            String fromVariableName = extElement.getFromVariable();
+            String fromPartnerLinkName = extElement.getFromPartnerLink();
+            if (fromPartnerLinkName != null && fromVariableName == null) {
+                obj.fromPartnerLink = _context.resolvePartnerLink(fromPartnerLinkName);    
+            } else if (fromPartnerLinkName == null && fromVariableName != null) {
+                obj.fromVariable = _context.resolveVariable(fromVariableName);
+            } else {
+                throw new CompilationException(_cmsgsGeneral.errMissingVariableOrPartnerLinkAttribute());
+            }
+            props.add(obj);
+        }
+        
+        return props.isEmpty() ? null : props;
+    }
+
 }

Modified: ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/InvokeGenerator.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/InvokeGenerator.java?rev=883568&r1=883567&r2=883568&view=diff
==============================================================================
--- ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/InvokeGenerator.java (original)
+++ ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/InvokeGenerator.java Tue Nov 24 01:48:48 2009
@@ -19,6 +19,10 @@
 
 package org.apache.ode.bpel.compiler.v2;
 
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
 import org.apache.ode.bpel.compiler.api.CompilationException;
 import org.apache.ode.bpel.compiler.bom.Activity;
 import org.apache.ode.bpel.compiler.bom.Correlation;
@@ -31,10 +35,6 @@
 import org.apache.ode.utils.stl.CollectionsX;
 import org.apache.ode.utils.stl.MemberOfFunction;
 
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-
 /**
  * Generates code for <code>&lt;invoke&gt;</code> activities.
  */
@@ -109,6 +109,8 @@
             doCorrelations(inoutcorrelations, oinvoke.outputVar, oinvoke.assertCorrelationsOutput, oinvoke.initCorrelationsOutput);
         }
 
+        oinvoke.propagates = doContextPropagation(src);
+        
         // Partner link could be initialized with magic session in a previous receive.
         // if (!oinvoke.getOwner().version.equals(Constants.NS_BPEL4WS_2003_03)) {
         // if (!oinvoke.partnerLink.initializePartnerRole && !_context.isPartnerLinkAssigned(oinvoke.partnerLink.getName())) {

Modified: ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/InvokeGeneratorMessages.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/InvokeGeneratorMessages.java?rev=883568&r1=883567&r2=883568&view=diff
==============================================================================
--- ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/InvokeGeneratorMessages.java (original)
+++ ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/InvokeGeneratorMessages.java Tue Nov 24 01:48:48 2009
@@ -52,5 +52,4 @@
                 "partner link.", iptype, pltype);
 
     }
-
 }

Modified: ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/ReplyGenerator.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/ReplyGenerator.java?rev=883568&r1=883567&r2=883568&view=diff
==============================================================================
--- ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/ReplyGenerator.java (original)
+++ ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/v2/ReplyGenerator.java Tue Nov 24 01:48:48 2009
@@ -111,5 +111,7 @@
                 _context.resolvePropertyAlias(oreply.variable, property.name);
             }
         }
+        
+        oreply.propagates = doContextPropagation(src);
     }
 }

Modified: ode/trunk/bpel-compiler/src/test/java/org/apache/ode/bpel/compiler_2_0/GoodCompileTest.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-compiler/src/test/java/org/apache/ode/bpel/compiler_2_0/GoodCompileTest.java?rev=883568&r1=883567&r2=883568&view=diff
==============================================================================
--- ode/trunk/bpel-compiler/src/test/java/org/apache/ode/bpel/compiler_2_0/GoodCompileTest.java (original)
+++ ode/trunk/bpel-compiler/src/test/java/org/apache/ode/bpel/compiler_2_0/GoodCompileTest.java Tue Nov 24 01:48:48 2009
@@ -77,6 +77,7 @@
         suite.addTest(new GoodCompileTCase("/2.0/good/xpath20-func/GetVariableProperty1-xp2.0.bpel"));
         suite.addTest(new GoodCompileTCase("/2.0/good/xsd-import/helloworld-Server.bpel"));
         suite.addTest(new GoodCompileTCase("/2.0/good/extensionActivity/ExtensionActivity1-2.0.bpel"));
+        suite.addTest(new GoodCompileTCase("/2.0/good/context/ContextPropagation-2.0.bpel"));
         //madars.vitolins _at gmail.com 2009.04.05 Inline variable initalization test
         suite.addTest(new GoodCompileTCase("/2.0/good/inlineinit/inlineinit1-2.0.bpel"));
         return suite;

Added: ode/trunk/bpel-dao/src/main/java/org/apache/ode/bpel/dao/ContextValueDAO.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-dao/src/main/java/org/apache/ode/bpel/dao/ContextValueDAO.java?rev=883568&view=auto
==============================================================================
--- ode/trunk/bpel-dao/src/main/java/org/apache/ode/bpel/dao/ContextValueDAO.java (added)
+++ ode/trunk/bpel-dao/src/main/java/org/apache/ode/bpel/dao/ContextValueDAO.java Tue Nov 24 01:48:48 2009
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.ode.bpel.dao;
+
+
+public interface ContextValueDAO {
+    
+    String getNamespace();
+    void setNamespace(String namespace);
+    
+    String getKey();
+    void setKey(String key);
+    
+    String getValue();
+    void setValue(String value);
+    
+}

Modified: ode/trunk/bpel-dao/src/main/java/org/apache/ode/bpel/dao/PartnerLinkDAO.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-dao/src/main/java/org/apache/ode/bpel/dao/PartnerLinkDAO.java?rev=883568&r1=883567&r2=883568&view=diff
==============================================================================
--- ode/trunk/bpel-dao/src/main/java/org/apache/ode/bpel/dao/PartnerLinkDAO.java (original)
+++ ode/trunk/bpel-dao/src/main/java/org/apache/ode/bpel/dao/PartnerLinkDAO.java Tue Nov 24 01:48:48 2009
@@ -19,6 +19,8 @@
 
 package org.apache.ode.bpel.dao;
 
+import java.util.Collection;
+
 import javax.xml.namespace.QName;
 
 import org.w3c.dom.Element;
@@ -33,40 +35,47 @@
  */
 public interface PartnerLinkDAO {
 
-  /**
-   * Get the model id of the partner link.
-   * @return
-   */
-  public int getPartnerLinkModelId();
-  
-  public String getMyRoleName();
+    /**
+     * Get the model id of the partner link.
+     * @return
+     */
+    public int getPartnerLinkModelId();
+
+    public String getMyRoleName();
+
+    public String getPartnerRoleName();
+
+    public String getPartnerLinkName();
+
+    /**
+     * Get the service name associated with this partner link.
+     * @return
+     */
+    public QName getMyRoleServiceName();
 
-  public String getPartnerRoleName();
-  
-  public String getPartnerLinkName();
+    public void setMyRoleServiceName(QName svcName);
 
-  /**
-   * Get the service name associated with this partner link.
-   * @return
-   */
-  public QName getMyRoleServiceName();
+    public Element getMyEPR();
 
-  public void setMyRoleServiceName(QName svcName);
-  
-  public Element getMyEPR();
+    public void setMyEPR(Element val);
 
-  public void setMyEPR(Element val);
+    public Element getPartnerEPR();
 
-  public Element getPartnerEPR();
+    public void setPartnerEPR(Element val);
 
-  public void setPartnerEPR(Element val);
+    public String getMySessionId();
 
-public String getMySessionId();
+    public String getPartnerSessionId();
 
-public String getPartnerSessionId();
+    public void setPartnerSessionId(String session);
 
-public void setPartnerSessionId(String session);
+    public void setMySessionId(String sessionId);
 
-public void setMySessionId(String sessionId);
+    /**
+     * Get all context storage objects declared in this partner link instance.
+     */
+    public Collection<ContextValueDAO> getContextValues();
+    public void setContextValue(String namespace, String key, String value);
+    public void removeContextValue(String namespace, String key);
 
 }

Added: ode/trunk/bpel-schemas/src/main/xsd/contexts.xsd
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-schemas/src/main/xsd/contexts.xsd?rev=883568&view=auto
==============================================================================
--- ode/trunk/bpel-schemas/src/main/xsd/contexts.xsd (added)
+++ ode/trunk/bpel-schemas/src/main/xsd/contexts.xsd Tue Nov 24 01:48:48 2009
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements.  See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership.  The ASF licenses this file
+  ~ to you under the Apache License, Version 2.0 (the
+  ~ "License"); you may not use this file except in compliance
+  ~ with the License.  You may obtain a copy of the License at
+  ~
+  ~    http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing,
+  ~ software distributed under the License is distributed on an
+  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  ~ KIND, either express or implied.  See the License for the
+  ~ specific language governing permissions and limitations
+  ~ under the License.
+  -->
+<schema targetNamespace="http://www.apache.org/ode/schemas/context/2009" elementFormDefault="qualified" xmlns="http://www.w3.org/2001/XMLSchema" xmlns:ctx="http://www.apache.org/ode/schemas/context/2009">
+
+    <complexType name="tContexts">
+    	<sequence>
+    		<element name="context" type="ctx:tContext" minOccurs="0"
+    			maxOccurs="unbounded">
+    		</element>
+    	</sequence>
+    </complexType>
+
+    <complexType name="tContext">
+    	<sequence>
+    		<element name="value" type="ctx:tContextValue" minOccurs="0" maxOccurs="unbounded"></element>
+    	</sequence>
+    	<attribute name="name" type="string"></attribute>
+    </complexType>
+
+    <complexType name="tContextValue">
+    	<simpleContent>
+    		<extension base="string">
+    			<attribute name="key" type="string"></attribute>
+    		</extension>
+    	</simpleContent>
+    </complexType>
+
+    <element name="contexts" type="ctx:tContexts"></element>
+</schema>
\ No newline at end of file

Modified: ode/trunk/bpel-schemas/src/main/xsd/dd.xsd
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-schemas/src/main/xsd/dd.xsd?rev=883568&r1=883567&r2=883568&view=diff
==============================================================================
--- ode/trunk/bpel-schemas/src/main/xsd/dd.xsd (original)
+++ ode/trunk/bpel-schemas/src/main/xsd/dd.xsd Tue Nov 24 01:48:48 2009
@@ -33,70 +33,114 @@
                 <xs:complexType>
                     <xs:sequence>
 
-                        <xs:element name="active" minOccurs="0" maxOccurs="1" type="xs:boolean"
-                                    default="true">
-                            <xs:annotation>
-                                <xs:documentation> Active flag, if set process will be activated once
-                                    deployed. </xs:documentation>
-                            </xs:annotation>
-                        </xs:element>
-                        <xs:element name="retired" minOccurs="0" maxOccurs="1" type="xs:boolean"
-                                    default="false">
-                            <xs:annotation>
-                                <xs:documentation> Retired flag, if set process will be retired once
-                                    deployed. </xs:documentation>
-                            </xs:annotation>
-                        </xs:element>
-                        <xs:element name="in-memory" minOccurs="0" maxOccurs="1" type="xs:boolean"
-                                    default="false">
-                            <xs:annotation>
-                                <xs:documentation>Should the process be persistent or only execute
-                                    in-memory.</xs:documentation>
-                            </xs:annotation>
-                        </xs:element>
-
-                        <xs:element name="property"  minOccurs="0" maxOccurs="unbounded">
-                            <xs:annotation>
-                                <xs:documentation>
-                                    A user-defined property that will be attached to a process upon
-                                    deployment.
-                                </xs:documentation>
-                            </xs:annotation>
-                            <xs:complexType>
-                                <xs:sequence>
-                                    <xs:any namespace="##other" minOccurs="0" maxOccurs="unbounded" processContents="lax"/>
-                                </xs:sequence>
-                                <xs:attribute name="name" type="xs:QName" use="required"/>
-                            </xs:complexType>
-                        </xs:element>
-
-                        <xs:element name="process-events" minOccurs="0" maxOccurs="1" type="dd:tProcessEvents"/>
+                    	<xs:element name="active" minOccurs="0"
+                    		maxOccurs="1" type="xs:boolean" default="true">
+                    		<xs:annotation>
+                    			<xs:documentation>
+                    				Active flag, if set process will be
+                    				activated once deployed.
+                    			</xs:documentation>
+                    		</xs:annotation>
+                    	</xs:element>
+                    	<xs:element name="retired" minOccurs="0"
+                    		maxOccurs="1" type="xs:boolean" default="false">
+                    		<xs:annotation>
+                    			<xs:documentation>
+                    				Retired flag, if set process will be
+                    				retired once deployed.
+                    			</xs:documentation>
+                    		</xs:annotation>
+                    	</xs:element>
+                    	<xs:element name="in-memory" minOccurs="0"
+                    		maxOccurs="1" type="xs:boolean" default="false">
+                    		<xs:annotation>
+                    			<xs:documentation>
+                    				Should the process be persistent or
+                    				only execute in-memory.
+                    			</xs:documentation>
+                    		</xs:annotation>
+                    	</xs:element>
+
+                    	<xs:element name="property" minOccurs="0"
+                    		maxOccurs="unbounded">
+                    		<xs:annotation>
+                    			<xs:documentation>
+                    				A user-defined property that will be
+                    				attached to a process upon
+                    				deployment.
+                    			</xs:documentation>
+                    		</xs:annotation>
+                    		<xs:complexType>
+                    			<xs:sequence>
+                    				<xs:any namespace="##other"
+                    					minOccurs="0" maxOccurs="unbounded"
+                    					processContents="lax" />
+                    			</xs:sequence>
+                    			<xs:attribute name="name"
+                    				type="xs:QName" use="required" />
+                    		</xs:complexType>
+                    	</xs:element>
+
+                    	<xs:element name="process-events" minOccurs="0"
+                    		maxOccurs="1" type="dd:tProcessEvents" />
+
+                    	<xs:element name="provide" minOccurs="0"
+                    		maxOccurs="unbounded" type="dd:tProvide" />
+                    	<xs:element name="invoke" minOccurs="0"
+                    		maxOccurs="unbounded" type="dd:tInvoke" />
+
+                    	<xs:element name="mex-interceptors"
+                    		minOccurs="0" maxOccurs="1">
+                    		<xs:annotation>
+                    			<xs:documentation>
+                    				List of message exchange
+                    				interceptors that should be
+                    				registered for this process.
+                    			</xs:documentation>
+                    		</xs:annotation>
+                    		<xs:complexType>
+                    			<xs:sequence>
+                    				<xs:element name="mex-interceptor"
+                    					minOccurs="0" maxOccurs="unbounded"
+                    					type="dd:tMexInterceptor" />
+                    			</xs:sequence>
+                    		</xs:complexType>
+                    	</xs:element>
+                    	<xs:element name="type" minOccurs="0"
+                    		maxOccurs="1" type="xs:QName">
+                    		<xs:annotation>
+                    			<xs:documentation>
+                    				Process type -- indicates which
+                    				process defintion should be used for
+                    				the process.
+                    			</xs:documentation>
+                    		</xs:annotation>
+                    	</xs:element>
+
+                    	<xs:element name="cleanup" minOccurs="0"
+                    		maxOccurs="3" type="dd:tCleanup" />
+                    	<xs:element name="schedule" minOccurs="0"
+                    		maxOccurs="unbounded" type="dd:tSchedule">
+                    	</xs:element>
+                    	<xs:element name="context" minOccurs="0"
+                    		maxOccurs="1">
+							<xs:annotation>
+                    			<xs:documentation>
+                    				Context propagation configuration.
+                    			</xs:documentation>
+                    		</xs:annotation>
+                    		<xs:complexType>
+                    			<xs:sequence>
+                    				<xs:element name="propagate"
+                    					type="dd:tPropagate" minOccurs="0"
+                    					maxOccurs="unbounded">
+                    				</xs:element>
+                    				<xs:element name="interceptor" type="dd:tContextInterceptor" minOccurs="0" maxOccurs="unbounded">
+                    				</xs:element>
+                    			</xs:sequence>
 
-                        <xs:element name="provide"  minOccurs="0" maxOccurs="unbounded" type="dd:tProvide"/>
-                        <xs:element name="invoke"  minOccurs="0" maxOccurs="unbounded" type="dd:tInvoke"/>
-
-                        <xs:element name="mex-interceptors" minOccurs="0" maxOccurs="1" >
-                            <xs:annotation>
-                                <xs:documentation>
-                                    List of message exchange interceptors that should be registered for this process.
-                                </xs:documentation>
-                            </xs:annotation>
-                            <xs:complexType>
-                                <xs:sequence>
-                                    <xs:element name="mex-interceptor" minOccurs="0" maxOccurs="unbounded" type="dd:tMexInterceptor" />
-                                </xs:sequence>
-                            </xs:complexType>
-                        </xs:element>
-                        <xs:element name="type" minOccurs="0" maxOccurs="1"  type="xs:QName">
-                            <xs:annotation>
-                                <xs:documentation> Process type -- indicates which process defintion should be used
-                                    for the process.</xs:documentation>
-                            </xs:annotation>
-                        </xs:element>
-
-                        <xs:element name="cleanup" minOccurs="0" maxOccurs="3" type="dd:tCleanup" />
-                        <xs:element name="schedule" minOccurs="0" maxOccurs="unbounded" type="dd:tSchedule">
-                        </xs:element>
+                    		</xs:complexType>
+                    	</xs:element>
                     </xs:sequence>
 
                     <xs:attribute name="name" type="xs:QName" use="required"/>
@@ -149,15 +193,37 @@
         </xs:complexContent>
     </xs:complexType>
 
-    <xs:complexType name="tMexInterceptor" >
+    <xs:complexType name="tMexInterceptor">
+    	<xs:annotation>
+    		<xs:documentation>
+    			Message exchange interceptor configuration.
+    		</xs:documentation>
+    	</xs:annotation>
+
+    	<xs:sequence>
+    		<xs:element name="config" type="xs:string"></xs:element>
+    	</xs:sequence>
+    	<xs:attribute name="class-name" type="xs:string" use="required"></xs:attribute>
+    </xs:complexType>
+
+    <xs:complexType name="tContextInterceptor" >
         <xs:annotation>
             <xs:documentation>
-                Message exchange interceptor configuration.
+                Context interceptor configuration.
             </xs:documentation>
         </xs:annotation>
 
         <xs:sequence>
             <xs:element name="class-name" type="xs:string" />
+			<xs:element	name="config">
+          		<xs:complexType>
+          			<xs:sequence>
+          				<xs:any
+          					namespace="##other" minOccurs="0"
+          					maxOccurs="unbounded" processContents="lax" />
+          			</xs:sequence>
+          		</xs:complexType>
+			</xs:element>
         </xs:sequence>
     </xs:complexType>
 
@@ -227,4 +293,10 @@
         </xs:sequence>
         <xs:attribute name="when" type="xs:string" use="required"></xs:attribute>
     </xs:complexType>
+
+    <xs:complexType name="tPropagate">
+    	<xs:attribute name="from" type="xs:string" use="required"></xs:attribute>
+    	<xs:attribute name="to" type="xs:string" use="required"></xs:attribute>
+    	<xs:attribute name="context" type="xs:NMTOKENS"></xs:attribute>
+    </xs:complexType>
 </xs:schema>

Added: ode/trunk/bpel-scripts/src/main/resources/2.0/good/context/ContextPropagation-2.0.bpel
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-scripts/src/main/resources/2.0/good/context/ContextPropagation-2.0.bpel?rev=883568&view=auto
==============================================================================
--- ode/trunk/bpel-scripts/src/main/resources/2.0/good/context/ContextPropagation-2.0.bpel (added)
+++ ode/trunk/bpel-scripts/src/main/resources/2.0/good/context/ContextPropagation-2.0.bpel Tue Nov 24 01:48:48 2009
@@ -0,0 +1,73 @@
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements.  See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership.  The ASF licenses this file
+  ~ to you under the Apache License, Version 2.0 (the
+  ~ "License"); you may not use this file except in compliance
+  ~ with the License.  You may obtain a copy of the License at
+  ~
+  ~    http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing,
+  ~ software distributed under the License is distributed on an
+  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  ~ KIND, either express or implied.  See the License for the
+  ~ specific language governing permissions and limitations
+  ~ under the License.
+  -->
+
+<!--
+<assign> Test Case
+DESCRIPTION
+-->
+
+<process name="context-propagation"
+	 xmlns="http://docs.oasis-open.org/wsbpel/2.0/process/executable"
+	 targetNamespace="http://ode/bpel/unit-test"
+	 xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+	 xmlns:test="uri:testing"
+	 xmlns:t="uri:testing"
+	 xmlns:ctx="http://ode.apache.org/contextPropagation">
+
+  <import location="../test.wsdl"
+	  importType="http://schemas.xmlsoap.org/wsdl/"
+	  namespace="uri:testing" />
+
+  <partnerLinks>
+    <partnerLink name="testPartnerLink"
+		 partnerLinkType="test:PartnerLinkType1"
+		 myRole="me"
+		 partnerRole="you" />
+  </partnerLinks>
+
+  <variables>
+    <variable name="var1" messageType="test:Message1"/>
+    <variable name="var2" type="xsd:string"/>
+  </variables>
+
+  <sequence>
+    <receive name="startReceive"     
+	     createInstance="yes"
+	     partnerLink="testPartnerLink"
+	     portType="test:PortType1"
+	     operation="opTwoWay"
+	     variable="var1"/>
+
+	<invoke name="PaperOrderInvoke"
+	     operation="opOneWay"
+	     inputVariable="var1"
+	     partnerLink="testPartnerLink"
+	     portType="test:PortType1">
+	     <ctx:propagate ctx:fromPartnerLink="testPartnerLink" ctx:context="*"/>
+	</invoke>
+	
+    <reply name="endReply"
+      operation="opTwoWay"
+      partnerLink="testPartnerLink"
+      portType="test:PortType1"
+      variable="var1"/>
+
+  </sequence>
+
+</process>

Modified: ode/trunk/bpel-store/src/main/java/org/apache/ode/store/ProcessConfImpl.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-store/src/main/java/org/apache/ode/store/ProcessConfImpl.java?rev=883568&r1=883567&r2=883568&view=diff
==============================================================================
--- ode/trunk/bpel-store/src/main/java/org/apache/ode/store/ProcessConfImpl.java (original)
+++ ode/trunk/bpel-store/src/main/java/org/apache/ode/store/ProcessConfImpl.java Tue Nov 24 01:48:48 2009
@@ -34,10 +34,12 @@
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.ode.bpel.dd.TCleanup;
+import org.apache.ode.bpel.dd.TContextInterceptor;
 import org.apache.ode.bpel.dd.TDeployment;
 import org.apache.ode.bpel.dd.TInvoke;
 import org.apache.ode.bpel.dd.TMexInterceptor;
 import org.apache.ode.bpel.dd.TProcessEvents;
+import org.apache.ode.bpel.dd.TPropagate;
 import org.apache.ode.bpel.dd.TProvide;
 import org.apache.ode.bpel.dd.TSchedule;
 import org.apache.ode.bpel.dd.TScopeEvents;
@@ -57,6 +59,7 @@
 import org.apache.ode.utils.HierarchicalProperties;
 import org.apache.ode.utils.WatchDog;
 import org.apache.ode.utils.CollectionUtils;
+import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 import org.w3c.dom.Node;
 
@@ -78,6 +81,8 @@
     private final HashMap<String, Endpoint> _myRoleEndpoints = new HashMap<String, Endpoint>();
     private final ArrayList<QName> _sharedServices = new ArrayList<QName>();
     private final Map<String, Set<BpelEvent.TYPE>> _events = new HashMap<String, Set<BpelEvent.TYPE>>();
+    private final List<PropagationRule> _propagationRules = new ArrayList<PropagationRule>();
+    private final Map<String, Element> _ctxi = new HashMap<String, Element>(); 
     private final ArrayList<String> _mexi = new ArrayList<String>();
     ProcessState _state;
     final TDeployment.Process _pinfo;
@@ -114,6 +119,8 @@
         initLinks();
         initMexInterceptors();
         initEventList();
+        initPropagationRules();
+        initContextInterceptors();
 
         processCleanupConfImpl = new ProcessCleanupConfImpl(pinfo);
         
@@ -481,4 +488,46 @@
         
         return jobs;
     }
+
+    public Map<String, Element> getContextInterceptors() {
+        return _ctxi;
+    }
+
+
+    public List<PropagationRule> getPropagationRules() {
+        return _propagationRules;
+    }
+    
+    @SuppressWarnings("unchecked")
+    private void initPropagationRules() {
+        if (_pinfo.getContext() != null) {
+            for (TPropagate propagate : _pinfo.getContext().getPropagateList()) {
+                PropagationRule rule = new PropagationRule();
+                rule.setFromPL(propagate.getFrom());
+                rule.setToPL(propagate.getTo());
+                rule.setContexts(propagate.getContext());
+                _propagationRules.add(rule);
+            }
+        }
+    }
+    
+    private void initContextInterceptors() {
+        if (_pinfo.getContext() != null) {
+            for (TContextInterceptor i : _pinfo.getContext().getInterceptorList()) {
+                if (i.getConfig().getDomNode().getNodeType() != Node.ELEMENT_NODE){
+                    __log.warn("Ignoring configuration for " + i.getClassName() + " since it is not an XML element.");
+                    continue;
+                }
+                Element config = (Element)i.getConfig().getDomNode();
+                if (config != null) {
+                    // We'll need DOM Level 3
+                    Document doc = DOMUtils.newDocument();
+                    doc.appendChild(doc.importNode(config, true));
+                    _ctxi.put(i.getClassName(), doc.getDocumentElement());
+                } else {
+                    _ctxi.put(i.getClassName(), null);
+                }
+            }
+        }
+    }
 }

Modified: ode/trunk/bpel-store/src/test/java/org/apache/ode/store/ProcessStoreTest.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-store/src/test/java/org/apache/ode/store/ProcessStoreTest.java?rev=883568&r1=883567&r2=883568&view=diff
==============================================================================
--- ode/trunk/bpel-store/src/test/java/org/apache/ode/store/ProcessStoreTest.java (original)
+++ ode/trunk/bpel-store/src/test/java/org/apache/ode/store/ProcessStoreTest.java Tue Nov 24 01:48:48 2009
@@ -28,6 +28,7 @@
 import junit.framework.TestCase;
 
 import org.apache.ode.bpel.iapi.ProcessConf;
+import org.apache.ode.utils.DOMUtils;
 
 public class ProcessStoreTest extends TestCase {
 
@@ -67,6 +68,10 @@
         assertNotNull(pconf);
         assertEquals(_testdd.getName(),pconf.getPackage());
         assertEquals(pname, pconf.getProcessId());
+        assertEquals(1, pconf.getPropagationRules().size());
+        assertEquals(1, pconf.getContextInterceptors().keySet().size());
+        assertNotNull(pconf.getContextInterceptors().get("org.apache.ode.bpel.context.TestInterceptor"));
+        assertEquals("myparam1", DOMUtils.getElementContent(pconf.getContextInterceptors().get("org.apache.ode.bpel.context.TestInterceptor")).getLocalName());
     } 
     
     public void testGetProcesses() {

Modified: ode/trunk/bpel-store/src/test/resources/testdd/deploy.xml
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-store/src/test/resources/testdd/deploy.xml?rev=883568&r1=883567&r2=883568&view=diff
==============================================================================
--- ode/trunk/bpel-store/src/test/resources/testdd/deploy.xml (original)
+++ ode/trunk/bpel-store/src/test/resources/testdd/deploy.xml Tue Nov 24 01:48:48 2009
@@ -26,5 +26,15 @@
 		<provide partnerLink="helloPartnerLink">
 			<service name="wns:HelloService" port="HelloPort"/>
 		</provide>
+		<context>
+			<propagate from="helloPartnerLink" to="helloPartnerLink" context="*"/>
+			<interceptor>
+				<class-name>org.apache.ode.bpel.context.TestInterceptor</class-name>
+				<config>
+					<myparam1>x</myparam1>
+					<myparam2>y</myparam2>
+				</config>
+			</interceptor>
+		</context>
 	</process>
 </deploy>

Added: ode/trunk/bpel-test/src/test/java/org/apache/ode/test/ContextTest.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-test/src/test/java/org/apache/ode/test/ContextTest.java?rev=883568&view=auto
==============================================================================
--- ode/trunk/bpel-test/src/test/java/org/apache/ode/test/ContextTest.java (added)
+++ ode/trunk/bpel-test/src/test/java/org/apache/ode/test/ContextTest.java Tue Nov 24 01:48:48 2009
@@ -0,0 +1,92 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.ode.test;
+
+import javax.xml.xpath.XPath;
+import javax.xml.xpath.XPathFactory;
+
+import org.apache.ode.bpel.context.AbstractContextInterceptor;
+import org.apache.ode.bpel.iapi.Message;
+import org.apache.ode.bpel.rapi.ContextData;
+import org.apache.ode.utils.DOMUtils;
+import org.apache.ode.utils.NSContext;
+import org.junit.Assert;
+import org.junit.Test;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+public class ContextTest extends BPELTestAbstract {
+
+    @Test
+    public void testContextAssign() throws Throwable {
+        TestContextInterceptor tci = new TestContextInterceptor();
+        _server.registerContextInterceptor(tci);
+        go("/bpel/2.0/TestContextAssign");
+        _server.unregisterContextInterceptor(tci);
+
+        Assert.assertNull(tci.contextPartnerInvoked);
+        Assert.assertNull(tci.contextPartnerReplied);
+        Assert.assertNotNull(tci.contextProcessInvoked);
+        Assert.assertNotNull(tci.contextProcessReplied);
+
+        Node xmlpr = tci.contextProcessReplied.toXML();
+
+        NSContext nsContext = new NSContext();
+        nsContext.register("ctx",
+                "http://www.apache.org/ode/schemas/context/2009");
+
+        XPath xpath = XPathFactory.newInstance().newXPath();
+        xpath.setNamespaceContext(nsContext);
+        Assert.assertEquals("baz", xpath.evaluate(
+                "/ctx:contexts/ctx:context[@name='foo']/ctx:value[@key='bar']",
+                xmlpr));
+        Assert.assertEquals("", xpath.evaluate(
+                "/ctx:contexts/ctx:context[@name='bar']/ctx:value[@key='foo']",
+                xmlpr));
+
+    }
+
+    public class TestContextInterceptor extends AbstractContextInterceptor {
+
+        ContextData contextPartnerInvoked = null;
+        ContextData contextPartnerReplied = null;
+        ContextData contextProcessInvoked = null;
+        ContextData contextProcessReplied = null;
+
+        public void configure(Element configuration) {
+        }
+
+        public void onPartnerInvoke(ContextData ctx, Message msg) {
+            contextPartnerInvoked = ctx;
+        }
+
+        public void onPartnerReply(ContextData ctx, Message msg) {
+            contextPartnerReplied = ctx;
+        }
+
+        public void onProcessInvoke(ContextData ctx, Message msg) {
+            contextProcessInvoked = ctx;
+        }
+
+        public void onProcessReply(ContextData ctx, Message msg) {
+            contextProcessReplied = ctx;
+        }
+
+    }
+}

Added: ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestContextAssign/TestContextAssign.bpel
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestContextAssign/TestContextAssign.bpel?rev=883568&view=auto
==============================================================================
--- ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestContextAssign/TestContextAssign.bpel (added)
+++ ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestContextAssign/TestContextAssign.bpel Tue Nov 24 01:48:48 2009
@@ -0,0 +1,110 @@
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements.  See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership.  The ASF licenses this file
+  ~ to you under the Apache License, Version 2.0 (the
+  ~ "License"); you may not use this file except in compliance
+  ~ with the License.  You may obtain a copy of the License at
+  ~
+  ~    http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing,
+  ~ software distributed under the License is distributed on an
+  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  ~ KIND, either express or implied.  See the License for the
+  ~ specific language governing permissions and limitations
+  ~ under the License.
+  -->
+
+<process name="TestContextAssign"
+    targetNamespace="http://ode/bpel/unit-testContextAssign"
+         xmlns:bpws="http://docs.oasis-open.org/wsbpel/2.0/process/executable"
+         xmlns="http://docs.oasis-open.org/wsbpel/2.0/process/executable"
+         xmlns:ode="http://www.apache.org/ode/type/extension"
+         xmlns:tns="http://ode/bpel/unit-testAssign2"
+         xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+         xmlns:test="http://ode/bpel/unit-testContextAssign.wsdl"
+         xmlns:sref=" http://docs.oasis-open.org/wsbpel/2.0/serviceref"
+         xmlns:addr="http://example.com/addressing"
+         xmlns:dd="http://www.apache.org/ode/schemas/dd/2007/03"
+         xmlns:ctx="http://ode.apache.org/contextPropagation"
+         xmlns:ctxd="http://www.apache.org/ode/schemas/context/2009"
+         queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath2.0"
+         expressionLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath2.0">
+
+    <import location="TestContextAssign.wsdl"
+        namespace="http://ode/bpel/unit-testContextAssign.wsdl"
+            importType="http://schemas.xmlsoap.org/wsdl/" />
+
+    <partnerLinks>
+        <partnerLink name="TestAssignPartnerLink" partnerLinkType="test:TestAssignPartnerLinkType" myRole="me" />
+    </partnerLinks>
+
+    <variables>
+        <variable name="myVar" messageType="test:TestAssignMessage"/>
+        <variable name="otherMsgVar" messageType="test:TestAssignMessage"/>
+        <variable name="strVar" type="xsd:string"/>
+        <variable name="str2Var" type="xsd:string"/>
+        <variable name="ctxVar" type="xsd:anyType"/>
+    </variables>
+
+    <sequence>
+        <receive name="start" partnerLink="TestAssignPartnerLink" portType="test:TestAssignPortType"
+                 operation="testAssign" variable="myVar" createInstance="yes"/>
+
+        <assign name="assign1">
+            <copy>
+                <from><literal>
+                    <ctxd:contexts>
+                        <ctxd:context name="foo">
+                            <ctxd:value key="bar">baz</ctxd:value>
+                        </ctxd:context>
+                        <ctxd:context name="bar">
+                            <ctxd:value key="foo">test</ctxd:value>
+                        </ctxd:context>
+                    </ctxd:contexts>
+                </literal></from>
+                <to partnerLink="TestAssignPartnerLink" context="*"/>
+            </copy>
+            <copy>
+                <from variable="myVar" part="TestPart"/>
+                <to variable="strVar"/>
+            </copy>
+            <copy keepSrcElementName="yes">
+                <from partnerLink="TestAssignPartnerLink" context="foo"/>
+                <to variable="ctxVar"/>
+            </copy>
+            <copy>
+                <from>concat($strVar, " ")</from>
+                <to variable="strVar"/>
+            </copy>
+            <copy>
+                <from>concat($strVar, $ctxVar/ctxd:context[@name='foo']/ctxd:value[@key='bar'])</from>
+                <to variable="strVar"/>
+            </copy>
+
+            <copy>
+                <from partnerLink="TestAssignPartnerLink" context="bar">
+                    <query>/ctxd:contexts/ctxd:context[@name="bar"]/ctxd:value[@key="foo"]</query>
+                </from>
+                <to variable="str2Var"/>
+            </copy>
+            <copy>
+                <from>concat($strVar, " ", $str2Var)</from>
+                <to variable="strVar"/>
+            </copy>
+
+            <copy>
+                <from variable="strVar"/>
+                <!--to variable="otherMsgVar" part="TestPart"/-->
+                <to>$otherMsgVar.TestPart</to>
+            </copy>
+        </assign>
+
+        <reply name="end" partnerLink="TestAssignPartnerLink" portType="test:TestAssignPortType"
+               operation="testAssign" variable="otherMsgVar">
+            <ctx:propagate ctx:fromPartnerLink="TestAssignPartnerLink" ctx:context="foo"/>
+        </reply>
+    </sequence>
+</process>

Added: ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestContextAssign/TestContextAssign.wsdl
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestContextAssign/TestContextAssign.wsdl?rev=883568&view=auto
==============================================================================
--- ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestContextAssign/TestContextAssign.wsdl (added)
+++ ode/trunk/bpel-test/src/test/resources/bpel/2.0/TestContextAssign/TestContextAssign.wsdl Tue Nov 24 01:48:48 2009
@@ -0,0 +1,66 @@
+<?xml version="1.0" encoding="utf-8" ?>
+
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements.  See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership.  The ASF licenses this file
+  ~ to you under the Apache License, Version 2.0 (the
+  ~ "License"); you may not use this file except in compliance
+  ~ with the License.  You may obtain a copy of the License at
+  ~
+  ~    http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing,
+  ~ software distributed under the License is distributed on an
+  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  ~ KIND, either express or implied.  See the License for the
+  ~ specific language governing permissions and limitations
+  ~ under the License.
+  -->
+
+<wsdl:definitions
+    targetNamespace="http://ode/bpel/unit-testContextAssign.wsdl"
+    xmlns="http://schemas.xmlsoap.org/wsdl/"
+    xmlns:tns="http://ode/bpel/unit-testContextAssign.wsdl"
+    xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+    xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+    xmlns:bpws="http://docs.oasis-open.org/wsbpel/2.0/process/executable"
+    xmlns:plnk="http://docs.oasis-open.org/wsbpel/2.0/plnktype">
+
+    <wsdl:message name="TestAssignMessage">
+        <wsdl:part name="TestPart" type="xsd:string"/>
+    </wsdl:message>
+
+    <wsdl:portType name="TestAssignPortType">
+        <wsdl:operation name="testAssign">
+            <wsdl:input message="tns:TestAssignMessage" name="TestIn"/>
+            <wsdl:output message="tns:TestAssignMessage" name="TestOut"/>
+        </wsdl:operation>
+    </wsdl:portType>
+
+     <wsdl:binding name="TestAssignSoapBinding" type="tns:TestAssignPortType">
+        <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
+        <wsdl:operation name="testAssign">
+            <soap:operation soapAction="" style="rpc"/>
+            <wsdl:input>
+                <soap:body namespace="http://ode/bpel/unit-test.wsdl" use="literal"/>
+            </wsdl:input>
+            <wsdl:output>
+                <soap:body namespace="http://ode/bpel/unit-test.wsdl" use="literal"/>
+            </wsdl:output>
+        </wsdl:operation>
+    </wsdl:binding>
+    <wsdl:service name="TestContextAssignService">
+		<wsdl:port name="TestAssignPort" binding="tns:TestAssignSoapBinding">
+     		<soap:address location="http://localhost:8080/ode/processes/TestAssign"/>
+		</wsdl:port>
+    </wsdl:service>
+
+   <plnk:partnerLinkType name="TestAssignPartnerLinkType">
+       <plnk:role name="me" portType="tns:TestAssignPortType"/>
+       <plnk:role name="you" portType="tns:TestAssignPortType"/>
+   </plnk:partnerLinkType>
+</wsdl:definitions>
+