Search in sources :

Example 26 with EndpointImpl

use of org.apache.cxf.endpoint.EndpointImpl in project cxf by apache.

the class AbstractSTSTokenTest method prepareMessage.

static MessageImpl prepareMessage(Bus bus, STSClient stsClient, String serviceAddress) throws EndpointException {
    MessageImpl message = new MessageImpl();
    message.put(SecurityConstants.STS_CLIENT, stsClient);
    message.put(Message.ENDPOINT_ADDRESS, serviceAddress);
    Exchange exchange = new ExchangeImpl();
    ServiceInfo si = new ServiceInfo();
    si.setName(new QName("http://www.apache.org", "ServiceName"));
    Service s = new ServiceImpl(si);
    EndpointInfo ei = new EndpointInfo();
    ei.setName(new QName("http://www.apache.org", "EndpointName"));
    Endpoint ep = new EndpointImpl(bus, s, ei);
    ei.setBinding(new BindingInfo(si, null));
    message.setExchange(exchange);
    exchange.put(Endpoint.class, ep);
    return message;
}
Also used : Exchange(org.apache.cxf.message.Exchange) ServiceInfo(org.apache.cxf.service.model.ServiceInfo) EndpointInfo(org.apache.cxf.service.model.EndpointInfo) Endpoint(org.apache.cxf.endpoint.Endpoint) QName(javax.xml.namespace.QName) ServiceImpl(org.apache.cxf.service.ServiceImpl) EndpointImpl(org.apache.cxf.endpoint.EndpointImpl) BindingInfo(org.apache.cxf.service.model.BindingInfo) Service(org.apache.cxf.service.Service) MessageImpl(org.apache.cxf.message.MessageImpl) ExchangeImpl(org.apache.cxf.message.ExchangeImpl)

Example 27 with EndpointImpl

use of org.apache.cxf.endpoint.EndpointImpl in project tesb-rt-se by Talend.

the class MessageToEventMapperTest method getTestMessage.

private Message getTestMessage() throws IOException, EndpointException {
    Message message = new MessageImpl();
    ExchangeImpl exchange = new ExchangeImpl();
    ServiceInfo serviceInfo = new ServiceInfo();
    InterfaceInfo interfaceInfo = new InterfaceInfo(serviceInfo, new QName("interfaceNs", "interfaceName"));
    serviceInfo.setInterface(interfaceInfo);
    SoapBindingInfo bInfo = new SoapBindingInfo(serviceInfo, WSDLConstants.NS_SOAP12);
    bInfo.setTransportURI(TransportType);
    OperationInfo opInfo = new OperationInfo();
    opInfo.setName(new QName("namespace", "opName"));
    BindingOperationInfo bindingOpInfo = new BindingOperationInfo(bInfo, opInfo);
    exchange.put(BindingOperationInfo.class, bindingOpInfo);
    SoapBinding binding = new SoapBinding(bInfo);
    exchange.put(Binding.class, binding);
    String ns = "ns";
    EndpointInfo ei = new EndpointInfo(serviceInfo, ns);
    ei.setAddress(Address);
    Service service = new ServiceImpl();
    Bus bus = BusFactory.getThreadDefaultBus();
    Endpoint endpoint = new EndpointImpl(bus, service, ei);
    exchange.put(Endpoint.class, endpoint);
    message.setExchange(exchange);
    FlowIdHelper.setFlowId(message, FlowID);
    Principal principal = new X500Principal(PrincipalString);
    SecurityContext sc = new DefaultSecurityContext(principal, new Subject());
    message.put(SecurityContext.class, sc);
    CachedOutputStream cos = new CachedOutputStream();
    InputStream is = new ByteArrayInputStream(TESTCONTENT.getBytes("UTF-8"));
    IOUtils.copy(is, cos);
    message.setContent(CachedOutputStream.class, cos);
    CustomInfo customInfo = CustomInfo.getOrCreateCustomInfo(message);
    customInfo.put("key1", "value1");
    return message;
}
Also used : BindingOperationInfo(org.apache.cxf.service.model.BindingOperationInfo) OperationInfo(org.apache.cxf.service.model.OperationInfo) DefaultSecurityContext(org.apache.cxf.interceptor.security.DefaultSecurityContext) BindingOperationInfo(org.apache.cxf.service.model.BindingOperationInfo) Message(org.apache.cxf.message.Message) CachedOutputStream(org.apache.cxf.io.CachedOutputStream) ServiceInfo(org.apache.cxf.service.model.ServiceInfo) EndpointInfo(org.apache.cxf.service.model.EndpointInfo) Endpoint(org.apache.cxf.endpoint.Endpoint) CustomInfo(org.talend.esb.sam.agent.message.CustomInfo) Bus(org.apache.cxf.Bus) QName(javax.xml.namespace.QName) ServiceImpl(org.apache.cxf.service.ServiceImpl) ByteArrayInputStream(java.io.ByteArrayInputStream) InputStream(java.io.InputStream) EndpointImpl(org.apache.cxf.endpoint.EndpointImpl) Service(org.apache.cxf.service.Service) SoapBinding(org.apache.cxf.binding.soap.SoapBinding) Subject(javax.security.auth.Subject) ByteArrayInputStream(java.io.ByteArrayInputStream) SoapBindingInfo(org.apache.cxf.binding.soap.model.SoapBindingInfo) DefaultSecurityContext(org.apache.cxf.interceptor.security.DefaultSecurityContext) SecurityContext(org.apache.cxf.security.SecurityContext) X500Principal(javax.security.auth.x500.X500Principal) InterfaceInfo(org.apache.cxf.service.model.InterfaceInfo) MessageImpl(org.apache.cxf.message.MessageImpl) ExchangeImpl(org.apache.cxf.message.ExchangeImpl) X500Principal(javax.security.auth.x500.X500Principal) Principal(java.security.Principal)

Example 28 with EndpointImpl

use of org.apache.cxf.endpoint.EndpointImpl 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 29 with EndpointImpl

use of org.apache.cxf.endpoint.EndpointImpl 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)

Example 30 with EndpointImpl

use of org.apache.cxf.endpoint.EndpointImpl 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

EndpointImpl (org.apache.cxf.endpoint.EndpointImpl)31 Endpoint (org.apache.cxf.endpoint.Endpoint)24 EndpointInfo (org.apache.cxf.service.model.EndpointInfo)18 Service (org.apache.cxf.service.Service)14 ExchangeImpl (org.apache.cxf.message.ExchangeImpl)13 QName (javax.xml.namespace.QName)12 Exchange (org.apache.cxf.message.Exchange)12 MessageImpl (org.apache.cxf.message.MessageImpl)12 WSDLServiceFactory (org.apache.cxf.wsdl11.WSDLServiceFactory)9 ServiceInfo (org.apache.cxf.service.model.ServiceInfo)8 Feature (org.apache.cxf.feature.Feature)7 ServiceImpl (org.apache.cxf.service.ServiceImpl)7 BindingInfo (org.apache.cxf.service.model.BindingInfo)7 Bus (org.apache.cxf.Bus)6 Message (org.apache.cxf.message.Message)6 ArrayList (java.util.ArrayList)5 SoapBindingInfo (org.apache.cxf.binding.soap.model.SoapBindingInfo)5 AbstractFeature (org.apache.cxf.feature.AbstractFeature)5 List (java.util.List)4 SourceDataBinding (org.apache.cxf.databinding.source.SourceDataBinding)4