Package org.apache.airavata.workflow.model.component

Examples of org.apache.airavata.workflow.model.component.Component


  }

  private void executeDynamically(final Node node) throws WorkflowException {
    node.setState(NodeExecutionState.EXECUTING);
    Component component = node.getComponent();
    if (component instanceof SubWorkflowComponent) {
      handleSubWorkComponent(node);
    } else if (component instanceof WSComponent) {
      handleWSComponent(node);
    } else if (component instanceof DynamicComponent) {
View Full Code Here


  private ArrayList<Node> getReadyNodesDynamically() {
    ArrayList<Node> list = new ArrayList<Node>();
    ArrayList<Node> waiting = InterpreterUtil.getWaitingNodesDynamically(this.getGraph());
    ArrayList<Node> finishedNodes = InterpreterUtil.getFinishedNodesDynamically(this.getGraph());
    for (Node node : waiting) {
      Component component = node.getComponent();
      if (component instanceof WSComponent
          || component instanceof DynamicComponent
          || component instanceof SubWorkflowComponent
          || component instanceof ForEachComponent
          || component instanceof EndForEachComponent
          || component instanceof IfComponent
          || component instanceof InstanceComponent) {

        /*
         * Check for control ports from other node
         */
        ControlPort control = node.getControlInPort();
        boolean controlDone = true;
        if (control != null) {
          for (EdgeImpl edge : control.getEdges()) {
            controlDone = controlDone && (finishedNodes.contains(edge.getFromPort().getNode())
            // amazon component use condition met to check
            // whether the control port is done
            // FIXME I changed the "||" to a "&&" in the following since thats the only this
            // that makes sense and if anyone found a scenario it should be otherwise pls fix
                || ((ControlPort) edge.getFromPort()).isConditionMet());
          }
        }

        /*
         * Check for input ports
         */
        List<DataPort> inputPorts = node.getInputPorts();
        boolean inputsDone = true;
        for (DataPort dataPort : inputPorts) {
          inputsDone = inputsDone && finishedNodes.contains(dataPort.getFromNode());
        }
        if (inputsDone && controlDone) {
          list.add(node);
        }
      } else if (component instanceof EndifComponent) {
        /*
         * EndIfComponent can run if number of input equals to number of
         * output that it expects
         */
        int expectedOutput = node.getOutputPorts().size();
        int actualInput = 0;
        List<DataPort> inputPorts = node.getInputPorts();
        for (DataPort dataPort : inputPorts) {
          if (finishedNodes.contains(dataPort.getFromNode()))
            actualInput++;
        }

        if (expectedOutput == actualInput) {
          list.add(node);
        }
      } else if (component instanceof TerminateInstanceComponent) {
        /*
         * All node connected to controlIn port must be done
         */
        ControlPort control = node.getControlInPort();
        boolean controlDone = true;
        if (control != null) {
          for (EdgeImpl edge : control.getEdges()) {
            controlDone = controlDone && finishedNodes.contains(edge.getFromPort().getFromNode());
          }
        }

        /*
         * Check for input ports
         */
        List<DataPort> inputPorts = node.getInputPorts();
        boolean inputsDone = true;
        for (DataPort dataPort : inputPorts) {
          inputsDone = inputsDone && finishedNodes.contains(dataPort.getFromNode());
        }
        if (inputsDone && controlDone) {
          list.add(node);
        }

      } else if (InputComponent.NAME.equals(component.getName())
          || DifferedInputComponent.NAME.equals(component.getName())
          || S3InputComponent.NAME.equals(component.getName())
          || OutputComponent.NAME.equals(component.getName())
          || MemoComponent.NAME.equals(component.getName())
          || component instanceof EndDoWhileComponent) {
        // no op
      } else if (component instanceof DoWhileComponent) {
        ControlPort control = node.getControlInPort();
        boolean controlDone = true;
        if (control != null) {
          for (EdgeImpl edge : control.getEdges()) {
            controlDone = controlDone && finishedNodes.contains(edge.getFromPort().getFromNode());
          }
        }

        if (controlDone) {
          list.add(node);
        }
      } else {
        throw new WorkFlowInterpreterException("Component Not handled :" + component.getName());
      }
    }

    notifyViaInteractor(WorkflowExecutionMessage.HANDLE_DEPENDENT_NODES_DIFFERED_INPUTS, this.getGraph());

View Full Code Here

    this.config.getNotifier().sendingPartialResults(outputValues.toArray(), outputKeywords.toArray(new String[outputKeywords.size()]));
  }

  private void executeDynamically(final Node node) throws WorkflowException {
    node.setState(NodeExecutionState.EXECUTING);
    Component component = node.getComponent();
    if (component instanceof SubWorkflowComponent) {
      handleSubWorkComponent(node);
    } else if (component instanceof WSComponent) {
      handleWSComponent(node);
    } else if (component instanceof DynamicComponent) {
View Full Code Here

  private ArrayList<Node> getReadyNodesDynamically() {
    ArrayList<Node> list = new ArrayList<Node>();
    ArrayList<Node> waiting = InterpreterUtil.getWaitingNodesDynamically(this.getGraph());
    ArrayList<Node> finishedNodes = InterpreterUtil.getFinishedNodesDynamically(this.getGraph());
    for (Node node : waiting) {
      Component component = node.getComponent();
      if (component instanceof WSComponent
          || component instanceof DynamicComponent
          || component instanceof SubWorkflowComponent
          || component instanceof ForEachComponent
          || component instanceof EndForEachComponent
          || component instanceof IfComponent
          || component instanceof InstanceComponent) {

        /*
         * Check for control ports from other node
         */
        ControlPort control = node.getControlInPort();
        boolean controlDone = true;
        if (control != null) {
          for (EdgeImpl edge : control.getEdges()) {
            controlDone = controlDone && (finishedNodes.contains(edge.getFromPort().getNode())
            // amazon component use condition met to check
            // whether the control port is done
            // FIXME I changed the "||" to a "&&" in the following since thats the only this
            // that makes sense and if anyone found a scenario it should be otherwise pls fix
                || ((ControlPort) edge.getFromPort()).isConditionMet());
          }
        }

        /*
         * Check for input ports
         */
        List<DataPort> inputPorts = node.getInputPorts();
        boolean inputsDone = true;
        for (DataPort dataPort : inputPorts) {
          inputsDone = inputsDone && finishedNodes.contains(dataPort.getFromNode());
        }
        if (inputsDone && controlDone) {
          list.add(node);
        }
      } else if (component instanceof EndifComponent) {
        /*
         * EndIfComponent can run if number of input equals to number of
         * output that it expects
         */
        int expectedOutput = node.getOutputPorts().size();
        int actualInput = 0;
        List<DataPort> inputPorts = node.getInputPorts();
        for (DataPort dataPort : inputPorts) {
          if (finishedNodes.contains(dataPort.getFromNode()))
            actualInput++;
        }

        if (expectedOutput == actualInput) {
          list.add(node);
        }
      } else if (component instanceof TerminateInstanceComponent) {
        /*
         * All node connected to controlIn port must be done
         */
        ControlPort control = node.getControlInPort();
        boolean controlDone = true;
        if (control != null) {
          for (EdgeImpl edge : control.getEdges()) {
            controlDone = controlDone && finishedNodes.contains(edge.getFromPort().getFromNode());
          }
        }

        /*
         * Check for input ports
         */
        List<DataPort> inputPorts = node.getInputPorts();
        boolean inputsDone = true;
        for (DataPort dataPort : inputPorts) {
          inputsDone = inputsDone && finishedNodes.contains(dataPort.getFromNode());
        }
        if (inputsDone && controlDone) {
          list.add(node);
        }

      } else if (InputComponent.NAME.equals(component.getName())
          || DifferedInputComponent.NAME.equals(component.getName())
          || S3InputComponent.NAME.equals(component.getName())
          || OutputComponent.NAME.equals(component.getName())
          || MemoComponent.NAME.equals(component.getName())
          || component instanceof EndDoWhileComponent) {
        // no op
      } else if (component instanceof DoWhileComponent) {
        ControlPort control = node.getControlInPort();
        boolean controlDone = true;
        if (control != null) {
          for (EdgeImpl edge : control.getEdges()) {
            controlDone = controlDone && finishedNodes.contains(edge.getFromPort().getFromNode());
          }
        }

        if (controlDone) {
          list.add(node);
        }
      } else {
        throw new WorkFlowInterpreterException("Component Not handled :" + component.getName());
      }
    }

    notifyViaInteractor(WorkflowExecutionMessage.HANDLE_DEPENDENT_NODES_DIFFERED_INPUTS, this.getGraph());

View Full Code Here

  }

  private void executeDynamically(final Node node) throws WorkflowException {
    node.setState(NodeExecutionState.EXECUTING);
    Component component = node.getComponent();
    if (component instanceof SubWorkflowComponent) {
      handleSubWorkComponent(node);
    } else if (component instanceof WSComponent) {
      handleWSComponent(node);
    } else if (component instanceof DynamicComponent) {
View Full Code Here

  private ArrayList<Node> getReadyNodesDynamically() {
    ArrayList<Node> list = new ArrayList<Node>();
    ArrayList<Node> waiting = InterpreterUtil.getWaitingNodesDynamically(this.getGraph());
    ArrayList<Node> finishedNodes = InterpreterUtil.getFinishedNodesDynamically(this.getGraph());
    for (Node node : waiting) {
      Component component = node.getComponent();
      if (component instanceof WSComponent
          || component instanceof DynamicComponent
          || component instanceof SubWorkflowComponent
          || component instanceof ForEachComponent
          || component instanceof EndForEachComponent
          || component instanceof IfComponent
          || component instanceof InstanceComponent) {

        /*
         * Check for control ports from other node
         */
        ControlPort control = node.getControlInPort();
        boolean controlDone = true;
        if (control != null) {
          for (EdgeImpl edge : control.getEdges()) {
            controlDone = controlDone && (finishedNodes.contains(edge.getFromPort().getNode())
            // amazon component use condition met to check
            // whether the control port is done
            // FIXME I changed the "||" to a "&&" in the following since thats the only this
            // that makes sense and if anyone found a scenario it should be otherwise pls fix
                || ((ControlPort) edge.getFromPort()).isConditionMet());
          }
        }

        /*
         * Check for input ports
         */
        List<DataPort> inputPorts = node.getInputPorts();
        boolean inputsDone = true;
        for (DataPort dataPort : inputPorts) {
          inputsDone = inputsDone && finishedNodes.contains(dataPort.getFromNode());
        }
        if (inputsDone && controlDone) {
          list.add(node);
        }
      } else if (component instanceof EndifComponent) {
        /*
         * EndIfComponent can run if number of input equals to number of
         * output that it expects
         */
        int expectedOutput = node.getOutputPorts().size();
        int actualInput = 0;
        List<DataPort> inputPorts = node.getInputPorts();
        for (DataPort dataPort : inputPorts) {
          if (finishedNodes.contains(dataPort.getFromNode()))
            actualInput++;
        }

        if (expectedOutput == actualInput) {
          list.add(node);
        }
      } else if (component instanceof TerminateInstanceComponent) {
        /*
         * All node connected to controlIn port must be done
         */
        ControlPort control = node.getControlInPort();
        boolean controlDone = true;
        if (control != null) {
          for (EdgeImpl edge : control.getEdges()) {
            controlDone = controlDone && finishedNodes.contains(edge.getFromPort().getFromNode());
          }
        }

        /*
         * Check for input ports
         */
        List<DataPort> inputPorts = node.getInputPorts();
        boolean inputsDone = true;
        for (DataPort dataPort : inputPorts) {
          inputsDone = inputsDone && finishedNodes.contains(dataPort.getFromNode());
        }
        if (inputsDone && controlDone) {
          list.add(node);
        }

      } else if (InputComponent.NAME.equals(component.getName())
          || DifferedInputComponent.NAME.equals(component.getName())
          || S3InputComponent.NAME.equals(component.getName())
          || OutputComponent.NAME.equals(component.getName())
          || MemoComponent.NAME.equals(component.getName())
          || component instanceof EndDoWhileComponent) {
        // no op
      } else if (component instanceof DoWhileComponent) {
        ControlPort control = node.getControlInPort();
        boolean controlDone = true;
        if (control != null) {
          for (EdgeImpl edge : control.getEdges()) {
            controlDone = controlDone && finishedNodes.contains(edge.getFromPort().getFromNode());
          }
        }

        if (controlDone) {
          list.add(node);
        }
      } else {
        throw new WorkFlowInterpreterException("Component Not handled :" + component.getName());
      }
    }

    notifyViaInteractor(WorkflowExecutionMessage.HANDLE_DEPENDENT_NODES_DIFFERED_INPUTS, this.getGraph());

View Full Code Here

        workflow.setDescription("Complex math workflow");

        Graph graph = workflow.getGraph();

        // Adder nodes
        Component adderComp = this.componentRegistry.getComponents(MATH_ADDER_WSDL).get(0);

        Node adderNode1 = workflow.addNode(adderComp);
        adderNode1.setPosition(new Point(170, 50));

        Node adderNode2 = workflow.addNode(adderComp);
        adderNode2.setPosition(new Point(170, 210));

        // Multiplier node
        Component multiComp = this.componentRegistry.getComponents(MATH_MULTIPLIER_WSDL).get(0);

        Node multiNode = workflow.addNode(multiComp);
        multiNode.setPosition(new Point(320, 130));

        // Parameter node 1
View Full Code Here

            GraphException {
        WSGraph graph = workflow.getGraph();

        OutputComponent outputComponent = new OutputComponent();
        LocalComponentRegistry registry = new LocalComponentRegistry(XBayaPathConstants.WSDL_DIRECTORY);
        Component adderComponent = registry.getComponent(Adder.WSDL_PATH);
        Component multiplierComponent = registry.getComponent(Multiplier.WSDL_PATH);

        NodeImpl c = graph.getNode("c");
        NodeImpl d = graph.getNode("d");
        NodeImpl adder = graph.getNode("Adder_add");
        NodeImpl adder2 = graph.getNode("Adder_add_2");
View Full Code Here

  }

  private void executeDynamically(final Node node) throws WorkflowException {
    NodeController.getGUI(node).setBodyColor(NodeState.EXECUTING.color);
    Component component = node.getComponent();
    if (component instanceof SubWorkflowComponent) {
      handleSubWorkComponent(node);
    } else if (component instanceof WSComponent) {
      handleWSComponent(node);
    } else if (component instanceof DynamicComponent) {
View Full Code Here

  private ArrayList<Node> getReadyNodesDynamically() {
    ArrayList<Node> list = new ArrayList<Node>();
    ArrayList<Node> waiting = InterpreterUtil.getWaitingNodesDynamically(this.getGraph());
    ArrayList<Node> finishedNodes = InterpreterUtil.getFinishedNodesDynamically(this.getGraph());
    for (Node node : waiting) {
      Component component = node.getComponent();
      if (component instanceof WSComponent
          || component instanceof DynamicComponent
          || component instanceof SubWorkflowComponent
          || component instanceof ForEachComponent
          || component instanceof EndForEachComponent
          || component instanceof IfComponent
          || component instanceof InstanceComponent) {

        /*
         * Check for control ports from other node
         */
        ControlPort control = node.getControlInPort();
        boolean controlDone = true;
        if (control != null) {
          for (EdgeImpl edge : control.getEdges()) {
            controlDone = controlDone && (finishedNodes.contains(edge.getFromPort().getNode())
            // amazon component use condition met to check
            // whether the control port is done
                || ((ControlPort) edge.getFromPort()).isConditionMet());
          }
        }

        /*
         * Check for input ports
         */
        List<DataPort> inputPorts = node.getInputPorts();
        boolean inputsDone = true;
        for (DataPort dataPort : inputPorts) {
          inputsDone = inputsDone && finishedNodes.contains(dataPort.getFromNode());
        }
        if (inputsDone && controlDone) {
          list.add(node);
        }
      } else if (component instanceof EndifComponent) {
        /*
         * EndIfComponent can run if number of input equals to number of
         * output that it expects
         */
        int expectedOutput = node.getOutputPorts().size();
        int actualInput = 0;
        List<DataPort> inputPorts = node.getInputPorts();
        for (DataPort dataPort : inputPorts) {
          if (finishedNodes.contains(dataPort.getFromNode()))
            actualInput++;
        }

        if (expectedOutput == actualInput) {
          list.add(node);
        }
      } else if (component instanceof TerminateInstanceComponent) {
        /*
         * All node connected to controlIn port must be done
         */
        ControlPort control = node.getControlInPort();
        boolean controlDone = true;
        if (control != null) {
          for (EdgeImpl edge : control.getEdges()) {
            controlDone = controlDone && finishedNodes.contains(edge.getFromPort().getFromNode());
          }
        }

        /*
         * Check for input ports
         */
        List<DataPort> inputPorts = node.getInputPorts();
        boolean inputsDone = true;
        for (DataPort dataPort : inputPorts) {
          inputsDone = inputsDone && finishedNodes.contains(dataPort.getFromNode());
        }
        if (inputsDone && controlDone) {
          list.add(node);
        }

      } else if (InputComponent.NAME.equals(component.getName())
          || DifferedInputComponent.NAME.equals(component.getName())
          || S3InputComponent.NAME.equals(component.getName())
          || OutputComponent.NAME.equals(component.getName())
          || MemoComponent.NAME.equals(component.getName())
          || component instanceof EndDoWhileComponent) {
        // no op
      } else if (component instanceof DoWhileComponent) {
        ControlPort control = node.getControlInPort();
        boolean controlDone = true;
        if (control != null) {
          for (EdgeImpl edge : control.getEdges()) {
            controlDone = controlDone && finishedNodes.contains(edge.getFromPort().getFromNode());
          }
        }

        if (controlDone) {
          list.add(node);
        }
      } else {
        throw new WorkFlowInterpreterException("Component Not handled :" + component.getName());
      }
    }

    notifyViaInteractor(WorkflowExecutionMessage.HANDLE_DEPENDENT_NODES_DIFFERED_INPUTS, this.getGraph());
    // if (this.config.getMode() ==
View Full Code Here

TOP

Related Classes of org.apache.airavata.workflow.model.component.Component

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.