Package org.apache.geronimo.jaxws

Examples of org.apache.geronimo.jaxws.PortInfo


                            serviceLink = beanType.getEjbLink();
                        } else if (beanType.getServletLink() != null) {
                            serviceLink = beanType.getServletLink();
                        }

                        PortInfo portInfo = serviceLinkPortInfoMap.get(serviceLink);
                        if (portInfo == null) {
                            portInfo = new PortInfo();
                            portInfo.setServiceLink(serviceLink);
                            serviceLinkPortInfoMap.put(serviceLink, portInfo);
                        }

                        if (port.getServiceEndpointInterface() != null) {
                            String sei = port.getServiceEndpointInterface();
                            portInfo.setServiceEndpointInterfaceName(sei);
                        }

                        if (port.getPortComponentName() != null) {
                            portInfo.setPortName(port.getPortComponentName());
                        }

                        if (port.getProtocolBinding() != null) {
                            portInfo.setProtocolBinding(port.getProtocolBinding());
                        }

                        portInfo.setServiceName(serviceName);

                        if (wsdlFile != null) {
                            portInfo.setWsdlFile(wsdlFile);
                        }

                        if (port.getHandlerChains() != null) {
                            portInfo.setHandlerChainsInfo(handlerChainsInfoBuilder.build(port.getHandlerChains()));
                        }

                        if (port.getWsdlPort() != null) {
                            portInfo.setWsdlPort(port.getWsdlPort());
                        }

                        if (port.getWsdlService() != null) {
                            portInfo.setWsdlService(port.getWsdlService());
                        }

                        String location = servletLocations.get(serviceLink);
                        portInfo.setLocation(location);

                        Addressing addressing = port.getAddressing();
                        if (addressing != null) {
                            AddressingFeatureInfo addressingFeatureInfo = portInfo.getAddressingFeatureInfo();
                            if (addressingFeatureInfo == null) {
                                addressingFeatureInfo = new AddressingFeatureInfo();
                                portInfo.setAddressingFeatureInfo(addressingFeatureInfo);
                            }
                            if (addressing.getEnabled() != null) {
                                addressingFeatureInfo.setEnabled(addressing.getEnabled());
                            }
                            if (addressing.getRequired() != null) {
                                addressingFeatureInfo.setRequired(addressing.getRequired());
                            }
                            if (addressing.getResponses() != null) {
                                addressingFeatureInfo.setResponses(AddressingFeature.Responses.valueOf(addressing.getResponses().name()));
                            }
                        }

                        if (port.getEnableMtom() != null || port.getMtomThreshold() != null) {
                            MTOMFeatureInfo mtomFeatureInfo = portInfo.getMtomFeatureInfo();
                            if (mtomFeatureInfo == null) {
                                mtomFeatureInfo = new MTOMFeatureInfo();
                                portInfo.setMtomFeatureInfo(mtomFeatureInfo);
                            }
                            if (port.getEnableMtom() != null) {
                                mtomFeatureInfo.setEnabled(port.getEnableMtom());
                            }
                            if (port.getMtomThreshold() != null) {
                                mtomFeatureInfo.setThreshold(port.getMtomThreshold());
                            }
                        }

                        if (port.getRespectBinding() != null && port.getRespectBinding().getEnabled() != null) {
                            RespectBindingFeatureInfo respectBindingFeatureInfo = portInfo.getRespectBindingFeatureInfo();
                            if (respectBindingFeatureInfo == null) {
                                respectBindingFeatureInfo = new RespectBindingFeatureInfo();
                                portInfo.setRespectBindingFeatureInfo(respectBindingFeatureInfo);
                            }
                            respectBindingFeatureInfo.setEnabled(port.getRespectBinding().getEnabled());
                        }
                    }
                }
View Full Code Here


        Map<String, PortInfo> portInfoMap = (Map<String, PortInfo>) sharedContext.get(getKey());
        if (portInfoMap == null) {
            // not ours
            return false;
        }
        PortInfo portInfo = portInfoMap.get(servletName);
        if (portInfo == null) {
            // not ours
            return false;
        }

        // verify that the class is loadable and is a JAX-WS web service
        Bundle bundle = context.getDeploymentBundle();
        Class<?> servletClass = loadClass(servletClassName, bundle);
        if (!JAXWSUtils.isWebService(servletClass)) {
            return false;
        }

        Map<String, PortInfo> servletNamePortInfoMap = null;
        AbstractName jaxwsWebApplicationContextName = context.getNaming().createChildName(module.getModuleName(), "JAXWSWebApplicationContext", "JAXWSWebApplicationContext");
        try {
            servletNamePortInfoMap = (Map<String, PortInfo>)(context.getGBeanInstance(jaxwsWebApplicationContextName).getAttribute("servletNamePortInfoMap"));
        } catch (GBeanNotFoundException e) {
            GBeanData jaxwsWebApplicationContextGBeanData = new GBeanData(jaxwsWebApplicationContextName, JAXWSWebApplicationContext.class);
            try {
                context.addGBean(jaxwsWebApplicationContextGBeanData);
            } catch (GBeanAlreadyExistsException e1) {
            }
            servletNamePortInfoMap = new HashMap<String, PortInfo>();
            jaxwsWebApplicationContextGBeanData.setAttribute("servletNamePortInfoMap", servletNamePortInfoMap);
        }
        targetGBean.addDependency(jaxwsWebApplicationContextName);
        servletNamePortInfoMap.put(servletName, portInfo);

        Map componentContext = null;
        Holder moduleHolder = null;
        try {
            //TODO Now we share the same DeploymentContext in the ear package, which means all the gbeans are saved in the one EARContext
            //Might need to update while we have real EAR support
            moduleHolder = (Holder) module.getSharedContext().get(NamingBuilder.INJECTION_KEY);
            GBeanData contextSourceGBean = context.getGBeanInstance(context.getNaming().createChildName(module.getModuleName(), "ContextSource", "ContextSource"));
            componentContext = (Map) contextSourceGBean.getAttribute("componentContext");
        } catch (GBeanNotFoundException e) {
            LOG.warn("ModuleGBean not found. JNDI resource injection will not work.");
        }

        AnnotationHolder serviceHolder =
            (AnnotationHolder)sharedContext.get(WebServiceContextAnnotationHelper.class.getName());
        if (serviceHolder == null) {
            serviceHolder = new AnnotationHolder(moduleHolder);
            sharedContext.put(WebServiceContextAnnotationHelper.class.getName(), serviceHolder);
        }
        WebServiceContextAnnotationHelper.addWebServiceContextInjections(serviceHolder, servletClass);

        String location = portInfo.getLocation();
        LOG.info("Configuring JAX-WS Web Service: " + servletName + " at " + location);

        AbstractName containerFactoryName = context.getNaming().createChildName(targetGBean.getAbstractName(), getContainerFactoryGBeanInfo().getName(), GBeanInfoBuilder.DEFAULT_J2EE_TYPE);
        GBeanData containerFactoryData = new GBeanData(containerFactoryName, getContainerFactoryGBeanInfo());
        containerFactoryData.setAttribute("portInfo", portInfo);
View Full Code Here

        Map<String, PortInfo> portInfoMap = (Map<String, PortInfo>) sharedContext.get(getKey());
        if (portInfoMap == null) {
            // not ours
            return false;
        }
        PortInfo portInfo = portInfoMap.get(ejbName);
        if (portInfo == null) {
            // not ours
            return false;
        }

        String beanClassName = (String)targetGBean.getAttribute("ejbClass");
        // verify that the class is loadable and is a JAX-WS web service
        Class<?> beanClass = loadClass(beanClassName, bundle);
        if (!JAXWSUtils.isWebService(beanClass)) {
            return false;
        }

        String location = portInfo.getLocation();
        if (location == null) {
            throw new DeploymentException("Endpoint URI for EJB WebService is missing");
        }

        Map<String, PortInfo> ejbNamePortInfoMap = null;
View Full Code Here

                Class<?> ejbClass = bundle.loadClass(bean.ejbClass);
                if (JAXWSUtils.isWebService(ejbClass)) {
                    if (LOG.isDebugEnabled()) {
                        LOG.debug("Found EJB Web Service: " + bean.ejbName);
                    }
                    PortInfo portInfo = new PortInfo();
                    String location = correctedPortLocations.get(bean.ejbName);
                    if (location == null) {
                        // set default location, i.e. /@WebService.serviceName/@WebService.name
                        location = "/" + JAXWSUtils.getServiceName(ejbClass) + "/" + JAXWSUtils.getName(ejbClass);
                    }
                    portInfo.setLocation(location);
                    portInfo.setWsdlService(JAXWSUtils.getServiceQName(ejbClass));
                    portInfo.setWsdlPort(JAXWSUtils.getPortQName(ejbClass));
                    map.put(bean.ejbName, portInfo);
                    ejbWebServiceClassNames.add(bean.ejbClass);
                }
            } catch (Exception e) {
                throw new DeploymentException("Failed to load ejb class "
View Full Code Here

                ServletMapping servletMapping = new ServletMapping();
                servletMapping.setServletName(service.getName());
                servletMapping.getUrlPattern().add(location);

                // map service
                PortInfo portInfo = new PortInfo();
                portInfo.setLocation(contextRoot + location);
                servletNamePortInfoMap.put(service.getName(), portInfo);
            }
        } else {
            // web.xml present, examine servlet classes and check for web
            // services
            for (Servlet servletType : servletTypes) {
                String servletName = servletType.getServletName().trim();
                if (servletType.getServletClass() != null) {
                    String servletClassName = servletType.getServletClass().trim();
                    try {
                        Class<?> servletClass = bundle.loadClass(servletClassName);
                        if (JAXWSUtils.isWebService(servletClass)) {
                            if (LOG.isDebugEnabled()) {
                                LOG.debug("Found POJO Web Service: " + servletName);
                            }
                            PortInfo portInfo = new PortInfo();
                            servletNamePortInfoMap.put(servletName, portInfo);
                        }
                    } catch (Exception e) {
                        throw new DeploymentException("Failed to load servlet class " + servletClassName + " from bundle " + bundle, e);
                    }
                }
            }

            // update web service locations
            for (Map.Entry<String, PortInfo> entry : servletNamePortInfoMap.entrySet()) {
                String servletName = entry.getKey();
                PortInfo portInfo = entry.getValue();

                String location = correctedPortLocations.get(servletName);
                if (location != null) {
                    portInfo.setLocation(location);
                }
            }
        }

        return servletNamePortInfoMap;
View Full Code Here

                    String serviceName = desc.getWebserviceDescriptionName().getStringValue();

                    for (PortComponentType port : desc.getPortComponentArray()) {

                        PortInfo portInfo = new PortInfo();
                        String serviceLink = null;
                        ServiceImplBeanType beanType = port.getServiceImplBean();
                        if (beanType.getEjbLink() != null) {
                            serviceLink = beanType.getEjbLink().getStringValue();
                        } else if (beanType.getServletLink().getStringValue() != null) {
                            serviceLink = beanType.getServletLink().getStringValue();
                        }
                        portInfo.setServiceLink(serviceLink);

                        if (port.getServiceEndpointInterface() != null) {
                            String sei = port.getServiceEndpointInterface().getStringValue();
                            portInfo.setServiceEndpointInterfaceName(sei);
                        }

                        String portName = port.getPortComponentName().getStringValue();
                        portInfo.setPortName(portName);

                        portInfo.setProtocolBinding(port.getProtocolBinding());
                        portInfo.setServiceName(serviceName);
                        portInfo.setWsdlFile(wsdlFile);

                        if (port.getEnableMtom() != null) {
                            portInfo.setEnableMTOM(port.getEnableMtom().getBooleanValue());
                        }

                        if (port.getHandlerChains() != null) {
                            StringBuffer chains = new StringBuffer("<handler-chains xmlns=\"http://java.sun.com/xml/ns/javaee\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">");
                            chains.append(port.getHandlerChains().xmlText());
                            chains.append("</handler-chains>");
                            portInfo.setHandlersAsXML(chains.toString());
                        }

                        if (port.getWsdlPort() != null) {
                            portInfo.setWsdlPort(port.getWsdlPort().getQNameValue());
                        }

                        if (port.getWsdlService() != null) {
                            portInfo.setWsdlService(port.getWsdlService().getQNameValue());
                        }

                        String location = (String) correctedPortLocations.get(serviceLink);
                        portInfo.setLocation(location);

                        if (map == null) {
                            map = new HashMap<String, PortInfo>();
                        }
View Full Code Here

    }

    public void testGetWSDL() throws Exception {
        ClassLoader cl = Thread.currentThread().getContextClassLoader();

        PortInfo portInfo = new PortInfo();
        portInfo.setLocation("/axis2/HelloWorld");
        portInfo.setServiceEndpointInterfaceName("org.apache.geronimo.axis2.testdata.simple.HelloWorld");

        Axis2Request req = new Axis2Request(504,
                "text/xml; charset=utf-8",
                null,
                Request.GET,
View Full Code Here

            System.out.println(envelope.toString());

            request = new ByteArrayInputStream(envelope.toString().getBytes("UTF-8"));

            PortInfo portInfo = new PortInfo();
            portInfo.setLocation("/axis2/" + serviceName);

            File wsdlFile = new File(RESOURCE_PATH + wsdl);
            portInfo.setWsdlFile(wsdlFile.toURI().toURL().toString());

            try {
                Axis2Request req = new Axis2Request(504,
                        "text/xml; charset=utf-8",
                        request,
View Full Code Here

                            serviceLink = beanType.getEjbLink();
                        } else if (beanType.getServletLink() != null) {
                            serviceLink = beanType.getServletLink();
                        }

                        PortInfo portInfo = serviceLinkPortInfoMap.get(serviceLink);
                        if (portInfo == null) {
                            portInfo = new PortInfo();
                            portInfo.setServiceLink(serviceLink);
                            serviceLinkPortInfoMap.put(serviceLink, portInfo);
                        }

                        if (port.getServiceEndpointInterface() != null) {
                            String sei = port.getServiceEndpointInterface();
                            portInfo.setServiceEndpointInterfaceName(sei);
                        }

                        if (port.getPortComponentName() != null) {
                            portInfo.setPortName(port.getPortComponentName());
                        }

                        if (port.getProtocolBinding() != null) {
                            portInfo.setProtocolBinding(port.getProtocolBinding());
                        }

                        portInfo.setServiceName(serviceName);

                        if (wsdlFile != null) {
                            portInfo.setWsdlFile(wsdlFile);
                        }

                        if (port.getHandlerChains() != null) {
                            portInfo.setHandlerChainsInfo(handlerChainsInfoBuilder.build(port.getHandlerChains()));
                        }

                        if (port.getWsdlPort() != null) {
                            portInfo.setWsdlPort(port.getWsdlPort());
                        }

                        if (port.getWsdlService() != null) {
                            portInfo.setWsdlService(port.getWsdlService());
                        }

                        String location = servletLocations.get(serviceLink);
                        portInfo.setLocation(location);

                        Addressing addressing = port.getAddressing();
                        if (addressing != null) {
                            AddressingFeatureInfo addressingFeatureInfo = portInfo.getAddressingFeatureInfo();
                            if (addressingFeatureInfo == null) {
                                addressingFeatureInfo = new AddressingFeatureInfo();
                                portInfo.setAddressingFeatureInfo(addressingFeatureInfo);
                            }
                            if (addressing.getEnabled() != null) {
                                addressingFeatureInfo.setEnabled(addressing.getEnabled());
                            }
                            if (addressing.getRequired() != null) {
                                addressingFeatureInfo.setRequired(addressing.getRequired());
                            }
                            if (addressing.getResponses() != null) {
                                addressingFeatureInfo.setResponses(AddressingFeature.Responses.valueOf(addressing.getResponses().name()));
                            }
                        }

                        if (port.getEnableMtom() != null || port.getMtomThreshold() != null) {
                            MTOMFeatureInfo mtomFeatureInfo = portInfo.getMtomFeatureInfo();
                            if (mtomFeatureInfo == null) {
                                mtomFeatureInfo = new MTOMFeatureInfo();
                                portInfo.setMtomFeatureInfo(mtomFeatureInfo);
                            }
                            if (port.getEnableMtom() != null) {
                                mtomFeatureInfo.setEnabled(port.getEnableMtom());
                            }
                            if (port.getMtomThreshold() != null) {
                                mtomFeatureInfo.setThreshold(port.getMtomThreshold());
                            }
                        }

                        if (port.getRespectBinding() != null && port.getRespectBinding().getEnabled() != null) {
                            RespectBindingFeatureInfo respectBindingFeatureInfo = portInfo.getRespectBindingFeatureInfo();
                            if (respectBindingFeatureInfo == null) {
                                respectBindingFeatureInfo = new RespectBindingFeatureInfo();
                                portInfo.setRespectBindingFeatureInfo(respectBindingFeatureInfo);
                            }
                            respectBindingFeatureInfo.setEnabled(port.getRespectBinding().getEnabled());
                        }
                    }
                }
View Full Code Here

        Map<String, PortInfo> portInfoMap = (Map<String, PortInfo>) sharedContext.get(getKey());
        if (portInfoMap == null) {
            // not ours
            return false;
        }
        PortInfo portInfo = portInfoMap.get(servletName);
        if (portInfo == null) {
            // not ours
            return false;
        }

        // verify that the class is loadable and is a JAX-WS web service
        Bundle bundle = context.getDeploymentBundle();
        Class<?> servletClass = loadClass(servletClassName, bundle);
        if (!JAXWSUtils.isWebService(servletClass)) {
            return false;
        }

        Map<String, PortInfo> servletNamePortInfoMap = null;
        AbstractName jaxwsWebApplicationContextName = context.getNaming().createChildName(module.getModuleName(), "JAXWSWebApplicationContext", "JAXWSWebApplicationContext");
        try {
            servletNamePortInfoMap = (Map<String, PortInfo>)(context.getGBeanInstance(jaxwsWebApplicationContextName).getAttribute("servletNamePortInfoMap"));
        } catch (GBeanNotFoundException e) {
            GBeanData jaxwsWebApplicationContextGBeanData = new GBeanData(jaxwsWebApplicationContextName, JAXWSWebApplicationContext.class);
            try {
                context.addGBean(jaxwsWebApplicationContextGBeanData);
            } catch (GBeanAlreadyExistsException e1) {
            }
            servletNamePortInfoMap = new HashMap<String, PortInfo>();
            jaxwsWebApplicationContextGBeanData.setAttribute("servletNamePortInfoMap", servletNamePortInfoMap);
        }
        targetGBean.addDependency(jaxwsWebApplicationContextName);
        servletNamePortInfoMap.put(servletName, portInfo);

        Map componentContext = null;
        Holder moduleHolder = null;
        try {
            //TODO Now we share the same DeploymentContext in the ear package, which means all the gbeans are saved in the one EARContext
            //Might need to update while we have real EAR support
            moduleHolder = (Holder) module.getSharedContext().get(NamingBuilder.INJECTION_KEY);
            GBeanData contextSourceGBean = context.getGBeanInstance(context.getNaming().createChildName(module.getModuleName(), "ContextSource", "ContextSource"));
            componentContext = (Map) contextSourceGBean.getAttribute("componentContext");
        } catch (GBeanNotFoundException e) {
            LOG.warn("ModuleGBean not found. JNDI resource injection will not work.");
        }

        AnnotationHolder serviceHolder =
            (AnnotationHolder)sharedContext.get(WebServiceContextAnnotationHelper.class.getName());
        if (serviceHolder == null) {
            serviceHolder = new AnnotationHolder(moduleHolder);
            sharedContext.put(WebServiceContextAnnotationHelper.class.getName(), serviceHolder);
        }
        WebServiceContextAnnotationHelper.addWebServiceContextInjections(serviceHolder, servletClass);

        String location = portInfo.getLocation();
        LOG.info("Configuring JAX-WS Web Service: " + servletName + " at " + location);

        AbstractName containerFactoryName = context.getNaming().createChildName(targetGBean.getAbstractName(), getContainerFactoryGBeanInfo().getName(), GBeanInfoBuilder.DEFAULT_J2EE_TYPE);
        GBeanData containerFactoryData = new GBeanData(containerFactoryName, getContainerFactoryGBeanInfo());
        containerFactoryData.setAttribute("portInfo", portInfo);
View Full Code Here

TOP

Related Classes of org.apache.geronimo.jaxws.PortInfo

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.