Package edu.indiana.extreme.xbaya.graph.impl

Examples of edu.indiana.extreme.xbaya.graph.impl.NodeImpl


    @Override
    public void copyType(DataPort port) throws GraphException {
        QName newType = port.getType();
        QName type = getType();

        NodeImpl node = port.getNode();
        if (node instanceof ForEachNode || node instanceof EndForEachNode) {
            // XXX ignore the check for foreach because we cannot parse arrays
            // from WSDL.
            return;
        }
View Full Code Here


        if (type == null) {
            // Old graphs don't have the namespace for the attribute.
            type = nodeElement.attributeValue(GraphSchema.NODE_TYPE_ATTRIBUTE);
        }

        NodeImpl node;
        if (GraphSchema.NODE_TYPE_WS.equals(type)) {
            node = new WSNode(nodeElement);
        } else if(GraphSchema.NODE_TYPE_STREAM_SOURCE.equals(type)){
          node = new StreamSourceNode(nodeElement);
        }else if(GraphSchema.NODE_TYPE_CEP.equals(type)){
View Full Code Here

      subWorkflow.removeNode(nodeImpl);
    }

    List<NodeImpl> nodes = subWorkflow.getGraph().getNodes();
    for (int i=0; i< nodes.size(); ++i) {
      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

        WSGraph graph = workflow.getGraph();

        String adder1ID = "Adder_add";
        String adder2ID = "Adder_add_2";

        NodeImpl a = graph.getNode("a");
        NodeImpl b = graph.getNode("b");
        NodeImpl c = graph.getNode("c");
        NodeImpl d = graph.getNode("d");
        NodeImpl adder = graph.getNode(adder1ID);
        NodeImpl adder2 = graph.getNode(adder2ID);

        WsdlDefinitions workflowWSDL = workflow.getWorkflowWSDL();
        DSCUtil.convertToCWSDL(workflowWSDL, URI.create("http://example.com"));
        HashMap<String, String> inputMap = new HashMap<String, String>();
        inputMap.put("a", "2");
        inputMap.put("b", "3");
        inputMap.put("c", "4");
        inputMap.put("d", "5");
        sendNotification(workflowWSDL, null,
            WSDLUtil.getFirstOperation(workflowWSDL).getName(), inputMap, null, notifier);

        WsdlDefinitions adderWSDL = WsdlResolver.getInstance().loadWsdl(
                new File(XBayaPathConstants.WSDL_DIRECTORY + File.separator
                        + Adder.WSDL_PATH).toURI());

        HashMap<String, String> inputMap1 = new HashMap<String, String>();
        inputMap1.put("x", "2");
        inputMap1.put("y", "3");
        HashMap<String, String> outputMap1 = new HashMap<String, String>();
        outputMap1.put("z", "5");
        sendNotification(adderWSDL, adder1ID, "add", inputMap1, outputMap1,
                notifier);
        // These are needed because without GUI, the nodes' color won't be
        // changed.
        a.getGUI().setBodyColor(NodeState.FINISHED.color);
        b.getGUI().setBodyColor(NodeState.FINISHED.color);
        adder.getGUI().setBodyColor(NodeState.FINISHED.color);
        repaintAndWait(3);

        HashMap<String, String> inputMap2 = new HashMap<String, String>();
        inputMap2.put("x", "4");
        inputMap2.put("y", "5");
        HashMap<String, String> outputMap2 = new HashMap<String, String>();
        outputMap2.put("z", "9");
        sendNotification(adderWSDL, adder2ID, "add", inputMap2, outputMap2,
                notifier);

        c.getGUI().setBodyColor(NodeState.FINISHED.color);
        d.getGUI().setBodyColor(NodeState.FINISHED.color);
        adder2.getGUI().setBodyColor(NodeState.FINISHED.color);
        repaintAndWait(3);
    }
View Full Code Here

                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");
        NodeImpl multiplier = graph.getNode("Multiplier_multiply");

        // Remove Adder_2 and replace with Multiplier_2.
        graph.removeNode(adder2);
        repaintAndWait(1);

        Node multiplier2 = workflow.addNode(multiplierComponent);
        multiplier2.setPosition(new Point(170, 210));
        repaintAndWait(1);

        graph.addEdge(c.getOutputPort(0), multiplier2.getInputPort(0));
        repaintAndWait(1);

        graph.addEdge(d.getOutputPort(0), multiplier2.getInputPort(1));
        repaintAndWait(1);

        graph.addEdge(multiplier2.getOutputPort(0), multiplier.getInputPort(1));
        repaintAndWait(1);

        // Add one more adder and an output.
        Node adder3 = workflow.addNode(adderComponent);
        adder3.setPosition(new Point(320, 300));
View Full Code Here

    LinkedList<Pair<String, String>> candidates = getCandidates(workflow,
        dataType);
    for (Pair<String, String> pair : candidates) {
      Workflow clone = workflow.clone();

      NodeImpl node = clone.getGraph().getNode(pair.getLeft());
      if (null == node) {
        throw new XBayaRuntimeException("Specified node not found:"
            + pair.getLeft());
      }
      Port candidatePort = null;
      List<DataPort> inPorts = node.getInputPorts();
      for (DataPort dataPort : inPorts) {
        if (pair.getRight().equals(dataPort.getID())) {
          candidatePort = dataPort;
          break;
        }
      }
      if (null == candidatePort) {
        throw new XBayaRuntimeException("Specifies Port was not found:"
            + pair.getRight());
      }
      if (!(candidatePort.getFromNode() instanceof InputNode)) {
        removeUnnecessaryNodes(node, candidatePort, clone);
        Node input = clone.addNode(new InputComponent());
        input.setPosition(new Point(Math.max(0,
            node.getPosition().x - 150), node.getPosition().y));

        // the returned workflows size should be less than that of the
        // original
        if (clone.getGraph().getNodes().size() < workflow.getGraph()
            .getNodes().size()
View Full Code Here

TOP

Related Classes of edu.indiana.extreme.xbaya.graph.impl.NodeImpl

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.