org.apache.cxf.transport.DestinationFactory Java Examples
The following examples show how to use
org.apache.cxf.transport.DestinationFactory.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MAPAggregatorImpl.java From cxf with Apache License 2.0 | 6 votes |
/** * @param address the address * @return a Destination for the address */ private Destination getDestination(Bus bus, String address, Message message) throws IOException { Destination destination = null; DestinationFactoryManager factoryManager = bus.getExtension(DestinationFactoryManager.class); DestinationFactory factory = factoryManager.getDestinationFactoryForUri(address); if (factory != null) { Endpoint ep = message.getExchange().getEndpoint(); EndpointInfo ei = new EndpointInfo(); ei.setName(new QName(ep.getEndpointInfo().getName().getNamespaceURI(), ep.getEndpointInfo().getName().getLocalPart() + ".decoupled")); ei.setAddress(address); destination = factory.getDestination(ei, bus); Conduit conduit = ContextUtils.getConduit(null, message); if (conduit != null) { MessageObserver ob = conduit.getMessageObserver(); ob = new InterposedMessageObserver(bus, ob); destination.setMessageObserver(ob); } } return destination; }
Example #2
Source File: DestinationFactoryManagerImpl.java From cxf with Apache License 2.0 | 6 votes |
/** * Returns the conduit initiator for the given namespace, constructing it * (and storing in the cache for future reference) if necessary, using its * list of factory classname to namespace mappings. * * @param namespace the namespace. */ @Override public DestinationFactory getDestinationFactory(String namespace) throws BusException { DestinationFactory factory = destinationFactories.get(namespace); if (factory == null && !failed.contains(namespace)) { factory = new TransportFinder<>(bus, destinationFactories, loaded, DestinationFactory.class) .findTransportForNamespace(namespace); } if (factory == null) { failed.add(namespace); throw new BusException(new Message("NO_DEST_FACTORY", BUNDLE, namespace)); } return factory; }
Example #3
Source File: EjbEndpoint.java From tomee with Apache License 2.0 | 6 votes |
public EjbEndpoint(Bus bus, PortData portData, BeanContext beanContext, DestinationFactory transportFactory, ServiceConfiguration config) { super(bus, portData, beanContext.getJndiEnc(), beanContext.getBeanClass(), transportFactory, config); this.beanContext = beanContext; String bindingURI = JaxWsUtils.getBindingURI(portData.getBindingID()); implInfo = new JaxWsImplementorInfoImpl((Class) implementor, bindingURI); serviceFactory = configureService(new JaxWsServiceFactoryBean(implInfo), config, CXF_JAXWS_PREFIX); serviceFactory.setBus(bus); serviceFactory.setServiceClass(beanContext.getBeanClass()); // install as first to overwrite annotations (wsdl-file, wsdl-port, wsdl-service) CxfServiceConfiguration configuration = new CxfServiceConfiguration(portData); serviceFactory.getConfigurations().add(0, configuration); service = doServiceCreate(); }
Example #4
Source File: JettyHTTPServerEngineFactoryTest.java From cxf with Apache License 2.0 | 6 votes |
/** * This test makes sure that a default Spring initialized bus will * have the JettyHTTPServerEngineFactory (absent of <httpj:engine-factory> * configuration. */ @Test public void testMakeSureTransportFactoryHasEngineFactory() throws Exception { bus = BusFactory.getDefaultBus(true); assertNotNull("Cannot get bus", bus); // Make sure we got the Transport Factory. DestinationFactoryManager destFM = bus.getExtension(DestinationFactoryManager.class); assertNotNull("Cannot get DestinationFactoryManager", destFM); DestinationFactory destF = destFM.getDestinationFactory( "http://cxf.apache.org/transports/http"); assertNotNull("No DestinationFactory", destF); assertTrue(HTTPTransportFactory.class.isInstance(destF)); // And the JettyHTTPServerEngineFactory should be there. JettyHTTPServerEngineFactory factory = bus.getExtension(JettyHTTPServerEngineFactory.class); assertNotNull("EngineFactory is not configured.", factory); }
Example #5
Source File: UndertowHTTPServerEngineFactoryTest.java From cxf with Apache License 2.0 | 6 votes |
/** * This test makes sure that a default Spring initialized bus will * have the UndertowHTTPServerEngineFactory (absent of <httpu:engine-factory> * configuration. */ @Test public void testMakeSureTransportFactoryHasEngineFactory() throws Exception { bus = BusFactory.getDefaultBus(true); assertNotNull("Cannot get bus", bus); // Make sure we got the Transport Factory. DestinationFactoryManager destFM = bus.getExtension(DestinationFactoryManager.class); assertNotNull("Cannot get DestinationFactoryManager", destFM); DestinationFactory destF = destFM.getDestinationFactory( "http://cxf.apache.org/transports/http"); assertNotNull("No DestinationFactory", destF); assertTrue(HTTPTransportFactory.class.isInstance(destF)); // And the UndertowHTTPServerEngineFactory should be there. UndertowHTTPServerEngineFactory factory = bus.getExtension(UndertowHTTPServerEngineFactory.class); assertNotNull("EngineFactory is not configured.", factory); }
Example #6
Source File: NettyHttpServerEngineFactoryTest.java From cxf with Apache License 2.0 | 6 votes |
@Test public void testTransportFactoryHasEngineFactory() throws Exception { bus = BusFactory.getDefaultBus(true); assertNotNull("Cannot get bus", bus); // Make sure we got the Transport Factory. DestinationFactoryManager destFM = bus.getExtension(DestinationFactoryManager.class); assertNotNull("Cannot get DestinationFactoryManager", destFM); DestinationFactory destF = destFM.getDestinationFactory( "http://cxf.apache.org/transports/http"); assertNotNull("No DestinationFactory", destF); assertTrue(HTTPTransportFactory.class.isInstance(destF)); NettyHttpServerEngineFactory factory = bus.getExtension(NettyHttpServerEngineFactory.class); assertNotNull("EngineFactory is not configured.", factory); }
Example #7
Source File: GenericWebServiceServlet.java From BIMserver with GNU Affero General Public License v3.0 | 5 votes |
private static DestinationRegistry getDestinationRegistryFromBus(Bus bus) { DestinationFactoryManager dfm = bus.getExtension(DestinationFactoryManager.class); try { DestinationFactory df = dfm.getDestinationFactory("http://cxf.apache.org/transports/http/configuration"); if (df instanceof HTTPTransportFactory) { HTTPTransportFactory transportFactory = (HTTPTransportFactory) df; return transportFactory.getRegistry(); } } catch (BusException e) { // why are we throwing a busexception if the DF isn't found? } return null; }
Example #8
Source File: PojoWsContainer.java From tomee with Apache License 2.0 | 5 votes |
public PojoWsContainer(final ClassLoader loader, final DestinationFactory transportFactory, final Bus bus, final PortData port, final Context context, final Class target, final Map<String, Object> bdgs, final ServiceConfiguration configuration) { super(bus, transportFactory, port, configuration); if (target == null) throw new NullPointerException("target is null"); this.context = context; this.target = target; this.bindings = bdgs; this.loader = loader; }
Example #9
Source File: CxfEndpoint.java From tomee with Apache License 2.0 | 5 votes |
public CxfEndpoint(Bus bus, PortData port, Context context, Object implementor, DestinationFactory destinationFactory, ServiceConfiguration configuration) { this.bus = bus; this.port = port; this.context = context; this.implementor = implementor; this.destinationFactory = destinationFactory; this.serviceConfiguration = configuration; this.bus.setExtension(this, CxfEndpoint.class); }
Example #10
Source File: ServerImpl.java From cxf with Apache License 2.0 | 5 votes |
public ServerImpl(Bus bus, Endpoint endpoint, DestinationFactory destinationFactory, BindingFactory bindingFactory) throws BusException, IOException { this.endpoint = endpoint; this.bus = bus; this.bindingFactory = bindingFactory; initDestination(destinationFactory); }
Example #11
Source File: DestinationFactoryManagerImpl.java From cxf with Apache License 2.0 | 5 votes |
@Override public DestinationFactory getDestinationFactoryForUri(String uri) { return new TransportFinder<DestinationFactory>(bus, destinationFactories, loaded, DestinationFactory.class).findTransportForURI(uri); }
Example #12
Source File: MtomServerTest.java From cxf with Apache License 2.0 | 5 votes |
private void unregisterServStatic(String add) throws Exception { Bus bus = getStaticBus(); DestinationFactoryManager dfm = bus.getExtension(DestinationFactoryManager.class); DestinationFactory df = dfm .getDestinationFactory("http://cxf.apache.org/transports/http/configuration"); EndpointInfo ei = new EndpointInfo(); ei.setAddress(add); Destination d = df.getDestination(ei, bus); d.setMessageObserver(null); }
Example #13
Source File: ServiceWSDLBuilderTest.java From cxf with Apache License 2.0 | 5 votes |
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>()); }
Example #14
Source File: WSDLServiceBuilderTest.java From cxf with Apache License 2.0 | 5 votes |
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; } }
Example #15
Source File: CXFNonSpringServlet.java From cxf with Apache License 2.0 | 5 votes |
protected DestinationRegistry getDestinationRegistryFromBusOrDefault(final String transportId) { DestinationFactoryManager dfm = bus.getExtension(DestinationFactoryManager.class); try { String peferredTransportId = transportId; // Check if the preferred transport is set on a bus level (f.e., from any // extension or customization). if (StringUtils.isEmpty(peferredTransportId) && getBus() != null) { peferredTransportId = (String)getBus().getProperty(AbstractTransportFactory.PREFERRED_TRANSPORT_ID); } if (StringUtils.isEmpty(peferredTransportId)) { final Set<String> candidates = dfm.getRegisteredDestinationFactoryNames(); // If the default transport is present, fall back to it and don't even // consider other candidates if (!candidates.contains(DEFAULT_TRANSPORT_ID)) { peferredTransportId = candidates .stream() .filter(name -> name.endsWith("/configuration")) .findAny() .orElse(DEFAULT_TRANSPORT_ID); } } DestinationFactory df = StringUtils.isEmpty(peferredTransportId) ? dfm.getDestinationFactory(DEFAULT_TRANSPORT_ID) : dfm.getDestinationFactory(peferredTransportId); if (df instanceof HTTPTransportFactory) { HTTPTransportFactory transportFactory = (HTTPTransportFactory)df; return transportFactory.getRegistry(); } } catch (BusException e) { // why are we throwing a busexception if the DF isn't found? } return null; }
Example #16
Source File: WebSocketDestinationFactory.java From cxf with Apache License 2.0 | 5 votes |
private static DestinationRegistry getDestinationRegistry(Bus bus) { DestinationFactoryManager dfm = bus.getExtension(DestinationFactoryManager.class); try { DestinationFactory df = dfm .getDestinationFactory("http://cxf.apache.org/transports/http/configuration"); if (df instanceof HTTPTransportFactory) { HTTPTransportFactory transportFactory = (HTTPTransportFactory)df; return transportFactory.getRegistry(); } } catch (Exception e) { // why are we throwing a busexception if the DF isn't found? } return null; }
Example #17
Source File: SoapTransportFactory.java From cxf with Apache License 2.0 | 5 votes |
public Destination getDestination(EndpointInfo ei, Bus bus) throws IOException { String address = ei.getAddress(); BindingInfo bi = ei.getBinding(); String transId = ei.getTransportId(); if (bi instanceof SoapBindingInfo) { transId = ((SoapBindingInfo)bi).getTransportURI(); if (transId == null) { transId = ei.getTransportId(); } } DestinationFactory destinationFactory; try { DestinationFactoryManager mgr = bus.getExtension(DestinationFactoryManager.class); if (StringUtils.isEmpty(address) || address.startsWith("http") || address.startsWith("jms") || address.startsWith("soap.udp") || address.startsWith("/")) { destinationFactory = mgr.getDestinationFactory(mapTransportURI(transId, address)); } else { destinationFactory = mgr.getDestinationFactoryForUri(address); } if (destinationFactory == null) { throw new IOException("Could not find destination factory for transport " + transId); } return destinationFactory.getDestination(ei, bus); } catch (BusException e) { IOException ex = new IOException("Could not find destination factory for transport " + transId); ex.initCause(e); throw ex; } }
Example #18
Source File: AbstractJAXRSFactoryBean.java From cxf with Apache License 2.0 | 5 votes |
protected EndpointInfo createEndpointInfo(Service service) throws BusException { String transportId = getTransportId(); if (transportId == null && getAddress() != null) { DestinationFactory df = getDestinationFactory(); if (df == null) { DestinationFactoryManager dfm = getBus().getExtension(DestinationFactoryManager.class); df = dfm.getDestinationFactoryForUri(getAddress()); super.setDestinationFactory(df); } if (df != null) { transportId = df.getTransportIds().get(0); } } //default to http transport if (transportId == null) { transportId = "http://cxf.apache.org/transports/http"; } setTransportId(transportId); //EndpointInfo ei = new EndpointInfo(service.getServiceInfos().get(0), transportId); EndpointInfo ei = new EndpointInfo(); ei.setTransportId(transportId); ei.setName(serviceFactory.getService().getName()); ei.setAddress(getAddress()); BindingInfo bindingInfo = createBindingInfo(); ei.setBinding(bindingInfo); if (!StringUtils.isEmpty(publishedEndpointUrl)) { ei.setProperty("publishedEndpointUrl", publishedEndpointUrl); } ei.setName(service.getName()); serviceFactory.sendEvent(FactoryBeanListener.Event.ENDPOINTINFO_CREATED, ei); return ei; }
Example #19
Source File: AbstractWSDLBasedEndpointFactory.java From cxf with Apache License 2.0 | 5 votes |
private void modifyTransportIdPerAddress(EndpointInfo ei) { //get chance to set transportId according to the the publish address prefix //this is useful for local & camel transport if (transportId == null && getAddress() != null) { DestinationFactory df = getDestinationFactory(); if (df == null) { DestinationFactoryManager dfm = getBus().getExtension( DestinationFactoryManager.class); df = dfm.getDestinationFactoryForUri(getAddress()); } if (df != null) { transportId = df.getTransportIds().get(0); } else { // check conduits (the address could be supported on // client only) ConduitInitiatorManager cim = getBus().getExtension( ConduitInitiatorManager.class); ConduitInitiator ci = cim .getConduitInitiatorForUri(getAddress()); if (ci != null) { transportId = ci.getTransportIds().get(0); } } } if (transportId != null) { ei.setTransportId(transportId); } }
Example #20
Source File: ServerFactoryBean.java From cxf with Apache License 2.0 | 5 votes |
@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; }
Example #21
Source File: ProtobufServerFactoryBean.java From fuchsia with Apache License 2.0 | 5 votes |
protected EndpointInfo createEndpointInfo() throws BusException { String transportId = getTransportId(); if (transportId == null && getAddress() != null) { DestinationFactory df = getDestinationFactory(); if (df == null) { DestinationFactoryManager dfm = getBus().getExtension(DestinationFactoryManager.class); df = dfm.getDestinationFactoryForUri(getAddress()); } if (df != null) { transportId = df.getTransportIds().get(0); } } // default to http transport if (transportId == null) { transportId = "http://schemas.xmlsoap.org/wsdl/soap/http"; } setTransportId(transportId); EndpointInfo ei = new EndpointInfo(); ei.setTransportId(transportId); ei.setName(serviceFactory.getService().getName()); ei.setAddress(getAddress()); ei.setProperty(PROTOBUF_MESSAGE_CLASS, messageClass); BindingInfo bindingInfo = createBindingInfo(); ei.setBinding(bindingInfo); return ei; }
Example #22
Source File: EjbWsContainer.java From tomee with Apache License 2.0 | 4 votes |
public EjbWsContainer(final Bus bus, final DestinationFactory transportFactory, final PortData port, final BeanContext beanContext, final ServiceConfiguration config) { super(bus, transportFactory, port, config); if (beanContext == null) throw new NullPointerException("deploymentInfo is null"); this.beanContext = beanContext; }
Example #23
Source File: CxfRsHttpListener.java From tomee with Apache License 2.0 | 4 votes |
public CxfRsHttpListener(final DestinationFactory destinationFactory, final String star, final CxfRSService cxfRSService) { transportFactory = destinationFactory; wildcard = star; service = cxfRSService; }
Example #24
Source File: CxfWsContainer.java From tomee with Apache License 2.0 | 4 votes |
public CxfWsContainer(final Bus bus, final DestinationFactory transportFactory, final PortData port, final ServiceConfiguration config) { this.bus = bus; this.port = port; this.serviceConfiguration = config; this.transportFactory = transportFactory; }
Example #25
Source File: DestinationFactoryManagerImpl.java From cxf with Apache License 2.0 | 4 votes |
public DestinationFactoryManagerImpl(Map<String, DestinationFactory> destinationFactories, Bus b) { this.destinationFactories = destinationFactories; setBus(b); }
Example #26
Source File: AbstractEndpointFactory.java From cxf with Apache License 2.0 | 4 votes |
public void setDestinationFactory(DestinationFactory destinationFactory) { this.destinationFactory = destinationFactory; }
Example #27
Source File: AbstractEndpointFactory.java From cxf with Apache License 2.0 | 4 votes |
public DestinationFactory getDestinationFactory() { return destinationFactory; }
Example #28
Source File: ServerImpl.java From cxf with Apache License 2.0 | 4 votes |
private void initDestination(DestinationFactory destinationFactory) throws BusException, IOException { EndpointInfo ei = endpoint.getEndpointInfo(); //Treat local transport as a special case, transports loaded by transportId can be replaced //by local transport when the publishing address is a local transport protocol. //Of course its not an ideal situation here to use a hard-coded prefix. To be refactored. if (destinationFactory == null) { if (ei.getAddress() != null && ei.getAddress().indexOf("local://") != -1) { destinationFactory = bus.getExtension(DestinationFactoryManager.class) .getDestinationFactoryForUri(ei.getAddress()); } if (destinationFactory == null) { destinationFactory = bus.getExtension(DestinationFactoryManager.class) .getDestinationFactory(ei.getTransportId()); } } destination = destinationFactory.getDestination(ei, bus); String wantFilter = ei.getAddress(); if (wantFilter != null && wantFilter.startsWith("jms")) { RegexLoggingFilter filter = new RegexLoggingFilter(); filter.setPattern("jms(.*?)password=+([^ ]+)"); filter.setGroup(2); wantFilter = filter.filter(wantFilter).toString(); } LOG.info("Setting the server's publish address to be " + wantFilter); serverRegistry = bus.getExtension(ServerRegistry.class); mep = new ManagedEndpoint(bus, endpoint, this); slcMgr = bus.getExtension(ServerLifeCycleManager.class); if (slcMgr != null) { slcMgr.registerListener(mep); } iMgr = bus.getExtension(InstrumentationManager.class); if (iMgr != null) { try { iMgr.register(mep); } catch (JMException jmex) { LOG.log(Level.WARNING, "Registering ManagedEndpoint failed.", jmex); } } }
Example #29
Source File: DestinationFactoryManagerImpl.java From cxf with Apache License 2.0 | 4 votes |
public void registerDestinationFactory(String namespace, DestinationFactory factory) { destinationFactories.put(namespace, factory); }
Example #30
Source File: DestinationFactoryManagerImpl.java From cxf with Apache License 2.0 | 4 votes |
public DestinationFactoryManagerImpl(Map<String, DestinationFactory> destinationFactories) { this.destinationFactories = destinationFactories; }