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