Package org.apache.cxf.frontend

Examples of org.apache.cxf.frontend.ServerFactoryBean


        }

        // create server factory bean
        // Shouldn't use CxfEndpointUtils.getServerFactoryBean(cls) as it is for
        // CxfSoapComponent
        ServerFactoryBean answer = null;

        if (cls == null) {
            checkName(portName, " endpoint/port name");
            checkName(serviceName, " service name");
            answer = new ServerFactoryBean(new WSDLServiceFactoryBean());
        } else if (CxfEndpointUtils.hasWebServiceAnnotation(cls)) {
            answer = new JaxWsServerFactoryBean();
        } else {
            answer = new ServerFactoryBean();
        }

        // setup server factory bean
        setupServerFactoryBean(answer, cls);
        return answer;
View Full Code Here


        }
       
        // create server factory bean
        // Shouldn't use CxfEndpointUtils.getServerFactoryBean(cls) as it is for
        // CxfSoapComponent
        ServerFactoryBean answer = null;
       
        if (cls == null) {
            ObjectHelper.notNull(portName, "Please provide endpoint/port name");
            ObjectHelper.notNull(serviceName, "Please provide service name");
            answer = new ServerFactoryBean(new WSDLServiceFactoryBean());
        } else if (CxfEndpointUtils.hasWebServiceAnnotation(cls)) {
            answer = new JaxWsServerFactoryBean();
        } else {
            answer = new ServerFactoryBean();
        }
       
        // setup server factory bean
        setupServerFactoryBean(answer, cls);
        return answer;
View Full Code Here

                return;
            }
        }
       
        // create server bean factory
        ServerFactoryBean factory = null;
        if (serviceClass != null && EndpointUtils.hasWebServiceAnnotation(serviceClass)) {
            factory = new JaxWsServerFactoryBean();
        } else {
            factory = new ServerFactoryBean();
        }
       
        if (serviceClass != null) {
            factory.setServiceClass(serviceClass);
        }
       
        if (spec.getWsdlLocation() != null) {  
            factory.setWsdlLocation(spec.getWsdlLocation());
        }
       
        if (spec.getAddress() != null) {
            factory.setAddress(spec.getAddress());
        }
       
        if (spec.getBusConfigLocation() != null) {
            factory.setBus(new SpringBusFactory().createBus(classLoader
                    .getResource(spec.getBusConfigLocation())));
        }
       
        if (spec.getEndpointName() != null) {
            factory.setEndpointName(QName.valueOf(spec.getEndpointName()));
        }
       
        if (spec.getSchemaLocations() != null) {
            factory.setSchemaLocations(getListOfString(spec.getSchemaLocations()));
        }
       
        if (spec.getServiceName() != null) {
            factory.setServiceName(QName.valueOf(spec.getServiceName()));
        }
             
        MDBInvoker invoker = createInvoker(endpoint);
        factory.setInvoker(invoker);


        // create and start the server
        factory.setStart(true);
        Server server = factory.create();

        // save the server for clean up later
        endpoints.put(spec.getDisplayName(), new InboundEndpoint(server, invoker));
    }
View Full Code Here

            return greetings;
        }
    }
   
    private Server startServer(String address, Class<?> type, Object impl) {
        ServerFactoryBean factory = new ServerFactoryBean();
        factory.setServiceClass(type);
        factory.setAddress(address);
        factory.getServiceFactory().setDataBinding(new AegisDatabinding());
        factory.setServiceBean(impl);
        Server server = factory.create();
        server.start();
        return server;
    }
View Full Code Here

        ServiceReference httpSvcSR = EasyMock.createNiceMock(ServiceReference.class);
        EasyMock.replay(httpSvcSR);
        EasyMock.expect(dswContext.getService(httpSvcSR)).andReturn(httpService).anyTimes();
        EasyMock.replay(dswContext);
       
        final ServerFactoryBean sfb = createMockServerFactoryBean();
       
        //        RemoteServiceAdminCore dp = new RemoteServiceAdminCore(dswContext);
        Map<String, Object> handlerProps = new HashMap<String, Object>();
        HttpServiceConfigurationTypeHandler h =
            new HttpServiceConfigurationTypeHandler(dswContext,  handlerProps) {
                @Override
                ServerFactoryBean createServerFactoryBean(String frontend) {
                    return sfb;
                }

                @Override
                String[] applyIntents(BundleContext dswContext, BundleContext callingContext,
                        List<AbstractFeature> features, AbstractEndpointFactory factory,
                        Map sd) {
                    return new String [] {"a.b.c"};
                }           
        };
        h.httpServiceReferences.add(httpSvcSR);
       
        Runnable myService = new Runnable() {
            public void run() {
                System.out.println("blah");
            }           
        };
               
        ServiceReference sr = EasyMock.createNiceMock(ServiceReference.class);
        BundleContext callingContext = EasyMock.createNiceMock(BundleContext.class);
        EasyMock.replay(sr);
        EasyMock.replay(callingContext);

        Map<String, Object> props = new HashMap<String, Object>();
        props.put(Constants.WS_HTTP_SERVICE_CONTEXT, "/myRunnable");
        //ServiceEndpointDescription sd = new ServiceEndpointDescriptionImpl(Runnable.class.getName(), props);
       
        ExportRegistrationImpl exReg = new ExportRegistrationImpl(sr,null,null);
       
        //        assertEquals("Precondition failed", 0, dp.getExposedServices().size());
        assertEquals("Precondition failed", "", sfb.getAddress());
        h.createServer(exReg, dswContext, callingContext, props, Runnable.class, myService);
        assertEquals("The address should be set to '/'. The Servlet context dictates the actual location.", "/", sfb.getAddress());
        //assertEquals(1, dp.getExposedServices().size());
        //assertSame(sr, dp.getExposedServices().iterator().next());
       
        String hostName;
        try {
View Full Code Here

        } else {
            databinding = new AegisDatabinding();
        }
        String frontEndImpl = (String)exportRegistration.getExportedService()
            .getProperty(Constants.WS_FRONTEND_PROP_KEY);
        ServerFactoryBean factory = createServerFactoryBean(frontEndImpl);
        String address = constructAddress(dswContext, contextRoot);
        factory.setBus(bus);
        factory.setServiceClass(iClass);
        factory.setAddress("/");
        factory.getServiceFactory().setDataBinding(databinding);
        factory.setServiceBean(serviceBean);

       

       
        ClassLoader oldClassLoader = Thread.currentThread().getContextClassLoader();
        try {
            String[] intents = applyIntents(dswContext, callingContext, factory.getFeatures(), factory, sd);

            // The properties for the EndpointDescription
            Map<String, Object> endpointProps = createEndpointProps(sd, iClass, new String[] {
                Constants.WS_CONFIG_TYPE
            }, address,intents);
            EndpointDescription endpdDesc = null;
           
            Thread.currentThread().setContextClassLoader(ServerFactoryBean.class.getClassLoader());
            Server server = factory.create();
           
            // TODO: does this still make sense ?!?
            registerStopHook(bus, httpService, server, contextRoot, Constants.WS_HTTP_SERVICE_CONTEXT);
           
            endpdDesc = new EndpointDescription(endpointProps);
View Full Code Here

        ServiceReference httpSvcSR = EasyMock.createNiceMock(ServiceReference.class);
        EasyMock.replay(httpSvcSR);
        EasyMock.expect(dswContext.getService(httpSvcSR)).andReturn(httpService).anyTimes();
        EasyMock.replay(dswContext);
       
        final ServerFactoryBean sfb = createMockServerFactoryBean();
       
        RemoteServiceAdminCore dp = new RemoteServiceAdminCore(dswContext);
        Map<String, Object> handlerProps = new HashMap<String, Object>();
        HttpServiceConfigurationTypeHandler h =
            new HttpServiceConfigurationTypeHandler(dswContext,  handlerProps) {
View Full Code Here

        ServiceReference httpSvcSR = EasyMock.createNiceMock(ServiceReference.class);
        EasyMock.replay(httpSvcSR);
        EasyMock.expect(dswContext.getService(httpSvcSR)).andReturn(httpService).anyTimes();
        EasyMock.replay(dswContext);
       
        final ServerFactoryBean sfb = createMockServerFactoryBean();
       
        RemoteServiceAdminCore dp = new RemoteServiceAdminCore(dswContext);
        Map<String, Object> handlerProps = new HashMap<String, Object>();
        HttpServiceConfigurationTypeHandler h =
            new HttpServiceConfigurationTypeHandler(dswContext,  handlerProps) {
View Full Code Here

        ReflectionServiceFactoryBean sf = EasyMock.createNiceMock(ReflectionServiceFactoryBean.class);
        EasyMock.replay(sf);
       
        final StringBuilder serverURI = new StringBuilder();
       
        ServerFactoryBean sfb = EasyMock.createNiceMock(ServerFactoryBean.class);
        Server server = createMockServer(sfb);   
       
        EasyMock.expect(sfb.getServiceFactory()).andReturn(sf).anyTimes();
        EasyMock.expect(sfb.create()).andReturn(server);
        sfb.setAddress((String) EasyMock.anyObject());
        EasyMock.expectLastCall().andAnswer(new IAnswer<Object>() {
            public Object answer() throws Throwable {
                serverURI.setLength(0);
                serverURI.append(EasyMock.getCurrentArguments()[0]);
                return null;
            }           
        }).anyTimes();
        EasyMock.expect(sfb.getAddress()).andAnswer(new IAnswer<String>() {
            public String answer() throws Throwable {
                return serverURI.toString();
            }           
        }).anyTimes();
        EasyMock.replay(sfb);
View Full Code Here

    // Isolated so that it can be substituted for testing
    ServerFactoryBean createServerFactoryBean(String frontEndImpl) {
      if("jaxws".equals(frontEndImpl)) {
        return new JaxWsServerFactoryBean();
      } else {
        return new ServerFactoryBean();
      }
    }
View Full Code Here

TOP

Related Classes of org.apache.cxf.frontend.ServerFactoryBean

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.