Search in sources :

Example 1 with AbstractServiceFactoryBean

use of org.apache.cxf.service.factory.AbstractServiceFactoryBean in project fabric8 by jboss-fuse.

the class ManagedApiFeature method initializeProvider.

@Override
protected void initializeProvider(InterceptorProvider provider, final Bus bus) {
    if (provider instanceof Endpoint) {
        EndpointImpl endpointImpl = (EndpointImpl) provider;
        List<Feature> features = endpointImpl.getActiveFeatures();
        if (features == null) {
            features = new ArrayList<Feature>();
            features.add(this);
            endpointImpl.initializeActiveFeatures(features);
        } else {
            features.add(this);
        }
    } else if (provider instanceof Bus) {
        FactoryBeanListenerManager factoryBeanListenerManager = bus.getExtension(FactoryBeanListenerManager.class);
        if (factoryBeanListenerManager == null) {
            factoryBeanListenerManager = new FactoryBeanListenerManager(bus);
        }
        factoryBeanListenerManager.addListener(new FactoryBeanListener() {

            @Override
            public void handleEvent(Event arg0, AbstractServiceFactoryBean arg1, Object... arg2) {
                if (arg0.equals(Event.SERVER_CREATED) && (arg2[0] instanceof Server)) {
                    Server server = (Server) arg2[0];
                    initialize(server, bus);
                }
            }
        });
    } else {
        List<Feature> features = (List<Feature>) bus.getFeatures();
        if (features == null) {
            features = new ArrayList<Feature>();
            features.add(this);
        } else {
            features.add(this);
        }
    }
}
Also used : AbstractServiceFactoryBean(org.apache.cxf.service.factory.AbstractServiceFactoryBean) Bus(org.apache.cxf.Bus) MBeanServer(javax.management.MBeanServer) Server(org.apache.cxf.endpoint.Server) EndpointImpl(org.apache.cxf.endpoint.EndpointImpl) ArrayList(java.util.ArrayList) Feature(org.apache.cxf.feature.Feature) AbstractFeature(org.apache.cxf.feature.AbstractFeature) FactoryBeanListenerManager(org.apache.cxf.service.factory.FactoryBeanListenerManager) Endpoint(org.apache.cxf.endpoint.Endpoint) ArrayList(java.util.ArrayList) List(java.util.List) FactoryBeanListener(org.apache.cxf.service.factory.FactoryBeanListener)

Example 2 with AbstractServiceFactoryBean

use of org.apache.cxf.service.factory.AbstractServiceFactoryBean in project fabric8 by fabric8io.

the class ManagedApiFeature method initialize.

@Override
public void initialize(final Bus bus) {
    FactoryBeanListenerManager factoryBeanListenerManager = bus.getExtension(FactoryBeanListenerManager.class);
    if (factoryBeanListenerManager == null) {
        factoryBeanListenerManager = new FactoryBeanListenerManager(bus);
    }
    factoryBeanListenerManager.addListener(new FactoryBeanListener() {

        @Override
        public void handleEvent(Event arg0, AbstractServiceFactoryBean arg1, Object... arg2) {
            if (arg0.equals(Event.SERVER_CREATED) && (arg2[0] instanceof Server)) {
                Server server = (Server) arg2[0];
                initialize(server, bus);
            }
        }
    });
}
Also used : AbstractServiceFactoryBean(org.apache.cxf.service.factory.AbstractServiceFactoryBean) Server(org.apache.cxf.endpoint.Server) FactoryBeanListener(org.apache.cxf.service.factory.FactoryBeanListener) FactoryBeanListenerManager(org.apache.cxf.service.factory.FactoryBeanListenerManager)

Example 3 with AbstractServiceFactoryBean

use of org.apache.cxf.service.factory.AbstractServiceFactoryBean in project cxf by apache.

the class ServiceImpl method createDispatchService.

private AbstractServiceFactoryBean createDispatchService(DataBinding db) {
    AbstractServiceFactoryBean serviceFactory;
    final Service dispatchService;
    if (null != wsdlURL) {
        WSDLServiceFactory sf = new WSDLServiceFactory(bus, wsdlURL, serviceName);
        dispatchService = sf.create();
        dispatchService.setDataBinding(db);
        serviceFactory = sf;
    } else {
        ReflectionServiceFactoryBean sf = new JaxWsServiceFactoryBean();
        sf.setBus(bus);
        sf.setServiceName(serviceName);
        // maybe we can find another way to create service which have no SEI
        sf.setServiceClass(DummyImpl.class);
        sf.setDataBinding(db);
        dispatchService = sf.create();
        serviceFactory = sf;
    }
    configureObject(dispatchService);
    for (ServiceInfo si : dispatchService.getServiceInfos()) {
        si.setProperty("soap.force.doclit.bare", Boolean.TRUE);
        if (null == wsdlURL) {
            for (EndpointInfo ei : si.getEndpoints()) {
                ei.setProperty("soap.no.validate.parts", Boolean.TRUE);
            }
        }
        for (BindingInfo bind : si.getBindings()) {
            for (BindingOperationInfo bop : bind.getOperations()) {
                // force to bare, no unwrapping
                if (bop.isUnwrappedCapable()) {
                    bop.getOperationInfo().setUnwrappedOperation(null);
                    bop.setUnwrappedOperation(null);
                }
            }
        }
    }
    return serviceFactory;
}
Also used : AbstractServiceFactoryBean(org.apache.cxf.service.factory.AbstractServiceFactoryBean) ServiceInfo(org.apache.cxf.service.model.ServiceInfo) EndpointInfo(org.apache.cxf.service.model.EndpointInfo) BindingOperationInfo(org.apache.cxf.service.model.BindingOperationInfo) WSDLServiceFactory(org.apache.cxf.wsdl11.WSDLServiceFactory) JaxWsServiceFactoryBean(org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean) BindingInfo(org.apache.cxf.service.model.BindingInfo) Service(org.apache.cxf.service.Service) WebService(javax.jws.WebService) ReflectionServiceFactoryBean(org.apache.cxf.wsdl.service.factory.ReflectionServiceFactoryBean)

Example 4 with AbstractServiceFactoryBean

use of org.apache.cxf.service.factory.AbstractServiceFactoryBean in project fabric8 by jboss-fuse.

the class ManagedApiFeature method initialize.

@Override
public void initialize(final Bus bus) {
    FactoryBeanListenerManager factoryBeanListenerManager = bus.getExtension(FactoryBeanListenerManager.class);
    if (factoryBeanListenerManager == null) {
        factoryBeanListenerManager = new FactoryBeanListenerManager(bus);
    }
    factoryBeanListenerManager.addListener(new FactoryBeanListener() {

        @Override
        public void handleEvent(Event arg0, AbstractServiceFactoryBean arg1, Object... arg2) {
            if (arg0.equals(Event.SERVER_CREATED) && (arg2[0] instanceof Server)) {
                Server server = (Server) arg2[0];
                initialize(server, bus);
            }
        }
    });
}
Also used : AbstractServiceFactoryBean(org.apache.cxf.service.factory.AbstractServiceFactoryBean) MBeanServer(javax.management.MBeanServer) Server(org.apache.cxf.endpoint.Server) FactoryBeanListener(org.apache.cxf.service.factory.FactoryBeanListener) FactoryBeanListenerManager(org.apache.cxf.service.factory.FactoryBeanListenerManager)

Example 5 with AbstractServiceFactoryBean

use of org.apache.cxf.service.factory.AbstractServiceFactoryBean in project fabric8 by jboss-fuse.

the class SwaggerFeature method initializeProvider.

@Override
protected void initializeProvider(InterceptorProvider provider, final Bus bus) {
    if (!(provider instanceof Endpoint)) {
        FactoryBeanListenerManager factoryBeanListenerManager = bus.getExtension(FactoryBeanListenerManager.class);
        if (factoryBeanListenerManager == null) {
            factoryBeanListenerManager = new FactoryBeanListenerManager(bus);
        }
        factoryBeanListenerManager.addListener(new FactoryBeanListener() {

            @Override
            public void handleEvent(Event arg0, AbstractServiceFactoryBean arg1, Object... arg2) {
                if (arg0.equals(Event.SERVER_CREATED) && (arg2[0] instanceof Server)) {
                    Server server = (Server) arg2[0];
                    if (server.getEndpoint().getEndpointInfo().getBinding().getBindingId().equals("http://apache.org/cxf/binding/jaxrs")) {
                        initialize(server, bus);
                    }
                }
            }
        });
        return;
    }
    EndpointImpl endpointImpl = (EndpointImpl) provider;
    List<Feature> features = endpointImpl.getActiveFeatures();
    if (features == null) {
        features = new ArrayList<Feature>();
        features.add(this);
        endpointImpl.initializeActiveFeatures(features);
    } else {
        features.add(this);
    }
}
Also used : AbstractServiceFactoryBean(org.apache.cxf.service.factory.AbstractServiceFactoryBean) Endpoint(org.apache.cxf.endpoint.Endpoint) Server(org.apache.cxf.endpoint.Server) EndpointImpl(org.apache.cxf.endpoint.EndpointImpl) FactoryBeanListener(org.apache.cxf.service.factory.FactoryBeanListener) Feature(org.apache.cxf.feature.Feature) FactoryBeanListenerManager(org.apache.cxf.service.factory.FactoryBeanListenerManager)

Aggregations

AbstractServiceFactoryBean (org.apache.cxf.service.factory.AbstractServiceFactoryBean)8 Server (org.apache.cxf.endpoint.Server)6 FactoryBeanListener (org.apache.cxf.service.factory.FactoryBeanListener)6 FactoryBeanListenerManager (org.apache.cxf.service.factory.FactoryBeanListenerManager)6 Feature (org.apache.cxf.feature.Feature)5 Endpoint (org.apache.cxf.endpoint.Endpoint)4 EndpointImpl (org.apache.cxf.endpoint.EndpointImpl)4 Bus (org.apache.cxf.Bus)3 ArrayList (java.util.ArrayList)2 List (java.util.List)2 MBeanServer (javax.management.MBeanServer)2 AbstractFeature (org.apache.cxf.feature.AbstractFeature)2 WebService (javax.jws.WebService)1 WebServiceException (javax.xml.ws.WebServiceException)1 WebServiceFeature (javax.xml.ws.WebServiceFeature)1 Handler (javax.xml.ws.handler.Handler)1 DataBinding (org.apache.cxf.databinding.DataBinding)1 SourceDataBinding (org.apache.cxf.databinding.source.SourceDataBinding)1 Client (org.apache.cxf.endpoint.Client)1 ClientImpl (org.apache.cxf.endpoint.ClientImpl)1