Package org.apache.airavata.xbaya.graph

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


            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
View Full Code Here


                output = getOutput(fromNodeID, messageName, parameterName);
            } else {
                // This should not happen.
                throw new XBayaRuntimeException(originalFromNode.getClass().getName());
            }
            Port originalToPort = originalFromPort.getToPorts().get(0);
            PortImpl toPort = graph.getPort(originalToPort.getID());
            InputNode inputNode = (InputNode) toPort.getFromNode();
            inputNode.setDefaultValue(output);
        }

        return workflow;
View Full Code Here

     */
    private Set<WSPort> getFinalOutputPorts(WSGraph originalGraph, WSGraph graph) {
        Collection<Port> inputPorts = GraphUtil.getPorts(graph, Port.Kind.DATA_IN);
        Set<WSPort> originalFromPorts = new HashSet<WSPort>();
        for (Port inputPort : inputPorts) {
            Port fromPort = inputPort.getFromPort();
            if (fromPort == null) {
                // This input port is not connected.
                String inputPortID = inputPort.getID();
                logger.info("id: " + inputPortID);
                Port originalInputPort = originalGraph.getPort(inputPortID);
                // No duplicate in set.
                Port originalFromPort = originalInputPort.getFromPort();
                originalFromPorts.add((WSPort) originalFromPort);
            }
        }
        return originalFromPorts;
    }
View Full Code Here

            InputNode inputNode = inputComponent.createNode(graph);
            List<Port> originalToPorts = originalFromPort.getToPorts();
            boolean first = true;
            for (Port originalToPort : originalToPorts) {
                String toPortID = originalToPort.getID();
                Port toPort = graph.getPort(toPortID);
                graph.addEdge(inputNode.getPort(), toPort);
                if (first) {
                    first = false;
                    Point position = originalToPort.getGUI().getPosition();
                    Point inputNodePosition = new Point(0, position.y);
View Full Code Here

                setMetadata(null);
            }

        } else {
            Edge edge = edges.get(0);
            Port toPort = edge.getToPort();
            WSPort toWsPort = (WSPort) toPort;
            QName toType = toWsPort.getType();
            setParameterType(toType);

            if (!isConfigured()) {
View Full Code Here

    @Override
    protected void setPortPositions() {
        // inputs
        List<? extends Port> inputPorts = this.node.getInputPorts();
        for (int i = 0; i < inputPorts.size(); i++) {
            Port port = inputPorts.get(i);
            Point offset;
            if (i < inputPorts.size() / 2) {
                offset = new Point(PortGUI.DATA_PORT_SIZE / 2, this.headHeight + PORT_INITIAL_GAP + PORT_GAP * i);
            } else {
                offset = new Point(PortGUI.DATA_PORT_SIZE / 2, this.headHeight + PORT_INITIAL_GAP + PORT_GAP * (i + 1));
            }
            port.getGUI().setOffset(offset);
        }

        // outputs
        List<? extends Port> outputPorts = this.node.getOutputPorts();
        for (int i = 0; i < outputPorts.size(); i++) {
            Port port = outputPorts.get(i);
            Point offset = new Point(this.getBounds().width - PortGUI.DATA_PORT_SIZE / 2, (int) (this.headHeight
                    + PORT_INITIAL_GAP + PORT_GAP * (outputPorts.size() / 2.0 + i)));
            port.getGUI().setOffset(offset);
        }

        // control-in
        Port controlInPort = this.node.getControlInPort();
        if (controlInPort != null) {
            controlInPort.getGUI().setOffset(new Point(0, 0));
        }

        // control-out
        for (Port controlOutPort : this.node.getControlOutPorts()) {
            controlOutPort.getGUI().setOffset(new Point(getBounds().width, getBounds().height - this.headHeight / 2));
View Full Code Here

     */
    @Override
    protected void setPortPositions() {
        List<? extends Port> inputPorts = this.node.getInputPorts();
        for (int i = 0; i < inputPorts.size(); i++) {
            Port port = inputPorts.get(i);
            Point offset = new Point(PortGUI.DATA_PORT_SIZE / 2, this.headHeight + PORT_INITIAL_GAP + PORT_GAP * i);
            port.getGUI().setOffset(offset);
        }

        PortImpl controlInPort = this.node.getControlInPort();
        if (controlInPort != null) {
            Point offset = new Point(0, this.headHeight / 2);
            controlInPort.getGUI().setOffset(offset);
        }

        // There are two controlOutPorts.
        List<? extends Port> controlOutPorts = this.node.getControlOutPorts();
        Port controlOutPort1 = controlOutPorts.get(0);
        Point offset = new Point(getBounds().width, +this.headHeight / 2);
        controlOutPort1.getGUI().setOffset(offset);

        Port controlOutPort2 = controlOutPorts.get(1);
        offset = new Point(this.getBounds().width, getBounds().height - this.headHeight / 2);
        controlOutPort2.getGUI().setOffset(offset);

        // No outputs
    }
View Full Code Here

    @Override
    protected void edgeWasAdded(Edge edge) throws GraphException {
        super.edgeWasAdded(edge);
        GraphUtil.validateConnection(edge);

        Port fromPort = edge.getFromPort();
        Port toPort = edge.getToPort();
        if (edge instanceof DataEdge) {
            if (fromPort instanceof EPRPort) {
                // TODO
                return;
            }
View Full Code Here

            String value;
            Node fromNode = port.getFromNode();
            if (fromNode instanceof InputNode) {
                value = PROPERTIES_VARIABLE + "." + GET_PROPERTY_METHOD + "('" + fromNode.getID() + "')";
            } else {
                Port fromPort = port.getFromPort();
                value = "" + fromNode.getID() + INVOKER_SUFFIX + "." + GET_OUTPUT_METHOD + "('" + fromPort.getName()
                        + "')";

                // This might try to remove a node that has been removed
                // already, but it's OK.
                this.executingNodes.remove(fromNode);
View Full Code Here

        }
    }

    private void writeOutput(OutputNode node, PrintWriter pw) throws GraphException {
        String id = node.getID();
        Port port = node.getPort();

        Node fromNode = port.getFromNode();
        if (fromNode == null) {
            throw new GraphException("Output parameter has to be connected to some node.");
        }
        Port fromPort = port.getFromPort();
        if (fromNode instanceof InputNode) {
            // The OutputNode is directly connected to an InputNode.
            pw.println(TAB + id + VALUE_SUFFIX + " = " + PROPERTIES_VARIABLE + "." + GET_PROPERTY_METHOD + "('"
                    + fromNode.getID() + "')");
        } else {
            pw.println(TAB + "# Wait output " + id);
            pw.println(TAB + id + VALUE_SUFFIX + " = " + fromNode.getID() + INVOKER_SUFFIX + "." + GET_OUTPUT_METHOD
                    + "('" + fromPort.getName() + "')");
        }
        pw.println(TAB + "print '" + id + " = ', " + id + VALUE_SUFFIX);

        // This might try to remove a node that has been removed
        // already, but it's OK.
View Full Code Here

TOP

Related Classes of org.apache.airavata.xbaya.graph.Port

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.