Coverage Report - org.apache.camel.component.jms.JmsExchange
 
Classes in this File Line Coverage Branch Coverage Complexity
JmsExchange
72% 
N/A 
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.jms;
 18  
 
 19  
 import org.apache.camel.CamelContext;
 20  
 import org.apache.camel.Exchange;
 21  
 import org.apache.camel.impl.DefaultExchange;
 22  
 
 23  
 import javax.jms.Message;
 24  
 
 25  
 /**
 26  
  * Represents an {@ilnk Exchange} for working with JMS messages while exposing the inbound and outbound JMS {@link Message}
 27  
  * objects via {@link #getInMessage()} and {@link #getOutMessage()} 
 28  
  *
 29  
  * @version $Revision:520964 $
 30  
  */
 31  101
 public class JmsExchange extends DefaultExchange {
 32  
     private JmsBinding binding;
 33  
 
 34  
     public JmsExchange(CamelContext context, JmsBinding binding) {
 35  32
         super(context);
 36  32
         this.binding = binding;
 37  32
     }
 38  
 
 39  
     public JmsExchange(CamelContext context, JmsBinding binding, Message message) {
 40  21
         this(context, binding);
 41  21
         setIn(new JmsMessage(message));
 42  21
     }
 43  
 
 44  
     @Override
 45  
     public JmsMessage getIn() {
 46  72
         return (JmsMessage) super.getIn();
 47  
     }
 48  
 
 49  
     @Override
 50  
     public JmsMessage getOut() {
 51  6
         return (JmsMessage) super.getOut();
 52  
     }
 53  
 
 54  
     @Override
 55  
     public JmsMessage getOut(boolean lazyCreate) {
 56  6
         return (JmsMessage) super.getOut(lazyCreate);
 57  
     }
 58  
 
 59  
     @Override
 60  
     public JmsMessage getFault() {
 61  0
         return (JmsMessage) super.getFault();
 62  
     }
 63  
 
 64  
     public JmsBinding getBinding() {
 65  20
         return binding;
 66  
     }
 67  
 
 68  
     @Override
 69  
     public Exchange newInstance() {
 70  0
         return new JmsExchange(getContext(), binding);
 71  
     }
 72  
 
 73  
     // Expose JMS APIs
 74  
     //-------------------------------------------------------------------------
 75  
 
 76  
     /**
 77  
      * Return the underlying JMS In message
 78  
      *
 79  
      * @return the JMS In message
 80  
      */
 81  
     public Message getInMessage() {
 82  0
         return getIn().getJmsMessage();
 83  
     }
 84  
 
 85  
     /**
 86  
      * Return the underlying JMS Out message
 87  
      *
 88  
      * @return the JMS out message
 89  
      */
 90  
     public Message getOutMessage() {
 91  0
         return getOut().getJmsMessage();
 92  
     }
 93  
 
 94  
     /**
 95  
      * Return the underlying JMS Fault message
 96  
      *
 97  
      * @return the JMS fault message
 98  
      */
 99  
     public Message getFaultMessage() {
 100  0
         return getOut().getJmsMessage();
 101  
     }
 102  
 
 103  
     // Implementation methods
 104  
     //-------------------------------------------------------------------------
 105  
 
 106  
     @Override
 107  
     protected JmsMessage createInMessage() {
 108  11
         return new JmsMessage();
 109  
     }
 110  
 
 111  
     @Override
 112  
     protected JmsMessage createOutMessage() {
 113  6
         return new JmsMessage();
 114  
     }
 115  
 }