camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chir...@apache.org
Subject svn commit: r576522 [1/3] - in /activemq/camel/trunk/components/camel-cxf: ./ src/main/java/org/apache/camel/component/cxf/ src/main/java/org/apache/camel/component/cxf/interceptors/ src/main/java/org/apache/camel/component/cxf/invoker/ src/main/java/o...
Date Mon, 17 Sep 2007 17:00:16 GMT
Author: chirino
Date: Mon Sep 17 10:00:08 2007
New Revision: 576522

URL: http://svn.apache.org/viewvc?rev=576522&view=rev
Log:
Patch - https://issues.apache.org/activemq/browse/CAMEL-121 Thanks Willem\!

Added:
    activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfMessageObserver.java   (with props)
    activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/DataFormat.java   (with props)
    activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/
    activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/AbstractInvokerInterceptor.java   (with props)
    activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/AbstractMessageInInterceptor.java   (with props)
    activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/AbstractMessageOutInterceptor.java   (with props)
    activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/DOMInInterceptor.java   (with props)
    activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/DOMOutInterceptor.java   (with props)
    activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/FaultOutInterceptor.java   (with props)
    activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/PayloadContentRedirectInterceptor.java   (with props)
    activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/PayloadInInterceptor.java   (with props)
    activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/RawMessageContentRedirectInterceptor.java   (with props)
    activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/RawMessageInInterceptor.java   (with props)
    activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/SoapMessageInInterceptor.java   (with props)
    activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/SoapMessageOutInterceptor.java   (with props)
    activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/XMLMessageInInterceptor.java   (with props)
    activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/XMLMessageOutInterceptor.java   (with props)
    activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/package.html   (with props)
    activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/invoker/
    activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/invoker/AbstractInvokingContext.java   (with props)
    activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/invoker/CxfClient.java   (with props)
    activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/invoker/CxfClientFactoryBean.java   (with props)
    activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/invoker/FaultChainInitiatorObserver.java   (with props)
    activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/invoker/InvokingContext.java   (with props)
    activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/invoker/InvokingContextFactory.java   (with props)
    activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/invoker/PayloadInvokingContext.java   (with props)
    activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/invoker/PayloadMessage.java   (with props)
    activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/invoker/RawMessageInvokingContext.java   (with props)
    activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/invoker/package.html   (with props)
    activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/phase/
    activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/phase/AbstractPhaseManagerImpl.java   (with props)
    activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/phase/FaultPayloadPhaseManagerImpl.java   (with props)
    activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/phase/PayloadPhaseManagerImpl.java   (with props)
    activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/phase/RawMessagePhaseManagerImpl.java   (with props)
    activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/phase/package.html   (with props)
    activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/util/
    activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/util/CxfEndpointUtils.java   (with props)
    activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/util/UriUtils.java   (with props)
    activemq/camel/trunk/components/camel-cxf/src/main/resources/org/
    activemq/camel/trunk/components/camel-cxf/src/main/resources/org/apache/
    activemq/camel/trunk/components/camel-cxf/src/main/resources/org/apache/camel/
    activemq/camel/trunk/components/camel-cxf/src/main/resources/org/apache/camel/component/
    activemq/camel/trunk/components/camel-cxf/src/main/resources/org/apache/camel/component/cxf/
    activemq/camel/trunk/components/camel-cxf/src/main/resources/org/apache/camel/component/cxf/interceptors/
    activemq/camel/trunk/components/camel-cxf/src/main/resources/org/apache/camel/component/cxf/interceptors/Messages.properties   (with props)
    activemq/camel/trunk/components/camel-cxf/src/main/resources/org/apache/camel/component/cxf/util/
    activemq/camel/trunk/components/camel-cxf/src/main/resources/org/apache/camel/component/cxf/util/Messages.properties   (with props)
    activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfPayLoadMessageRouterTest.java   (with props)
    activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfRawMessageRouterTest.java   (with props)
    activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/phase/
    activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/phase/PayloadPhaseManagerImplTest.java   (with props)
    activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/phase/RawMessagePhaseManagerImplTest.java   (with props)
    activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/util/
    activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/util/CxfEndpointUtilsTest.java   (with props)
Modified:
    activemq/camel/trunk/components/camel-cxf/pom.xml
    activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CamelInvoker.java
    activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfBinding.java
    activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfComponent.java
    activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfConstants.java
    activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfConsumer.java
    activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfEndpoint.java
    activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfExchange.java
    activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfMessage.java
    activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfProducer.java
    activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfProducerTest.java
    activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfRouterTest.java
    activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/HelloServiceImpl.java

Modified: activemq/camel/trunk/components/camel-cxf/pom.xml
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-cxf/pom.xml?rev=576522&r1=576521&r2=576522&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-cxf/pom.xml (original)
+++ activemq/camel/trunk/components/camel-cxf/pom.xml Mon Sep 17 10:00:08 2007
@@ -51,6 +51,13 @@
     </dependency>
 
     <dependency>
+      <groupId>commons-io</groupId>
+      <artifactId>commons-io</artifactId>
+      <version>${commons-io-version}</version>
+    </dependency>
+    
+
+    <dependency>
       <groupId>org.apache.cxf</groupId>
       <artifactId>cxf-rt-core</artifactId>
       <version>${cxf-version}</version>
@@ -79,6 +86,11 @@
     </dependency>
     <dependency>
       <groupId>org.apache.cxf</groupId>
+      <artifactId>cxf-rt-frontend-jaxws</artifactId>
+      <version>${cxf-version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.cxf</groupId>
       <artifactId>cxf-rt-management</artifactId>
       <version>${cxf-version}</version>
     </dependency>
@@ -144,6 +156,35 @@
     </dependency>
 
     <dependency>
+       <groupId>org.springframework</groupId>
+       <artifactId>spring-core</artifactId>
+       <version>2.0.5</version>
+       <scope>test</scope>
+    </dependency>
+
+    <dependency>
+       <groupId>org.springframework</groupId>
+       <artifactId>spring-beans</artifactId>
+       <version>2.0.5</version>
+       <scope>test</scope>
+     </dependency>
+    
+    <dependency>
+       <groupId>org.springframework</groupId>
+       <artifactId>spring-context</artifactId>
+       <version>2.0.5</version>
+       <scope>test</scope>
+     </dependency>
+
+
+    <dependency>
+       <groupId>org.springframework</groupId>
+       <artifactId>spring-web</artifactId>
+       <version>2.0.5</version>
+       <scope>test</scope>
+     </dependency>
+
+    <dependency>
       <groupId>junit</groupId>
       <artifactId>junit</artifactId>
       <scope>test</scope>
@@ -172,7 +213,7 @@
           </includes>
           <excludes>
             <!-- TODO re-enable ASAP! -->
-            <exclude>**/CxfTest.*</exclude>
+            <exclude>**/CxfEndpointUtilsTest.*</exclude>
             <exclude>**/transport/*Test.*</exclude>
           </excludes>
         </configuration>

Modified: activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CamelInvoker.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CamelInvoker.java?rev=576522&r1=576521&r2=576522&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CamelInvoker.java (original)
+++ activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CamelInvoker.java Mon Sep 17 10:00:08 2007
@@ -16,25 +16,126 @@
  */
 package org.apache.camel.component.cxf;
 
+import java.io.InputStream;
 import java.lang.reflect.Method;
 import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
 import java.util.List;
+import java.util.Map;
+import java.util.logging.Level;
+import java.util.logging.Logger;
 
+import org.apache.camel.component.cxf.invoker.InvokingContext;
+import org.apache.cxf.endpoint.Client;
+import org.apache.cxf.endpoint.Endpoint;
 import org.apache.cxf.frontend.MethodDispatcher;
 import org.apache.cxf.helpers.CastUtils;
 import org.apache.cxf.message.Exchange;
+import org.apache.cxf.message.Message;
 import org.apache.cxf.message.MessageContentsList;
+import org.apache.cxf.message.MessageImpl;
 import org.apache.cxf.service.Service;
 import org.apache.cxf.service.invoker.AbstractInvoker;
 import org.apache.cxf.service.invoker.Invoker;
 import org.apache.cxf.service.model.BindingOperationInfo;
 
 public class CamelInvoker implements Invoker  {
+    private static final Logger LOG = Logger.getLogger(CamelInvoker.class.getName());
     private CxfConsumer cxfConsumer;
     public CamelInvoker(CxfConsumer consumer) {
         cxfConsumer = consumer;
     }
+    /**
+    * This method is called when the incoming message is to
+    * be passed into the camel processor. The return value is the response
+    * from the processor
+    * @param inMessage
+    * @return outMessage
+    */
+    public Message invoke(Message inMessage) {
+        System.out.println("invoke the message " + inMessage);
+        Exchange exchange = inMessage.getExchange();
+        //InvokingContext invokingContext = exchange.get(InvokingContext.class);
+                               
+        //Set Request Context into CXF Message
+        Map<String, Object> ctxContainer = new HashMap<String, Object>();
+        Map<String, Object> requestCtx = new HashMap<String, Object>();
+        ctxContainer.put(Client.REQUEST_CONTEXT, requestCtx);
+        updateContext(inMessage, requestCtx);
+        CxfEndpoint endpoint = (CxfEndpoint) cxfConsumer.getEndpoint();
+        CxfExchange cxfExchange = endpoint.createExchange(inMessage);
+        try {
+            cxfConsumer.getProcessor().process(cxfExchange);
+        } catch (Exception e) {
+            // catch the exception and send back to cxf client
+            e.printStackTrace();
+        }
+       
+        // make sure the client has retrun back the message
+        Message outMessage = getCxfMessage(cxfExchange, exchange);
+               
+        //Set Response Context into CXF Message
+        /*ctxContainer = (Map<String, Object>)outMessage.getProperty(CxfMessageAdapter.REQ_RESP_CONTEXT);
+        Map<String, Object> respCtx = (Map<String, Object>)ctxContainer.get(Client.RESPONSE_CONTEXT);
+        updateContext(respCtx, outMessage);*/
+       
+        return outMessage;
+    }
+    
+    public Message getCxfMessage(CxfExchange result, Exchange exchange) {        
+        Message outMessage = null;
+        if (result.isFailed()) {
+            CxfMessage fault = result.getFault();
+            outMessage = exchange.getInFaultMessage();
+            //REVISIT ?
+            if (outMessage == null) {
+                outMessage = new MessageImpl();
+                //outMessage.setExchange(exchange);
+                exchange.setInFaultMessage(outMessage);
+            }
+            Exception ex = (Exception) fault.getBody();
+            outMessage.setContent(Exception.class, ex);
+        } else {
+            if (LOG.isLoggable(Level.FINEST)) {
+                LOG.finest("Payload is a response.");
+            }
+            // get the payload message
+            outMessage = result.getOutMessage();
+            if (outMessage == null) {
+                Endpoint ep = exchange.get(Endpoint.class);                    
+                outMessage = ep.getBinding().createMessage();
+                exchange.setOutMessage(outMessage);
+            }
+        }
+        
+        return outMessage;
+    }
+    
+    @SuppressWarnings("unchecked")
+    public void updateContext(Map<String, Object> from, Map<String, Object> to) {
+        if (to != null && from != null) {
+            for (Iterator iter = from.entrySet().iterator(); iter.hasNext();) {
+                Map.Entry entry = (Map.Entry) iter.next();
+                String key = (String)entry.getKey();
 
+                //Requires deep copy.
+                if (!(Message.INBOUND_MESSAGE.equals(key)
+                      || Message.REQUESTOR_ROLE.equals(key)
+                      || Message.PROTOCOL_HEADERS.equals(key))) {
+                    to.put(key, entry.getValue());
+                }
+            }
+        }
+    }
+
+    /**
+     * This method is called when the incoming pojo invocation is called
+     * from the service invocation interceptor. The return value is the response
+     * from the processor
+     * @param inMessage
+     * @return outMessage
+     */
     public Object invoke(Exchange exchange, Object o) {
         BindingOperationInfo bop = exchange.get(BindingOperationInfo.class);
         MethodDispatcher md = (MethodDispatcher) 
@@ -48,15 +149,10 @@
             params = new MessageContentsList(o);
         }
         
-        final List<Object> messageBody = new ArrayList<Object>(params.size()+1);
-        messageBody.add(m.getName());
-        for (Object obj: params) {
-            messageBody.add(obj);
-        }  
-        
         CxfEndpoint endpoint = (CxfEndpoint) cxfConsumer.getEndpoint();
         CxfExchange cxfExchange = endpoint.createExchange(exchange.getInMessage());
-        cxfExchange.getIn().setBody(messageBody);
+        cxfExchange.getIn().setHeader(CxfConstants.OPERATION_NAME, m.getName());
+        cxfExchange.getIn().setBody(params);
         
         
         try {
@@ -65,8 +161,9 @@
             // catch the exception and send back to cxf client
             e.printStackTrace();
         }
-        System.out.println(cxfExchange.getOut().getBody());
+        //System.out.println(cxfExchange.getOut().getBody());
         //TODO deal with the paraments that contains holders
+        //TODO deal with the fault message
         Object[] result = (Object[])cxfExchange.getOut().getBody();
         return result;
         

Modified: activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfBinding.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfBinding.java?rev=576522&r1=576521&r2=576522&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfBinding.java (original)
+++ activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfBinding.java Mon Sep 17 10:00:08 2007
@@ -36,17 +36,19 @@
 
     protected Object getBody(Message message) {
         Set<Class<?>> contentFormats = message.getContentFormats();
-        for (Class<?> contentFormat : contentFormats) {            
-            Object answer = message.getContent(contentFormat);
-            if (answer != null) {
-                return answer;
+        if (contentFormats != null) {
+            for (Class<?> contentFormat : contentFormats) {            
+                Object answer = message.getContent(contentFormat);
+                if (answer != null) {
+                    return answer;
+                }
             }
-        }
+        }    
         return null;
     }
 
-    public MessageImpl createCxfMessage(CxfExchange exchange) {
-        MessageImpl answer = (MessageImpl) exchange.getInMessage();
+    public Message createCxfMessage(CxfExchange exchange) {
+        Message answer = exchange.getInMessage();
 
         // CXF uses the stax which is based on the stream API to parser the XML, so
         // the CXF transport is also based on the stream API.
@@ -60,15 +62,19 @@
         }
         if (body instanceof InputStream) {
         	answer.setContent(InputStream.class, body);
+                // we need copy context 
         } else if (body instanceof List) {
         	//just set the operation's parament
         	answer.setContent(List.class, body);
+                //just set the method name
+                answer.setContent(String.class, in.getHeader(CxfConstants.OPERATION_NAME));
         }
         
         
         return answer;
     }
-
+    
+   
     public void storeCxfResponse(CxfExchange exchange, Message response) {
         // no need to process headers as we use the CXF message
         CxfMessage out = exchange.getOut();

Modified: activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfComponent.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfComponent.java?rev=576522&r1=576521&r2=576522&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfComponent.java (original)
+++ activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfComponent.java Mon Sep 17 10:00:08 2007
@@ -43,6 +43,7 @@
         // now we need to add the address, endpoint name, wsdl url or the SEI to build up a endpoint
         CxfEndpoint result = new CxfEndpoint(uri, remaining, this);        
         setProperties(result, parameters);
+        // we can check the endpoint integration here
         return result;
     }
 

Modified: activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfConstants.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfConstants.java?rev=576522&r1=576521&r2=576522&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfConstants.java (original)
+++ activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfConstants.java Mon Sep 17 10:00:08 2007
@@ -29,6 +29,8 @@
     String ADDRESS = "address";
     String SERVICE_NAME = "serviceName";
     String PORT_NAME = "portName";
+    String PROTOCOL_NAME_RES = "res";
+    String OPERATION_NAME = "operationName";
     // service name -- come from the wsdl   
 }
 

Modified: activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfConsumer.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfConsumer.java?rev=576522&r1=576521&r2=576522&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfConsumer.java (original)
+++ activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfConsumer.java Mon Sep 17 10:00:08 2007
@@ -16,9 +16,17 @@
  */
 package org.apache.camel.component.cxf;
 
+import java.net.URI;
+
 import org.apache.camel.Processor;
+import org.apache.camel.component.cxf.util.CxfEndpointUtils;
+import org.apache.camel.component.cxf.util.UriUtils;
 import org.apache.camel.impl.DefaultConsumer;
+import org.apache.cxf.Bus;
+import org.apache.cxf.BusFactory;
+import org.apache.cxf.common.classloader.ClassLoaderUtils;
 import org.apache.cxf.endpoint.Server;
+import org.apache.cxf.endpoint.ServerImpl;
 import org.apache.cxf.frontend.ServerFactoryBean;
 import org.apache.cxf.message.Message;
 import org.apache.cxf.transport.Destination;
@@ -33,25 +41,39 @@
 public class CxfConsumer extends DefaultConsumer<CxfExchange> {
     private CxfEndpoint endpoint;    
     private Server server;
-    private Destination destination;
+    
 
-    public CxfConsumer(CxfEndpoint endpoint, Processor processor) throws ClassNotFoundException {
+    public CxfConsumer(CxfEndpoint endpoint, Processor processor) throws Exception {
        
-        super(endpoint, processor);
-        System.out.println(processor.toString());
+        super(endpoint, processor);        
         this.endpoint = endpoint;
-        //we setup the interceptors by the endpoint configuration
-        //create server here, now we just use the simple front-end        
-        ServerFactoryBean svrBean = new ServerFactoryBean();
-        Class serviceClass = Class.forName(endpoint.getServiceClass());        
-        svrBean.setAddress(endpoint.getAddress());
-        svrBean.setServiceClass(serviceClass);
-        if (endpoint.isInvoker()) {
-            System.out.println("setup the invoker ");
-            svrBean.setInvoker(new CamelInvoker(this));
-        }    
-        svrBean.setStart(false);
-        server = svrBean.create();
+        try {
+            // now we just use the default bus here   
+            Bus bus = BusFactory.getDefaultBus();
+            Class serviceClass = ClassLoaderUtils.loadClass(endpoint.getServiceClass(), this.getClass()); 
+            ServerFactoryBean svrBean = CxfEndpointUtils.getServerFactoryBean(serviceClass);                           
+            svrBean.setAddress(endpoint.getAddress());
+            svrBean.setServiceClass(serviceClass);
+            if (endpoint.getWsdlURL() != null) {                
+                svrBean.setWsdlURL(endpoint.getWsdlURL());
+            }
+            DataFormat dataFormat = CxfEndpointUtils.getDataFormat(endpoint);
+            if (dataFormat.equals(DataFormat.POJO)) {
+                svrBean.setInvoker(new CamelInvoker(this));
+            }
+            svrBean.setBus(bus);
+            svrBean.setStart(false);
+            server = svrBean.create();            
+            if (!dataFormat.equals(DataFormat.POJO)) {
+                CxfMessageObserver observer = new CxfMessageObserver(this, server.getEndpoint(), bus , dataFormat);
+                //set the message observer for the Message and PayLoad mode message 
+                ServerImpl serverImpl = (ServerImpl)server;
+                serverImpl.setMessageObserver(observer);
+            } 
+            
+        } catch (Exception ex) {
+            
+        }
     }
 
     @Override
@@ -65,6 +87,10 @@
     protected void doStop() throws Exception {
         server.stop();
         super.doStop();
+    }
+    
+    public CxfEndpoint getEndpoint() {
+        return endpoint;
     }
 
     

Modified: activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfEndpoint.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfEndpoint.java?rev=576522&r1=576521&r2=576522&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfEndpoint.java (original)
+++ activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfEndpoint.java Mon Sep 17 10:00:08 2007
@@ -37,10 +37,11 @@
     private String wsdlURL;
     private String serviceClass;
     private CxfBinding binding;
-    private QName portName;
-    private QName serviceName;
+    private String portName;
+    private String serviceName;
+    private String dataFormat;
     private boolean inOut = true;
-    private boolean invoker = true;
+    
 
     public CxfEndpoint(String uri, String address, CxfComponent component) {
         super(uri, component);
@@ -67,15 +68,16 @@
     public CxfExchange createExchange(Message inMessage) {
         return new CxfExchange(getContext(), getExchangePattern(), getBinding(), inMessage);
     }
-    
-    public boolean isInvoker() {
-        return invoker;
+           
+    public String getDataFormat() {
+        return dataFormat;
     }
     
-    public void setInvoker(boolean invoker) {
-        this.invoker = invoker;
+    public void setDataFormat(String format) {
+        dataFormat = format;
     }
     
+        
     public String getAddress() {
     	return address;
     }
@@ -96,19 +98,19 @@
         serviceClass = className;
     }
     
-    public void setPortName(QName port) {
+    public void setPortName(String port) {
         portName = port;
     }
     
-    public void setServiceName(QName service) {
+    public void setServiceName(String service) {
         serviceName = service;
     }
     
-    public QName getPortName(){
+    public String getPortName(){
         return portName;
     }
     
-    public QName getServiceName() {
+    public String getServiceName() {
         return serviceName;
     }
 

Modified: activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfExchange.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfExchange.java?rev=576522&r1=576521&r2=576522&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfExchange.java (original)
+++ activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfExchange.java Mon Sep 17 10:00:08 2007
@@ -19,6 +19,7 @@
 import org.apache.camel.CamelContext;
 import org.apache.camel.ExchangePattern;
 import org.apache.camel.impl.DefaultExchange;
+import org.apache.camel.impl.DefaultMessage;
 import org.apache.cxf.message.Exchange;
 import org.apache.cxf.message.Message;
 import org.apache.cxf.transport.Conduit;
@@ -42,7 +43,9 @@
 
         setIn(new CxfMessage(exchange.getInMessage()));
         setOut(new CxfMessage(exchange.getOutMessage()));
-        setFault(new CxfMessage(exchange.getInFaultMessage()));
+        if (exchange.getInFaultMessage() != null) {
+            setFault(new CxfMessage(exchange.getInFaultMessage()));
+        }    
     }
 
     public CxfExchange(CamelContext context, ExchangePattern pattern, CxfBinding binding) {
@@ -57,7 +60,9 @@
         setIn(new CxfMessage(inMessage));
         if (exchange != null) {
             setOut(new CxfMessage(exchange.getOutMessage()));
-            setFault(new CxfMessage(exchange.getInFaultMessage()));
+            if (exchange.getInFaultMessage() != null) {
+                setFault(new CxfMessage(exchange.getInFaultMessage()));
+            }    
         }
     }
 
@@ -80,6 +85,12 @@
     public CxfMessage getFault() {
         return (CxfMessage) super.getFault();
     }
+    
+    @Override
+    protected org.apache.camel.Message createFaultMessage() {
+        return new CxfMessage();
+    }
+
 
     /**
      * @return the Camel <-> JBI binding

Modified: activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfMessage.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfMessage.java?rev=576522&r1=576521&r2=576522&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfMessage.java (original)
+++ activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfMessage.java Mon Sep 17 10:00:08 2007
@@ -36,6 +36,9 @@
     }
 
     public CxfMessage(Message cxfMessage) {
+        if (cxfMessage == null) {
+            this.cxfMessage = new MessageImpl();
+        }
         this.cxfMessage = cxfMessage;
     }
 

Added: activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfMessageObserver.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfMessageObserver.java?rev=576522&view=auto
==============================================================================
--- activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfMessageObserver.java (added)
+++ activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfMessageObserver.java Mon Sep 17 10:00:08 2007
@@ -0,0 +1,85 @@
+/**
+ * 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.camel.component.cxf;
+
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import org.apache.camel.component.cxf.invoker.InvokingContext;
+import org.apache.camel.component.cxf.invoker.InvokingContextFactory;
+
+import org.apache.cxf.Bus;
+import org.apache.cxf.endpoint.Endpoint;
+import org.apache.cxf.endpoint.EndpointImpl;
+import org.apache.cxf.message.Exchange;
+import org.apache.cxf.message.ExchangeImpl;
+import org.apache.cxf.message.Message;
+import org.apache.cxf.phase.PhaseInterceptorChain;
+import org.apache.cxf.transport.ChainInitiationObserver;
+
+public class CxfMessageObserver extends ChainInitiationObserver {
+    private static final Logger LOG = Logger.getLogger(ChainInitiationObserver.class.getName());
+    private CxfConsumer cxfConsumer;
+    private DataFormat dataFormat;
+    private CamelInvoker invoker;
+    
+    
+    public CxfMessageObserver(CxfConsumer consumer, Endpoint endpoint, Bus bus,
+            DataFormat dataFormat) {
+        super(endpoint, bus);
+        cxfConsumer = consumer;
+        this.dataFormat = dataFormat;
+        invoker = new CamelInvoker(consumer);
+    }
+
+    protected void setExchangeProperties(Exchange exchange, Message m) {
+        super.setExchangeProperties(exchange, m);        
+        exchange.put(CxfConsumer.class, cxfConsumer);
+        exchange.put(Bus.class, bus);
+        exchange.put(Endpoint.class, endpoint);
+        exchange.put(InvokingContext.class, InvokingContextFactory.createContext(dataFormat));
+        exchange.put(CamelInvoker.class, invoker);
+    }
+    
+    public void onMessage(Message m) {
+        if (LOG.isLoggable(Level.FINER)) {
+            LOG.fine("Observed Client request at router's endpoint.  Request message: " + m);
+        }
+        Message message = endpoint.getBinding().createMessage(m);
+        message.put(Message.INBOUND_MESSAGE, Boolean.TRUE);
+        Exchange exchange = message.getExchange();
+        if (exchange == null) {
+            exchange = new ExchangeImpl();
+            exchange.setInMessage(message);
+        }
+        setExchangeProperties(exchange, message);
+        
+        InvokingContext invokingContext = exchange.get(InvokingContext.class);
+        assert invokingContext != null;
+        invokingContext.setEndpointFaultObservers((EndpointImpl)endpoint, bus);
+        
+        if (LOG.isLoggable(Level.FINEST)) {
+            LOG.finest("Build inbound interceptor chain and inject routing interceptor");
+        }
+        // now we just support the raw message and the payload message
+        PhaseInterceptorChain chain = invokingContext.getRequestInInterceptorChain(exchange);
+
+        message.setInterceptorChain(chain);
+        chain.setFaultObserver(endpoint.getOutFaultObserver());
+        chain.doIntercept(message);        
+    }
+}

Propchange: activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfMessageObserver.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfMessageObserver.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

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=576522&r1=576521&r2=576522&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 Mon Sep 17 10:00:08 2007
@@ -18,18 +18,30 @@
 
 import java.util.List;
 
+import org.apache.camel.CamelException;
 import org.apache.camel.Exchange;
 import org.apache.camel.RuntimeCamelException;
+import org.apache.camel.component.cxf.invoker.CxfClient;
+import org.apache.camel.component.cxf.invoker.CxfClientFactoryBean;
+import org.apache.camel.component.cxf.invoker.InvokingContext;
+import org.apache.camel.component.cxf.util.CxfEndpointUtils;
 import org.apache.camel.impl.DefaultProducer;
 import org.apache.camel.util.ObjectHelper;
 import org.apache.cxf.Bus;
 import org.apache.cxf.BusFactory;
+import org.apache.cxf.binding.Binding;
+import org.apache.cxf.binding.BindingFactory;
+import org.apache.cxf.binding.BindingFactoryManager;
+import org.apache.cxf.common.classloader.ClassLoaderUtils;
 import org.apache.cxf.endpoint.Client;
+import org.apache.cxf.endpoint.Endpoint;
 import org.apache.cxf.frontend.ClientFactoryBean;
 import org.apache.cxf.message.Message;
 import org.apache.cxf.message.MessageImpl;
+import org.apache.cxf.service.model.BindingOperationInfo;
 import org.apache.cxf.transport.Conduit;
 
+import java.io.InputStream;
 import java.net.MalformedURLException;
 
 /**
@@ -37,32 +49,65 @@
  * 
  * @version $Revision$
  */
-public class CxfProducer extends DefaultProducer {
+public class CxfProducer extends DefaultProducer <CxfExchange> {
     private CxfEndpoint endpoint;
-    private Client client;    
-    private Conduit conduit;
+    private Client client;
+    private DataFormat dataFormat;
+    
     
 
-    public CxfProducer(CxfEndpoint endpoint) throws MalformedURLException {
+    public CxfProducer(CxfEndpoint endpoint) throws CamelException {
         super(endpoint);
         this.endpoint = endpoint;
-        client = createClient();
+        dataFormat = CxfEndpointUtils.getDataFormat(endpoint);
+        
+        if (dataFormat.equals(DataFormat.POJO)) {
+            client = createClientFormClientFactoryBean(null);
+        } else {
+            // create CxfClient for message
+            client = createClientForStreamMessge();           
+        }
     }
     
-    private Client createClient() throws MalformedURLException {
+    private Client createClientForStreamMessge() throws CamelException {
+        ClientFactoryBean cfb = new CxfClientFactoryBean();
+        return createClientFormClientFactoryBean(cfb);
+    }
+   
+    //If cfb is null ,we will try to find a right cfb to use.    
+    private Client createClientFormClientFactoryBean(ClientFactoryBean cfb) throws CamelException {
+        //TODO we can get also the client from spring context       
         Bus bus = BusFactory.getDefaultBus();
-        // setup the ClientFactoryBean with endpoint
-        ClientFactoryBean cfb = new ClientFactoryBean();
-        cfb.setBus(bus);
-        cfb.setAddress(endpoint.getAddress());
-        if (null != endpoint.getServiceClass()) {            
-            cfb.setServiceClass(ObjectHelper.loadClass(endpoint.getServiceClass()));
+        // setup the ClientFactoryBean with endpoint, 
+        // we need to choice the right front end to create the clientFactoryBean
+        
+        if (null != endpoint.getServiceClass()) {
+            try {
+                Class serviceClass = ClassLoaderUtils.loadClass(endpoint.getServiceClass(), this.getClass());
+                if (cfb == null) {
+                    cfb = CxfEndpointUtils.getClientFactoryBean(serviceClass);
+                }                            
+                cfb.setAddress(endpoint.getAddress());
+                if (null != endpoint.getServiceClass()) {            
+                    cfb.setServiceClass(ObjectHelper.loadClass(endpoint.getServiceClass()));
+                } 
+                if (null != endpoint.getWsdlURL()) {
+                    cfb.setWsdlURL(endpoint.getWsdlURL());
+                }
+            } catch (Exception ex) {
+                // rethrow the exception out
+            }
+        } else { 
+            if (cfb == null) {
+                cfb = new ClientFactoryBean();
+            }    
+            if (null != endpoint.getWsdlURL()) {
+                cfb.setWsdlURL(endpoint.getWsdlURL());
+            } else {
+                // throw the exception for insufficiency of the endpoint info
+            }
         }
-        if (null != endpoint.getWsdlURL()) {
-            cfb.setWsdlURL(endpoint.getWsdlURL());
-        }       
-        // there may other setting work
-        // create client 
+        cfb.setBus(bus);        
         return cfb.create();
     }
    
@@ -72,38 +117,60 @@
     }
 
     public void process(CxfExchange exchange) {
+        CxfBinding cxfBinding = endpoint.getBinding();
+        Message inMessage = cxfBinding.createCxfMessage(exchange);
         try {
-            CxfBinding binding = endpoint.getBinding();
-            MessageImpl m = binding.createCxfMessage(exchange);
-            //InputStream is = m.getContent(InputStream.class);
-            // now we just deal with the POJO invocations 
-            List paraments = m.getContent(List.class);
-            Message response = new MessageImpl();            
-            if (paraments != null) {
-            	String operation = (String)paraments.get(0);
-            	Object[] args = new Object[paraments.size()-1];
-            	for(int i = 0 ; i < paraments.size()-1 ; i++) {            		
-            		args[i] = paraments.get(i+1);
-            	}
-            	// now we just deal with the invoking the paraments
-            	Object[] result = client.invoke(operation, args);                
-            	response.setContent(Object[].class, result);
-                binding.storeCxfResponse(exchange, response);
-            }          	
-            
+            if (dataFormat.equals(DataFormat.POJO)) {
+                //InputStream is = m.getContent(InputStream.class);
+                // now we just deal with the POJO invocations 
+                List paraments = inMessage.getContent(List.class);
+                String operation = inMessage.getContent(String.class);
+                Message response = new MessageImpl();            
+                if (operation != null && paraments != null) {                
+                  	// now we just deal with the invoking the paraments
+                  	Object[] result = client.invoke(operation, paraments.toArray());                
+                   	response.setContent(Object[].class, result);
+                    cxfBinding.storeCxfResponse(exchange, response);
+                }  
+            } else {
+                // get the invocation context
+                org.apache.cxf.message.Exchange ex = exchange.getExchange();
+                InvokingContext invokingContext = ex.get(InvokingContext.class);
+                Object params = invokingContext.getRequestContent(inMessage);
+                // invoke the stream message with the exchange context
+                CxfClient cxfClient = (CxfClient) client;
+                // invoke the message
+                //TODO need setup the call context here
+                //TODO need to handle the one way message
+                Object result = cxfClient.dispatch(params, null, ex);
+                System.out.println("the result object is " + result);
+                // need to get the binding object to create the message
+                BindingOperationInfo boi = ex.get(BindingOperationInfo.class);
+                Message response = null;
+                System.out.println("the boi is " + boi);
+                if (boi == null) {
+                    // it should be the raw message                    
+                    response = new MessageImpl(); 
+                } else {
+                    // create the message here
+                    Endpoint ep = ex.get(Endpoint.class);                    
+                    response = ep.getBinding().createMessage();
+                }                
+                response.setExchange(ex);
+                ex.setOutMessage(response);                
+                invokingContext.setResponseContent(response, result);
+                cxfBinding.storeCxfResponse(exchange, response);
+            }
         } catch (Exception e) {
+            //TODO add the falut message handling work
             throw new RuntimeCamelException(e);
-        }   
+        }     
                 
     }
 
     @Override
     protected void doStart() throws Exception {
-        super.doStart();
-                
-        client = createClient();
-        conduit = client.getConduit();
-        
+        super.doStart(); 
     }
 
     @Override

Added: activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/DataFormat.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/DataFormat.java?rev=576522&view=auto
==============================================================================
--- activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/DataFormat.java (added)
+++ activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/DataFormat.java Mon Sep 17 10:00:08 2007
@@ -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.camel.component.cxf;
+
+/**
+ * The data format the user expoects to see at the camel cxf components.  It can be
+ * configured as a property (DataFormat) in the Camel cxf endpoint.
+ */
+public enum DataFormat {
+
+    /**
+     * PAYLOAD is the message payload of the message after message configured in
+     * the CXF endpoint is applied.  Streaming and non-streaming are both
+     * supported.
+     */
+    PAYLOAD,
+
+    /**
+     * MESSAGE is the raw message that is received from the transport layer.
+     * Streaming and non-streaming are both supported.
+     */
+    MESSAGE,
+
+    /**
+     * POJOs (Plain old Java objects) are the Java parameters to the method
+     * it is invoking on the target server.  The "serviceClass" property
+     * must be included in the endpoint.  Streaming is not available for this
+     * data format.
+     */
+    POJO
+}

Propchange: activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/DataFormat.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/DataFormat.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/AbstractInvokerInterceptor.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/AbstractInvokerInterceptor.java?rev=576522&view=auto
==============================================================================
--- activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/AbstractInvokerInterceptor.java (added)
+++ activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/AbstractInvokerInterceptor.java Mon Sep 17 10:00:08 2007
@@ -0,0 +1,123 @@
+/**
+ * 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.camel.component.cxf.interceptors;
+
+import java.io.IOException;
+import java.util.logging.Logger;
+
+import org.apache.camel.component.cxf.CamelInvoker;
+import org.apache.camel.component.cxf.invoker.InvokingContext;
+import org.apache.cxf.endpoint.ConduitSelector;
+import org.apache.cxf.endpoint.PreexistingConduitSelector;
+import org.apache.cxf.interceptor.Fault;
+import org.apache.cxf.interceptor.InterceptorChain;
+import org.apache.cxf.message.Exchange;
+import org.apache.cxf.message.Message;
+import org.apache.cxf.phase.AbstractPhaseInterceptor;
+import org.apache.cxf.service.model.BindingMessageInfo;
+import org.apache.cxf.service.model.BindingOperationInfo;
+import org.apache.cxf.transport.Conduit;
+import org.apache.cxf.ws.addressing.EndpointReferenceType;
+
+/**
+ * This is the base class for routing interceptors that can intercept and forward
+ * message to router as different phases.
+ *
+ */
+public abstract class AbstractInvokerInterceptor extends AbstractPhaseInterceptor<Message> {
+    public static final String ROUTING_INERCEPTOR_PHASE = "Routing-Phase";
+    public static final String BUNDLE = "wsdl-cxf"; 
+    public AbstractInvokerInterceptor(String phase) {
+        super(phase);
+    }
+    
+    private boolean isRequestor(Message message) {
+        return Boolean.TRUE.equals(message.get(Message.REQUESTOR_ROLE));
+    }
+    
+    /**
+     * Send the intercepted message to router
+     */
+    @SuppressWarnings("unchecked")
+    public void handleMessage(Message inMessage) throws Fault {
+        if (isRequestor(inMessage)) {
+            return;
+        }
+
+        Exchange exchange = inMessage.getExchange();
+        Message outMessage = null;
+        try {
+            CamelInvoker invoker = exchange.get(CamelInvoker.class);
+            outMessage = invoker.invoke(inMessage);
+        } catch (Exception e) {
+            throw new Fault(e);
+        }
+
+        // set back channel conduit in the exchange if it is not present
+        setBackChannelConduit(exchange, outMessage);
+        
+        Exception ex = outMessage.getContent(Exception.class);
+        if (ex != null) {
+            if (!(ex instanceof Fault)) {
+                ex = new Fault(ex); 
+            }
+            throw (Fault)ex;
+        }
+
+        outMessage.put(Message.INBOUND_MESSAGE, Boolean.FALSE);
+        BindingOperationInfo boi = exchange.get(BindingOperationInfo.class);
+        if (boi != null) {
+            exchange.put(BindingMessageInfo.class, boi.getOutput());
+        }
+
+        InvokingContext invokingContext = exchange.get(InvokingContext.class);
+        assert invokingContext != null;
+        
+        InterceptorChain chain = invokingContext.getResponseOutInterceptorChain(exchange);
+        if (chain != null) {
+            outMessage.setInterceptorChain(chain);
+            
+            //Initiate the OutBound Chain.
+            chain.doIntercept(outMessage);
+        }                
+    }
+    
+    /**
+     * Creates a conduit if not present on the exchange. outMessage or faultMessage
+     * It will create a back channel in PAYLOAD and MESSAGE case.
+     * POJO case will have a coduit due to OutgoingChainInterceptor in PRE_INVOKE Phase
+     */
+
+    protected void setBackChannelConduit(Exchange ex, Message message) throws Fault {
+        Conduit conduit = ex.getConduit(message);
+        if (conduit == null) {
+            try {
+                EndpointReferenceType target =
+                    ex.get(EndpointReferenceType.class);
+                conduit = ex.getDestination().getBackChannel(ex.getInMessage(), null, target);
+                ex.put(ConduitSelector.class,
+                       new PreexistingConduitSelector(conduit));
+            } catch (IOException e) {
+                throw new Fault(e);
+            }
+        }
+        
+        assert conduit != null;
+    }
+    
+    protected abstract Logger getLogger();
+}

Propchange: activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/AbstractInvokerInterceptor.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/AbstractInvokerInterceptor.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/AbstractMessageInInterceptor.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/AbstractMessageInInterceptor.java?rev=576522&view=auto
==============================================================================
--- activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/AbstractMessageInInterceptor.java (added)
+++ activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/AbstractMessageInInterceptor.java Mon Sep 17 10:00:08 2007
@@ -0,0 +1,185 @@
+/**
+ * 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.camel.component.cxf.interceptors;
+
+import java.util.List;
+import java.util.ResourceBundle;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+import org.apache.cxf.common.i18n.BundleUtils;
+import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.endpoint.Endpoint;
+import org.apache.cxf.interceptor.Fault;
+import org.apache.cxf.message.Exchange;
+import org.apache.cxf.message.Message;
+import org.apache.cxf.phase.AbstractPhaseInterceptor;
+import org.apache.cxf.service.model.BindingInfo;
+import org.apache.cxf.service.model.BindingMessageInfo;
+import org.apache.cxf.service.model.BindingOperationInfo;
+import org.apache.cxf.service.model.OperationInfo;
+import org.apache.cxf.staxutils.StaxUtils;
+
+/**
+ * This is the base class for message interceptors that intercepts message as DOM content
+ * infers the BindingOperationInfo and then set the
+ *
+ */
+public abstract class AbstractMessageInInterceptor<T extends Message> 
+       extends AbstractPhaseInterceptor<T> {
+    private static final Logger LOG = LogUtils.getL7dLogger(AbstractMessageInInterceptor.class);
+
+    public AbstractMessageInInterceptor(String phase) {
+        super(phase);
+    }
+
+    protected boolean isRequestor(Message message) {
+        return Boolean.TRUE.equals(message.get(Message.REQUESTOR_ROLE));
+    }
+
+   
+
+    /**
+     * Infer the OperationInfo from the XML Document and get the list of 
+     * parts as DOM Element
+     */
+    public void handleMessage(T message) throws Fault {
+        Logger logger = getLogger();
+        
+        if (isFaultMessage(message)) {
+            message.getInterceptorChain().abort();
+            Endpoint ep = message.getExchange().get(Endpoint.class);
+            if (ep.getInFaultObserver() != null) {
+                ep.getInFaultObserver().onMessage(message);
+                return;
+            }
+            //Fault f = createFault(message, payloadEl);
+            //message.setContent(Exception.class, f);
+            //return;
+        }
+
+        Document document = createDOMMessage(message);
+        //Document document = message.getContent(Document.class);
+        Element payloadEl = (Element)document.getChildNodes().item(0);
+        
+        Exchange ex = message.getExchange();
+        BindingOperationInfo boi = ex.get(BindingOperationInfo.class);
+        if (boi == null) {
+            BindingInfo bi = ex.get(BindingInfo.class);
+            if (bi == null) {
+                Endpoint ep = ex.get(Endpoint.class);
+                bi = ep.getEndpointInfo().getBinding();
+                ex.put(BindingInfo.class, bi);
+            }
+            // handling inbound message
+            if (logger.isLoggable(Level.INFO)) {
+                logger.info("AbstractRoutingMessageInInterceptor Infer BindingOperationInfo.");
+            }
+            
+            boi = getBindingOperation(message, document);
+
+            if (boi == null) {
+                QName startQName = new QName(payloadEl.getNamespaceURI(), payloadEl.getLocalName());
+                System.out.println("StartQName " + startQName);
+                throw new Fault(new org.apache.cxf.common.i18n.Message(
+                                "REQ_NOT_UNDERSTOOD", LOG, startQName));
+            }
+            
+            if (boi != null) {
+                ex.put(BindingOperationInfo.class, boi);
+                ex.put(OperationInfo.class, boi.getOperationInfo());
+                ex.setOneWay(boi.getOperationInfo().isOneWay());
+                if (logger.isLoggable(Level.INFO)) {
+                    logger.info("DOMInInterceptor- BindingOperation is:" + boi.getName());
+                }                
+            }
+        }
+
+        BindingMessageInfo bmi = isRequestor(message) ?  boi.getOutput() : boi.getInput();
+        List<Element> partList = getPartList(message, payloadEl, bmi);        
+        message.put(List.class, partList);
+        
+        Element header = getHeader(message);
+        message.put(Element.class, header);
+    }
+
+    /**
+     * This method is called to convert a incoming message format e.g Stax Stream
+     * to a DOM Tree. Default Implementation converts Stax Stream to a DOM
+     * @param inMessage
+     * @param Document
+     */
+    protected Document createDOMMessage(T message) {
+        Document doc = null;
+        try {
+            if (getLogger().isLoggable(Level.INFO)) {
+                getLogger().info("AbstractMessageInInterceptor Converting Stax Stream to DOM");
+            }
+            XMLStreamReader xsr = message.getContent(XMLStreamReader.class);            
+            doc = StaxUtils.read(xsr);
+        } catch (XMLStreamException xe) {
+            throw new Fault(new org.apache.cxf.common.i18n.Message("STAX_READ_EXC", LOG), xe);
+        }
+        return doc;
+    }
+    
+    protected abstract Logger getLogger();
+
+    /**
+     * This method is called on incoming to check if it is a fault.
+     * @param inMessage
+     * @param boolean
+     */
+    protected abstract boolean isFaultMessage(T message);
+
+    /**
+     * This method is called when the routing message interceptor has received a inbound message
+     * It infers the binding operation by matching the root Element with a binding operation
+     * from the service model.
+     * @param inMessage
+     * @param resultPayload
+     */
+    protected abstract BindingOperationInfo getBindingOperation(T inMessage, Document document);
+
+    /**
+     * This method is called when the routing message interceptor has intercepted a inbound
+     * message as a DOM Content.  It retreives the message parts as DOM Element
+     * and returns a List<Element>
+     * @param inMessage
+     * @param rootElement
+     * @param bindingMessageInfo
+     * @return List<Element>
+     */
+    protected abstract List<Element> getPartList(T inMessage, Element rootElement, BindingMessageInfo boi);
+
+    /**
+     * This method is called when the routing message interceptor has intercepted a inbound
+     * message as a DOM Content.  It retreives the header parts as DOM Element
+     * and returns a Element.
+     * @param inMessage
+     * @return Element
+     */
+    protected abstract Element getHeader(T inMessage);
+
+}

Propchange: activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/AbstractMessageInInterceptor.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/AbstractMessageInInterceptor.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/AbstractMessageOutInterceptor.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/AbstractMessageOutInterceptor.java?rev=576522&view=auto
==============================================================================
--- activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/AbstractMessageOutInterceptor.java (added)
+++ activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/AbstractMessageOutInterceptor.java Mon Sep 17 10:00:08 2007
@@ -0,0 +1,82 @@
+/**
+ * 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.camel.component.cxf.interceptors;
+
+import java.util.List;
+//import java.util.ResourceBundle;
+//import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.xml.namespace.QName;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+//import org.apache.cxf.common.i18n.BundleUtils;
+import org.apache.cxf.helpers.DOMUtils;
+import org.apache.cxf.message.Message;
+import org.apache.cxf.phase.AbstractPhaseInterceptor;
+
+/**
+ * This is the base class for message interceptors that intercepts
+ * binding specific headers and message parts as DOM Element.
+ * Then moves dom elements between header and message part list based on the
+ * binding operation info provided in the exchange.
+ */
+public abstract class AbstractMessageOutInterceptor<T extends Message>
+       extends AbstractPhaseInterceptor<T> {
+    
+    
+    public AbstractMessageOutInterceptor(String phase) {
+        super(phase);
+    }
+    protected boolean isRequestor(Message message) {
+        return Boolean.TRUE.equals(message.get(Message.REQUESTOR_ROLE));
+    }
+
+    protected abstract Logger getLogger();
+    
+    protected Element createElement(QName elName, List<Element> childEl) {
+        Document doc = DOMUtils.createDocument();
+
+        String prefix = elName.getPrefix();
+        StringBuilder tagName = new StringBuilder();
+        if (!"".equals(prefix)) {
+            tagName.append(prefix);
+            tagName.append(":");
+        }
+        tagName.append(elName.getLocalPart());
+        
+        Element el = doc.createElementNS(elName.getNamespaceURI(),
+                                         tagName.toString());
+
+        if (!"".equals(elName.getPrefix())) {
+            StringBuilder attrName = new StringBuilder("xmlns");        
+            attrName.append(':');
+            attrName.append(elName.getPrefix());
+            el.setAttribute(attrName.toString(), elName.getNamespaceURI());
+        }
+
+        for (Element part : childEl) {
+            Node adoptedNode = doc.adoptNode(part);
+            el.appendChild(adoptedNode);
+        }
+
+        return el;
+    }    
+}

Propchange: activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/AbstractMessageOutInterceptor.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/AbstractMessageOutInterceptor.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/DOMInInterceptor.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/DOMInInterceptor.java?rev=576522&view=auto
==============================================================================
--- activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/DOMInInterceptor.java (added)
+++ activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/DOMInInterceptor.java Mon Sep 17 10:00:08 2007
@@ -0,0 +1,56 @@
+/**
+ * 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.camel.component.cxf.interceptors;
+
+import java.util.ResourceBundle;
+import java.util.logging.Logger;
+
+import org.apache.cxf.binding.soap.SoapMessage;
+import org.apache.cxf.binding.soap.interceptor.SoapActionInInterceptor;
+import org.apache.cxf.common.i18n.BundleUtils;
+import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.interceptor.Fault;
+import org.apache.cxf.message.Message;
+import org.apache.cxf.message.XMLMessage;
+import org.apache.cxf.phase.AbstractPhaseInterceptor;
+import org.apache.cxf.phase.Phase;
+
+public class DOMInInterceptor extends AbstractPhaseInterceptor<Message> {
+    private static final Logger LOG = LogUtils.getL7dLogger(DOMOutInterceptor.class);
+    private final XMLMessageInInterceptor xmlInterceptor = new XMLMessageInInterceptor();
+    private final SoapMessageInInterceptor soapInterceptor = new SoapMessageInInterceptor();
+    public DOMInInterceptor() {
+        super(Phase.READ);
+        this.addAfter(SoapActionInInterceptor.class.getName());
+        this.addBefore(PayloadInInterceptor.class.getName());
+    }
+
+    public boolean isRequestor(Message message) {
+        return Boolean.TRUE.equals(message.get(Message.REQUESTOR_ROLE));
+    }
+    
+    public void handleMessage(Message message) throws Fault {
+        if (message instanceof XMLMessage) {
+            xmlInterceptor.handleMessage((XMLMessage)message);
+        } else if (message instanceof SoapMessage) {
+            soapInterceptor.handleMessage((SoapMessage)message);
+        } else {
+            throw new Fault(new org.apache.cxf.common.i18n.Message("NOT_SUPPORTED_MESSAGE", 
+                                                                   LOG, message.getClass().getName()));
+        }
+    }
+}

Propchange: activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/DOMInInterceptor.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/DOMInInterceptor.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/DOMOutInterceptor.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/DOMOutInterceptor.java?rev=576522&view=auto
==============================================================================
--- activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/DOMOutInterceptor.java (added)
+++ activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/DOMOutInterceptor.java Mon Sep 17 10:00:08 2007
@@ -0,0 +1,61 @@
+/**
+ * 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.camel.component.cxf.interceptors;
+
+import java.util.ResourceBundle;
+import java.util.logging.Logger;
+//import java.util.logging.Level;
+//import java.util.logging.Logger;
+
+import org.apache.cxf.binding.soap.SoapMessage;
+import org.apache.cxf.common.i18n.BundleUtils;
+import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.interceptor.Fault;
+import org.apache.cxf.interceptor.MessageSenderInterceptor;
+import org.apache.cxf.message.Message;
+import org.apache.cxf.message.XMLMessage;
+import org.apache.cxf.phase.AbstractPhaseInterceptor;
+import org.apache.cxf.phase.Phase;
+
+public class DOMOutInterceptor extends AbstractPhaseInterceptor<Message> {
+    private static final Logger LOG = LogUtils.getL7dLogger(DOMOutInterceptor.class);
+
+
+    private final XMLMessageOutInterceptor xmlInterceptor = new XMLMessageOutInterceptor();
+    private final SoapMessageOutInterceptor soapInterceptor = new SoapMessageOutInterceptor();
+    
+    public DOMOutInterceptor() {
+        super(Phase.PREPARE_SEND);
+        this.addBefore(MessageSenderInterceptor.class.getName());
+    }
+
+    public boolean isRequestor(Message message) {
+        return Boolean.TRUE.equals(message.get(Message.REQUESTOR_ROLE));
+    }
+    
+    @SuppressWarnings("unchecked")
+    public void handleMessage(Message message) throws Fault {
+        if (message instanceof XMLMessage) {
+            xmlInterceptor.handleMessage((XMLMessage)message);
+        } else if (message instanceof SoapMessage) {
+            soapInterceptor.handleMessage((SoapMessage)message);
+        } else {
+            throw new Fault(new org.apache.cxf.common.i18n.Message("NOT_SUPPORTED_MESSAGE", 
+                                                                   LOG, message.getClass().getName()));
+        }        
+    }
+}

Propchange: activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/DOMOutInterceptor.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/DOMOutInterceptor.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/FaultOutInterceptor.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/FaultOutInterceptor.java?rev=576522&view=auto
==============================================================================
--- activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/FaultOutInterceptor.java (added)
+++ activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/FaultOutInterceptor.java Mon Sep 17 10:00:08 2007
@@ -0,0 +1,66 @@
+/**
+ * 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.camel.component.cxf.interceptors;
+
+
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import org.apache.cxf.binding.soap.SoapFault;
+import org.apache.cxf.binding.soap.SoapMessage;
+import org.apache.cxf.binding.xml.XMLFault;
+import org.apache.cxf.common.logging.LogUtils;
+//import org.apache.cxf.common.i18n.BundleUtils;
+import org.apache.cxf.interceptor.Fault;
+import org.apache.cxf.message.Message;
+import org.apache.cxf.message.XMLMessage;
+import org.apache.cxf.phase.AbstractPhaseInterceptor;
+import org.apache.cxf.phase.Phase;
+
+public class FaultOutInterceptor extends AbstractPhaseInterceptor<Message> {
+    private static final Logger LOG = LogUtils.getL7dLogger(FaultOutInterceptor.class);
+    
+    public FaultOutInterceptor() {
+        super(Phase.PREPARE_SEND);        
+    }
+
+    @SuppressWarnings("unchecked")
+    public void handleMessage(Message message) throws Fault {
+        Exception ex = message.getContent(Exception.class); 
+
+        if (ex != null) {
+            if (!(ex instanceof Fault)) {
+                ex = new Fault(ex);
+            }
+            
+            if (message instanceof XMLMessage) {
+                if (LOG.isLoggable(Level.INFO)) {
+                    LOG.info("FaultOutInterceptor Creating XMLFault");
+                }                
+                ex = XMLFault.createFault((Fault)ex);
+            } else if (message instanceof SoapMessage) {
+                if (LOG.isLoggable(Level.INFO)) {
+                    LOG.info("FaultOutInterceptor Creating SoapFault");
+                }                
+                
+                SoapMessage sm = (SoapMessage)message;
+                ex = SoapFault.createFault((Fault)ex, sm.getVersion());
+            } 
+            message.setContent(Exception.class, ex);
+        }
+    }
+}

Propchange: activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/FaultOutInterceptor.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/FaultOutInterceptor.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/PayloadContentRedirectInterceptor.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/PayloadContentRedirectInterceptor.java?rev=576522&view=auto
==============================================================================
--- activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/PayloadContentRedirectInterceptor.java (added)
+++ activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/PayloadContentRedirectInterceptor.java Mon Sep 17 10:00:08 2007
@@ -0,0 +1,50 @@
+/**
+ * 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.camel.component.cxf.interceptors;
+
+import java.util.List;
+
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.w3c.dom.Element;
+
+import org.apache.cxf.interceptor.Fault;
+import org.apache.cxf.message.Message;
+import org.apache.cxf.phase.AbstractPhaseInterceptor;
+import org.apache.cxf.phase.Phase;
+import org.apache.cxf.staxutils.StaxUtils;
+
+public class PayloadContentRedirectInterceptor extends AbstractPhaseInterceptor<Message> {
+
+    public PayloadContentRedirectInterceptor() {
+        super(Phase.POST_STREAM);        
+    }
+
+    @SuppressWarnings("unchecked")
+    public void handleMessage(Message message) throws Fault {
+        XMLStreamWriter out = message.getContent(XMLStreamWriter.class);
+        List<Element> in = message.get(List.class);
+        try {
+            for (Element el : in) {
+                StaxUtils.writeElement(el, out, false, true);
+            }
+        } catch (XMLStreamException e) {
+            throw new Fault(e);
+        }
+    }
+}

Propchange: activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/PayloadContentRedirectInterceptor.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/PayloadContentRedirectInterceptor.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/PayloadInInterceptor.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/PayloadInInterceptor.java?rev=576522&view=auto
==============================================================================
--- activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/PayloadInInterceptor.java (added)
+++ activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/PayloadInInterceptor.java Mon Sep 17 10:00:08 2007
@@ -0,0 +1,36 @@
+/**
+ * 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.camel.component.cxf.interceptors;
+
+import java.util.logging.Logger;
+
+import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.phase.Phase;
+
+public class PayloadInInterceptor extends AbstractInvokerInterceptor {
+
+    private static final Logger LOG = LogUtils.getL7dLogger(PayloadInInterceptor.class); 
+
+    public PayloadInInterceptor() {
+        super(Phase.READ);       
+    }
+    
+    @Override
+    protected Logger getLogger() {
+        return LOG;
+    }
+}
\ No newline at end of file

Propchange: activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/PayloadInInterceptor.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/PayloadInInterceptor.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/RawMessageContentRedirectInterceptor.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/RawMessageContentRedirectInterceptor.java?rev=576522&view=auto
==============================================================================
--- activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/RawMessageContentRedirectInterceptor.java (added)
+++ activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/RawMessageContentRedirectInterceptor.java Mon Sep 17 10:00:08 2007
@@ -0,0 +1,35 @@
+/**
+ *        Copyright (c) 1993-2006 IONA Technologies PLC.
+ *                       All Rights Reserved.
+ */
+package org.apache.camel.component.cxf.interceptors;
+
+import java.io.InputStream;
+import java.io.OutputStream;
+
+import org.apache.commons.io.IOUtils;
+import org.apache.cxf.interceptor.Fault;
+import org.apache.cxf.message.Message;
+import org.apache.cxf.phase.AbstractPhaseInterceptor;
+import org.apache.cxf.phase.Phase;
+
+public class RawMessageContentRedirectInterceptor extends AbstractPhaseInterceptor<Message> {
+    public RawMessageContentRedirectInterceptor() {
+        super(Phase.WRITE);        
+    }
+    
+    public void handleMessage(Message message) throws Fault {
+
+        InputStream is = message.getContent(InputStream.class);
+        OutputStream os = message.getContent(OutputStream.class);
+        
+        try {
+            System.out.println("the input stream is " + is);
+            IOUtils.copy(is, os);
+            is.close();
+            os.flush();
+        } catch (Exception e) {
+            throw new Fault(e);
+        }
+    }
+}

Propchange: activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/RawMessageContentRedirectInterceptor.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/RawMessageContentRedirectInterceptor.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/RawMessageInInterceptor.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/RawMessageInInterceptor.java?rev=576522&view=auto
==============================================================================
--- activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/RawMessageInInterceptor.java (added)
+++ activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/RawMessageInInterceptor.java Mon Sep 17 10:00:08 2007
@@ -0,0 +1,37 @@
+/**
+ * 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.camel.component.cxf.interceptors;
+
+import java.util.logging.Logger;
+
+import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.phase.Phase;
+
+public class RawMessageInInterceptor extends AbstractInvokerInterceptor {
+
+    private static final Logger LOG = LogUtils.getL7dLogger(RawMessageInInterceptor.class); 
+
+    public RawMessageInInterceptor() {
+        super(Phase.RECEIVE);
+        
+    }
+    
+    @Override
+    protected Logger getLogger() {
+        return LOG;
+    }
+}

Propchange: activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/RawMessageInInterceptor.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/RawMessageInInterceptor.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date



Mime
View raw message