Package org.apache.airavata.xbaya.graph

Examples of org.apache.airavata.xbaya.graph.Node


        // Input ports need to be connected.
        Collection<Port> inputPorts = GraphUtil.getPorts(this.graph, Port.Kind.DATA_IN);
        for (Port inputPort : inputPorts) {
            Collection<Port> fromPorts = inputPort.getFromPorts();
            if (fromPorts.size() == 0) {
                Node node = inputPort.getNode();
                String message = node.getID() + " has an unconnected input " + inputPort.getName();
                warnings.add(message);
            }
        }

        // Input nodes need to be connected.
View Full Code Here


            Thread.sleep(10000);
            registry = new URLComponentRegistry(new URI("http://129.79.246.108:8080/axis2/services/"
                    + getClassName(code) + "?wsdl"));
            ComponentRegistryLoader.getLoader(this.engine, RegistryConstants.REGISTRY_TYPE_URL).load(registry);

            Node newNode = this.engine
                    .getGUI()
                    .getGraphCanvas()
                    .addNode(
                            ((ComponentTreeNode) registry.getComponentTree().getFirstLeaf()).getComponentReference()
                                    .getComponent(), this.node.getPosition());
            List<DataPort> inputPorts = newNode.getInputPorts();
            Graph graph = this.engine.getGUI().getGraphCanvas().getGraph();
            for (int i = 0; i < inputPorts.size(); ++i) {
                graph.addEdge(this.node.getInputPort(i).getFromPort(), inputPorts.get(i));
            }
            List<DataPort> outputPorts = newNode.getOutputPorts();

            for (int i = 0; i < outputPorts.size(); ++i) {
                List<Port> toPorts = this.node.getOutputPort(i).getToPorts();
                for (Port port : toPorts) {
                    graph.removeEdge(this.node.getOutputPort(i), port);
View Full Code Here

    public void testRemoveNode() throws ComponentException, GraphException, 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

    private void initSchema(File rootDir, File srcDir, File classesDir) {

        List<DataPort> inputPorts = node.getInputPorts();
        for (DataPort inPort : inputPorts) {
            Port fromPort = inPort.getFromPort();
            Node fromNode = inPort.getFromNode();
            if (fromNode instanceof WSNode) {
                WSNode fromWsNode = (WSNode) fromNode;
                if (null != fromPort && fromPort instanceof DataPort) {
                    DataPort fromDataPort = (DataPort) fromPort;
                    WsdlDefinitions wsdl = engine.getWorkflow().getWSDLs().get(fromWsNode.getWSDLID());
View Full Code Here

    private boolean hasComplexTypes() {
        List<DataPort> inputPorts = node.getInputPorts();
        for (DataPort inPort : inputPorts) {
            Port fromPort = inPort.getFromPort();
            Node fromNode = inPort.getFromNode();
            if (fromNode instanceof WSNode) {
                if (null != fromPort && fromPort instanceof DataPort) {

                } else {
                    return false;
View Full Code Here

         * message and instanceID do not equal, so we have to handle it explicitly
         */
        if (type == EventType.RESOURCE_MAPPING && event.getMessage().contains("i-")) {
            String nodeID = event.getNodeID();
            for (GraphCanvas graphCanvas : graphCanvases) {
                Node node = graphCanvas.getWorkflow().getGraph().getNode(nodeID);
                if (node != null) {
                    ControlPort control = node.getControlInPort();
                    if (control != null) {
                        Node fromNode = control.getFromNode();
                        if (fromNode instanceof InstanceNode) {
                            InstanceNode ec2Node = (InstanceNode) fromNode;

                            /*
                             * parse message and set output to InstanceNode
View Full Code Here

    private void handleEvent(MonitorEvent event, String instanceName, WSGraph graph) {
        // TODO Auto-generated method stub
        if (-1 == instanceName.indexOf("Control_")) {
            EventType type = event.getType();
            String nodeID = event.getNodeID();
            Node node = graph.getNode(nodeID);
            if (type == MonitorUtil.EventType.WORKFLOW_INVOKED) {
                // workflowStarted(graph, forward);
                LinkedList<InputNode> inputNodes = getInputNodes(graph);
                for (InputNode inputNode : inputNodes) {
                    inputNode.getGUI().setToken(instanceName, NodeState.FINISHED);
                }
            } else if (type == MonitorUtil.EventType.WORKFLOW_INITIALIZED) {
                // workflowStarted(graph, forward);
                LinkedList<InputNode> inputNodes = getInputNodes(graph);
                for (InputNode inputNode : inputNodes) {
                    inputNode.getGUI().setToken(instanceName, NodeState.FINISHED);
                }
            } else if (type == MonitorUtil.EventType.WORKFLOW_TERMINATED) {
                LinkedList<OutputNode> outputNodes = getOutputNodes(graph);
                for (OutputNode outputNode : outputNodes) {
                    outputNode.getGUI().setToken(instanceName, NodeState.EXECUTING);
                }
            } else if (type == EventType.INVOKING_SERVICE
            // TODO this should be removed when GPEL sends all notification
            // correctly.
                    || type == EventType.SERVICE_INVOKED) {
                if (node == null) {
                    logger.warn("There is no node that has ID, " + nodeID);
                } else {
                    node.getGUI().setToken(instanceName, NodeState.EXECUTING);
                }
            } else if (type == MonitorUtil.EventType.RECEIVED_RESULT
            // TODO this should be removed when GPEL sends all notification
            // correctly.
                    || type == EventType.SENDING_RESULT) {
                if (node == null) {
                    logger.warn("There is no node that has ID, " + nodeID);
                } else {
                    node.getGUI().setToken(instanceName, NodeState.FINISHED);
                }
            } else if (type == EventType.INVOKING_SERVICE_FAILED || type == EventType.RECEIVED_FAULT
            // TODO
                    || type == EventType.SENDING_FAULT || type == EventType.SENDING_RESPONSE_FAILED) {
                if (node == null) {
                    logger.warn("There is no node that has ID, " + nodeID);
                } else {
                    node.getGUI().setToken(instanceName, NodeState.FAILED);
                }
            } else if (type == MonitorUtil.EventType.RESOURCE_MAPPING) {
                if (node == null) {
                    logger.warn("There is no node that has ID, " + nodeID);
                } else {
View Full Code Here

     * @param graph
     */
    private void handleEvent(MonitorEvent event, boolean forward, Graph graph) {
        EventType type = event.getType();
        String nodeID = event.getNodeID();
        Node node = graph.getNode(nodeID);

        // logger.info("type: " + type);
        if (type == MonitorUtil.EventType.WORKFLOW_INVOKED) {
            workflowStarted(graph, forward);
        } else if (type == MonitorUtil.EventType.WORKFLOW_TERMINATED) {
View Full Code Here

    private void finishPredecessorNodes(Node node) {
        for (Port inputPort : node.getInputPorts()) {
            for (Edge edge : inputPort.getEdges()) {
                Port fromPort = edge.getFromPort();
                if (!(fromPort instanceof EPRPort)) {
                    Node fromNode = fromPort.getNode();
                    finishNode(fromNode);
                    finishPredecessorNodes(fromNode);
                }
            }
        }
View Full Code Here

        // 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));
        repaintAndWait(1);

        graph.addEdge(adder.getOutputPort(0), adder3.getInputPort(0));
        repaintAndWait(1);

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

        Node output2 = workflow.addNode(outputComponent);
        output2.setPosition(new Point(500, 300));
        repaintAndWait(1);

        graph.addEdge(adder3.getOutputPort(0), output2.getInputPort(0));
        repaintAndWait(1);
    }
View Full Code Here

TOP

Related Classes of org.apache.airavata.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.