Package edu.indiana.extreme.xbaya.graph

Examples of edu.indiana.extreme.xbaya.graph.Node


            ComponentRegistryException {
        WorkflowCreator creator = new WorkflowCreator();
        Workflow workflow = creator.createSimpleMathWorkflow();
        Graph graph = workflow.getGraph();

        Node node = graph.getNode("Adder_add");
        assertNotNull(node);
        int originalSize = graph.getPorts().size();
        int portNum = node.getAllPorts().size();
        graph.removeNode(node);

        assertEquals(originalSize - portNum, graph.getPorts().size());
    }
View Full Code Here


        input3.setPosition(new Point(50, 250));

        // Adder node
        Component adderComp = this.componentRegistry
                .getComponent(Adder.WSDL_PATH);
        Node adder = workflow.addNode(adderComp);
        adder.setPosition(new Point(200, 100));

        // Sub workflow
        WorkflowComponent subWorkflowComponent = this.gpelComponentRegistry
                .getComponent(subWorkflowID);
        Node subWorkflow = workflow.addNode(subWorkflowComponent);
        subWorkflow.setPosition(new Point(350, 150));

        // Output
        OutputComponent outputComponent = new OutputComponent();
        OutputNode outParamNode = (OutputNode) workflow
                .addNode(outputComponent);
        outParamNode.setPosition(new Point(800, 150));

        // Connect ports
        graph.addEdge(input1.getOutputPort(0), adder.getInputPort(0));
        graph.addEdge(input2.getOutputPort(0), adder.getInputPort(1));
        graph.addEdge(adder.getOutputPort(0), subWorkflow.getInputPort(0));
        graph.addEdge(input3.getOutputPort(0), subWorkflow.getInputPort(1));
        graph.addEdge(subWorkflow.getOutputPort(0), outParamNode
                .getInputPort(0));

        // Set the default values
        // This needs to be after connection.
        input1.setDefaultValue("2");
View Full Code Here

    }
    // sizes are the same
    // try the names
    List<NodeImpl> thisNodes = this.getNodes();
    for (NodeImpl thisNode : thisNodes) {
      Node matchingNode = find(thisNode.getID(), graph.getNodes());
      if (null == matchingNode) {
        // not found so this is not equal
        return true;
      } else {
        // ok found, now check whether the connections match
View Full Code Here

      nodeMap.put(node, NodeCloneFactory.clone(node, this));

    }

    for (Node node : subworkflowNodes) {
      Node newNode = nodeMap.get(node);

      List<DataPort> inputPorts = node.getInputPorts();
      for (DataPort dataPort : inputPorts) {
        DataPort newPort = newNode.getInputPort(dataPort.getID());
        Node fromNode = dataPort.getFromNode();
        Node newFromNode = nodeMap.get(fromNode);
        if (null == newFromNode) {
          // input to this subworkflow
          InputNode inputNode = new InputComponent().createNode(this);
          addEdge(inputNode.getOutputPort(0), newPort);
        } else {
          String fromPortID = dataPort.getFromPort().getID();
          addEdge(newFromNode.getOutputPort(fromPortID), newPort);
        }
      }

      List<DataPort> outputPorts = node.getOutputPorts();
      for (DataPort dataPort : outputPorts) {
        DataPort newPort = newNode.getOutputPort(dataPort.getID());

        List<Port> toNodes = dataPort.getToPorts();
        for (Port toPort : toNodes) {
          Node newToNode = nodeMap.get(toPort.getNode());
          if (null == newToNode) {
            // outputnode
            Node outputNode = new OutputComponent()
                .createNode(this);
            addEdge(newPort, outputNode.getInputPort(0));
          } else {

            addEdge(newPort, newToNode.getInputPort(toPort.getID()));
          }
        }
View Full Code Here

    List<Node> workQueue = new LinkedList<Node>(
        GraphUtil.getInputNodes(this));
    workQueue.addAll(GraphUtil.getStreamSourceNodes(this));
    LinkedList<Node> sortedOrder = new LinkedList<Node>();
    while (!workQueue.isEmpty()) {
      Node currentNode = workQueue.remove(0);
      sortedOrder.add(currentNode);
      List<DataPort> outputPorts = currentNode.getOutputPorts();
      for (DataPort dataPort : outputPorts) {
        List<DataEdge> curentEdges = dataPort.getEdges();
        for (DataEdge dataEdge : curentEdges) {
          edgeSet.remove(dataEdge);
          if (isAllEdgesRemoved(edgeSet, dataEdge.getToPort()
View Full Code Here

          dataEdge.setLabel(label);
        }
      }
    }

    Node node = null;
    while (!workQueue.isEmpty()) {
      Node processingNode = workQueue.remove();
      if (!GraphUtil.isAllInputsConnected(processingNode)) {
        throw new XBayaRuntimeException(
            "Disconnedted node inputs during labeling");
      }
      if (GraphUtil.isAllInputsLabeled(processingNode)) {
        String sameLabel = GraphUtil.isSameLabeledInput(processingNode);
        if (null != sameLabel) {
          // same label so its a regular node

          if (GraphUtil.isRegulerNode(processingNode)) {
            processingNode.setLabel(sameLabel);
            String nodeLabel = processingNode.getLabel();

            List<DataPort> outputPorts = processingNode
                .getOutputPorts();
            for (DataPort dataPort : outputPorts) {
              List<DataEdge> edges = dataPort.getEdges();
              for (DataEdge dataEdge : edges) {
                dataEdge.setLabel(nodeLabel);
              }
              workQueue.addAll(dataPort.getToNodes());
            }
          } else {
            processingNode.inventLabel(GraphUtil
                .getEncodedInputLabels(processingNode));
            String nodeOutLabel = processingNode.getLabel()
                + "_out";

            List<DataPort> outputPorts = processingNode
                .getOutputPorts();
            for (DataPort dataPort : outputPorts) {
              List<DataEdge> edges = dataPort.getEdges();
              for (DataEdge dataEdge : edges) {
                dataEdge.setLabel(nodeOutLabel);
              }
              workQueue.addAll(dataPort.getToNodes());
            }
          }

        } else {
          // may need to introduce a join
          // if its CEP node we assume it doesnt require
          // joins
          // Its hard to determine if the CEP node would
          // resolve the joins
          if (!GraphUtil.isCEPNode(processingNode)) {
            processingNode.setRequireJoin(true);

          }
          processingNode.inventLabel(GraphUtil
              .getEncodedInputLabels(processingNode));
          String nodeOutLabel = processingNode.getLabel() + "_out";

          List<DataPort> outputPorts = processingNode
              .getOutputPorts();
          for (DataPort dataPort : outputPorts) {
            List<DataEdge> edges = dataPort.getEdges();
            for (DataEdge dataEdge : edges) {
              dataEdge.setLabel(nodeOutLabel);
View Full Code Here

  /**
   * @see edu.indiana.extreme.xbaya.component.Component#createNode(edu.indiana.extreme.xbaya.graph.Graph)
   */
  @Override
  public Node createNode(Graph graph) {
    Node node = super.createNode(graph);
   
    node.setName(workflow.getName());
    Collection<? extends Port> allPorts = node.getAllPorts();
    for (Port port : allPorts) {
      ((GenericSubworkflowPort)port).setID(port.getComponentPort().getName());
      port.setName(port.getComponentPort().getName());
    }
    return node;
View Full Code Here

      NodeImpl nodeImpl = nodes.get(i);
      List<DataPort> inputPorts = nodeImpl.getInputPorts();
      int count = 0;
      for (DataPort dataPort : inputPorts) {
        if (dataPort.getFromNode() == null) {
          Node inputNode = subWorkflow.addNode(new InputComponent());
          inputNode.setPosition(new Point(Math.max(0,
              nodeImpl.getPosition().x - 200), nodeImpl
              .getPosition().y + count * 50));
          subWorkflow.getGraph().addEdge(inputNode.getOutputPort(0),
              dataPort);
          ++count;
        }
      }
      count = 0;
      List<DataPort> outputPorts = nodeImpl.getOutputPorts();
      for (DataPort dataPort : outputPorts) {
        if (dataPort.getToNodes().size() == 0) {
          Node outputNode = subWorkflow
              .addNode(new OutputComponent());
          outputNode.setPosition(new Point(
              nodeImpl.getPosition().x + 200, nodeImpl
                  .getPosition().y + count * 50));
          subWorkflow.getGraph().addEdge(dataPort, outputNode.getInputPort(0));
          ++count;
        }
      }

    }
View Full Code Here

   * @param component
   *            The specified component
   * @return The node added
   */
  public Node addNode(Component component) {
    Node node = component.createNode(this.graph);
    return node;
  }
View Full Code Here

      throws GraphException, ComponentException {
    this.getGraph().setID(this.getName());

    // find whether its Streaming
    List<NodeImpl> nodes = this.graph.getNodes();
    Node activeNode = null;
    boolean streaming = false;
    String operationName = null;
    for (NodeImpl node : nodes) {
      if (node instanceof StreamReceiveNode) {
        streaming = true;
View Full Code Here

TOP

Related Classes of edu.indiana.extreme.xbaya.graph.Node

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.