Package org.apache.airavata.xbaya.invoker

Examples of org.apache.airavata.xbaya.invoker.Invoker


          throw new WorkFlowInterpreterException("Unable to find input for the node:" + forEachNode.getID());
        }
        String[] vals = returnValForProvenance.toString().split(",");
        inputNumbers[inputPorts.indexOf(forEachInputPort)] = vals.length;
      } else {
        Invoker workflowInvoker = invokerMap.get(forEachInputNode);
        if (workflowInvoker != null) {
          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) {
View Full Code Here


  }

  protected void handleWSComponent(Node node) throws WorkflowException {
    WSComponent wsComponent = ((WSComponent) node.getComponent());
    QName portTypeQName = wsComponent.getPortTypeQName();
    Invoker invoker = this.invokerMap.get(node);
    // We do this because invokers cannot be cached because the puretls
    // expires
    if (invoker != null) {
      this.invokerMap.remove(invoker);
    }
    final WSNode wsNode = (WSNode) node;
    String wsdlLocation = InterpreterUtil.getEPR(wsNode);
    final String gfacURLString = this.getConfig().getConfiguration().getGFacURL().toString();
    if (null == wsdlLocation) {
      if (gfacURLString.startsWith("https")) {
        LeadContextHeader leadCtxHeader = null;
        // try {
        // leadCtxHeader =
        // (LeadContextHeader)getInputViaInteractor(WorkflowExecutionMessage.INPUT_LEAD_CONTEXT_HEADER,
        // wsNode);
        // } catch (Exception e1) {
        // throw new WorkflowException(e1);
        // }
        try {
          leadCtxHeader = XBayaUtil.buildLeadContextHeader(this.getWorkflow(), this.getConfig().getConfiguration(), new MonitorConfiguration(this
              .getConfig().getConfiguration().getBrokerURL(), this.config.getTopic(), true, this.getConfig().getConfiguration()
              .getMessageBoxURL()), wsNode.getID(), null);
          // if (this.config.getMode() ==
          // WorkflowInterpreterConfiguration.GUI_MODE) {
          // leadCtxHeader = XBayaUtil.buildLeadContextHeader(
          // this.getWorkflow(),
          // this.getConfig().getConfiguration(),
          // new
          // MonitorConfiguration(this.getConfig().getConfiguration()
          // .getBrokerURL(), this.config.getTopic(), true,
          // this.getConfig().getConfiguration().getMessageBoxURL()),
          // wsNode.getID(), null);
          // } else {
          // leadCtxHeader = XBayaUtil.buildLeadContextHeader(
          // this.getWorkflow(),
          // this.getConfig().getConfiguration(),
          // new
          // MonitorConfiguration(this.getConfig().getConfiguration()
          // .getBrokerURL(), this.config.getTopic(), true,
          // this.getConfig().getConfiguration().getMessageBoxURL()),
          // wsNode.getID(), null);
          // }
        } catch (URISyntaxException e) {
          throw new WorkflowException(e);
        }

        leadCtxHeader.setServiceId(node.getID());
        try {
          leadCtxHeader.setWorkflowId(new URI(this.getWorkflow().getName()));

          // We do this so that the wsdl resolver can is setup
          // wsdlresolver.getInstance is static so once this is
          // done
          // rest of the loading should work.

          XBayaSecurity.init();

        } catch (URISyntaxException e) {
          throw new WorkflowRuntimeException(e);
        }

        /*
         * Resource Mapping Header
         */
        if (this.resourceMapping != null) {
          leadCtxHeader.setResourceMapping(this.resourceMapping);
        }

        /*
         * If there is a instance control component connects to this
         * component send information in soap header
         */
        for (Node n : wsNode.getControlInPort().getFromNodes()) {
          if (n instanceof InstanceNode) {
            // TODO make it as constant
            LeadResourceMapping x = new LeadResourceMapping("AMAZON");

            x.addAttribute("ACCESS_KEY", AmazonCredential.getInstance().getAwsAccessKeyId());
            x.addAttribute("SECRET_KEY", AmazonCredential.getInstance().getAwsSecretAccessKey());

            if (((InstanceNode) n).isStartNewInstance()) {
              x.addAttribute("AMI_ID", ((InstanceNode) n).getIdAsValue());
              x.addAttribute("INS_TYPE", ((InstanceNode) n).getInstanceType());
            } else {
              x.addAttribute("INS_ID", ((InstanceNode) n).getIdAsValue());
            }

            x.addAttribute("USERNAME", ((InstanceNode) n).getUsername());

            // set to leadHeader
            leadCtxHeader.setResourceMapping(x);
          }
        }

        invoker = new WorkflowInvokerWrapperForGFacInvoker(portTypeQName, gfacURLString, this.config.getMonitor().getConfiguration().getMessageBoxURL()
            .toString(), leadCtxHeader, this.config.getNotifier().createServiceNotificationSender(node.getID()));

      } else {
        // invoker=(Invoker)getInputViaInteractor(WorkflowExecutionMessage.INPUT_GFAC_INVOKER,
        // new GFacInvokerData(gfacEmbeddedMode,portTypeQName,
        // WSDLUtil.wsdlDefinitions5ToWsdlDefintions3(wsNode
        // .getComponent().getWSDL()), node.getID(),
        // this.engine.getMonitor().getConfiguration()
        // .getMessageBoxURL().toASCIIString(),
        // this.engine.getMonitor().getConfiguration().getBrokerURL().toASCIIString(),
        // this.config.getNotifier(), this.config.getTopic(),
        // this.engine.getConfiguration().getJcrComponentRegistry().getRegistry(),
        // portTypeQName.getLocalPart(),this.engine.getConfiguration()));
        if (this.config.isGfacEmbeddedMode()) {
          invoker = new EmbeddedGFacInvoker(portTypeQName, WSDLUtil.wsdlDefinitions5ToWsdlDefintions3(wsNode.getComponent().getWSDL()), node.getID(),
              this.config.getMessageBoxURL().toASCIIString(), this.config.getMessageBrokerURL().toASCIIString(), this.config.getNotifier(),
              this.config.getTopic(), this.config.getRegistry(), portTypeQName.getLocalPart(), this.config.getConfiguration());
        } else {
          invoker = new GenericInvoker(portTypeQName, WSDLUtil.wsdlDefinitions5ToWsdlDefintions3(wsNode.getComponent().getWSDL()), node.getID(),
              this.config.getMessageBoxURL().toASCIIString(), gfacURLString, this.config.getNotifier());
        }

      }

    } else {
      if (wsdlLocation.endsWith("/")) {
        wsdlLocation = wsdlLocation.substring(0, wsdlLocation.length() - 1);
      }
      if (!wsdlLocation.endsWith("?wsdl")) {
        wsdlLocation += "?wsdl";
      }
      invoker = new GenericInvoker(portTypeQName, wsdlLocation, node.getID(), this.getConfig().getConfiguration().getMessageBoxURL().toString(),
          gfacURLString, this.config.getNotifier());
    }
    invoker.setup();
    this.invokerMap.put(node, invoker);
    invoker.setOperation(wsComponent.getOperationName());

    // find inputs
    List<DataPort> inputPorts = node.getInputPorts();
    ODEClient odeClient = new ODEClient();
    for (DataPort port : inputPorts) {
      Object inputVal = InterpreterUtil.findInputFromPort(port, this.invokerMap);

      /*
       * Need to override inputValue if it is odeClient
       */
      if (port.getFromNode() instanceof InputNode) {
        inputVal = ODEClientUtil.parseValue((WSComponentPort) port.getComponentPort(), (String) inputVal);
      }

      if (null == inputVal) {
        throw new WorkFlowInterpreterException("Unable to find inputs for the node:" + node.getID());
      }
      if (port.getFromNode() instanceof EndForEachNode) {
        inputVal = ODEClientUtil.parseValue((WSComponentPort) port.getComponentPort(), (String) inputVal);
        // org.xmlpull.v1.builder.XmlElement inputElem = XMLUtil
        // .stringToXmlElement3("<" + port.getName() + ">"
        // + inputVal.toString() + "</" + port.getName()
        // + ">");
        // inputVal = inputElem;
      }
      invoker.setInput(port.getName(), inputVal);
    }
    invoker.invoke();
  }
View Full Code Here

        type = BasicTypeMapping.STRING_QNAME;
      } else if (fromNode instanceof ConstantNode) {
        type = ((ConstantNode) fromNode).getType();
      } else if ((dataPort.getFromPort() instanceof WSPort)
          && BasicTypeMapping.isArrayType(((WSPort) dataPort.getFromPort()).getComponentPort().getElement())) {
        Invoker fromInvoker = this.invokerMap.get(fromNode);
        inputVal = BasicTypeMapping.getOutputArray(XmlConstants.BUILDER.parseFragmentFromString(fromInvoker.getOutputs().toString()), dataPort
            .getFromPort().getName(), BasicTypeMapping.getSimpleTypeIndex(((DataPort) dataPort.getFromPort()).getType()));
        type = ((DataPort) dataPort.getFromPort()).getType();
      } else {
        type = ((DataPort) dataPort.getFromPort()).getType();
      }
View Full Code Here

    NodeController.getGUI(node).setBodyColor(NodeState.FINISHED.color);
  }

  private Invoker createInvokerForEachSingleWSNode(Node foreachWSNode, String gfacURLString, WSComponent wsComponent) throws WorkflowException {
    Invoker invoker;
    String wsdlLocation = InterpreterUtil.getEPR((WSNode) foreachWSNode);
    QName portTypeQName = wsComponent.getPortTypeQName();
    if (null == wsdlLocation) {
      if (gfacURLString.startsWith("https")) {
        LeadContextHeader leadCtxHeader = null;
View Full Code Here

      List<String> inputValues = createInputValues(listOfValues, inputNumber);
      for (final Iterator<String> iterator = inputValues.iterator(); iterator.hasNext();) {
        final String gfacURLString = this.getConfig().getConfiguration().getGFacURL().toString();
        final String input = iterator.next();
        WSComponent wsComponent = (WSComponent) middleNode.getComponent();
        final Invoker invoker2 = createInvokerForEachSingleWSNode(middleNode, gfacURLString, wsComponent);
        invokerList.add(invoker2);

        new Thread() {
          @Override
          public void run() {
            try {
              getInvoker(middleNode, invoker2);
              invokeGFacService(listOfValues, middleNode, inputNumber, input, invoker2);

            } catch (WorkflowException e) {
              WorkflowInterpreter.this.config.getGUI().getErrorWindow().error(e);
            }
          }

        }.start();

        try {
          Thread.sleep(3000);
        } catch (InterruptedException e) {
          WorkflowInterpreter.this.config.getGUI().getErrorWindow().error(e);
        }
      }
    } else {
      Invoker invoker = null;
      for (Iterator<String> iterator = listOfValues.iterator(); iterator.hasNext();) {
        String input = iterator.next();
        final String gfacURLString = this.getConfig().getConfiguration().getGFacURL().toString();

        WSComponent wsComponent = (WSComponent) middleNode.getComponent();
        invoker = createInvokerForEachSingleWSNode(middleNode, gfacURLString, wsComponent);
        invokerList.add(invoker);
        getInvoker(middleNode, invoker);

        // find inputs
        List<DataPort> inputPorts = middleNode.getInputPorts();
        for (DataPort port : inputPorts) {
          Object inputVal = InterpreterUtil.findInputFromPort(port, this.invokerMap);

          /*
           * Handle ForEachNode
           */
          Node fromNode = port.getFromNode();
          // if (fromNode instanceof ForEachNode) {
          inputVal = ODEClientUtil.parseValue((WSComponentPort) port.getComponentPort(), input);
          // }

          if (null == inputVal) {
            throw new WorkFlowInterpreterException("Unable to find inputs for the node:" + middleNode.getID());
          }
          invoker.setInput(port.getName(), inputVal);
        }
        invoker.invoke();
      }
    }

    // String arrayElementName = foreachWSNode.getOperationName() +
    // "ArrayResponse";
    // String outputStr = "<" + arrayElementName + ">";
    // invokerMap size and endForEachNodes size can be difference
    // because we can create endForEachNode with n number of input/output
    // ports so always have to use
    // middleNode.getOutputPorts when iterate
    String[] outputStr = new String[middleNode.getOutputPorts().size()];
    int i = 0;
    for (DataPort port : middleNode.getOutputPorts()) {
      String outputString = "";
      for (Iterator<Invoker> iterator = invokerList.iterator(); iterator.hasNext();) {
        Invoker workflowInvoker = iterator.next();

        // /
        Object output = workflowInvoker.getOutput(port.getName());
        if (output instanceof org.xmlpull.v1.builder.XmlElement) {
          org.xmlpull.v1.builder.XmlElement element = (org.xmlpull.v1.builder.XmlElement) ((org.xmlpull.v1.builder.XmlElement) output).children()
              .next();
          outputString += "\n" + XMLUtil.xmlElementToString(element);
        } else {
View Full Code Here

    if (fromNode instanceof InputNode) {
      outputVal = ((InputNode) fromNode).getDefaultValue();
    } else if (fromNode instanceof ConstantNode) {
      outputVal = ((ConstantNode) fromNode).getValue();
    } else if (fromNode instanceof EndifNode) {
      Invoker fromInvoker = invokerMap.get(fromNode);
      outputVal = fromInvoker.getOutput(inputPort.getFromPort().getID());
    } else if (fromNode instanceof InstanceNode) {
      return ((InstanceNode) fromNode).getOutputInstanceId();
    } else if (fromNode instanceof EndForEachNode) {
      outputVal = "";
      Invoker workflowInvoker = invokerMap.get(fromNode);
      String outputName = fromNode.getOutputPort(0).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) {
          outputVal = outputVal
              + StringUtil.DELIMETER
              + StringUtil.quoteString(((XmlElement) object2).children().iterator()
                  .next().toString());
        }
      }
      outputVal = ((String) outputVal).substring(1,
          ((String) outputVal).length());
    } else {
      Invoker fromInvoker = invokerMap.get(fromNode);
      try {
        if (fromInvoker != null)
          outputVal = fromInvoker.getOutput(inputPort.getFromPort()
              .getName());

      } catch (Exception e) {
        // if the value is still null look it up from the inputport name
        // because the value is set to the input port name at some point
        // there is no harm in doing this
        if (null == outputVal) {
          outputVal = fromInvoker.getOutput(inputPort.getName());
        }
      }

    }
    return outputVal;
View Full Code Here

                    }
                    String[] vals = StringUtil.getElementsFromString(returnValForProvenance.toString());
                    listOfValues.addAll(Arrays.asList(vals));
//                }
            } else {
                Invoker workflowInvoker = invokerMap.get(inputNode);
                if (workflowInvoker != null) {
                    if (workflowInvoker instanceof GenericInvoker) {

                        String outputName = inputNode.getOutputPort(0).getName();
                        returnValForProvenance = workflowInvoker.getOutput(outputName);
            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) {
View Full Code Here

        } else if (fromNode instanceof ConstantNode) {
            outputVal = ((ConstantNode) fromNode).getValue();
        } else if (fromNode instanceof DifferedInputNode && ((DifferedInputNode) fromNode).isConfigured()) {
            outputVal = ((DifferedInputNode) fromNode).getDefaultValue();
        } else if (fromNode instanceof EndifNode || fromNode instanceof DoWhileNode  || fromNode instanceof EndDoWhileNode) {
            Invoker fromInvoker = invokerMap.get(fromNode);
            outputVal = fromInvoker.getOutput(inputPort.getFromPort().getID());
        } else if (fromNode instanceof InstanceNode) {
            return ((InstanceNode) fromNode).getOutputInstanceId();
        } else if (fromNode instanceof EndForEachNode) {
            outputVal = "";
            Invoker workflowInvoker = invokerMap.get(fromNode);
            String outputName = "";
            if (inputPort instanceof SystemDataPort) {
                outputName = ((SystemDataPort) inputPort).getWSComponentPort().getName();

            } 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()) {
                        outputVal = outputVal + StringUtil.DELIMETER  + StringUtil.quoteString(((XmlElement) object2).children().iterator().next().toString());
                    }
                }
            }

            if (((String) outputVal).length() == 0) {
                throw new WorkflowException("Empty Output Generated");
            }
            outputVal = ((String) outputVal).substring(1, ((String) outputVal).length());
        } else {
            Invoker fromInvoker = invokerMap.get(fromNode);
            try {
                if (fromInvoker != null)
                    outputVal = fromInvoker.getOutput(inputPort.getFromPort().getName());

            } catch (Exception e) {
                // if the value is still null look it up from the inputport name
                // because the value is set to the input port name at some point
                // there is no harm in doing this
                if (null == outputVal) {
                    outputVal = fromInvoker.getOutput(inputPort.getName());
                }
            }

        }
        return outputVal;
View Full Code Here

                    throw new WorkFlowInterpreterException("Unable to find input for the node:" + forEachNode.getID());
                }
                String[] vals = StringUtil.getElementsFromString(returnValForProvenance.toString());
                inputNumbers[inputPorts.indexOf(forEachInputPort)] = vals.length;
            } else {
                Invoker workflowInvoker = invokerMap.get(forEachInputNode);
                if (workflowInvoker != null) {
                    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) {
View Full Code Here

                    }
                    String[] vals = StringUtil.getElementsFromString(returnValForProvenance.toString());
                    listOfValues.addAll(Arrays.asList(vals));
//                }
            } else {
                Invoker workflowInvoker = invokerMap.get(inputNode);
                if (workflowInvoker != null) {
                    if (workflowInvoker instanceof GenericInvoker) {

                        String outputName = inputNode.getOutputPort(0).getName();
                        returnValForProvenance = workflowInvoker.getOutput(outputName);
            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) {
View Full Code Here

TOP

Related Classes of org.apache.airavata.xbaya.invoker.Invoker

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.