Coverage Report - org.apache.camel.component.cxf.CxfMessage
 
Classes in this File Line Coverage Branch Coverage Complexity
CxfMessage
37% 
0% 
0
 
 1  
 /**
 2  
  * Licensed to the Apache Software Foundation (ASF) under one or more
 3  
  * contributor license agreements.  See the NOTICE file distributed with
 4  
  * this work for additional information regarding copyright ownership.
 5  
  * The ASF licenses this file to You under the Apache License, Version 2.0
 6  
  * (the "License"); you may not use this file except in compliance with
 7  
  * the License.  You may obtain a copy of the License at
 8  
  *
 9  
  *      http://www.apache.org/licenses/LICENSE-2.0
 10  
  *
 11  
  * Unless required by applicable law or agreed to in writing, software
 12  
  * distributed under the License is distributed on an "AS IS" BASIS,
 13  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 14  
  * See the License for the specific language governing permissions and
 15  
  * limitations under the License.
 16  
  */
 17  
 package org.apache.camel.component.cxf;
 18  
 
 19  
 import java.util.Map;
 20  
 
 21  
 import org.apache.camel.impl.DefaultMessage;
 22  
 import org.apache.cxf.message.Message;
 23  
 import org.apache.cxf.message.MessageImpl;
 24  
 
 25  
 /**
 26  
  * An Apache CXF {@link Message} which provides access to the underlying CXF
 27  
  * features
 28  
  * 
 29  
  * @version $Revision: 563665 $
 30  
  */
 31  1
 public class CxfMessage extends DefaultMessage {
 32  
     private Message cxfMessage;
 33  
 
 34  
     public CxfMessage() {
 35  2
         this(new MessageImpl());
 36  2
     }
 37  
 
 38  2
     public CxfMessage(Message cxfMessage) {
 39  2
         this.cxfMessage = cxfMessage;
 40  2
     }
 41  
 
 42  
     @Override
 43  
     public String toString() {
 44  0
         if (cxfMessage != null) {
 45  0
             return "CxfMessage: " + cxfMessage;
 46  
         } else {
 47  0
             return "CxfMessage: " + getBody();
 48  
         }
 49  
     }
 50  
 
 51  
     @Override
 52  
     public CxfExchange getExchange() {
 53  1
         return (CxfExchange)super.getExchange();
 54  
     }
 55  
 
 56  
     /**
 57  
      * Returns the underlying CXF message
 58  
      * 
 59  
      * @return the CXF message
 60  
      */
 61  
     public Message getMessage() {
 62  0
         return cxfMessage;
 63  
     }
 64  
 
 65  
     public void setMessage(Message cxfMessage) {
 66  0
         this.cxfMessage = cxfMessage;
 67  0
     }
 68  
 
 69  
     public Object getHeader(String name) {
 70  0
         return cxfMessage.get(name);
 71  
     }
 72  
 
 73  
     @Override
 74  
     public void setHeader(String name, Object value) {
 75  0
         cxfMessage.put(name, value);
 76  0
     }
 77  
 
 78  
     @Override
 79  
     public Map<String, Object> getHeaders() {
 80  0
         return cxfMessage;
 81  
     }
 82  
 
 83  
     @Override
 84  
     public CxfMessage newInstance() {
 85  0
         return new CxfMessage();
 86  
     }
 87  
 
 88  
     @Override
 89  
     protected Object createBody() {
 90  0
         return getExchange().getBinding().extractBodyFromCxf(getExchange(), cxfMessage);
 91  
     }
 92  
 }