Search in sources :

Example 31 with Feature

use of org.apache.cxf.feature.Feature in project tesb-rt-se by Talend.

the class JmsConfigurator method configureServerFactory.

public JaxWsServerFactoryBean configureServerFactory(JaxWsServerFactoryBean serverFactory) {
    if (jmsConfiguration == null || serverFactory == null || (serviceName == null && configuration == null)) {
        return null;
    }
    if (!jmsConfigured) {
        setupJmsConfiguration();
    }
    final JMSConfigFeature feature = new JMSConfigFeature();
    feature.setJmsConfig(jmsConfiguration);
    List<Feature> features = serverFactory.getFeatures();
    if (features == null) {
        features = new ArrayList<Feature>();
    }
    features.add(feature);
    serverFactory.setFeatures(features);
    return serverFactory;
}
Also used : JMSConfigFeature(org.apache.cxf.transport.jms.JMSConfigFeature) Feature(org.apache.cxf.feature.Feature) JMSConfigFeature(org.apache.cxf.transport.jms.JMSConfigFeature)

Example 32 with Feature

use of org.apache.cxf.feature.Feature in project tesb-rt-se by Talend.

the class CallContext method createCallbackProxy.

public <T> T createCallbackProxy(final Class<T> proxyInterface) {
    final JaxWsProxyFactoryBean callback = new JaxWsProxyFactoryBean();
    callback.setServiceName(serviceName);
    callback.setEndpointName(new QName(serviceName.getNamespaceURI(), serviceName.getLocalPart() + "Port"));
    callback.setAddress(replyToAddress);
    callback.setServiceClass(proxyInterface);
    final List<Feature> features = callback.getFeatures();
    features.add(new RequestCallbackFeature());
    if (logging) {
        features.add(new LoggingFeature());
    }
    if (serviceActivityMonitoring) {
        features.add(getEventFeature());
    }
    final Map<String, Object> properties = new HashMap<String, Object>();
    properties.put(RequestCallbackFeature.CALLCONTEXT_PROPERTY_NAME, this);
    callback.setProperties(properties);
    return callback.create(proxyInterface);
}
Also used : HashMap(java.util.HashMap) QName(javax.xml.namespace.QName) LoggingFeature(org.apache.cxf.feature.LoggingFeature) JaxWsProxyFactoryBean(org.apache.cxf.jaxws.JaxWsProxyFactoryBean) Feature(org.apache.cxf.feature.Feature) LoggingFeature(org.apache.cxf.feature.LoggingFeature)

Example 33 with Feature

use of org.apache.cxf.feature.Feature in project tesb-rt-se by Talend.

the class CallContext method setupEndpoint.

public static void setupEndpoint(final Endpoint endpoint) {
    if (!(endpoint instanceof EndpointImpl)) {
        throw new IllegalArgumentException("Only CXF JAX-WS endpoints supported. ");
    }
    final EndpointImpl ep = (EndpointImpl) endpoint;
    final List<Feature> features = new ArrayList<Feature>();
    features.add(new RequestCallbackFeature());
    if (logging) {
        features.add(new LoggingFeature());
    }
    if (serviceActivityMonitoring) {
        features.add(getEventFeature());
    }
    if (ep.getFeatures() != null) {
        features.addAll(ep.getFeatures());
    }
    ep.setFeatures(features);
    ep.getProperties().put(NULL_MEANS_ONEWAY, Boolean.TRUE);
}
Also used : EndpointImpl(org.apache.cxf.jaxws.EndpointImpl) LoggingFeature(org.apache.cxf.feature.LoggingFeature) ArrayList(java.util.ArrayList) Feature(org.apache.cxf.feature.Feature) LoggingFeature(org.apache.cxf.feature.LoggingFeature)

Example 34 with Feature

use of org.apache.cxf.feature.Feature in project fabric8 by fabric8io.

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) 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 35 with Feature

use of org.apache.cxf.feature.Feature in project fabric8 by fabric8io.

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

Feature (org.apache.cxf.feature.Feature)37 ArrayList (java.util.ArrayList)16 Bus (org.apache.cxf.Bus)8 Endpoint (org.apache.cxf.endpoint.Endpoint)7 EndpointImpl (org.apache.cxf.endpoint.EndpointImpl)7 List (java.util.List)6 Server (org.apache.cxf.endpoint.Server)6 AbstractFeature (org.apache.cxf.feature.AbstractFeature)6 LoggingFeature (org.apache.cxf.feature.LoggingFeature)6 IOException (java.io.IOException)5 QName (javax.xml.namespace.QName)5 Interceptor (org.apache.cxf.interceptor.Interceptor)5 Test (org.junit.Test)5 HashMap (java.util.HashMap)4 JAXRSServerFactoryBean (org.apache.cxf.jaxrs.JAXRSServerFactoryBean)4 Message (org.apache.cxf.message.Message)4 AbstractServiceFactoryBean (org.apache.cxf.service.factory.AbstractServiceFactoryBean)4 SingletonResourceProvider (org.apache.cxf.jaxrs.lifecycle.SingletonResourceProvider)3 EndpointImpl (org.apache.cxf.jaxws.EndpointImpl)3 FactoryBeanListener (org.apache.cxf.service.factory.FactoryBeanListener)3