Package org.servicemix.components.util

Examples of org.servicemix.components.util.ComponentSupport


    /**
     * Forwards the inbound message to the destination copying the content and properties
     */
    public void forward(XSLProcessorContext context, Element element) throws MessagingException {
        ComponentSupport component = getComponent(context, element);
        if (component == null) {
            throw new MessagingException("Could not find a component on which to perform the service invocation!");
        }

        TransformerImpl transformer = context.getTransformer();
        PrefixResolver namespaceContext = transformer.getXPathContext().getNamespaceContext();

        QName service = getQNameAttribute(namespaceContext, element, "service");
        QName interfaceName = getQNameAttribute(namespaceContext, element, "interface");
        QName operation = getQNameAttribute(namespaceContext, element, "operation");

        MessageExchange exchange = getExchange(context, element);
        NormalizedMessage in = getInMessage(context, element);

        // TODO we should allow nested setOutProperty tags

        component.invoke(exchange, in, service, interfaceName, operation);
    }
View Full Code Here


    /**
     * Invokes the service with the XML content included in the XML element
     */
    public void invoke(XSLProcessorContext context, ElemTemplateElement element) throws MessagingException, ParserConfigurationException, TransformerException {
        ComponentSupport component = getComponent(context, element);
        if (component == null) {
            throw new MessagingException("Could not find a component on which to perform the service invocation!");
        }

        TransformerImpl transformer = context.getTransformer();
        PrefixResolver namespaceContext = transformer.getXPathContext().getNamespaceContext();

        QName service = getQNameAttribute(namespaceContext, element, "service");
        QName interfaceName = getQNameAttribute(namespaceContext, element, "interface");
        QName operation = getQNameAttribute(namespaceContext, element, "operation");

        InOnly outExchange = component.createInOnlyExchange(service, interfaceName, operation);
        NormalizedMessage out = outExchange.createMessage();
        outExchange.setInMessage(out);

        transformer.setParameter("out", out);

        // lets copy the content into the body
        Document document = getTransformer().createDocument();
        DOMBuilder builder = new DOMBuilder(document);
        transformer.executeChildTemplates(element, context.getContextNode(), context.getMode(), builder);
       
        out.setContent(new DOMSource(document));

        // now lets perform the invocation
        component.send(outExchange);
    }
View Full Code Here

    /**
     * Calls the service with the XML content included in the XML element and outputs the XML content
     */
    public void call(XSLProcessorContext context, ElemTemplateElement element) throws MessagingException, ParserConfigurationException, TransformerException {
        ComponentSupport component = getComponent(context, element);
        if (component == null) {
            throw new MessagingException("Could not find a component on which to perform the service invocation!");
        }

        TransformerImpl transformer = context.getTransformer();
        PrefixResolver namespaceContext = transformer.getXPathContext().getNamespaceContext();

        QName service = getQNameAttribute(namespaceContext, element, "service");
        QName interfaceName = getQNameAttribute(namespaceContext, element, "interface");
        QName operation = getQNameAttribute(namespaceContext, element, "operation");

        InOut outExchange = component.createInOutExchange(service, interfaceName, operation);
        NormalizedMessage out = outExchange.createMessage();
        outExchange.setInMessage(out);


        // lets copy the content into the body
        Document document = getTransformer().createDocument();
        DOMBuilder builder = new DOMBuilder(document);
        transformer.executeChildTemplates(element, context.getContextNode(), context.getMode(), builder);

        out.setContent(new DOMSource(document));

        // now lets perform the invocation
        if (component.getDeliveryChannel().sendSync(outExchange)) {
            NormalizedMessage result = outExchange.getOutMessage();
            String outVarName = getAttribute(element, "outVar", "out");
            transformer.setParameter(outVarName, result);
        }
        else {
View Full Code Here

TOP

Related Classes of org.servicemix.components.util.ComponentSupport

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.