Search in sources :

Example 1 with OutputNode

use of org.apache.airavata.workflow.model.graph.system.OutputNode in project airavata by apache.

the class Workflow method getOutputs.

/**
 * Returns the outputs of the workflow.
 *
 * @return The outputs of the workflow.
 * @throws ComponentException
 */
public List<WSComponentPort> getOutputs() throws ComponentException {
    List<OutputNode> nodes = GraphUtil.getNodes(this.graph, OutputNode.class);
    List<WSComponentPort> ports = new ArrayList<WSComponentPort>();
    for (OutputNode outputNode : nodes) {
        ports.add(new WSComponentPort(outputNode.getName(), outputNode.getOutputPorts().get(0).getType(), null));
    }
    return ports;
}
Also used : OutputNode(org.apache.airavata.workflow.model.graph.system.OutputNode) ArrayList(java.util.ArrayList) WSComponentPort(org.apache.airavata.workflow.model.component.ws.WSComponentPort)

Example 2 with OutputNode

use of org.apache.airavata.workflow.model.graph.system.OutputNode in project airavata by apache.

the class ParameterPropertyWindow method ok.

private void ok() {
    String inputMetadataText = this.inputPanel.getMetadata();
    XmlElement inputMetadata;
    if (inputMetadataText.length() == 0) {
        inputMetadata = null;
    } else {
        try {
            inputMetadata = XMLUtil.stringToXmlElement(inputMetadataText);
        } catch (RuntimeException e) {
            String warning = "The input metadata is ill-formed.";
            this.engine.getGUI().getErrorWindow().error(warning, e);
            return;
        }
    }
    String outputMetadataText = this.outputPanel.getMetadata();
    XmlElement outputMetadata;
    if (outputMetadataText.length() == 0) {
        outputMetadata = null;
    } else {
        try {
            outputMetadata = XMLUtil.stringToXmlElement(outputMetadataText);
        } catch (RuntimeException e) {
            String warning = "The output metadata is ill-formed.";
            this.engine.getGUI().getErrorWindow().error(warning, e);
            return;
        }
    }
    // outputs, and the rest.
    for (int i = 0; i < this.inputNodes.size(); i++) {
        InputNode inputNode = this.inputNodes.get(i);
        Collections.swap(this.nodes, i, this.nodes.indexOf(inputNode));
    }
    for (int i = 0; i < this.outputNodes.size(); i++) {
        OutputNode outputNode = this.outputNodes.get(i);
        Collections.swap(this.nodes, this.inputNodes.size() + i, this.nodes.indexOf(outputNode));
    }
    hide();
}
Also used : InputNode(org.apache.airavata.workflow.model.graph.system.InputNode) OutputNode(org.apache.airavata.workflow.model.graph.system.OutputNode) XmlElement(org.xmlpull.infoset.XmlElement)

Example 3 with OutputNode

use of org.apache.airavata.workflow.model.graph.system.OutputNode in project airavata by apache.

the class BPELScript method getSpecialBlock.

/**
 * @param node
 * @param depth
 * @param block
 *            It's a set so that duplicated nodes won't be added.
 * @param startClass
 * @param endClass
 * @throws GraphException
 */
private void getSpecialBlock(Node node, int depth, Set<Node> block, Class startClass, Class endClass) throws GraphException {
    List<Node> nextNodes = GraphUtil.getNextNodes(node);
    for (Node nextNode : nextNodes) {
        if (nextNode instanceof OutputNode) {
            throw new GraphException("Nodes after " + startClass.getName() + " cannot be connected to the output without going through " + endClass.getName() + ".");
        } else if (endClass.isInstance(nextNode)) {
            block.add(nextNode);
            if (depth == 0) {
            // Stop the recursion here.
            } else {
                getSpecialBlock(nextNode, depth - 1, block, startClass, endClass);
            }
        } else if (startClass.isInstance(nextNode)) {
            // handle embedded forEach
            block.add(nextNode);
            getSpecialBlock(nextNode, depth + 1, block, startClass, endClass);
        } else {
            block.add(nextNode);
            getSpecialBlock(nextNode, depth, block, startClass, endClass);
        }
    }
}
Also used : GraphException(org.apache.airavata.workflow.model.graph.GraphException) OutputNode(org.apache.airavata.workflow.model.graph.system.OutputNode) InputNode(org.apache.airavata.workflow.model.graph.system.InputNode) BlockNode(org.apache.airavata.workflow.model.graph.system.BlockNode) IfNode(org.apache.airavata.workflow.model.graph.system.IfNode) EndBlockNode(org.apache.airavata.workflow.model.graph.system.EndBlockNode) MemoNode(org.apache.airavata.workflow.model.graph.system.MemoNode) Node(org.apache.airavata.workflow.model.graph.Node) EndForEachNode(org.apache.airavata.workflow.model.graph.system.EndForEachNode) ForEachNode(org.apache.airavata.workflow.model.graph.system.ForEachNode) WSNode(org.apache.airavata.workflow.model.graph.ws.WSNode) ConstantNode(org.apache.airavata.workflow.model.graph.system.ConstantNode) EndifNode(org.apache.airavata.workflow.model.graph.system.EndifNode) OutputNode(org.apache.airavata.workflow.model.graph.system.OutputNode)

Example 4 with OutputNode

use of org.apache.airavata.workflow.model.graph.system.OutputNode in project airavata by apache.

the class MonitorEventHandler method workflowFinished.

private void workflowFinished(Graph graph, boolean forward) {
    for (OutputNode node : GraphUtil.getOutputNodes(graph)) {
        if (forward) {
            finishNode(node);
            finishPredecessorNodes(node);
        } else {
            resetNode(node);
        }
    }
}
Also used : OutputNode(org.apache.airavata.workflow.model.graph.system.OutputNode)

Example 5 with OutputNode

use of org.apache.airavata.workflow.model.graph.system.OutputNode in project airavata by apache.

the class MonitorEventHandler method getOutputNodes.

private LinkedList<OutputNode> getOutputNodes(WSGraph graph) {
    List<NodeImpl> nodes = graph.getNodes();
    LinkedList<OutputNode> outputNodes = new LinkedList<OutputNode>();
    for (NodeImpl nodeImpl : nodes) {
        if (nodeImpl instanceof OutputNode) {
            outputNodes.add((OutputNode) nodeImpl);
        }
    }
    return outputNodes;
}
Also used : OutputNode(org.apache.airavata.workflow.model.graph.system.OutputNode) NodeImpl(org.apache.airavata.workflow.model.graph.impl.NodeImpl) LinkedList(java.util.LinkedList)

Aggregations

OutputNode (org.apache.airavata.workflow.model.graph.system.OutputNode)14 InputNode (org.apache.airavata.workflow.model.graph.system.InputNode)8 ConstantNode (org.apache.airavata.workflow.model.graph.system.ConstantNode)4 EndifNode (org.apache.airavata.workflow.model.graph.system.EndifNode)4 IfNode (org.apache.airavata.workflow.model.graph.system.IfNode)4 MemoNode (org.apache.airavata.workflow.model.graph.system.MemoNode)4 ArrayList (java.util.ArrayList)3 Node (org.apache.airavata.workflow.model.graph.Node)3 NodeImpl (org.apache.airavata.workflow.model.graph.impl.NodeImpl)3 BlockNode (org.apache.airavata.workflow.model.graph.system.BlockNode)3 EndBlockNode (org.apache.airavata.workflow.model.graph.system.EndBlockNode)3 EndForEachNode (org.apache.airavata.workflow.model.graph.system.EndForEachNode)3 ForEachNode (org.apache.airavata.workflow.model.graph.system.ForEachNode)3 WSNode (org.apache.airavata.workflow.model.graph.ws.WSNode)3 GraphException (org.apache.airavata.workflow.model.graph.GraphException)2 URL (java.net.URL)1 LinkedList (java.util.LinkedList)1 Client (org.apache.airavata.api.Airavata.Client)1 InputDataObjectType (org.apache.airavata.model.appcatalog.appinterface.InputDataObjectType)1 OutputDataObjectType (org.apache.airavata.model.appcatalog.appinterface.OutputDataObjectType)1