Search in sources :

Example 16 with DestinationFactoryManager

use of org.apache.cxf.transport.DestinationFactoryManager in project cxf by apache.

the class ServerFactoryBean method detectTransportIdFromAddress.

@Override
protected String detectTransportIdFromAddress(String ad) {
    DestinationFactory df = getDestinationFactory();
    if (df == null) {
        DestinationFactoryManager dfm = getBus().getExtension(DestinationFactoryManager.class);
        df = dfm.getDestinationFactoryForUri(getAddress());
        if (df != null) {
            return df.getTransportIds().get(0);
        }
    }
    return null;
}
Also used : DestinationFactory(org.apache.cxf.transport.DestinationFactory) DestinationFactoryManager(org.apache.cxf.transport.DestinationFactoryManager)

Example 17 with DestinationFactoryManager

use of org.apache.cxf.transport.DestinationFactoryManager in project camel by apache.

the class CxfBeanEndpoint method registerTransportFactory.

private void registerTransportFactory(CxfBeanComponent cxfBeanComponent) {
    CxfBeanTransportFactory transportFactory = new CxfBeanTransportFactory();
    transportFactory.setCxfBeanComponent(cxfBeanComponent);
    transportFactory.setBus(bus);
    // register the conduit initiator
    ConduitInitiatorManager cim = bus.getExtension(ConduitInitiatorManager.class);
    cim.registerConduitInitiator(CxfBeanTransportFactory.TRANSPORT_ID, transportFactory);
    // register the destination factory
    DestinationFactoryManager dfm = bus.getExtension(DestinationFactoryManager.class);
    dfm.registerDestinationFactory(CxfBeanTransportFactory.TRANSPORT_ID, transportFactory);
}
Also used : DestinationFactoryManager(org.apache.cxf.transport.DestinationFactoryManager) ConduitInitiatorManager(org.apache.cxf.transport.ConduitInitiatorManager)

Example 18 with DestinationFactoryManager

use of org.apache.cxf.transport.DestinationFactoryManager in project camel by apache.

the class CamelTransportFactory method registerFactory.

public final void registerFactory() {
    if (null == bus) {
        return;
    }
    DestinationFactoryManager dfm = bus.getExtension(DestinationFactoryManager.class);
    if (null != dfm && getTransportIds() != null) {
        for (String ns : getTransportIds()) {
            dfm.registerDestinationFactory(ns, this);
        }
    }
    ConduitInitiatorManager cim = bus.getExtension(ConduitInitiatorManager.class);
    if (cim != null && getTransportIds() != null) {
        for (String ns : getTransportIds()) {
            cim.registerConduitInitiator(ns, this);
        }
    }
}
Also used : DestinationFactoryManager(org.apache.cxf.transport.DestinationFactoryManager) ConduitInitiatorManager(org.apache.cxf.transport.ConduitInitiatorManager)

Example 19 with DestinationFactoryManager

use of org.apache.cxf.transport.DestinationFactoryManager in project cxf by apache.

the class ServiceWSDLBuilderTest method setupWSDL.

private void setupWSDL(String wsdlPath, boolean doXsdImports) throws Exception {
    String wsdlUrl = getClass().getResource(wsdlPath).toString();
    LOG.info("the path of wsdl file is " + wsdlUrl);
    WSDLFactory wsdlFactory = WSDLFactory.newInstance();
    WSDLReader wsdlReader = wsdlFactory.newWSDLReader();
    wsdlReader.setFeature("javax.wsdl.verbose", false);
    def = wsdlReader.readWSDL(wsdlUrl);
    control = EasyMock.createNiceControl();
    bus = control.createMock(Bus.class);
    bindingFactoryManager = control.createMock(BindingFactoryManager.class);
    destinationFactoryManager = control.createMock(DestinationFactoryManager.class);
    destinationFactory = control.createMock(DestinationFactory.class);
    wsdlServiceBuilder = new WSDLServiceBuilder(bus, false);
    for (Service serv : CastUtils.cast(def.getServices().values(), Service.class)) {
        if (serv != null) {
            service = serv;
            break;
        }
    }
    EasyMock.expect(bus.getExtension(WSDLManager.class)).andReturn(new WSDLManagerImpl()).anyTimes();
    EasyMock.expect(bus.getExtension(BindingFactoryManager.class)).andReturn(bindingFactoryManager);
    EasyMock.expect(bus.getExtension(DestinationFactoryManager.class)).andReturn(destinationFactoryManager);
    EasyMock.expect(destinationFactoryManager.getDestinationFactory("http://schemas.xmlsoap.org/wsdl/soap/")).andReturn(destinationFactory);
    control.replay();
    serviceInfo = wsdlServiceBuilder.buildServices(def, service).get(0);
    ServiceWSDLBuilder builder = new ServiceWSDLBuilder(bus, serviceInfo);
    builder.setUseSchemaImports(doXsdImports);
    builder.setBaseFileName("HelloWorld");
    newDef = builder.build(new HashMap<String, SchemaInfo>());
}
Also used : Bus(org.apache.cxf.Bus) DestinationFactory(org.apache.cxf.transport.DestinationFactory) DestinationFactoryManager(org.apache.cxf.transport.DestinationFactoryManager) HashMap(java.util.HashMap) Service(javax.wsdl.Service) BindingFactoryManager(org.apache.cxf.binding.BindingFactoryManager) WSDLFactory(javax.wsdl.factory.WSDLFactory) WSDLManager(org.apache.cxf.wsdl.WSDLManager) WSDLReader(javax.wsdl.xml.WSDLReader)

Example 20 with DestinationFactoryManager

use of org.apache.cxf.transport.DestinationFactoryManager in project cxf by apache.

the class WSDLServiceBuilderTest method buildService.

private void buildService(QName endpointName) throws Exception {
    control = EasyMock.createNiceControl();
    bus = control.createMock(Bus.class);
    bindingFactoryManager = control.createMock(BindingFactoryManager.class);
    destinationFactoryManager = control.createMock(DestinationFactoryManager.class);
    DestinationFactory destinationFactory = control.createMock(DestinationFactory.class);
    WSDLServiceBuilder wsdlServiceBuilder = new WSDLServiceBuilder(bus);
    EasyMock.expect(bus.getExtension(BindingFactoryManager.class)).andReturn(bindingFactoryManager).anyTimes();
    EasyMock.expect(bus.getExtension(DestinationFactoryManager.class)).andReturn(destinationFactoryManager).atLeastOnce();
    EasyMock.expect(destinationFactoryManager.getDestinationFactory("http://schemas.xmlsoap.org/wsdl/soap/")).andReturn(destinationFactory).anyTimes();
    control.replay();
    serviceInfos = wsdlServiceBuilder.buildServices(def, service, endpointName);
    if (!serviceInfos.isEmpty()) {
        serviceInfo = serviceInfos.get(0);
    } else {
        serviceInfo = null;
    }
}
Also used : Bus(org.apache.cxf.Bus) DestinationFactory(org.apache.cxf.transport.DestinationFactory) DestinationFactoryManager(org.apache.cxf.transport.DestinationFactoryManager) BindingFactoryManager(org.apache.cxf.binding.BindingFactoryManager)

Aggregations

DestinationFactoryManager (org.apache.cxf.transport.DestinationFactoryManager)40 Bus (org.apache.cxf.Bus)23 DestinationFactory (org.apache.cxf.transport.DestinationFactory)18 ConduitInitiatorManager (org.apache.cxf.transport.ConduitInitiatorManager)16 BindingFactoryManager (org.apache.cxf.binding.BindingFactoryManager)15 EndpointInfo (org.apache.cxf.service.model.EndpointInfo)13 QName (javax.xml.namespace.QName)9 ServiceInfo (org.apache.cxf.service.model.ServiceInfo)8 WSDLServiceBuilder (org.apache.cxf.wsdl11.WSDLServiceBuilder)8 Before (org.junit.Before)8 Test (org.junit.Test)8 Destination (org.apache.cxf.transport.Destination)7 BindingInfo (org.apache.cxf.service.model.BindingInfo)6 Definition (javax.wsdl.Definition)5 Service (javax.wsdl.Service)5 WSDLReader (javax.wsdl.xml.WSDLReader)5 SoapBindingInfo (org.apache.cxf.binding.soap.model.SoapBindingInfo)5 LocalTransportFactory (org.apache.cxf.transport.local.LocalTransportFactory)5 BusException (org.apache.cxf.BusException)4 ConduitInitiator (org.apache.cxf.transport.ConduitInitiator)4