Package org.apache.geronimo.xbeans.javaee

Examples of org.apache.geronimo.xbeans.javaee.HandlerChainsType


public class GeronimoHandlerResolverTest extends TestSupport {

    public void testBasic() throws Exception {
        InputStream in = getClass().getResourceAsStream("/handlers.xml");
        assertTrue(in != null);
        HandlerChainsType handlerChains = toHandlerChains(in);
        assertEquals(3, handlerChains.getHandlerChainArray().length);

        GeronimoHandlerResolver resolver =
            new GeronimoHandlerResolver(getClass().getClassLoader(), getClass(), handlerChains, null);

        List<Handler> handlers = null;
View Full Code Here


    }

    public void testServiceMatching() throws Exception {
        InputStream in = getClass().getResourceAsStream("/handlers_service.xml");
        assertTrue(in != null);
        HandlerChainsType handlerChains = toHandlerChains(in);
        assertEquals(4, handlerChains.getHandlerChainArray().length);

        GeronimoHandlerResolver resolver =
            new GeronimoHandlerResolver(getClass().getClassLoader(), getClass(), handlerChains, null);

        List<Handler> handlers = null;
View Full Code Here

    }

    public void testBindingMatching() throws Exception {
        InputStream in = getClass().getResourceAsStream("/handlers_bindings.xml");
        assertTrue(in != null);
        HandlerChainsType handlerChains = toHandlerChains(in);
        assertEquals(4, handlerChains.getHandlerChainArray().length);

        GeronimoHandlerResolver resolver =
            new GeronimoHandlerResolver(getClass().getClassLoader(), getClass(), handlerChains, null);

        List<Handler> handlers = null;
View Full Code Here

    }

    public void testPortMatching() throws Exception {
        InputStream in = getClass().getResourceAsStream("/handlers_port.xml");
        assertTrue(in != null);
        HandlerChainsType handlerChains = toHandlerChains(in);
        assertEquals(4, handlerChains.getHandlerChainArray().length);

        GeronimoHandlerResolver resolver =
            new GeronimoHandlerResolver(getClass().getClassLoader(), getClass(), handlerChains, null);

        List<Handler> handlers = null;
View Full Code Here

    }

    public void testMixedMatching() throws Exception {
        InputStream in = getClass().getResourceAsStream("/handlers_mixed.xml");
        assertTrue(in != null);
        HandlerChainsType handlerChains = toHandlerChains(in);
        assertEquals(3, handlerChains.getHandlerChainArray().length);

        GeronimoHandlerResolver resolver =
            new GeronimoHandlerResolver(getClass().getClassLoader(), getClass(), handlerChains, null);

        List<Handler> handlers = null;
View Full Code Here

        } else {
            hcAnn.validate();

            try {
                URL handlerFileURL = clz.getResource(hcAnn.getFileName());
                HandlerChainsType handlerChainsType = HandlerChainsDocument.Factory.parse(handlerFileURL).getHandlerChains();

                if (null == handlerChainsType || handlerChainsType.getHandlerChainArray() == null) {
                    throw new WebServiceException("Chain not specified");
                }

                chain = new ArrayList<Handler>();
                for (HandlerChainType hc : handlerChainsType.getHandlerChainArray()) {
                    chain.addAll(buildHandlerChain(hc, clz.getClassLoader()));
                }

            } catch (Exception e) {
                throw new WebServiceException("Chain not specified", e);
View Full Code Here

        }
        return handlerChains;
    }

    public static HandlerChainsType getHandlerChains(String xml) throws XmlException {
        HandlerChainsType types = null;
        if (xml != null) {
            try {
                types = HandlerChainsDocument.Factory.parse(xml).getHandlerChains();
            } catch (XmlException e){
                types = HandlerChainsType.Factory.parse(xml);
View Full Code Here

                if (url != null) {
                    // Bind the XML handler chain file to an XMLBeans document
                    XmlObject xml = XmlBeansUtil.parse(url, null);
                    HandlerChainsDocument hcd = (HandlerChainsDocument) XmlBeansUtil.typedCopy(xml, HandlerChainsDocument.type);
                    HandlerChainsType handlerChains = hcd.getHandlerChains();

                    // Find the <service-ref> entry this handler chain belongs to and insert it
                    ServiceRefType[] serviceRefs = annotatedApp.getServiceRefArray();
                    boolean exists = false;
                    for ( ServiceRefType serviceRef : serviceRefs ) {
                        if ( serviceRef.getServiceRefName().getStringValue().trim().equals(serviceRefName) ) {
                            ServiceRefHandlerChainsType serviceRefHandlerChains = serviceRef.addNewHandlerChains();
                            for (HandlerChainType handlerChain : handlerChains.getHandlerChainArray()) {
                                ServiceRefHandlerChainType serviceRefHandlerChain = serviceRefHandlerChains.addNewHandlerChain();
                                for ( PortComponentHandlerType handler : handlerChain.getHandlerArray()) {
                                    ServiceRefHandlerType serviceRefHandler = serviceRefHandlerChain.addNewHandler();
                                    serviceRefHandler.setHandlerName(handler.getHandlerName());
                                    serviceRefHandler.setHandlerClass(handler.getHandlerClass());
View Full Code Here

        } else {
            hcAnn.validate();

            try {
                URL handlerFileURL = clz.getResource(hcAnn.getFileName());
                HandlerChainsType handlerChainsType = HandlerChainsDocument.Factory.parse(handlerFileURL).getHandlerChains();

                if (null == handlerChainsType || handlerChainsType.getHandlerChainArray() == null) {
                    throw new WebServiceException("Chain not specified");
                }
               
                chain = new ArrayList<Handler>();
                for (HandlerChainType hc : handlerChainsType.getHandlerChainArray()) {
                    chain.addAll(buildHandlerChain(hc, clz.getClassLoader()));
                }

            } catch (Exception e) {
                throw new WebServiceException("Chain not specified", e);
View Full Code Here

                                 Map<Object, EndpointInfo> seiInfoMap) {
        super(handlerChainsXML, seiInfoMap, name, serviceQName, wsdlURI, referenceClassName, serviceClassName);
    }

    protected HandlerResolver getHandlerResolver(Class serviceClass) {
        HandlerChainsType types = null;
        try {
            if (this.handlerChainsXML != null){
                try {
                    types = HandlerChainsDocument.Factory.parse(this.handlerChainsXML).getHandlerChains();
                } catch (XmlException e){
View Full Code Here

TOP

Related Classes of org.apache.geronimo.xbeans.javaee.HandlerChainsType

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.