Search in sources :

Example 6 with Feature

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

the class JmsConfiguratorTest method testCreateAndConfigureFactory.

@Test
public void testCreateAndConfigureFactory() {
    JaxWsServerFactoryBean factory = new JaxWsServerFactoryBean();
    factory.setServiceName(SERVICE_NAME);
    factory.setEndpointName(new QName(SERVICE_NS, "HelloWorldImplServiceInstance1"));
    JmsConfigurator jmsConfigurator = JmsConfigurator.create(factory);
    Assert.assertNotNull(jmsConfigurator);
    Assert.assertEquals("HelloWorldImplServiceInstance1", jmsConfigurator.getConfigurationPrefix());
    Assert.assertEquals(SERVICE_NAME, jmsConfigurator.getServiceName());
    JaxWsServerFactoryBean factory2 = jmsConfigurator.configureServerFactory(factory);
    Assert.assertNotNull(factory2);
    List<Feature> features = factory2.getFeatures();
    boolean jmsConfigFeaturePresent = false;
    for (Feature f : features) {
        if (f instanceof org.apache.cxf.transport.jms.JMSConfigFeature) {
            jmsConfigFeaturePresent = true;
            break;
        }
    }
    Assert.assertTrue(jmsConfigFeaturePresent);
}
Also used : QName(javax.xml.namespace.QName) JaxWsServerFactoryBean(org.apache.cxf.jaxws.JaxWsServerFactoryBean) Feature(org.apache.cxf.feature.Feature) JmsConfigurator(org.talend.esb.mep.requestcallback.beans.JmsConfigurator) Test(org.junit.Test)

Example 7 with Feature

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

the class JmsConfigurator method configureEndpoint.

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

Example 8 with Feature

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

the class CallContext method createCallbackEndpoint.

public static Endpoint createCallbackEndpoint(final Object implementor, final CallbackInfo cbInfo, final String policyAlias) {
    final Bus bus = BusFactory.getThreadDefaultBus();
    final JaxWsServerFactoryBean serverFactory = new JaxWsServerFactoryBean();
    final List<Feature> features = new ArrayList<Feature>();
    features.add(new RequestCallbackFeature());
    if (logging) {
        features.add(new LoggingFeature());
    }
    if (serviceActivityMonitoring) {
        features.add(getEventFeature());
    }
    serverFactory.setFeatures(features);
    final QName cbInterfaceName;
    final String wsdlLocation;
    if (cbInfo == null) {
        cbInterfaceName = null;
        wsdlLocation = null;
    } else {
        cbInterfaceName = cbInfo.getCallbackPortTypeName();
        wsdlLocation = cbInfo.getEffectiveCallbackReceiverWsdlLocation(policyAlias);
    }
    final boolean useWsdlLocation = wsdlLocation != null && cbInfo.getCallbackServiceName() != null && cbInfo.getCallbackPortName() != null;
    if (cbInterfaceName != null) {
        final QName cbServiceName = cbInfo.getCallbackServiceName() == null ? new QName(cbInterfaceName.getNamespaceURI(), cbInterfaceName.getLocalPart() + "Service") : cbInfo.getCallbackServiceName();
        final QName cbEndpointName = cbInfo.getCallbackServiceName() == null ? new QName(cbInterfaceName.getNamespaceURI(), cbInterfaceName.getLocalPart() + "ServicePort") : new QName(cbServiceName.getNamespaceURI(), cbInfo.getCallbackPortName() == null ? cbServiceName.getLocalPart() + "Port" : cbInfo.getCallbackPortName());
        serverFactory.setServiceName(cbServiceName);
        serverFactory.setEndpointName(cbEndpointName);
        final List<AbstractServiceConfiguration> svcConfigs = serverFactory.getServiceFactory().getServiceConfigurations();
        for (ListIterator<AbstractServiceConfiguration> it = svcConfigs.listIterator(); it.hasNext(); ) {
            final AbstractServiceConfiguration cfg = it.next();
            if (cfg instanceof DefaultServiceConfiguration) {
                final AbstractServiceConfiguration ncfg = new CallbackDefaultServiceConfiguration(cbInfo);
                it.set(ncfg);
            }
        }
        if (useWsdlLocation) {
            serverFactory.setWsdlLocation(wsdlLocation);
        }
    }
    final EndpointImpl endpoint = new EndpointImpl(bus, implementor, serverFactory);
    endpoint.setFeatures(features);
    endpoint.getProperties().put(NULL_MEANS_ONEWAY, Boolean.TRUE);
    if (cbInterfaceName != null) {
        endpoint.setEndpointName(serverFactory.getEndpointName());
        endpoint.setServiceName(serverFactory.getServiceName());
        if (useWsdlLocation) {
            endpoint.setWsdlLocation(wsdlLocation);
        }
    }
    return endpoint;
}
Also used : Bus(org.apache.cxf.Bus) QName(javax.xml.namespace.QName) EndpointImpl(org.apache.cxf.jaxws.EndpointImpl) ArrayList(java.util.ArrayList) Feature(org.apache.cxf.feature.Feature) LoggingFeature(org.apache.cxf.feature.LoggingFeature) DefaultServiceConfiguration(org.apache.cxf.wsdl.service.factory.DefaultServiceConfiguration) CallbackDefaultServiceConfiguration(org.talend.esb.mep.requestcallback.impl.wsdl.CallbackDefaultServiceConfiguration) AbstractServiceConfiguration(org.apache.cxf.wsdl.service.factory.AbstractServiceConfiguration) LoggingFeature(org.apache.cxf.feature.LoggingFeature) CallbackDefaultServiceConfiguration(org.talend.esb.mep.requestcallback.impl.wsdl.CallbackDefaultServiceConfiguration) JaxWsServerFactoryBean(org.apache.cxf.jaxws.JaxWsServerFactoryBean)

Example 9 with Feature

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

the class CallContext method setupServerFactory.

public static void setupServerFactory(final JaxWsServerFactoryBean serverFactory) {
    final List<Feature> features = serverFactory.getFeatures();
    features.add(new RequestCallbackFeature());
    if (logging) {
        features.add(new LoggingFeature());
    }
    if (serviceActivityMonitoring) {
        features.add(getEventFeature());
    }
    serverFactory.getProperties(true).put(NULL_MEANS_ONEWAY, Boolean.TRUE);
}
Also used : LoggingFeature(org.apache.cxf.feature.LoggingFeature) Feature(org.apache.cxf.feature.Feature) LoggingFeature(org.apache.cxf.feature.LoggingFeature)

Example 10 with Feature

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

the class RuntimeESBConsumerTest method noPropertiesSetProvidesEmptyArgumentList.

@Test
public void noPropertiesSetProvidesEmptyArgumentList() throws Exception {
    QName serviceName = new QName("http://services.talend.org/test/Library/1.0", "LibraryProvider");
    QName portName = new QName("http://services.talend.org/test/Library/1.0", "LibraryHttpPort");
    QName operationName = new QName("http://services.talend.org/test/Library/1.0", "seekBook");
    String publishedEndpointUrl = "local://LibraryHttpPort";
    String wsdlURL = "classpath:/conf/libraryService/Library.wsdl";
    boolean useServiceLocator = false;
    LocatorFeature locatorFeature = null;
    Map<String, String> locatorProps = new HashMap<String, String>();
    EventFeature samFeature = null;
    Map<String, String> samProps = new HashMap<String, String>();
    boolean useServiceRegistry = false;
    EsbSecurity esbSecurity = null;
    Policy policy = null;
    String username = "";
    String password = "";
    String alias = "";
    Map<String, String> clientProperties = new HashMap<String, String>();
    String roleName = "";
    Object securityToken = null;
    Crypto cryptoProvider = null;
    SecurityArguments securityArguments = new SecurityArguments(esbSecurity, policy, username, password, alias, clientProperties, roleName, securityToken, cryptoProvider);
    Bus bus = null;
    boolean logging = false;
    List<Header> soapHeaders = new ArrayList<Header>();
    Feature httpHeadersFeature = null;
    boolean enhancedResponse = false;
    Object correlationIDCallbackHandler = null;
    final boolean useGZipCompression = false;
    RuntimeESBConsumer consumer = new RuntimeESBConsumer(serviceName, portName, operationName, publishedEndpointUrl, wsdlURL, useServiceLocator, locatorFeature, locatorProps, samFeature, samProps, useServiceRegistry, securityArguments, bus, logging, soapHeaders, httpHeadersFeature, enhancedResponse, correlationIDCallbackHandler, useGZipCompression);
    String requestString = "<ns2:SearchFor xmlns:ns2=\"http://types.talend.org/test/Library/Common/1.0\" " + "xmlns:ns3=\"http://types.talend.org/test/GeneralObjects/ErrorHandling/1.0\">" + "<AuthorLastName>Icebear</AuthorLastName><ISBNNumber>123</ISBNNumber></ns2:SearchFor>";
    consumer.invoke(getDocumentFromString(requestString));
}
Also used : Policy(org.apache.neethi.Policy) Bus(org.apache.cxf.Bus) HashMap(java.util.HashMap) QName(javax.xml.namespace.QName) ArrayList(java.util.ArrayList) EventFeature(org.talend.esb.sam.agent.feature.EventFeature) EventFeature(org.talend.esb.sam.agent.feature.EventFeature) LocatorFeature(org.talend.esb.servicelocator.cxf.LocatorFeature) Feature(org.apache.cxf.feature.Feature) Crypto(org.apache.wss4j.common.crypto.Crypto) Header(org.apache.cxf.headers.Header) EsbSecurity(org.talend.esb.job.controller.ESBEndpointConstants.EsbSecurity) LocatorFeature(org.talend.esb.servicelocator.cxf.LocatorFeature) Test(org.junit.Test)

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