Search in sources :

Example 1 with JBossWSDestinationRegistryImpl

use of org.jboss.wsf.stack.cxf.transport.JBossWSDestinationRegistryImpl in project jbossws-cxf by jbossws.

the class ServerBeanCustomizer method customize.

@Override
public void customize(Object beanInstance) {
    if (beanInstance instanceof EndpointImpl) {
        configureEndpoint((EndpointImpl) beanInstance);
    }
    if (beanInstance instanceof ServerFactoryBean) {
        ServerFactoryBean factory = (ServerFactoryBean) beanInstance;
        if (factory.getInvoker() instanceof JBossWSInvoker) {
            ((JBossWSInvoker) factory.getInvoker()).setTargetBean(factory.getServiceBean());
        }
        List<Endpoint> depEndpoints = dep.getService().getEndpoints();
        if (depEndpoints != null) {
            final String targetBeanName = factory.getServiceBean().getClass().getName();
            for (Endpoint depEndpoint : depEndpoints) {
                if (depEndpoint.getTargetBeanClass().getName().equals(targetBeanName)) {
                    depEndpoint.addAttachment(Object.class, factory.getServiceBean());
                }
            }
        }
    }
    if (beanInstance instanceof ServiceImpl) {
        ServiceImpl service = (ServiceImpl) beanInstance;
        List<Endpoint> depEndpoints = dep.getService().getEndpoints();
        if (depEndpoints != null) {
            final Collection<org.apache.cxf.endpoint.Endpoint> eps = service.getEndpoints().values();
            for (Endpoint depEp : depEndpoints) {
                for (org.apache.cxf.endpoint.Endpoint ep : eps) {
                    if (ep.getService().getName().equals(depEp.getProperty(Message.WSDL_SERVICE)) && ep.getEndpointInfo().getName().equals(depEp.getProperty(Message.WSDL_PORT)) && ep.getEndpointInfo().getAddress().equals(depEp.getAddress())) {
                        depEp.addAttachment(org.apache.cxf.endpoint.Endpoint.class, ep);
                    }
                }
            }
        }
    }
    if (beanInstance instanceof HTTPTransportFactory) {
        HTTPTransportFactory factory = (HTTPTransportFactory) beanInstance;
        DestinationRegistry oldRegistry = factory.getRegistry();
        if (!(oldRegistry instanceof JBossWSDestinationRegistryImpl)) {
            factory.setRegistry(new JBossWSDestinationRegistryImpl());
        }
    }
    super.customize(beanInstance);
}
Also used : DestinationRegistry(org.apache.cxf.transport.http.DestinationRegistry) ServiceImpl(org.apache.cxf.service.ServiceImpl) EndpointImpl(org.jboss.wsf.stack.cxf.deployment.EndpointImpl) JaxWsEndpointImpl(org.apache.cxf.jaxws.support.JaxWsEndpointImpl) HTTPTransportFactory(org.apache.cxf.transport.http.HTTPTransportFactory) ServerFactoryBean(org.apache.cxf.frontend.ServerFactoryBean) JBossWSInvoker(org.jboss.wsf.stack.cxf.JBossWSInvoker) Endpoint(org.jboss.wsf.spi.deployment.Endpoint) DefaultHttpEndpoint(org.jboss.ws.common.deployment.DefaultHttpEndpoint) JBossWSDestinationRegistryImpl(org.jboss.wsf.stack.cxf.transport.JBossWSDestinationRegistryImpl)

Aggregations

ServerFactoryBean (org.apache.cxf.frontend.ServerFactoryBean)1 JaxWsEndpointImpl (org.apache.cxf.jaxws.support.JaxWsEndpointImpl)1 ServiceImpl (org.apache.cxf.service.ServiceImpl)1 DestinationRegistry (org.apache.cxf.transport.http.DestinationRegistry)1 HTTPTransportFactory (org.apache.cxf.transport.http.HTTPTransportFactory)1 DefaultHttpEndpoint (org.jboss.ws.common.deployment.DefaultHttpEndpoint)1 Endpoint (org.jboss.wsf.spi.deployment.Endpoint)1 JBossWSInvoker (org.jboss.wsf.stack.cxf.JBossWSInvoker)1 EndpointImpl (org.jboss.wsf.stack.cxf.deployment.EndpointImpl)1 JBossWSDestinationRegistryImpl (org.jboss.wsf.stack.cxf.transport.JBossWSDestinationRegistryImpl)1