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