svn commit: r639250 - in /activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf: ./ invoker/

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r639250 - in /activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf: ./ invoker/

ningjiang
Author: ningjiang
Date: Thu Mar 20 04:28:02 2008
New Revision: 639250

URL: http://svn.apache.org/viewvc?rev=639250&view=rev
Log:
CAMEL-392 patch applied with thanks to Marc

Modified:
    activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfProducer.java
    activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/invoker/CxfClient.java
    activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/invoker/InvokingContext.java
    activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/invoker/PayloadInvokingContext.java
    activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/invoker/RawMessageInvokingContext.java

Modified: activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfProducer.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfProducer.java?rev=639250&r1=639249&r2=639250&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfProducer.java (original)
+++ activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfProducer.java Thu Mar 20 04:28:02 2008
@@ -222,7 +222,7 @@
                  invokingContext = InvokingContextFactory.createContext(dataFormat);
                  ex.put(InvokingContext.class, invokingContext);
                 }
-                Object params = invokingContext.getRequestContent(inMessage);
+                Map params = invokingContext.getRequestContent(inMessage);
                 // invoke the stream message with the exchange context
                 CxfClient cxfClient = (CxfClient) client;
                 // need to get the binding object to create the message

Modified: activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/invoker/CxfClient.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/invoker/CxfClient.java?rev=639250&r1=639249&r2=639250&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/invoker/CxfClient.java (original)
+++ activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/invoker/CxfClient.java Thu Mar 20 04:28:02 2008
@@ -48,7 +48,7 @@
 
     }
 
-    public Object dispatch(Object params,
+    public Object dispatch(Map<Class, Object> params,
                            Map<String, Object> context,
                            Exchange exchange) throws Exception {
 
@@ -82,7 +82,7 @@
 
     @SuppressWarnings("unchecked")
     public Object invokeWithMessageStream(BindingOperationInfo bi,
-                                          Object param,
+                                          Map<Class, Object> param,
                                           Map<String, Object> context,
                                           InvokingContext invokingContext) throws Exception {
 
@@ -182,7 +182,7 @@
 
 
     private Message prepareMessage(Exchange exchange, Map<String, Object> requestContext,
-            Object param, InvokingContext InvokingContext) {
+            Map<Class, Object> param, InvokingContext InvokingContext) {
 
         Message message = getEndpoint().getBinding().createMessage();
         message.put(Message.REQUESTOR_ROLE, Boolean.TRUE);

Modified: activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/invoker/InvokingContext.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/invoker/InvokingContext.java?rev=639250&r1=639249&r2=639250&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/invoker/InvokingContext.java (original)
+++ activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/invoker/InvokingContext.java Thu Mar 20 04:28:02 2008
@@ -29,7 +29,7 @@
      * It sets the content in the given (out) message object.
      * @param content
      */
-    void setRequestOutMessageContent(Message message, Object content);
+    void setRequestOutMessageContent(Message message, Map<Class, Object> contents);
 
     /**
      * This method is call when the CxfClient receives a response from a CXF server and needs
@@ -54,8 +54,8 @@
      * the client and needs to extract the request content from the message.  It retreives
      * and receives the request content from the incoming message.
      * @param inMessage
-     * @return the request from client
+     * @return the request contents from client
      */
-    Object getRequestContent(Message inMessage);
+    Map<Class, Object> getRequestContent(Message inMessage);
 
 }

Modified: activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/invoker/PayloadInvokingContext.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/invoker/PayloadInvokingContext.java?rev=639250&r1=639249&r2=639250&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/invoker/PayloadInvokingContext.java (original)
+++ activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/invoker/PayloadInvokingContext.java Thu Mar 20 04:28:02 2008
@@ -18,6 +18,7 @@
 
 import java.util.List;
 import java.util.Map;
+import java.util.IdentityHashMap;
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
@@ -34,9 +35,9 @@
 
     }
 
-    public void setRequestOutMessageContent(Message message, Object content) {
+    public void setRequestOutMessageContent(Message message, Map<Class, Object> contents) {
 
-        PayloadMessage request = (PayloadMessage) content;
+        PayloadMessage request = (PayloadMessage)contents.get(PayloadMessage.class);
 
         Element header = request.getHeader();
         List<Element> payload = request.getPayload();
@@ -91,8 +92,9 @@
         }
     }
 
+
     @SuppressWarnings("unchecked")
-    public Object getRequestContent(Message inMessage) {
+    public Map<Class, Object> getRequestContent(Message inMessage) {
         List<Element> payload = inMessage.get(List.class);
         Element header = inMessage.get(Element.class);
 
@@ -100,7 +102,10 @@
             LOG.finest("Header = " + header + ", Payload = " + payload);
         }
 
-        return new PayloadMessage(payload, header);
+        Map<Class, Object> contents = new IdentityHashMap<Class, Object>();
+        contents.put(PayloadMessage.class, new PayloadMessage(payload, header));
+
+        return contents;
     }
 
 }

Modified: activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/invoker/RawMessageInvokingContext.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/invoker/RawMessageInvokingContext.java?rev=639250&r1=639249&r2=639250&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/invoker/RawMessageInvokingContext.java (original)
+++ activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/invoker/RawMessageInvokingContext.java Thu Mar 20 04:28:02 2008
@@ -18,6 +18,9 @@
 
 import java.io.InputStream;
 import java.util.Map;
+import java.util.Set;
+import java.util.Iterator;
+import java.util.IdentityHashMap;
 import java.util.logging.Logger;
 
 import org.apache.cxf.message.Exchange;
@@ -30,8 +33,15 @@
 
     }
 
-    public void setRequestOutMessageContent(Message message, Object content) {
-        message.setContent(InputStream.class, content);
+    public void setRequestOutMessageContent(Message message, Map<Class, Object> contents) {
+        Set entries = contents.keySet();
+        Iterator iter = entries.iterator();
+        while (iter.hasNext()){
+            Object obj = iter.next();
+            if (obj instanceof Class){
+                message.setContent((Class<?>)obj, contents.get((Class<?>)obj));
+            }
+        }
     }
 
     public Object getResponseObject(Exchange exchange, Map<String, Object> responseContext) {
@@ -45,9 +55,20 @@
         //loggerTheMessage(outMessage, "Out Message");
     }
 
-    public Object getRequestContent(Message inMessage) {
+    public Map<Class, Object> getRequestContent(Message inMessage) {
         //loggerTheMessage(inMessage, "In Message");
-        return inMessage.getContent(InputStream.class);
+
+        IdentityHashMap<Class, Object> contents = new IdentityHashMap<Class, Object>();
+
+        Set set = inMessage.getContentFormats();
+        Iterator iter = set.iterator();
+        while (iter.hasNext()){
+            Object obj = iter.next();
+            if (obj instanceof Class)
+                contents.put((Class<?>)obj, inMessage.getContent((Class<?>)obj));
+        }
+
+        return contents;
     }
 
 }