Package org.xmlpull.infoset

Examples of org.xmlpull.infoset.XmlElement


                Workflow importedWorkflow;
                if (path.endsWith(XBayaConstants.GRAPH_FILE_SUFFIX)) {
                    WSGraph importedGraph = WSGraphFactory.createGraph(file);
                    importedWorkflow = Workflow.graphToWorkflow(importedGraph);
                } else {
                    XmlElement importedWorkflowElement = XMLUtil.loadXML(file);
                    importedWorkflow = new Workflow(importedWorkflowElement);
                }
                GraphCanvas newGraphCanvas = engine.getGUI().newGraphCanvas(true);
                newGraphCanvas.setWorkflow(importedWorkflow);
                this.engine.getGUI().setWorkflow(importedWorkflow);
View Full Code Here


                if (path.endsWith(XBayaConstants.GRAPH_FILE_SUFFIX)) {
                    WSGraph graph = WSGraphFactory.createGraph(file);
                    workflow = Workflow.graphToWorkflow(graph);
                } else {
                    XmlElement workflowElement = XMLUtil.loadXML(file);
                    workflow = new Workflow(workflowElement);
                }

            } catch (IOException e) {
                this.engine.getGUI().getErrorWindow().error(ErrorMessages.OPEN_FILE_ERROR, e);
View Full Code Here

            Iterator children = null;
            if (returnValForProvenance instanceof org.xmlpull.v1.builder.XmlElement) {
              org.xmlpull.v1.builder.XmlElement msgElmt = (org.xmlpull.v1.builder.XmlElement) returnValForProvenance;
              children = msgElmt.children();
            } else {
              XmlElement msgElmt = XmlConstants.BUILDER.parseFragmentFromString("<temp>" + returnValForProvenance + "</temp>");
              children = msgElmt.children().iterator();
            }
                        while (children.hasNext()) {
                            Object object = children.next();
                            if (object instanceof org.xmlpull.v1.builder.XmlElement) {
                                org.xmlpull.v1.builder.XmlElement child = (org.xmlpull.v1.builder.XmlElement) object;
                                Iterator valItr = child.children();
                                if (valItr.hasNext()) {
                                    Object object2 = valItr.next();
                                    if (object2 instanceof String) {
                                        listOfValues.add(object2.toString());
                                    }
                                }
                            }
                            if (object instanceof XmlElement) {
                                listOfValues.add(((XmlElement) object).children().iterator().next().toString());
                            }if (object instanceof String){
                                listOfValues.add(object.toString());
                            }
                        }
                    } else if (workflowInvoker instanceof SystemComponentInvoker) {
                        int index = inputNode.getOutputPorts().indexOf(inputPort.getEdge(0).getFromPort());
                        String outputName = "";
                        if (inputNode.getInputPort(index) instanceof SystemDataPort) {
                            outputName = ((SystemDataPort) inputNode.getInputPort(index)).getWSComponentPort().getName();
                        } else if (inputNode.getInputPort(index) instanceof WSPort) {
                            outputName = ((SystemDataPort) inputNode.getInputPort(inputNode.getOutputPorts().indexOf(
                                    inputPort.getEdge(0).getFromPort()))).getWSComponentPort().getName();
                        }
                        returnValForProvenance = workflowInvoker.getOutput(outputName);
                        XmlElement msgElmt = XmlConstants.BUILDER.parseFragmentFromString("<temp>" + returnValForProvenance + "</temp>");
                        Iterator valItr = msgElmt.children().iterator();
                        while (valItr.hasNext()) {
                            Object object2 = valItr.next();
                            if (object2 instanceof XmlElement) {
                                listOfValues.add(((XmlElement) object2).children().iterator().next().toString());
                            }
View Full Code Here

            } else if (inputPort instanceof WSPort) {
                outputName = ((SystemDataPort) fromNode.getInputPort(fromNode.getOutputPorts().indexOf(inputPort.getEdge(0).getFromPort())))
                        .getWSComponentPort().getName();
            }
            XmlElement msgElmt = XmlConstants.BUILDER.parseFragmentFromString("<temp>" + workflowInvoker.getOutput(outputName) + "</temp>");
            Iterator valItr = msgElmt.children().iterator();
            while (valItr.hasNext()) {
                Object object2 = valItr.next();
                if (object2 instanceof XmlElement) {

                    if (((XmlElement) object2).children().iterator().hasNext()) {
View Full Code Here

                    if (workflowInvoker instanceof GenericInvoker) {

                        returnValForProvenance = ((GenericInvoker) workflowInvoker).getOutputs();
                        String message = returnValForProvenance.toString();

                        XmlElement msgElmt = XmlConstants.BUILDER.parseFragmentFromString(message);
                        Iterator children = msgElmt.children().iterator();
                        while (children.hasNext()) {
                            Object object = children.next();
                            // foreachWSNode.getInputPort(0).getType()
                            if (object instanceof XmlElement) {
                                index++;
                            }
                        }
                    } else if (workflowInvoker instanceof WorkflowInvokerWrapperForGFacInvoker) {
                        String outputName = forEachInputNode.getOutputPort(0).getName();
                        returnValForProvenance = workflowInvoker.getOutput(outputName);
                        org.xmlpull.v1.builder.XmlElement msgElmt = (org.xmlpull.v1.builder.XmlElement) returnValForProvenance;
                        Iterator children = msgElmt.children();
                        while (children.hasNext()) {
                            Object object = children.next();
                            if (object instanceof org.xmlpull.v1.builder.XmlElement) {
                                org.xmlpull.v1.builder.XmlElement child = (org.xmlpull.v1.builder.XmlElement) object;
                                Iterator valItr = child.children();
                                if (valItr.hasNext()) {
                                    Object object2 = valItr.next();
                                    if (object2 instanceof String) {
                                        index++;
                                    }
                                }
                            }
                        }
                        inputNumbers[inputPorts.indexOf(forEachInputPort)] = index;
                    } else if (workflowInvoker instanceof SystemComponentInvoker) {
                        int portIndex = forEachInputNode.getOutputPorts().indexOf(forEachInputPort.getEdge(0).getFromPort());
                        String outputName = "";
                        if (forEachInputNode.getInputPort(portIndex) instanceof SystemDataPort) {
                            outputName = ((SystemDataPort) forEachInputNode.getInputPort(portIndex)).getWSComponentPort().getName();
                        } else if (forEachInputNode.getInputPort(portIndex) instanceof WSPort) {
                            outputName = ((WSPort) forEachInputNode.getInputPort(portIndex)).getComponentPort().getName();
                        }
                        returnValForProvenance = workflowInvoker.getOutput(outputName);
                        XmlElement msgElmt = XmlConstants.BUILDER.parseFragmentFromString("<temp>" + returnValForProvenance + "</temp>");
                        Iterator valItr = msgElmt.children().iterator();
                        while (valItr.hasNext()) {
                            Object object2 = valItr.next();
                            if (object2 instanceof XmlElement) {
                                index++;
                            }
View Full Code Here

        if (e != null) {
            message += ": " + e.toString();
        }
        if (e != null) {
            String stackTrace = StringUtil.getStackTraceInString(e);
            XmlElement stackTraceElement = XMLUtil.BUILDER.newFragment("stackTrace");
            stackTraceElement.addChild(stackTrace);
            this.notifier.sendingFault(context, this.invocationContext, message,
                    XMLUtil.xmlElementToString(stackTraceElement));
        } else {
            this.notifier.sendingFault(context, this.invocationContext, message);
        }
View Full Code Here

  private void saveNodeOutputs(Node node,
      Map<Node, Invoker> invokerMap, String workflowName)
      throws WorkflowException {

    if (null != node && !(node instanceof InputNode)) {
      XmlElement elem = XmlConstants.BUILDER.newFragment("previousdat");
      XmlElement inputs = null;
      if (node instanceof WSNode) {
        String nodeID = node.getComponent().getName();
        XmlElement nodeElement = elem.newElement("wsnode");
        elem.addChild(nodeElement);
        nodeElement.addChild(nodeID);
        inputs = elem.newElement("inputs");
        elem.addChild(inputs);

        List<DataPort> portsToBeSaved = node.getInputPorts();
        for (DataPort savePort : portsToBeSaved) {

          String portID = savePort.getName();
          XmlElement portElem = inputs.newElement(portID);
          inputs.addChild(portElem);
          Object portInput = XBayaUtil.findInputFromPort(
                            savePort, invokerMap);
          if (portInput instanceof org.xmlpull.v1.builder.XmlElement) {
            portInput = XMLUtil
                .xmlElement3ToXmlElement5((org.xmlpull.v1.builder.XmlElement) portInput);
          }
          portElem.addChild(portInput);

        }

      } else if (node instanceof EndForEachNode) {
        // here we save the inputs for the entire foreach block
        Node middleNode = node.getInputPort(0).getFromNode();
        String nodeID = middleNode.getComponent().getName();
        XmlElement nodeElement = elem.newElement("foreach");
        elem.addChild(nodeElement);
        nodeElement.addChild(nodeID);
        inputs = elem.newElement("inputs");
        elem.addChild(inputs);
        XmlConstants.BUILDER.serializeToString(elem);
        if (middleNode instanceof ForEachExecutableNode) {
          List<DataPort> portsToBeSaved = middleNode.getInputPorts();
          for (DataPort savePort : portsToBeSaved) {
            // we will save all the inputs
            // these are static inputs and
            // input to the foreach node

            if (savePort.getFromNode() instanceof ForEachNode) {
              // this is the foreach node rest are simple
              // inputs
              Object value = XBayaUtil
                  .getInputsForForEachNode(
                      (ForEachNode) savePort
                          .getFromNode(),
                      new LinkedList<String>(),
                      invokerMap);
              if (value instanceof org.xmlpull.v1.builder.XmlElement) {
                value = XMLUtil
                    .xmlElement3ToXmlElement5((org.xmlpull.v1.builder.XmlElement) value);
              }

              XmlElement portElement = inputs.newElement(savePort
                  .getName());
              inputs.addChild(portElement);
              portElement.addChild(value);
            } else {
              String portID = savePort.getName();
              XmlElement portElem = inputs.newElement(portID);
              inputs.addChild(portElem);
              Object portInput = XBayaUtil
                  .findInputFromPort(savePort, invokerMap);
              if (portInput instanceof org.xmlpull.v1.builder.XmlElement) {
                portInput = XMLUtil
                    .xmlElement3ToXmlElement5((org.xmlpull.v1.builder.XmlElement) portInput);
              }

              portElem.addChild(portInput);
            }

          }

        } else {
          // error but we will let it pass because it will be
          // caught at higher level
        }

      }
            if (inputs!=null) {
        try {
          this.airavataAPI.getProvenanceManager().setWorkflowInstanceNodeInput(new WorkflowInstanceNode(new WorkflowExecution(experimentId, experimentId), node.getID()), xsul5.XmlConstants.BUILDER.serializeToString(inputs));
                } catch (AiravataAPIInvocationException e) {
          throw new WorkflowException(e);
        }
        // deal with the outputs
      }
      XmlElement outputs = elem.newElement("outputs");
      elem.addChild(outputs);

      List<DataPort> outputPorts = node.getOutputPorts();
      for (DataPort outputPort : outputPorts) {
        String outputName = outputPort.getName();

        XmlElement outputParamElement = outputs.newElement(outputName);
        outputs.addChild(outputParamElement);
        Object ouputParamValue = invokerMap.get(node).getOutput(
            outputName);

        if (ouputParamValue instanceof org.xmlpull.v1.builder.XmlElement) {
          ouputParamValue = XMLUtil
              .xmlElement3ToXmlElement5((org.xmlpull.v1.builder.XmlElement) ouputParamValue);
        }

        if (ouputParamValue != null) {
          outputParamElement.addChild(ouputParamValue);
        } else {
          outputParamElement.addChild("null");
        }
      }
            try {
        this.airavataAPI.getProvenanceManager().setWorkflowInstanceNodeOutput(new WorkflowInstanceNode(new WorkflowExecution(experimentId,experimentId),node.getID()),xsul5.XmlConstants.BUILDER.serializeToString(outputs));
            } catch (AiravataAPIInvocationException e) {
View Full Code Here

    private void loadDefaultGraph() {
        if (this.engine.getConfiguration().getWorkflow() != null) {
            this.newGraphCanvas(true, false);
            try {
              String xml = this.engine.getConfiguration().getAiravataAPI().getWorkflowManager().getWorkflowAsString(this.engine.getConfiguration().getWorkflow());
                XmlElement xwf = XMLUtil.stringToXmlElement(xml);
                Workflow workflow = new Workflow(xwf);
                setWorkflow(workflow);
            } catch (AiravataAPIInvocationException e) {
               getErrorWindow().error(ErrorMessages.REPOSITORY_CONFIGURATION_IS_WRONG_FAILED_TO_LOAD_THE_WORKFLOW, e);
            } catch (GraphException e) {
View Full Code Here

        return (WorkflowComponent) super.getComponent();
    }

    @Override
    public XmlElement toXML() {
        XmlElement nodeElement = super.toXML();
        nodeElement
                .setAttributeValue(GraphSchema.NS,
                        GraphSchema.NODE_TYPE_ATTRIBUTE,
                        GraphSchema.NODE_TYPE_WORKFLOW);
        return nodeElement;
    }
View Full Code Here

        if (name == null) {
            name = this.node.getName();
        }
        this.nameTextField.setText(name);
        this.descriptionTextArea.setText(this.node.getDescription());
        XmlElement metadata = this.node.getMetadata();
        String metadataText;
        if (metadata == null) {
            metadataText = WSConstants.EMPTY_APPINFO;
        } else {
            metadataText = XMLUtil.xmlElementToString(metadata);
View Full Code Here

TOP

Related Classes of org.xmlpull.infoset.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.