Author: ruwan
Date: Mon Oct 29 02:42:37 2007
New Revision: 589560

URL: http://svn.apache.org/viewvc?rev=589560&view=rev
Log:
Fixing the issue SYNAPSE-158. Now there will be a new scope named "client" and 
one needs to use that to set the properties to the client options rather than 
to the message context

Modified:
    
webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/PropertyMediatorFactory.java
    
webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/XMLConfigConstants.java
    
webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/core/axis2/Axis2FlexibleMEPClient.java
    
webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/mediators/builtin/PropertyMediator.java
    
webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/util/MessageHelper.java

Modified: 
webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/PropertyMediatorFactory.java
URL: 
http://svn.apache.org/viewvc/webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/PropertyMediatorFactory.java?rev=589560&r1=589559&r2=589560&view=diff
==============================================================================
--- 
webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/PropertyMediatorFactory.java
 (original)
+++ 
webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/PropertyMediatorFactory.java
 Mon Oct 29 02:42:37 2007
@@ -35,7 +35,7 @@
  * Creates a property mediator through the supplied XML configuration
  * <p/>
  * <pre>
- * &lt;property name="string" [action=set/remove] (value="literal" | 
expression="xpath")/&gt;
+ * &lt;property name="string" [action=set/remove] (value="literal" | 
expression="xpath") [scope=(axis2 | client | transport)]/&gt;
  * </pre>
  */
 public class PropertyMediatorFactory extends AbstractMediatorFactory {
@@ -78,8 +78,8 @@
         if (scope != null) {
             String valueStr = scope.getAttributeValue();
             if (!XMLConfigConstants.SCOPE_AXIS2.equals(valueStr) && 
!XMLConfigConstants.SCOPE_TRANSPORT.equals(valueStr)
-                    && !XMLConfigConstants.SCOPE_DEFAULT.equals(valueStr)) {
-                String msg = "Only '" + XMLConfigConstants.SCOPE_AXIS2 + "' or 
'" + XMLConfigConstants.SCOPE_TRANSPORT
+                    && !XMLConfigConstants.SCOPE_DEFAULT.equals(valueStr) && 
!XMLConfigConstants.SCOPE_CLIENT.equals(valueStr)) {
+                String msg = "Only '" + XMLConfigConstants.SCOPE_AXIS2 + "' or 
'" + XMLConfigConstants.SCOPE_TRANSPORT + "' or '" + 
XMLConfigConstants.SCOPE_CLIENT
                         + "' values are allowed for attribute scope for a 
property mediator"
                         + ", Unsupported scope " + valueStr;
                 log.error(msg);

Modified: 
webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/XMLConfigConstants.java
URL: 
http://svn.apache.org/viewvc/webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/XMLConfigConstants.java?rev=589560&r1=589559&r2=589560&view=diff
==============================================================================
--- 
webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/XMLConfigConstants.java
 (original)
+++ 
webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/XMLConfigConstants.java
 Mon Oct 29 02:42:37 2007
@@ -36,6 +36,8 @@
     public static final String SCOPE_DEFAULT = "default";
     /** The scope name for axis2 message context properties */
     public static final String SCOPE_AXIS2 = "axis2";
+    /** The scope name for axis2 message context client options properties */
+    public static final String SCOPE_CLIENT = "client";
     /** The scope name for transport header properties */
     public static final String SCOPE_TRANSPORT = "transport";
 

Modified: 
webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/core/axis2/Axis2FlexibleMEPClient.java
URL: 
http://svn.apache.org/viewvc/webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/core/axis2/Axis2FlexibleMEPClient.java?rev=589560&r1=589559&r2=589560&view=diff
==============================================================================
--- 
webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/core/axis2/Axis2FlexibleMEPClient.java
 (original)
+++ 
webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/core/axis2/Axis2FlexibleMEPClient.java
 Mon Oct 29 02:42:37 2007
@@ -263,16 +263,6 @@
         newMC.setEnvelope(ori.getEnvelope());        
         removeAddressingHeaders(newMC);
 
-        // pass any transport headers on the original request
-        newMC.setProperty(MessageContext.TRANSPORT_HEADERS,
-            ori.getProperty(MessageContext.TRANSPORT_HEADERS));
-
-        Iterator iter = ori.getOptions().getProperties().keySet().iterator();
-        while (iter.hasNext()) {
-            String key = (String) iter.next();
-            newMC.setProperty(key, ori.getProperty(key));
-        }
-
         return newMC;
     }
 

Modified: 
webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/mediators/builtin/PropertyMediator.java
URL: 
http://svn.apache.org/viewvc/webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/mediators/builtin/PropertyMediator.java?rev=589560&r1=589559&r2=589560&view=diff
==============================================================================
--- 
webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/mediators/builtin/PropertyMediator.java
 (original)
+++ 
webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/mediators/builtin/PropertyMediator.java
 Mon Oct 29 02:42:37 2007
@@ -100,6 +100,14 @@
                 Axis2MessageContext axis2smc = (Axis2MessageContext) synCtx;
                 org.apache.axis2.context.MessageContext axis2MessageCtx =
                         axis2smc.getAxis2MessageContext();
+                axis2MessageCtx.setProperty(name, resultValue);
+
+            } else if (XMLConfigConstants.SCOPE_CLIENT.equals(scope)
+                    && synCtx instanceof Axis2MessageContext) {
+                //Setting property into the  Axis2 Message Context client 
options
+                Axis2MessageContext axis2smc = (Axis2MessageContext) synCtx;
+                org.apache.axis2.context.MessageContext axis2MessageCtx =
+                        axis2smc.getAxis2MessageContext();
                 axis2MessageCtx.getOptions().setProperty(name, resultValue);
 
             } else if (XMLConfigConstants.SCOPE_TRANSPORT.equals(scope)
@@ -137,9 +145,11 @@
                     pros.remove(name);
                 }
 
-            } else if (XMLConfigConstants.SCOPE_AXIS2.equals(scope)
-                    && synCtx instanceof Axis2MessageContext) {
-                //Removing property from the        Axis2 Message Context
+            } else if ((XMLConfigConstants.SCOPE_AXIS2.equals(scope) ||
+                XMLConfigConstants.SCOPE_CLIENT.equals(scope))
+                && synCtx instanceof Axis2MessageContext) {
+                
+                //Removing property from the Axis2 Message Context
                 Axis2MessageContext axis2smc = (Axis2MessageContext) synCtx;
                 org.apache.axis2.context.MessageContext axis2MessageCtx =
                         axis2smc.getAxis2MessageContext();

Modified: 
webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/util/MessageHelper.java
URL: 
http://svn.apache.org/viewvc/webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/util/MessageHelper.java?rev=589560&r1=589559&r2=589560&view=diff
==============================================================================
--- 
webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/util/MessageHelper.java
 (original)
+++ 
webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/util/MessageHelper.java
 Mon Oct 29 02:42:37 2007
@@ -103,15 +103,6 @@
         newMC.setTransportOut(mc.getTransportOut());
         newMC.setProperty(org.apache.axis2.Constants.OUT_TRANSPORT_INFO,
             mc.getProperty(org.apache.axis2.Constants.OUT_TRANSPORT_INFO));
-        
newMC.setProperty(org.apache.axis2.context.MessageContext.TRANSPORT_HEADERS,
-            
mc.getProperty(org.apache.axis2.context.MessageContext.TRANSPORT_HEADERS));
-
-        // Copying properties in the original message
-        Iterator iter = mc.getProperties().keySet().iterator();
-        while (iter.hasNext()) {
-            String key = (String) iter.next();
-            newMC.setProperty(key, mc.getProperty(key));
-        }
 
         return newMC;
     }
@@ -139,6 +130,9 @@
         newMC.setDoingMTOM(ori.isDoingMTOM());
         newMC.setDoingSwA(ori.isDoingSwA());
 
+        
newMC.setProperty(org.apache.axis2.context.MessageContext.TRANSPORT_HEADERS,
+            
ori.getProperty(org.apache.axis2.context.MessageContext.TRANSPORT_HEADERS));
+
         // if the original request carries any attachments, copy them to the 
clone
         // as well, except for the soap part if any
         Attachments attachments = ori.getAttachmentMap();
@@ -150,6 +144,18 @@
                     newMC.addAttachment(cIDs[i], 
attachments.getDataHandler(cIDs[i]));
                 }
             }
+        }
+
+        Iterator iter = ori.getOptions().getProperties().keySet().iterator();
+        while (iter.hasNext()) {
+            String key = (String) iter.next();
+            newMC.getOptions().setProperty(key, 
ori.getOptions().getProperty(key));
+        }
+
+        Iterator iter2 = ori.getProperties().keySet().iterator();
+        while (iter2.hasNext()) {
+            String key = (String) iter2.next();
+            newMC.setProperty(key, ori.getProperty(key));
         }
 
         newMC.setServerSide(false);



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to