Search in sources :

Example 11 with Configurer

use of org.apache.cxf.configuration.Configurer in project teiid by teiid.

the class WSManagedConnectionFactory method createConnectionFactory.

@SuppressWarnings("serial")
@Override
public BasicConnectionFactory<WSConnectionImpl> createConnectionFactory() throws ResourceException {
    if (this.endPointName == null) {
        this.endPointName = WSManagedConnectionFactory.DEFAULT_LOCAL_NAME;
    }
    if (this.serviceName == null) {
        this.serviceName = WSManagedConnectionFactory.DEFAULT_LOCAL_NAME;
    }
    if (this.namespaceUri == null) {
        this.namespaceUri = WSManagedConnectionFactory.DEFAULT_NAMESPACE_URI;
    }
    this.portQName = new QName(this.namespaceUri, this.endPointName);
    this.serviceQName = new QName(this.namespaceUri, this.serviceName);
    if (this.wsdl != null) {
        try {
            this.wsdlUrl = new URL(this.wsdl);
        } catch (MalformedURLException e) {
            File f = new File(this.wsdl);
            try {
                this.wsdlUrl = f.toURI().toURL();
            } catch (MalformedURLException e1) {
                throw new InvalidPropertyException(e1);
            }
        }
    }
    if (this.configFile != null) {
        this.bus = new SpringBusFactory().createBus(this.configFile);
        JaxWsClientFactoryBean instance = new JaxWsClientFactoryBean();
        if (this.wsdl == null) {
            Configurer configurer = this.bus.getExtension(Configurer.class);
            if (null != configurer) {
                // $NON-NLS-1$
                configurer.configureBean(this.portQName.toString() + ".jaxws-client.proxyFactory", instance);
            }
            this.outInterceptors = instance.getOutInterceptors();
        }
    }
    return new BasicConnectionFactory<WSConnectionImpl>() {

        @Override
        public WSConnectionImpl getConnection() throws ResourceException {
            return new WSConnectionImpl(WSManagedConnectionFactory.this);
        }
    };
}
Also used : JaxWsClientFactoryBean(org.apache.cxf.jaxws.JaxWsClientFactoryBean) MalformedURLException(java.net.MalformedURLException) SpringBusFactory(org.apache.cxf.bus.spring.SpringBusFactory) BasicConnectionFactory(org.teiid.resource.spi.BasicConnectionFactory) QName(javax.xml.namespace.QName) InvalidPropertyException(javax.resource.spi.InvalidPropertyException) Configurer(org.apache.cxf.configuration.Configurer) File(java.io.File) URL(java.net.URL)

Example 12 with Configurer

use of org.apache.cxf.configuration.Configurer in project cxf by apache.

the class ServiceImplTest method testConfigureBean.

@Test
public // CXF-2723 :Allow configuration of JaxWsClientFactoryBean during port creation
void testConfigureBean() throws Exception {
    Configurer oldConfiguer = this.getBus().getExtension(Configurer.class);
    JAXWSClientFactoryCongfiguer clientConfiguer = new JAXWSClientFactoryCongfiguer();
    getBus().setExtension(clientConfiguer, Configurer.class);
    URL wsdl1 = getClass().getResource("/wsdl/calculator.wsdl");
    ServiceImpl service = new ServiceImpl(getBus(), wsdl1, SERVICE_1, ServiceImpl.class);
    service.createPort(PORT_1, null, CalculatorPortType.class);
    assertTrue("The JAXWSClientFcatoryBean is not configured by the new configurer", isJAXWSClientFactoryConfigured);
    assertTrue("The ClientProxyFcatoryBean is not configured by the new configurer", isClientProxyFactoryBeanConfigured);
    getBus().setExtension(oldConfiguer, Configurer.class);
}
Also used : Configurer(org.apache.cxf.configuration.Configurer) URL(java.net.URL) Test(org.junit.Test)

Example 13 with Configurer

use of org.apache.cxf.configuration.Configurer in project cxf by apache.

the class WSAFeatureXmlTest method testServerFactory.

@Test
public void testServerFactory() {
    JaxWsServerFactoryBean sf = new JaxWsServerFactoryBean();
    assertNotNull(bus != null);
    sf.setServiceBean(new GreeterImpl());
    sf.setAddress("http://localhost:" + PORT + "/test");
    sf.setStart(false);
    Configurer c = getBus().getExtension(Configurer.class);
    c.configureBean("server", sf);
    Server server = sf.create();
    Endpoint endpoint = server.getEndpoint();
    checkAddressInterceptors(endpoint.getInInterceptors());
}
Also used : Server(org.apache.cxf.endpoint.Server) Endpoint(org.apache.cxf.endpoint.Endpoint) GreeterImpl(org.apache.hello_world_soap_http.GreeterImpl) Configurer(org.apache.cxf.configuration.Configurer) JaxWsServerFactoryBean(org.apache.cxf.jaxws.JaxWsServerFactoryBean) Test(org.junit.Test) AbstractCXFTest(org.apache.cxf.test.AbstractCXFTest)

Example 14 with Configurer

use of org.apache.cxf.configuration.Configurer in project jbossws-cxf by jbossws.

the class Helper method setBindingCustomizationOnClientSide.

/**
 * Setup binding customization on client side using the JBossWSConfigurer
 *
 * @throws Exception
 */
@SuppressWarnings("unchecked")
private Bus setBindingCustomizationOnClientSide() throws Exception {
    BindingCustomization jaxbCustomizations = new JAXBBindingCustomization();
    if (jaxbIntroUrl == null) {
        jaxbIntroUrl = Thread.currentThread().getContextClassLoader().getResource("jaxb-intros.xml");
    }
    BindingCustomizationFactory.populateBindingCustomization(jaxbIntroUrl.openStream(), jaxbCustomizations);
    Bus bus = BusFactory.newInstance().createBus();
    BusFactory.setThreadDefaultBus(bus);
    JBossWSConfigurer configurer = (JBossWSConfigurer) bus.getExtension(Configurer.class);
    configurer.getCustomizer().setBindingCustomization(jaxbCustomizations);
    return bus;
}
Also used : Bus(org.apache.cxf.Bus) JBossWSConfigurer(org.jboss.wsf.stack.cxf.client.configuration.JBossWSConfigurer) JAXBBindingCustomization(org.jboss.ws.api.binding.JAXBBindingCustomization) BindingCustomization(org.jboss.ws.api.binding.BindingCustomization) JAXBBindingCustomization(org.jboss.ws.api.binding.JAXBBindingCustomization) JBossWSConfigurer(org.jboss.wsf.stack.cxf.client.configuration.JBossWSConfigurer) Configurer(org.apache.cxf.configuration.Configurer)

Example 15 with Configurer

use of org.apache.cxf.configuration.Configurer in project jbossws-cxf by jbossws.

the class BusDeploymentAspect method startDeploymentBus.

private void startDeploymentBus(final Deployment dep) {
    BusFactory.setThreadDefaultBus(null);
    ClassLoader origClassLoader = SecurityActions.getContextClassLoader();
    try {
        final ArchiveDeployment aDep = (ArchiveDeployment) dep;
        final ResourceResolver deploymentResolver = aDep.getResourceResolver();
        final org.apache.cxf.resource.ResourceResolver resolver = new JBossWSResourceResolver(deploymentResolver);
        // set the runtime classloader (pointing to the deployment unit) to allow CXF accessing to the classes;
        // use origClassLoader (which on AS7 is set to ASIL aggregation module's classloader by TCCLDeploymentProcessor) as
        // parent to make sure user provided libs in the deployment do no mess up the WS endpoint's deploy if they duplicates
        // libraries already available on the application server modules.
        SecurityActions.setContextClassLoader(new DelegateClassLoader(dep.getClassLoader(), origClassLoader));
        DDBeans metadata = dep.getAttachment(DDBeans.class);
        BusHolder holder = new BusHolder(metadata);
        Configurer configurer = holder.createServerConfigurer(dep.getAttachment(BindingCustomization.class), new WSDLFilePublisher(aDep), aDep);
        holder.configure(resolver, configurer, dep.getAttachment(JBossWebservicesMetaData.class), dep);
        dep.addAttachment(BusHolder.class, holder);
    } finally {
        BusFactory.setThreadDefaultBus(null);
        SecurityActions.setContextClassLoader(origClassLoader);
    }
}
Also used : DDBeans(org.jboss.wsf.stack.cxf.metadata.services.DDBeans) BusHolder(org.jboss.wsf.stack.cxf.configuration.BusHolder) JBossWSResourceResolver(org.jboss.wsf.stack.cxf.resolver.JBossWSResourceResolver) ArchiveDeployment(org.jboss.wsf.spi.deployment.ArchiveDeployment) JBossWebservicesMetaData(org.jboss.wsf.spi.metadata.webservices.JBossWebservicesMetaData) ResourceResolver(org.jboss.wsf.spi.deployment.ResourceResolver) JBossWSResourceResolver(org.jboss.wsf.stack.cxf.resolver.JBossWSResourceResolver) DelegateClassLoader(org.jboss.ws.common.utils.DelegateClassLoader) DelegateClassLoader(org.jboss.ws.common.utils.DelegateClassLoader) Configurer(org.apache.cxf.configuration.Configurer) BindingCustomization(org.jboss.ws.api.binding.BindingCustomization) WSDLFilePublisher(org.jboss.wsf.stack.cxf.deployment.WSDLFilePublisher)

Aggregations

Configurer (org.apache.cxf.configuration.Configurer)15 Bus (org.apache.cxf.Bus)7 Before (org.junit.Before)4 Test (org.junit.Test)4 URL (java.net.URL)2 ResourceInjector (org.apache.cxf.common.injection.ResourceInjector)2 ConfigurerImpl (org.apache.cxf.configuration.spring.ConfigurerImpl)2 InstrumentationManager (org.apache.cxf.management.InstrumentationManager)2 ResourceResolver (org.apache.cxf.resource.ResourceResolver)2 SinglePropertyResolver (org.apache.cxf.resource.SinglePropertyResolver)2 AbstractCXFTest (org.apache.cxf.test.AbstractCXFTest)2 BindingCustomization (org.jboss.ws.api.binding.BindingCustomization)2 File (java.io.File)1 MalformedURLException (java.net.MalformedURLException)1 InvalidPropertyException (javax.resource.spi.InvalidPropertyException)1 QName (javax.xml.namespace.QName)1 BusException (org.apache.cxf.BusException)1 BindingFactoryManager (org.apache.cxf.binding.BindingFactoryManager)1 SpringBusFactory (org.apache.cxf.bus.spring.SpringBusFactory)1 BusLifeCycleManager (org.apache.cxf.buslifecycle.BusLifeCycleManager)1