Search in sources :

Example 11 with NodeImpl

use of org.apache.airavata.workflow.model.graph.impl.NodeImpl in project airavata by apache.

the class GraphUtil method getStreamSourceNodes.

/**
 * @param graph
 * @return
 */
public static LinkedList<StreamSourceNode> getStreamSourceNodes(WSGraph graph) {
    List<NodeImpl> nodes = graph.getNodes();
    LinkedList<StreamSourceNode> ret = new LinkedList<StreamSourceNode>();
    for (NodeImpl nodeImpl : nodes) {
        if (nodeImpl instanceof StreamSourceNode) {
            ret.add((StreamSourceNode) nodeImpl);
        }
    }
    return ret;
}
Also used : StreamSourceNode(org.apache.airavata.workflow.model.graph.system.StreamSourceNode) NodeImpl(org.apache.airavata.workflow.model.graph.impl.NodeImpl) LinkedList(java.util.LinkedList)

Example 12 with NodeImpl

use of org.apache.airavata.workflow.model.graph.impl.NodeImpl in project airavata by apache.

the class GraphUtil method getJoinRequiredNodes.

/**
 * @param wsGraph
 * @return
 */
public static List<Node> getJoinRequiredNodes(WSGraph wsGraph) {
    List<NodeImpl> nodes = wsGraph.getNodes();
    List<Node> ret = new LinkedList<Node>();
    for (NodeImpl node : nodes) {
        if (node.getRequireJoin()) {
            ret.add(node);
        }
    }
    return ret;
}
Also used : NodeImpl(org.apache.airavata.workflow.model.graph.impl.NodeImpl) InputNode(org.apache.airavata.workflow.model.graph.system.InputNode) StreamSourceNode(org.apache.airavata.workflow.model.graph.system.StreamSourceNode) Node(org.apache.airavata.workflow.model.graph.Node) WSNode(org.apache.airavata.workflow.model.graph.ws.WSNode) OutputNode(org.apache.airavata.workflow.model.graph.system.OutputNode) LinkedList(java.util.LinkedList)

Example 13 with NodeImpl

use of org.apache.airavata.workflow.model.graph.impl.NodeImpl in project airavata by apache.

the class WSGraphFactory method createNode.

/**
 * @see org.apache.airavata.workflow.model.graph.GraphFactory#createNode(org.xmlpull.infoset.XmlElement)
 */
public NodeImpl createNode(XmlElement nodeElement) throws GraphException {
    String type = nodeElement.attributeValue(GraphSchema.NS, GraphSchema.NODE_TYPE_ATTRIBUTE);
    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_WORKFLOW.equals(type)) {
        node = new WorkflowNode(nodeElement);
    } else if (GraphSchema.NODE_TYPE_INPUT.equals(type)) {
        node = new InputNode(nodeElement);
    } else if (GraphSchema.NODE_TYPE_OUTPUT.equals(type)) {
        node = new OutputNode(nodeElement);
    } else if (GraphSchema.NODE_TYPE_CONSTANT.equals(type)) {
        node = new ConstantNode(nodeElement);
    } else if (GraphSchema.NODE_TYPE_SPLIT.equals(type)) {
        node = new ForEachNode(nodeElement);
    } else if (GraphSchema.NODE_TYPE_MERGE.equals(type)) {
        node = new EndForEachNode(nodeElement);
    } else if (GraphSchema.NODE_TYPE_IF.equals(type)) {
        node = new IfNode(nodeElement);
    } else if (GraphSchema.NODE_TYPE_ENDIF.equals(type)) {
        node = new EndifNode(nodeElement);
    } else if (GraphSchema.NODE_TYPE_DOWHILE.equals(type)) {
        node = new DoWhileNode(nodeElement);
    } else if (GraphSchema.NODE_TYPE_ENDDOWHILE.equals(type)) {
        node = new EndDoWhileNode(nodeElement);
    } else if (GraphSchema.NODE_TYPE_MEMO.equals(type)) {
        node = new MemoNode(nodeElement);
    } else if (GraphSchema.NODE_TYPE_RECEIVE.equals(type)) {
        node = new ReceiveNode(nodeElement);
    } else if (GraphSchema.NODE_TYPE_BLOCK.equals(type)) {
        node = new BlockNode(nodeElement);
    } else if (GraphSchema.NODE_TYPE_ENDBLOCK.equals(type)) {
        node = new EndBlockNode(nodeElement);
    } else if (GraphSchema.NODE_TYPE_INSTANCE.equals(type)) {
        node = new InstanceNode(nodeElement);
    } else if (GraphSchema.NODE_TYPE_TERMINATE.equals(type)) {
        node = new TerminateInstanceNode(nodeElement);
    } else {
        // Default is WsNode for backward compatibility.
        node = new WSNode(nodeElement);
    }
    return node;
}
Also used : BlockNode(org.apache.airavata.workflow.model.graph.system.BlockNode) EndBlockNode(org.apache.airavata.workflow.model.graph.system.EndBlockNode) InputNode(org.apache.airavata.workflow.model.graph.system.InputNode) OutputNode(org.apache.airavata.workflow.model.graph.system.OutputNode) ReceiveNode(org.apache.airavata.workflow.model.graph.system.ReceiveNode) NodeImpl(org.apache.airavata.workflow.model.graph.impl.NodeImpl) InstanceNode(org.apache.airavata.workflow.model.graph.amazon.InstanceNode) TerminateInstanceNode(org.apache.airavata.workflow.model.graph.amazon.TerminateInstanceNode) EndDoWhileNode(org.apache.airavata.workflow.model.graph.system.EndDoWhileNode) DoWhileNode(org.apache.airavata.workflow.model.graph.system.DoWhileNode) IfNode(org.apache.airavata.workflow.model.graph.system.IfNode) EndifNode(org.apache.airavata.workflow.model.graph.system.EndifNode) MemoNode(org.apache.airavata.workflow.model.graph.system.MemoNode) StreamSourceNode(org.apache.airavata.workflow.model.graph.system.StreamSourceNode) EndBlockNode(org.apache.airavata.workflow.model.graph.system.EndBlockNode) ConstantNode(org.apache.airavata.workflow.model.graph.system.ConstantNode) EndDoWhileNode(org.apache.airavata.workflow.model.graph.system.EndDoWhileNode) EndForEachNode(org.apache.airavata.workflow.model.graph.system.EndForEachNode) ForEachNode(org.apache.airavata.workflow.model.graph.system.ForEachNode) TerminateInstanceNode(org.apache.airavata.workflow.model.graph.amazon.TerminateInstanceNode) EndForEachNode(org.apache.airavata.workflow.model.graph.system.EndForEachNode)

Example 14 with NodeImpl

use of org.apache.airavata.workflow.model.graph.impl.NodeImpl in project airavata by apache.

the class WSGraphFactory method createNode.

public NodeImpl createNode(JsonObject nodeObject) throws GraphException {
    String type = nodeObject.getAsJsonPrimitive(GraphSchema.NODE_TYPE_ATTRIBUTE).getAsString();
    NodeImpl node;
    if (GraphSchema.NODE_TYPE_WS.equals(type)) {
        node = new WSNode(nodeObject);
    } else if (GraphSchema.NODE_TYPE_WORKFLOW.equals(type)) {
        node = new WorkflowNode(nodeObject);
    } else if (GraphSchema.NODE_TYPE_INPUT.equals(type)) {
        node = new InputNode(nodeObject);
    } else if (GraphSchema.NODE_TYPE_OUTPUT.equals(type)) {
        node = new OutputNode(nodeObject);
    /*        } else if (GraphSchema.NODE_TYPE_STREAM_SOURCE.equals(type)) {
            node = new StreamSourceNode(nodeElement);
        } else if (GraphSchema.NODE_TYPE_CONSTANT.equals(type)) {
            node = new ConstantNode(nodeElement);
        } else if (GraphSchema.NODE_TYPE_SPLIT.equals(type)) {
            node = new ForEachNode(nodeElement);
        } else if (GraphSchema.NODE_TYPE_MERGE.equals(type)) {
            node = new EndForEachNode(nodeElement);
        } else if (GraphSchema.NODE_TYPE_IF.equals(type)) {
            node = new IfNode(nodeElement);
        } else if (GraphSchema.NODE_TYPE_ENDIF.equals(type)) {
            node = new EndifNode(nodeElement);
        } else if (GraphSchema.NODE_TYPE_DOWHILE.equals(type)) {
            node = new DoWhileNode(nodeElement);
        } else if (GraphSchema.NODE_TYPE_ENDDOWHILE.equals(type)) {
            node = new EndDoWhileNode(nodeElement);
        } else if (GraphSchema.NODE_TYPE_MEMO.equals(type)) {
            node = new MemoNode(nodeElement);
        } else if (GraphSchema.NODE_TYPE_RECEIVE.equals(type)) {
            node = new ReceiveNode(nodeElement);
        } else if (GraphSchema.NODE_TYPE_BLOCK.equals(type)) {
            node = new BlockNode(nodeElement);
        } else if (GraphSchema.NODE_TYPE_ENDBLOCK.equals(type)) {
            node = new EndBlockNode(nodeElement);
        } else if (GraphSchema.NODE_TYPE_INSTANCE.equals(type)) {
            node = new InstanceNode(nodeElement);
        } else if (GraphSchema.NODE_TYPE_TERMINATE.equals(type)) {
            node = new TerminateInstanceNode(nodeElement);*/
    } else {
        // Default is WsNode for backward compatibility.
        node = new WSNode(nodeObject);
    }
    return node;
}
Also used : InputNode(org.apache.airavata.workflow.model.graph.system.InputNode) OutputNode(org.apache.airavata.workflow.model.graph.system.OutputNode) NodeImpl(org.apache.airavata.workflow.model.graph.impl.NodeImpl)

Example 15 with NodeImpl

use of org.apache.airavata.workflow.model.graph.impl.NodeImpl in project airavata by apache.

the class InterpreterUtil method getNodeCountWithBodyColor.

public static int getNodeCountWithBodyColor(NodeExecutionState state, WSGraph graph) {
    int sum = 0;
    List<NodeImpl> nodes = graph.getNodes();
    for (Node node : nodes) {
        if (node.getState() == state) {
            ++sum;
        }
    }
    return sum;
}
Also used : NodeImpl(org.apache.airavata.workflow.model.graph.impl.NodeImpl) EndForEachNode(org.apache.airavata.workflow.model.graph.system.EndForEachNode) ForEachNode(org.apache.airavata.workflow.model.graph.system.ForEachNode) InputNode(org.apache.airavata.workflow.model.graph.system.InputNode) Node(org.apache.airavata.workflow.model.graph.Node)

Aggregations

NodeImpl (org.apache.airavata.workflow.model.graph.impl.NodeImpl)24 Node (org.apache.airavata.workflow.model.graph.Node)14 WSNode (org.apache.airavata.workflow.model.graph.ws.WSNode)14 InputNode (org.apache.airavata.workflow.model.graph.system.InputNode)12 LinkedList (java.util.LinkedList)11 DataPort (org.apache.airavata.workflow.model.graph.DataPort)8 OutputNode (org.apache.airavata.workflow.model.graph.system.OutputNode)6 GraphException (org.apache.airavata.workflow.model.graph.GraphException)5 DynamicNode (org.apache.airavata.workflow.model.graph.dynamic.DynamicNode)5 SubWorkflowNode (org.apache.airavata.workflow.model.graph.subworkflow.SubWorkflowNode)5 Pair (org.apache.airavata.common.utils.Pair)4 WorkflowRuntimeException (org.apache.airavata.workflow.model.exceptions.WorkflowRuntimeException)4 EndForEachNode (org.apache.airavata.workflow.model.graph.system.EndForEachNode)4 ForEachNode (org.apache.airavata.workflow.model.graph.system.ForEachNode)4 StreamSourceNode (org.apache.airavata.workflow.model.graph.system.StreamSourceNode)4 Workflow (org.apache.airavata.workflow.model.wf.Workflow)3 Point (java.awt.Point)2 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 RegistryException (org.apache.airavata.registry.cpi.RegistryException)2