Coverage Report - org.apache.camel.component.cxf.CxfComponent
 
Classes in this File Line Coverage Branch Coverage Complexity
CxfComponent
0% 
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.net.URI;
 20  
 import java.util.Map;
 21  
 
 22  
 import org.apache.camel.CamelContext;
 23  
 import org.apache.camel.Endpoint;
 24  
 import org.apache.camel.impl.DefaultComponent;
 25  
 import org.apache.cxf.Bus;
 26  
 import org.apache.cxf.BusException;
 27  
 import org.apache.cxf.bus.CXFBusFactory;
 28  
 import org.apache.cxf.service.model.EndpointInfo;
 29  
 import org.apache.cxf.transport.DestinationFactoryManager;
 30  
 import org.apache.cxf.transport.local.LocalTransportFactory;
 31  
 import org.xmlsoap.schemas.wsdl.http.AddressType;
 32  
 
 33  
 /**
 34  
  * Defines the <a href="http://activemq.apache.org/camel/cxf.html">CXF Component</a>
 35  
 
 36  
  * @version $Revision: 563665 $
 37  
  */
 38  
 public class CxfComponent extends DefaultComponent<CxfExchange> {
 39  
     private LocalTransportFactory localTransportFactory;
 40  
 
 41  0
     public CxfComponent() {
 42  0
     }
 43  
 
 44  
     public CxfComponent(CamelContext context) {
 45  0
         super(context);
 46  0
     }
 47  
 
 48  
     @Override
 49  
     protected Endpoint<CxfExchange> createEndpoint(String uri, String remaining, Map parameters) throws Exception {
 50  0
         URI u = new URI(remaining);
 51  
 
 52  
         // TODO this is a hack!!!
 53  0
         EndpointInfo endpointInfo = new EndpointInfo(null, "http://schemas.xmlsoap.org/soap/http");
 54  0
         AddressType a = new AddressType();
 55  0
         a.setLocation(remaining);
 56  0
         endpointInfo.addExtensor(a);
 57  
 
 58  0
         return new CxfEndpoint(uri, this, endpointInfo);
 59  
     }
 60  
 
 61  
     public LocalTransportFactory getLocalTransportFactory() throws BusException {
 62  0
         if (localTransportFactory == null) {
 63  0
             localTransportFactory = findLocalTransportFactory();
 64  0
             if (localTransportFactory == null) {
 65  0
                 localTransportFactory = new LocalTransportFactory();
 66  
             }
 67  
         }
 68  0
         return localTransportFactory;
 69  
     }
 70  
 
 71  
     public void setLocalTransportFactory(LocalTransportFactory localTransportFactory) {
 72  0
         this.localTransportFactory = localTransportFactory;
 73  0
     }
 74  
 
 75  
     protected LocalTransportFactory findLocalTransportFactory() throws BusException {
 76  0
         Bus bus = CXFBusFactory.getDefaultBus();
 77  0
         DestinationFactoryManager dfm = bus.getExtension(DestinationFactoryManager.class);
 78  0
         return (LocalTransportFactory) dfm.getDestinationFactory(LocalTransportFactory.TRANSPORT_ID);
 79  
     }
 80  
 }