Search in sources :

Example 11 with EndpointImpl

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

the class ReflectionServiceFactoryBean method createEndpoint.

public Endpoint createEndpoint(EndpointInfo ei) throws EndpointException {
    Endpoint ep = new EndpointImpl(getBus(), getService(), ei);
    sendEvent(Event.ENDPOINT_CREATED, ei, ep, getServiceClass());
    return ep;
}
Also used : Endpoint(org.apache.cxf.endpoint.Endpoint) EndpointImpl(org.apache.cxf.endpoint.EndpointImpl)

Example 12 with EndpointImpl

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

the class SimpleBatchSTSClient method createClient.

protected void createClient() throws BusException, EndpointException {
    if (client != null) {
        return;
    }
    bus.getExtension(Configurer.class).configureBean(name, this);
    if (wsdlLocation != null) {
        WSDLServiceFactory factory = new WSDLServiceFactory(bus, wsdlLocation, serviceName);
        SourceDataBinding dataBinding = new SourceDataBinding();
        factory.setDataBinding(dataBinding);
        Service service = factory.create();
        service.setDataBinding(dataBinding);
        EndpointInfo ei = service.getEndpointInfo(endpointName);
        Endpoint endpoint = new EndpointImpl(bus, service, ei);
        client = new ClientImpl(bus, endpoint);
    } else {
        Endpoint endpoint = STSUtils.createSTSEndpoint(bus, namespace, null, location, soapVersion, policy, endpointName);
        client = new ClientImpl(bus, endpoint);
    }
    client.getInFaultInterceptors().addAll(inFault);
    client.getInInterceptors().addAll(in);
    client.getOutInterceptors().addAll(out);
    client.getOutFaultInterceptors().addAll(outFault);
    in = null;
    out = null;
    inFault = null;
    outFault = null;
    if (features != null) {
        for (AbstractFeature f : features) {
            f.initialize(client, bus);
        }
    }
}
Also used : EndpointInfo(org.apache.cxf.service.model.EndpointInfo) WSDLServiceFactory(org.apache.cxf.wsdl11.WSDLServiceFactory) Endpoint(org.apache.cxf.endpoint.Endpoint) EndpointImpl(org.apache.cxf.endpoint.EndpointImpl) Service(org.apache.cxf.service.Service) ClientImpl(org.apache.cxf.endpoint.ClientImpl) AbstractFeature(org.apache.cxf.feature.AbstractFeature) Configurer(org.apache.cxf.configuration.Configurer) SourceDataBinding(org.apache.cxf.databinding.source.SourceDataBinding)

Example 13 with EndpointImpl

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

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

the class STSTokenOutInterceptorTest method prepareMessage.

private 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();
    Service s = new ServiceImpl(si);
    EndpointInfo ei = new EndpointInfo();
    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) 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 15 with EndpointImpl

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

the class TestBase method setUp.

@Before
public void setUp() throws Exception {
    bus = BusFactory.newInstance().createBus();
    BindingFactoryManager bfm = bus.getExtension(BindingFactoryManager.class);
    IMocksControl control = createNiceControl();
    BindingFactory bf = control.createMock(BindingFactory.class);
    Binding binding = control.createMock(Binding.class);
    expect(bf.createBinding(null)).andStubReturn(binding);
    expect(binding.getInFaultInterceptors()).andStubReturn(new ArrayList<Interceptor<? extends Message>>());
    expect(binding.getOutFaultInterceptors()).andStubReturn(new ArrayList<Interceptor<? extends Message>>());
    bfm.registerBindingFactory("http://schemas.xmlsoap.org/wsdl/soap/", bf);
    String ns = "http://apache.org/hello_world_soap_http";
    WSDLServiceFactory factory = new WSDLServiceFactory(bus, getClass().getResource("/org/apache/cxf/jaxb/resources/wsdl/hello_world.wsdl").toString(), new QName(ns, "SOAPService"));
    service = factory.create();
    endpointInfo = service.getEndpointInfo(new QName(ns, "SoapPort"));
    endpoint = new EndpointImpl(bus, service, endpointInfo);
    JAXBDataBinding db = new JAXBDataBinding();
    db.setContext(JAXBContext.newInstance(new Class[] { GreetMe.class, GreetMeResponse.class }));
    service.setDataBinding(db);
    operation = endpointInfo.getBinding().getOperation(new QName(ns, "greetMe"));
    operation.getOperationInfo().getInput().getMessagePartByIndex(0).setTypeClass(GreetMe.class);
    operation.getOperationInfo().getOutput().getMessagePartByIndex(0).setTypeClass(GreetMeResponse.class);
    message = new MessageImpl();
    Exchange exchange = new ExchangeImpl();
    message.setExchange(exchange);
    exchange.put(Service.class, service);
    exchange.put(Endpoint.class, endpoint);
    exchange.put(Binding.class, endpoint.getBinding());
}
Also used : Binding(org.apache.cxf.binding.Binding) GreetMe(org.apache.hello_world_soap_http.types.GreetMe) WSDLServiceFactory(org.apache.cxf.wsdl11.WSDLServiceFactory) Message(org.apache.cxf.message.Message) QName(javax.xml.namespace.QName) EndpointImpl(org.apache.cxf.endpoint.EndpointImpl) BindingFactoryManager(org.apache.cxf.binding.BindingFactoryManager) GreetMeResponse(org.apache.hello_world_soap_http.types.GreetMeResponse) IMocksControl(org.easymock.IMocksControl) Exchange(org.apache.cxf.message.Exchange) Interceptor(org.apache.cxf.interceptor.Interceptor) MessageImpl(org.apache.cxf.message.MessageImpl) ExchangeImpl(org.apache.cxf.message.ExchangeImpl) BindingFactory(org.apache.cxf.binding.BindingFactory) Before(org.junit.Before)

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