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;
}
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);
}
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);
}
}
}
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>());
}
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;
}
}
Aggregations