Coverage Report - org.apache.camel.component.jbi.CamelJbiEndpoint
 
Classes in this File Line Coverage Branch Coverage Complexity
CamelJbiEndpoint
0% 
0% 
1.5
 
 1  
 /*
 2  
  * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE
 3  
  * file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file
 4  
  * to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the
 5  
  * License. You may obtain a copy of the License at
 6  
  * 
 7  
  * http://www.apache.org/licenses/LICENSE-2.0
 8  
  * 
 9  
  * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
 10  
  * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
 11  
  * specific language governing permissions and limitations under the License.
 12  
  */
 13  
 package org.apache.camel.component.jbi;
 14  
 
 15  
 import org.apache.camel.Endpoint;
 16  
 import org.apache.camel.Processor;
 17  
 import org.apache.camel.FailedToCreateProducerException;
 18  
 import org.apache.commons.logging.Log;
 19  
 import org.apache.commons.logging.LogFactory;
 20  
 import org.apache.servicemix.common.ServiceUnit;
 21  
 import org.apache.servicemix.common.endpoints.ProviderEndpoint;
 22  
 
 23  
 import javax.jbi.messaging.MessageExchange;
 24  
 import javax.jbi.messaging.NormalizedMessage;
 25  
 import javax.xml.namespace.QName;
 26  
 
 27  
 /**
 28  
  * A JBI endpoint which when invoked will delegate to a Camel endpoint
 29  
  *
 30  
  * @version $Revision: 426415 $
 31  
  */
 32  
 public class CamelJbiEndpoint extends ProviderEndpoint {
 33  0
     public static final QName SERVICE_NAME = new QName("http://activemq.apache.org/camel/schema/jbi", "endpoint");
 34  
 
 35  0
     private static final transient Log log = LogFactory.getLog(CamelJbiEndpoint.class);
 36  
     private Endpoint camelEndpoint;
 37  
     private JbiBinding binding;
 38  
     private Processor camelProcessor;
 39  
 
 40  
     public CamelJbiEndpoint(ServiceUnit serviceUnit, QName service, String endpoint, Endpoint camelEndpoint, JbiBinding binding, Processor camelProcessor) {
 41  0
         super(serviceUnit, service, endpoint);
 42  0
         this.camelProcessor = camelProcessor;
 43  0
         this.camelEndpoint = camelEndpoint;
 44  0
         this.binding = binding;
 45  0
     }
 46  
 
 47  
     public CamelJbiEndpoint(ServiceUnit serviceUnit, Endpoint camelEndpoint, JbiBinding binding, Processor camelProcesso) {
 48  0
         this(serviceUnit, SERVICE_NAME, camelEndpoint.getEndpointUri(), camelEndpoint, binding, camelProcesso);
 49  0
     }
 50  
 
 51  
     protected void processInOnly(MessageExchange exchange, NormalizedMessage in) throws Exception {
 52  0
         if (log.isDebugEnabled()) {
 53  0
             log.debug("Received exchange: " + exchange);
 54  
         }
 55  0
         JbiExchange camelExchange = new JbiExchange(camelEndpoint.getContext(), binding, exchange);
 56  0
         camelProcessor.process(camelExchange);
 57  0
     }
 58  
 
 59  
     protected void processInOut(MessageExchange exchange, NormalizedMessage in, NormalizedMessage out) throws Exception {
 60  0
         if (log.isDebugEnabled()) {
 61  0
             log.debug("Received exchange: " + exchange);
 62  
         }
 63  
         /*
 64  
          * ToDo
 65  
          */
 66  0
     }
 67  
 }