Package org.xmlpull.v1.builder

Examples of org.xmlpull.v1.builder.XmlElement


        InvocationEntity serviceEntity = notifier.createEntity(serviceWorkflowID, serviceServiceID, serviceNodeID,
                serviceTimestep);
        WorkflowTrackingContext workflowContext = notifier.createTrackingContext(new Properties(), this.configuration
                .getBrokerURL().toASCIIString(), myWorkflowID, myServiceID, myNodeID, myTimestep);

        XmlElement inputBody = (XmlElement) ((XmlElement) inputMessage).getParent();
        XmlObject inputBodyObject = XBeansUtil.xmlElementToXmlObject(inputBody);

        InvocationContext context = notifier.invokingService(workflowContext, serviceEntity, null, inputBodyObject);

        if (outputMap != null) {
            WSIFMessage outputMessage = operation.createOutputMessage();
            Soap11Util.getInstance().wrapBodyContent((XmlElement) outputMessage);
            for (String key : outputMap.keySet()) {
                String value = outputMap.get(key);
                outputMessage.setObjectPart(key, value);
            }
            XmlElement outputBody = (XmlElement) ((XmlElement) outputMessage).getParent();
            XmlObject outputBodyObject = XBeansUtil.xmlElementToXmlObject(outputBody);

            notifier.receivedResult(workflowContext, context, null, outputBodyObject);
        }
    }
View Full Code Here


         * @param type
         * @param message
         */
        public void deliverMessage(String topic, NotificationType type, XmlObject message) {

            XmlElement event = XBeansUtil.xmlObjectToXmlElement(message);
            this.eventData.addEvent(XMLUtil.xmlElement3ToXmlElement5(event));
        }
View Full Code Here

                serviceTimestep = new Integer(this.builder.getWorkflowMonitoringContext().getWorkflowTimeStep());
            } catch (NumberFormatException e) {
                logger.error(e.getMessage(), e);
            }
        }*/
        XmlElement soapHeader = soapEnvelope.element(null, XmlConstants.S_HEADER);
        XmlElement soapBody = soapEnvelope.element(null, XmlConstants.S_BODY);
        XmlObject headerObject = null;
        if (soapHeader != null) {
            headerObject = XBeansUtil.xmlElementToXmlObject(soapHeader);
        }
        XmlObject bodyObject = XBeansUtil.xmlElementToXmlObject(soapBody);
View Full Code Here

    @Override
    public boolean processIncomingXml(XmlElement soapEnvelope, MessageContext context)
            throws DynamicInfosetInvokerException {
        logger.info("soapEnvelope: " + XMLUtil.xmlElementToString(soapEnvelope));

        XmlElement soapHeader = soapEnvelope.element(null, XmlConstants.S_HEADER);
        XmlObject headerObject = null;
        if (soapHeader != null) {
            headerObject = XBeansUtil.xmlElementToXmlObject(soapHeader);
        }

        XmlElement soapBody = soapEnvelope.element(null, XmlConstants.S_BODY);
        XmlObject bodyObject = XBeansUtil.xmlElementToXmlObject(soapBody);
        XmlElement faultElement = soapBody.element(null, "Fault");
        if (faultElement == null) {
            this.notifier.receivedResult(this.context, this.invocationContext, headerObject, bodyObject,
                    RECEIVE_RESULT_MESSAGE);
        } else {
            this.notifier.receivedFault(this.context, this.invocationContext, headerObject, bodyObject,
View Full Code Here

    public void create() throws GraphException {

        XmlDocument doc = builder.newDocument();

        XmlElement scufl = doc.addDocumentElement(scuflNS, "scufl");
        scufl.addAttribute("version", "0.2");
        scufl.addAttribute("log", "0");
        XmlElement description = scufl.addElement(scuflNS, "workflowdescription");
        description.addAttribute("lsid", "urn:lsid:net.sf.taverna:wfDefinition:" + UUID.randomUUID());
        description.addAttribute("author", "");
        description.addAttribute("title", workflow.getName());
        writeServices(scufl);

        writeSplitors(scufl);

        // add links
View Full Code Here

     * @param node
     * @throws GraphException
     */
    private void writeSplitorPerService(XmlElement scufl, WSNode node) throws GraphException {
        List<DataPort> inputPorts = node.getInputPorts();
        XmlElement processor = scufl.addElement(scuflNS, "processor");
        processor.addAttribute("name", getValidName(node) + "InputMessagePartXML");
        XmlElement local = processor.addElement(scuflNS, "local");
        local.addChild(0, "org.embl.ebi.escience.scuflworkers.java.XMLInputSplitter");
        XmlElement extensions = local.addElement(scuflNS, "extensions");

        QName inputName = getInputElementName(node);
        if (null == inputName) {
            throw new GraphException("No Valid input type found for WS Node" + node.getName());
        }
        if (node.getOutputPorts().size() != 1) {
            throw new GraphException("Number of out ports in WS node " + node.getName() + "is invalid:"
                    + node.getOutputPorts().size());
        }
        DataPort outputPort = node.getOutputPort(0);

        WSComponent component = node.getComponent();
        String inputPartName = component.getInputPartName();
        String inputTypeName = component.getInputTypeName();

        XmlElement complexType = extensions.addElement(scuflNS, "complextype");
        complexType.addAttribute("optional", "false");
        complexType.addAttribute("unbounded", "false");
        complexType.addAttribute("typename", inputTypeName);

        String spliterName = inputPartName;
        complexType.addAttribute("name", spliterName);
        complexType.addAttribute("qname", inputName.toString());

        XmlElement element = complexType.addElement(scuflNS, "elements");
        for (DataPort port : inputPorts) {
            if ("http://www.w3.org/2001/XMLSchema".equals(port.getType().getNamespaceURI())) {
                XmlElement baseType = element.addElement(scuflNS, "basetype");
                baseType.addAttribute("optional", "false");
                baseType.addAttribute("unbounded", "false");
                baseType.addAttribute("typename", port.getType().getLocalPart());
                baseType.addAttribute("name", port.getName());
                baseType.addAttribute("qname", inputTypeName + "&gt;" + port.getName());

            }
            // all the sources are written here
            // the links from input nodes to the spiters are done here
            // links from the from node output splitter to the this service's
            // inputsplitter is done here

            if (port.getFromNode() instanceof InputNode) {
                XmlElement source = builder.newFragment(scuflNS, "source");
                source.addAttribute("name", port.getFromNode().getID());
                if (!sourceExist(port.getFromNode().getID())) {
                    this.sources.put(port.getFromNode().getID(), source);
                }
                XmlElement link = builder.newFragment(scuflNS, "link");
                link.addAttribute("source", port.getFromNode().getID());
                link.addAttribute("sink", getValidName(node) + "InputMessagePartXML:" + port.getName());
                this.links.add(link);

            } else if (port.getFromNode() instanceof WSNode) {
                XmlElement link = builder.newFragment(scuflNS, "link");
                if (port.getFromNode().getOutputPorts().size() != 1) {
                    throw new GraphException("Number of out ports in from WS node " + port.getFromNode().getName()
                            + "is invalid:" + node.getOutputPorts().size());
                }
                link.addAttribute("source", getValidName((WSNode) port.getFromNode()) + "OutputMessagePartXML:"
                        + port.getFromNode().getOutputPort(0).getName());
                link.addAttribute("sink", getValidName(node) + "InputMessagePartXML:" + port.getName());
                this.links.add(link);
            } else {
                throw new GraphException("Unhandled from node type:" + port.getFromNode() + " for node"
                        + node.getName());
            }
        }

        // link from the spliter to the service

        XmlElement link = builder.newFragment(scuflNS, "link");
        link.addAttribute("source", getValidName(node) + "InputMessagePartXML:output");
        link.addAttribute("sink", getValidName(node) + ":" + spliterName);
        this.links.add(link);

        // link from service out to the ouput spliter

        link = builder.newFragment(scuflNS, "link");
        link.addAttribute("source", getValidName(node) + ":" + node.getComponent().getOutputPartName());
        link.addAttribute("sink", getValidName(node) + "OutputMessagePartXML:input");
        this.links.add(link);

        // /outspiltor
        XmlElement outProcessor = scufl.addElement(scuflNS, "processor");
        outProcessor.addAttribute("name", getValidName(node) + "OutputMessagePartXML");
        XmlElement outLocal = outProcessor.addElement(scuflNS, "local");
        outLocal.addChild(0, "org.embl.ebi.escience.scuflworkers.java.XMLOutputSplitter");
        XmlElement outExtensions = outLocal.addElement(scuflNS, "extensions");
        XmlElement outComplextype = outExtensions.addElement(scuflNS, "complextype");
        outComplextype.addAttribute("optional", "false");
        outComplextype.addAttribute("unbounded", "false");
        outComplextype.addAttribute("typename", component.getOutputTypeName());
        outComplextype.addAttribute("name", component.getOutputPartName());
        QName outputName = getOutputElementName(node);
        if (null == outputName) {
            throw new GraphException("No Valid output type found for WS Node" + node.getName());
        }
        outComplextype.addAttribute("qname", outputName.toString());
        XmlElement elements = outComplextype.addElement(scuflNS, "elements");
        XmlElement outBaseType = elements.addElement(scuflNS, "basetype");
        outBaseType.addAttribute("optional", "false");
        outBaseType.addAttribute("unbounded", "false");

        outBaseType.addAttribute("typename", outputPort.getType().getLocalPart());
        String Z = component.getOutputPort(0).getName();
        outBaseType.addAttribute("name", Z);

        outBaseType.addAttribute("qname", component.getOutputTypeName() + "&gt;" + Z);

        List<DataPort> outputPorts = node.getOutputPorts();
        for (DataPort port : outputPorts) {
            List<Node> toNodes = port.getToNodes();
            for (Node toNode : toNodes) {
                if (toNode instanceof OutputNode) {
                    if ("http://www.w3.org/2001/XMLSchema".equals(port.getType().getNamespaceURI())) {
                        XmlElement sink = builder.newFragment(scuflNS, "sink");
                        sink.addAttribute("name", toNode.getID());
                        sinks.add(sink);
                        link = builder.newFragment(scuflNS, "link");
                        link.addAttribute("source", getValidName(node) + "OutputMessagePartXML:" + outputPort.getName());
                        link.addAttribute("sink", toNode.getID());
                        this.links.add(link);
View Full Code Here

            }

            String wsdl = (String) outputMessage.getObjectPart(WSDL_PART);
            logger.debug("WSDL: " + wsdl);

            XmlElement definitionsElement = XMLUtil.stringToXmlElement3(wsdl);

            this.serviceDefinitions = new WsdlDefinitions(definitionsElement);
            return this.serviceDefinitions;
        } catch (RuntimeException e) {
            String message = "Failed to create a service";
View Full Code Here

        }
    }

    private XmlElement createWSProcess(WSNode node, XmlElement scufl) throws GraphException, XmlBuilderException {

        XmlElement processor = scufl.addElement(scuflNS, "processor");
        String name = getValidName(node);
        processor.addAttribute("name", name);
        XmlElement description = processor.addElement(scuflNS, "description");
        String txt = node.getComponent().getDescription();
        if (null == txt) {
            description.addChild(name);
        } else {
            description.addChild(txt);
        }

        XmlElement arbitrarywsdl = processor.addElement(scuflNS, "arbitrarywsdl");
        XmlElement wsdl = arbitrarywsdl.addElement(scuflNS, "wsdl");

        String epr = getEPR(node);
        if (null == epr) {
            throw new GraphException("EPR not found for the WS-node:" + builder.serializeToString(node));
        }
        wsdl.addChild(epr + "?wsdl");

        XmlElement operation = arbitrarywsdl.addElement(scuflNS, "operation");
        operation.addChild(node.getOperationName());

        return processor;

    }
View Full Code Here

                    String message = next.toStringWithConsume();
                    xmlArrayList.add(XMLUtil.stringToXmlElement3(message));
                }
                // now hard work: find callbacks
                for (int i = 0; i < xmlArrayList.size(); i++) {
                    XmlElement m = xmlArrayList.get(i);
                    try {
                        logger.debug(Thread.currentThread().getName());
                        WSIFMessageElement e = new WSIFMessageElement(m);
                        this.invoker.setOutputMessage(e);
                        //ideally there are no multiple messages, so we can return from this thread at this point
View Full Code Here

        inputMessage.setObjectPart("y", "3");

        logger.info("Sending a message:\n" + XMLUtil.xmlElementToString((XmlElement) inputMessage));
        boolean success = operation.executeRequestResponseOperation(inputMessage, outputMessage, faultMessage);

        XmlElement result;
        if (success) {
            result = (XmlElement) outputMessage;
        } else {
            result = (XmlElement) faultMessage;
        }
View Full Code Here

TOP

Related Classes of org.xmlpull.v1.builder.XmlElement

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.