Search in sources :

Example 1 with HandlerChains$JAXB.writeHandlerChains

use of org.apache.openejb.jee.HandlerChains$JAXB.writeHandlerChains in project tomee by apache.

the class WsDeployer method getHandlerChains.

public static HandlerChains getHandlerChains(Class<?> declaringClass, final String serviceEndpoint, final ClassLoader classLoader) throws OpenEJBException {
    HandlerChain handlerChain = declaringClass.getAnnotation(HandlerChain.class);
    if (handlerChain == null && serviceEndpoint != null) {
        try {
            declaringClass = classLoader.loadClass(serviceEndpoint);
            handlerChain = declaringClass.getAnnotation(HandlerChain.class);
        } catch (final ClassNotFoundException ignored) {
        // no-op
        }
    }
    HandlerChains handlerChains = null;
    if (handlerChain != null) {
        try {
            final URL handlerFileURL = declaringClass.getResource(handlerChain.file());
            handlerChains = ReadDescriptors.readHandlerChains(handlerFileURL);
        } catch (final Throwable e) {
            throw new OpenEJBException("Unable to load handler chain file: " + handlerChain.file(), e);
        }
    }
    return handlerChains;
}
Also used : OpenEJBException(org.apache.openejb.OpenEJBException) HandlerChain(javax.jws.HandlerChain) HandlerChains(org.apache.openejb.jee.HandlerChains) URL(java.net.URL)

Example 2 with HandlerChains$JAXB.writeHandlerChains

use of org.apache.openejb.jee.HandlerChains$JAXB.writeHandlerChains in project tomee by apache.

the class WsDeployer method processPorts.

private void processPorts(final EjbModule ejbModule) throws OpenEJBException {
    // map existing webservice port declarations by servlet link
    Webservices webservices = ejbModule.getWebservices();
    final Map<String, PortComponent> portMap = new TreeMap<>();
    if (webservices != null) {
        for (final WebserviceDescription webserviceDescription : webservices.getWebserviceDescription()) {
            for (final PortComponent portComponent : webserviceDescription.getPortComponent()) {
                final ServiceImplBean serviceImplBean = portComponent.getServiceImplBean();
                if (serviceImplBean != null && serviceImplBean.getEjbLink() != null) {
                    portMap.put(serviceImplBean.getEjbLink(), portComponent);
                }
            }
        }
    }
    final Map<String, EjbDeployment> deploymentsByEjbName = ejbModule.getOpenejbJar().getDeploymentsByEjbName();
    WebserviceDescription webserviceDescription;
    for (final EnterpriseBean enterpriseBean : ejbModule.getEjbJar().getEnterpriseBeans()) {
        // skip if this is not a webservices endpoint
        if (!(enterpriseBean instanceof SessionBean)) {
            continue;
        }
        final SessionBean sessionBean = (SessionBean) enterpriseBean;
        if (sessionBean.getSessionType() == SessionType.STATEFUL) {
            continue;
        }
        if (sessionBean.getSessionType() == SessionType.MANAGED) {
            continue;
        }
        if (sessionBean.getServiceEndpoint() == null) {
            continue;
        }
        final EjbDeployment deployment = deploymentsByEjbName.get(sessionBean.getEjbName());
        if (deployment == null) {
            continue;
        }
        final Class<?> ejbClass;
        try {
            ejbClass = ejbModule.getClassLoader().loadClass(sessionBean.getEjbClass());
        } catch (final ClassNotFoundException e) {
            throw new OpenEJBException("Unable to load ejb class: " + sessionBean.getEjbClass(), e);
        }
        // for now, skip all non jaxws beans
        if (!JaxWsUtils.isWebService(ejbClass)) {
            continue;
        }
        // create webservices dd if not defined
        if (webservices == null) {
            webservices = new Webservices();
            ejbModule.setWebservices(webservices);
        }
        webserviceDescription = webservices.getWebserviceDescriptionMap().get(JaxWsUtils.getServiceName(ejbClass));
        if (webserviceDescription == null) {
            webserviceDescription = new WebserviceDescription();
            if (JaxWsUtils.isWebService(ejbClass)) {
                webserviceDescription.setWebserviceDescriptionName(JaxWsUtils.getServiceName(ejbClass));
            }
            // TODO else { /* create webserviceDescription name using some sort of jaxrpc data */ }
            webservices.getWebserviceDescription().add(webserviceDescription);
        }
        // add a port component if we don't alrady have one
        PortComponent portComponent = portMap.get(sessionBean.getEjbName());
        if (portComponent == null) {
            portComponent = new PortComponent();
            if (webserviceDescription.getPortComponentMap().containsKey(JaxWsUtils.getPortQName(ejbClass).getLocalPart())) {
                // when to webservices.xml is defined and when we want to
                // publish more than one port for the same implementation by configuration
                portComponent.setPortComponentName(sessionBean.getEjbName());
            } else {
                // JAX-WS Metadata specification default
                portComponent.setPortComponentName(JaxWsUtils.getPortQName(ejbClass).getLocalPart());
            }
            webserviceDescription.getPortComponent().add(portComponent);
            final ServiceImplBean serviceImplBean = new ServiceImplBean();
            serviceImplBean.setEjbLink(sessionBean.getEjbName());
            portComponent.setServiceImplBean(serviceImplBean);
            // Checking if MTOM must be enabled
            if (portComponent.getProtocolBinding() == null) {
                portComponent.setProtocolBinding(JaxWsUtils.getBindingUriFromAnn(ejbClass));
            }
            configMtomAnnotation(ejbClass, portComponent);
            if (SOAPBinding.SOAP12HTTP_MTOM_BINDING.equals(portComponent.getProtocolBinding()) || SOAPBinding.SOAP11HTTP_MTOM_BINDING.equals(portComponent.getProtocolBinding())) {
                portComponent.setEnableMtom(true);
            }
        }
        // default portId == deploymentId
        if (portComponent.getId() == null) {
            portComponent.setId(deployment.getDeploymentId());
        }
        if (webserviceDescription.getId() == null) {
            webserviceDescription.setId(deployment.getDeploymentId());
        }
        // set service endpoint interface
        if (portComponent.getServiceEndpointInterface() == null) {
            portComponent.setServiceEndpointInterface(sessionBean.getServiceEndpoint());
        }
        // default location is /@WebService.serviceName/@WebService.name
        if (JaxWsUtils.isWebService(ejbClass)) {
            if (portComponent.getWsdlPort() == null) {
                portComponent.setWsdlPort(JaxWsUtils.getPortQName(ejbClass));
            }
            if (webserviceDescription.getWsdlFile() == null) {
                webserviceDescription.setWsdlFile(JaxWsUtils.getServiceWsdlLocation(ejbClass, ejbModule.getClassLoader()));
            }
            if (portComponent.getWsdlService() == null) {
                final Definition definition = getWsdl(ejbModule, webserviceDescription.getWsdlFile());
                if (definition != null && definition.getServices().size() == 1) {
                    final QName serviceQName = (QName) definition.getServices().keySet().iterator().next();
                    portComponent.setWsdlService(serviceQName);
                } else {
                    portComponent.setWsdlService(JaxWsUtils.getServiceQName(ejbClass));
                }
            }
            if (portComponent.getLocation() == null && webserviceDescription.getWsdlFile() != null) {
                // set location based on wsdl port
                final Definition definition = getWsdl(ejbModule, webserviceDescription.getWsdlFile());
                final String locationURI = getLocationFromWsdl(definition, portComponent);
                portComponent.setLocation(locationURI);
            }
            if (portComponent.getProtocolBinding() == null) {
                portComponent.setProtocolBinding(JaxWsUtils.getBindingUriFromAnn(ejbClass));
            }
            // handlers
            if (portComponent.getHandlerChains() == null) {
                final HandlerChains handlerChains = getHandlerChains(ejbClass, sessionBean.getServiceEndpoint(), ejbModule.getClassLoader());
                portComponent.setHandlerChains(handlerChains);
            }
        }
    // TODO else { /* location JAX-RPC services comes from wsdl file */ }
    }
}
Also used : OpenEJBException(org.apache.openejb.OpenEJBException) EnterpriseBean(org.apache.openejb.jee.EnterpriseBean) PortComponent(org.apache.openejb.jee.PortComponent) ServiceImplBean(org.apache.openejb.jee.ServiceImplBean) QName(javax.xml.namespace.QName) Definition(javax.wsdl.Definition) HandlerChains(org.apache.openejb.jee.HandlerChains) Webservices(org.apache.openejb.jee.Webservices) TreeMap(java.util.TreeMap) SessionBean(org.apache.openejb.jee.SessionBean) WebserviceDescription(org.apache.openejb.jee.WebserviceDescription) EjbDeployment(org.apache.openejb.jee.oejb3.EjbDeployment)

Example 3 with HandlerChains$JAXB.writeHandlerChains

use of org.apache.openejb.jee.HandlerChains$JAXB.writeHandlerChains in project tomee by apache.

the class WsDeployer method processPorts.

private void processPorts(final WebModule webModule) throws OpenEJBException {
    // map existing webservice port declarations by servlet link
    Webservices webservices = webModule.getWebservices();
    final Map<String, PortComponent> portMap = new TreeMap<>();
    if (webservices != null) {
        for (final WebserviceDescription webserviceDescription : webservices.getWebserviceDescription()) {
            for (final PortComponent portComponent : webserviceDescription.getPortComponent()) {
                final ServiceImplBean serviceImplBean = portComponent.getServiceImplBean();
                if (serviceImplBean != null && serviceImplBean.getServletLink() != null) {
                    portMap.put(serviceImplBean.getServletLink(), portComponent);
                }
            }
        }
    }
    // map existing servlet-mapping declarations
    final WebApp webApp = webModule.getWebApp();
    final Map<String, ServletMapping> servletMappings = new TreeMap<>();
    for (final ServletMapping servletMapping : webApp.getServletMapping()) {
        servletMappings.put(servletMapping.getServletName(), servletMapping);
    }
    // add port declarations for Pojo webservices
    WebserviceDescription webserviceDescription;
    for (final Servlet servlet : webApp.getServlet()) {
        // the implementation class will be replaced by the WsServlet in the WsRegistry
        final String className = servlet.getServletClass();
        // Skip JSPs
        if (className == null) {
            continue;
        }
        try {
            final Class<?> clazz = webModule.getClassLoader().loadClass(className);
            if (JaxWsUtils.isWebService(clazz)) {
                // add servlet mapping if not already declared
                ServletMapping servletMapping = servletMappings.get(servlet.getServletName());
                final String serviceName = JaxWsUtils.getServiceName(clazz);
                if (servletMapping == null) {
                    servletMapping = new ServletMapping();
                    servletMapping.setServletName(servlet.getServletName());
                    final String location = "/" + serviceName;
                    servletMapping.getUrlPattern().add(location);
                    webApp.getServletMapping().add(servletMapping);
                }
                // if we don't have a webservices document yet, we're gonna need one now
                if (webservices == null) {
                    webservices = new Webservices();
                    webModule.setWebservices(webservices);
                }
                // add web service description element (maps to service)
                webserviceDescription = webservices.getWebserviceDescriptionMap().get(serviceName);
                if (webserviceDescription == null) {
                    webserviceDescription = new WebserviceDescription();
                    webserviceDescription.setWebserviceDescriptionName(serviceName);
                    webservices.getWebserviceDescription().add(webserviceDescription);
                }
                // define port if not already declared
                PortComponent portComponent = portMap.get(servlet.getServletName());
                if (portComponent == null) {
                    portComponent = new PortComponent();
                    portComponent.setPortComponentName(clazz.getSimpleName());
                    final ServiceImplBean serviceImplBean = new ServiceImplBean();
                    serviceImplBean.setServletLink(servlet.getServletName());
                    portComponent.setServiceImplBean(serviceImplBean);
                    webserviceDescription.getPortComponent().add(portComponent);
                }
                // default portId == host.moduleId.servletName
                if (portComponent.getId() == null) {
                    portComponent.setId(webModule.getHost() + "." + webModule.getModuleId() + "." + servlet.getServletName());
                }
                if (webserviceDescription.getId() == null) {
                    webserviceDescription.setId(webModule.getHost() + "." + webModule.getModuleId() + "." + servlet.getServletName());
                }
                // set port values from annotations if not already set
                if (portComponent.getServiceEndpointInterface() == null) {
                    portComponent.setServiceEndpointInterface(JaxWsUtils.getServiceInterface(clazz));
                }
                if (portComponent.getWsdlPort() == null) {
                    portComponent.setWsdlPort(JaxWsUtils.getPortQName(clazz));
                }
                if (webserviceDescription.getWsdlFile() == null) {
                    webserviceDescription.setWsdlFile(JaxWsUtils.getServiceWsdlLocation(clazz, webModule.getClassLoader()));
                }
                if (portComponent.getWsdlService() == null) {
                    final Definition definition = getWsdl(webModule, webserviceDescription.getWsdlFile());
                    if (definition != null && definition.getServices().size() == 1) {
                        final QName serviceQName = (QName) definition.getServices().keySet().iterator().next();
                        portComponent.setWsdlService(serviceQName);
                    } else {
                        portComponent.setWsdlService(JaxWsUtils.getServiceQName(clazz));
                    }
                }
                if (portComponent.getProtocolBinding() == null) {
                    portComponent.setProtocolBinding(JaxWsUtils.getBindingUriFromAnn(clazz));
                }
                configMtomAnnotation(clazz, portComponent);
                if (SOAPBinding.SOAP12HTTP_MTOM_BINDING.equals(portComponent.getProtocolBinding()) || SOAPBinding.SOAP11HTTP_MTOM_BINDING.equals(portComponent.getProtocolBinding())) {
                    portComponent.setEnableMtom(true);
                }
                // handlers
                if (portComponent.getHandlerChains() == null) {
                    final HandlerChains handlerChains = getHandlerChains(clazz, portComponent.getServiceEndpointInterface(), webModule.getClassLoader());
                    portComponent.setHandlerChains(handlerChains);
                }
            }
        } catch (final Exception e) {
            throw new OpenEJBException("Unable to load servlet class: " + className, e);
        }
    }
}
Also used : ServletMapping(org.apache.openejb.jee.ServletMapping) OpenEJBException(org.apache.openejb.OpenEJBException) PortComponent(org.apache.openejb.jee.PortComponent) ServiceImplBean(org.apache.openejb.jee.ServiceImplBean) QName(javax.xml.namespace.QName) Definition(javax.wsdl.Definition) HandlerChains(org.apache.openejb.jee.HandlerChains) Webservices(org.apache.openejb.jee.Webservices) TreeMap(java.util.TreeMap) MalformedURLException(java.net.MalformedURLException) OpenEJBException(org.apache.openejb.OpenEJBException) IOException(java.io.IOException) WebserviceDescription(org.apache.openejb.jee.WebserviceDescription) Servlet(org.apache.openejb.jee.Servlet) WebApp(org.apache.openejb.jee.WebApp)

Example 4 with HandlerChains$JAXB.writeHandlerChains

use of org.apache.openejb.jee.HandlerChains$JAXB.writeHandlerChains in project tomee by apache.

the class ServiceRef$JAXB method _write.

public static final void _write(final XoXMLStreamWriter writer, final ServiceRef serviceRef, RuntimeContext context) throws Exception {
    if (serviceRef == null) {
        writer.writeXsiNil();
        return;
    }
    if (context == null) {
        context = new RuntimeContext();
    }
    final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee");
    if (ServiceRef.class != serviceRef.getClass()) {
        context.unexpectedSubclass(writer, serviceRef, ServiceRef.class);
        return;
    }
    context.beforeMarshal(serviceRef, LifecycleCallback.NONE);
    // ATTRIBUTE: id
    final String idRaw = serviceRef.id;
    if (idRaw != null) {
        String id = null;
        try {
            id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw);
        } catch (final Exception e) {
            context.xmlAdapterError(serviceRef, "id", CollapsedStringAdapter.class, String.class, String.class, e);
        }
        writer.writeAttribute("", "", "id", id);
    }
    // ELEMENT: descriptions
    Text[] descriptions = null;
    try {
        descriptions = serviceRef.getDescriptions();
    } catch (final Exception e) {
        context.getterError(serviceRef, "descriptions", ServiceRef.class, "getDescriptions", e);
    }
    if (descriptions != null) {
        for (final Text descriptionsItem : descriptions) {
            if (descriptionsItem != null) {
                writer.writeStartElement(prefix, "description", "http://java.sun.com/xml/ns/javaee");
                writeText(writer, descriptionsItem, context);
                writer.writeEndElement();
            } else {
                context.unexpectedNullValue(serviceRef, "descriptions");
            }
        }
    }
    // ELEMENT: displayNames
    Text[] displayNames = null;
    try {
        displayNames = serviceRef.getDisplayNames();
    } catch (final Exception e) {
        context.getterError(serviceRef, "displayNames", ServiceRef.class, "getDisplayNames", e);
    }
    if (displayNames != null) {
        for (final Text displayNamesItem : displayNames) {
            if (displayNamesItem != null) {
                writer.writeStartElement(prefix, "display-name", "http://java.sun.com/xml/ns/javaee");
                writeText(writer, displayNamesItem, context);
                writer.writeEndElement();
            } else {
                context.unexpectedNullValue(serviceRef, "displayNames");
            }
        }
    }
    // ELEMENT: icon
    final LocalCollection<Icon> icon = serviceRef.icon;
    if (icon != null) {
        for (final Icon iconItem : icon) {
            if (iconItem != null) {
                writer.writeStartElement(prefix, "icon", "http://java.sun.com/xml/ns/javaee");
                writeIcon(writer, iconItem, context);
                writer.writeEndElement();
            } else {
                context.unexpectedNullValue(serviceRef, "icon");
            }
        }
    }
    // ELEMENT: serviceRefName
    final String serviceRefNameRaw = serviceRef.serviceRefName;
    String serviceRefName = null;
    try {
        serviceRefName = Adapters.collapsedStringAdapterAdapter.marshal(serviceRefNameRaw);
    } catch (final Exception e) {
        context.xmlAdapterError(serviceRef, "serviceRefName", CollapsedStringAdapter.class, String.class, String.class, e);
    }
    if (serviceRefName != null) {
        writer.writeStartElement(prefix, "service-ref-name", "http://java.sun.com/xml/ns/javaee");
        writer.writeCharacters(serviceRefName);
        writer.writeEndElement();
    } else {
        context.unexpectedNullValue(serviceRef, "serviceRefName");
    }
    // ELEMENT: serviceInterface
    final String serviceInterfaceRaw = serviceRef.serviceInterface;
    String serviceInterface = null;
    try {
        serviceInterface = Adapters.collapsedStringAdapterAdapter.marshal(serviceInterfaceRaw);
    } catch (final Exception e) {
        context.xmlAdapterError(serviceRef, "serviceInterface", CollapsedStringAdapter.class, String.class, String.class, e);
    }
    if (serviceInterface != null) {
        writer.writeStartElement(prefix, "service-interface", "http://java.sun.com/xml/ns/javaee");
        writer.writeCharacters(serviceInterface);
        writer.writeEndElement();
    } else {
        context.unexpectedNullValue(serviceRef, "serviceInterface");
    }
    // ELEMENT: serviceRefType
    final String serviceRefTypeRaw = serviceRef.serviceRefType;
    String serviceRefType = null;
    try {
        serviceRefType = Adapters.collapsedStringAdapterAdapter.marshal(serviceRefTypeRaw);
    } catch (final Exception e) {
        context.xmlAdapterError(serviceRef, "serviceRefType", CollapsedStringAdapter.class, String.class, String.class, e);
    }
    if (serviceRefType != null) {
        writer.writeStartElement(prefix, "service-ref-type", "http://java.sun.com/xml/ns/javaee");
        writer.writeCharacters(serviceRefType);
        writer.writeEndElement();
    }
    // ELEMENT: wsdlFile
    final String wsdlFileRaw = serviceRef.wsdlFile;
    String wsdlFile = null;
    try {
        wsdlFile = Adapters.collapsedStringAdapterAdapter.marshal(wsdlFileRaw);
    } catch (final Exception e) {
        context.xmlAdapterError(serviceRef, "wsdlFile", CollapsedStringAdapter.class, String.class, String.class, e);
    }
    if (wsdlFile != null) {
        writer.writeStartElement(prefix, "wsdl-file", "http://java.sun.com/xml/ns/javaee");
        writer.writeCharacters(wsdlFile);
        writer.writeEndElement();
    }
    // ELEMENT: jaxrpcMappingFile
    final String jaxrpcMappingFileRaw = serviceRef.jaxrpcMappingFile;
    String jaxrpcMappingFile = null;
    try {
        jaxrpcMappingFile = Adapters.collapsedStringAdapterAdapter.marshal(jaxrpcMappingFileRaw);
    } catch (final Exception e) {
        context.xmlAdapterError(serviceRef, "jaxrpcMappingFile", CollapsedStringAdapter.class, String.class, String.class, e);
    }
    if (jaxrpcMappingFile != null) {
        writer.writeStartElement(prefix, "jaxrpc-mapping-file", "http://java.sun.com/xml/ns/javaee");
        writer.writeCharacters(jaxrpcMappingFile);
        writer.writeEndElement();
    }
    // ELEMENT: serviceQname
    final QName serviceQname = serviceRef.serviceQname;
    if (serviceQname != null) {
        writer.writeStartElement(prefix, "service-qname", "http://java.sun.com/xml/ns/javaee");
        writer.writeQName(serviceQname);
        writer.writeEndElement();
    }
    // ELEMENT: portComponentRef
    final List<PortComponentRef> portComponentRef = serviceRef.portComponentRef;
    if (portComponentRef != null) {
        for (final PortComponentRef portComponentRefItem : portComponentRef) {
            if (portComponentRefItem != null) {
                writer.writeStartElement(prefix, "port-component-ref", "http://java.sun.com/xml/ns/javaee");
                writePortComponentRef(writer, portComponentRefItem, context);
                writer.writeEndElement();
            } else {
                context.unexpectedNullValue(serviceRef, "portComponentRef");
            }
        }
    }
    // ELEMENT: handler
    final List<Handler> handler = serviceRef.handler;
    if (handler != null) {
        for (final Handler handlerItem : handler) {
            if (handlerItem != null) {
                writer.writeStartElement(prefix, "handler", "http://java.sun.com/xml/ns/javaee");
                writeHandler(writer, handlerItem, context);
                writer.writeEndElement();
            } else {
                context.unexpectedNullValue(serviceRef, "handler");
            }
        }
    }
    // ELEMENT: handlerChains
    final HandlerChains handlerChains = serviceRef.handlerChains;
    if (handlerChains != null) {
        writer.writeStartElement(prefix, "handler-chains", "http://java.sun.com/xml/ns/javaee");
        writeHandlerChains(writer, handlerChains, context);
        writer.writeEndElement();
    }
    // ELEMENT: mappedName
    final String mappedNameRaw = serviceRef.mappedName;
    String mappedName = null;
    try {
        mappedName = Adapters.collapsedStringAdapterAdapter.marshal(mappedNameRaw);
    } catch (final Exception e) {
        context.xmlAdapterError(serviceRef, "mappedName", CollapsedStringAdapter.class, String.class, String.class, e);
    }
    if (mappedName != null) {
        writer.writeStartElement(prefix, "mapped-name", "http://java.sun.com/xml/ns/javaee");
        writer.writeCharacters(mappedName);
        writer.writeEndElement();
    }
    // ELEMENT: injectionTarget
    final Set<InjectionTarget> injectionTarget = serviceRef.injectionTarget;
    if (injectionTarget != null) {
        for (final InjectionTarget injectionTargetItem : injectionTarget) {
            if (injectionTargetItem != null) {
                writer.writeStartElement(prefix, "injection-target", "http://java.sun.com/xml/ns/javaee");
                writeInjectionTarget(writer, injectionTargetItem, context);
                writer.writeEndElement();
            } else {
                context.unexpectedNullValue(serviceRef, "injectionTarget");
            }
        }
    }
    // ELEMENT: lookupName
    final String lookupNameRaw = serviceRef.lookupName;
    String lookupName = null;
    try {
        lookupName = Adapters.collapsedStringAdapterAdapter.marshal(lookupNameRaw);
    } catch (final Exception e) {
        context.xmlAdapterError(serviceRef, "lookupName", CollapsedStringAdapter.class, String.class, String.class, e);
    }
    if (lookupName != null) {
        writer.writeStartElement(prefix, "lookup-name", "http://java.sun.com/xml/ns/javaee");
        writer.writeCharacters(lookupName);
        writer.writeEndElement();
    }
    context.afterMarshal(serviceRef, LifecycleCallback.NONE);
}
Also used : CollapsedStringAdapter(javax.xml.bind.annotation.adapters.CollapsedStringAdapter) QName(javax.xml.namespace.QName) Handler$JAXB.readHandler(org.apache.openejb.jee.Handler$JAXB.readHandler) Handler$JAXB.writeHandler(org.apache.openejb.jee.Handler$JAXB.writeHandler) Text$JAXB.readText(org.apache.openejb.jee.Text$JAXB.readText) Text$JAXB.writeText(org.apache.openejb.jee.Text$JAXB.writeText) HandlerChains$JAXB.readHandlerChains(org.apache.openejb.jee.HandlerChains$JAXB.readHandlerChains) HandlerChains$JAXB.writeHandlerChains(org.apache.openejb.jee.HandlerChains$JAXB.writeHandlerChains) PortComponentRef$JAXB.readPortComponentRef(org.apache.openejb.jee.PortComponentRef$JAXB.readPortComponentRef) PortComponentRef$JAXB.writePortComponentRef(org.apache.openejb.jee.PortComponentRef$JAXB.writePortComponentRef) InjectionTarget$JAXB.readInjectionTarget(org.apache.openejb.jee.InjectionTarget$JAXB.readInjectionTarget) InjectionTarget$JAXB.writeInjectionTarget(org.apache.openejb.jee.InjectionTarget$JAXB.writeInjectionTarget) Icon$JAXB.readIcon(org.apache.openejb.jee.Icon$JAXB.readIcon) Icon$JAXB.writeIcon(org.apache.openejb.jee.Icon$JAXB.writeIcon) RuntimeContext(org.metatype.sxc.jaxb.RuntimeContext)

Example 5 with HandlerChains$JAXB.writeHandlerChains

use of org.apache.openejb.jee.HandlerChains$JAXB.writeHandlerChains in project tomee by apache.

the class HandlerResolverImplTest method testBasic.

public void testBasic() throws Exception {
    final HandlerChains handlerChains = readHandlerChains("/handlers.xml");
    assertEquals(3, handlerChains.getHandlerChain().size());
    final List<HandlerChainInfo> handlerChainInfos = ConfigurationFactory.toHandlerChainInfo(handlerChains);
    final List<HandlerChainData> handlerChainDatas = WsBuilder.toHandlerChainData(handlerChainInfos, getClass().getClassLoader());
    final HandlerResolverImpl resolver = new HandlerResolverImpl(handlerChainDatas, null, new InitialContext());
    List<Handler> handlers = null;
    handlers = resolver.getHandlerChain(new TestPortInfo(null, null, null));
    assertEquals(3, handlers.size());
}
Also used : HandlerChainInfo(org.apache.openejb.assembler.classic.HandlerChainInfo) Handler(javax.xml.ws.handler.Handler) HandlerChains(org.apache.openejb.jee.HandlerChains) InitialContext(javax.naming.InitialContext)

Aggregations

QName (javax.xml.namespace.QName)9 HandlerChains (org.apache.openejb.jee.HandlerChains)9 InitialContext (javax.naming.InitialContext)5 Handler (javax.xml.ws.handler.Handler)5 HandlerChainInfo (org.apache.openejb.assembler.classic.HandlerChainInfo)5 CollapsedStringAdapter (javax.xml.bind.annotation.adapters.CollapsedStringAdapter)4 Handler$JAXB.readHandler (org.apache.openejb.jee.Handler$JAXB.readHandler)4 Handler$JAXB.writeHandler (org.apache.openejb.jee.Handler$JAXB.writeHandler)4 HandlerChains$JAXB.readHandlerChains (org.apache.openejb.jee.HandlerChains$JAXB.readHandlerChains)4 HandlerChains$JAXB.writeHandlerChains (org.apache.openejb.jee.HandlerChains$JAXB.writeHandlerChains)4 Icon$JAXB.readIcon (org.apache.openejb.jee.Icon$JAXB.readIcon)4 Icon$JAXB.writeIcon (org.apache.openejb.jee.Icon$JAXB.writeIcon)4 RuntimeContext (org.metatype.sxc.jaxb.RuntimeContext)4 OpenEJBException (org.apache.openejb.OpenEJBException)3 URL (java.net.URL)2 ArrayList (java.util.ArrayList)2 TreeMap (java.util.TreeMap)2 Definition (javax.wsdl.Definition)2 Addressing$JAXB.readAddressing (org.apache.openejb.jee.Addressing$JAXB.readAddressing)2 Addressing$JAXB.writeAddressing (org.apache.openejb.jee.Addressing$JAXB.writeAddressing)2