Search in sources :

Example 6 with WSComponentPort

use of org.apache.airavata.workflow.model.component.ws.WSComponentPort in project airavata by apache.

the class BPELScript method validate.

/**
 * @param warnings
 *            returns the warning messages.
 * @return true if the workflow is valid; false otherwise.
 */
public boolean validate(List<String> warnings) {
    // Empty
    if (this.graph.getNodes().size() == 0) {
        String message = "The workflow is empty.";
        warnings.add(message);
    }
    // Input ports need to be connected.
    Collection<Port> inputPorts = GraphUtil.getPorts(this.graph, Port.Kind.DATA_IN);
    for (Port inputPort : inputPorts) {
        ComponentPort componentPort = inputPort.getComponentPort();
        if (componentPort instanceof WSComponentPort) {
            WSComponentPort wsComponentPort = (WSComponentPort) componentPort;
            if (wsComponentPort.isOptional()) {
                // optional input.
                continue;
            }
        }
        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.
    List<InputNode> inputNodes = GraphUtil.getNodes(this.graph, InputNode.class);
    for (InputNode inputNode : inputNodes) {
        if (inputNode.getPort().getToPorts().size() == 0) {
            String message = inputNode.getID() + " is not connected to any service.";
            warnings.add(message);
        }
    }
    // Cycle
    if (GraphUtil.containsCycle(this.graph)) {
        String message = "There is a cycle in the workflow.";
        warnings.add(message);
    }
    // XXX bypass some checks for debugging.
    String debug = System.getProperty("xbaya.debug");
    if (!"true".equalsIgnoreCase(debug)) {
        // split/merge are not supported.
        List<ForEachNode> splitNodes = GraphUtil.getNodes(this.graph, ForEachNode.class);
        List<EndForEachNode> mergeNodes = GraphUtil.getNodes(this.graph, EndForEachNode.class);
        if (splitNodes.size() > 0 || mergeNodes.size() > 0) {
            String message = "Split/merge are not supported yet.";
            warnings.add(message);
        }
        // block are not supported.
        List<BlockNode> blockNodes = GraphUtil.getNodes(this.graph, BlockNode.class);
        List<EndBlockNode> endBlockNodes = GraphUtil.getNodes(this.graph, EndBlockNode.class);
        if (blockNodes.size() > 0 || endBlockNodes.size() > 0) {
            String message = "Blocks/EndBlocks are not supported yet.";
            warnings.add(message);
        }
    // // receive is not supported.
    // List<ReceiveNode> receiveNodes = GraphUtil.getNodes(this.graph,
    // ReceiveNode.class);
    // if (receiveNodes.size() > 0) {
    // String message = "Receive is not supported yet.";
    // warnings.add(message);
    // }
    }
    if (warnings.size() > 0) {
        return false;
    } else {
        // No error.
        return true;
    }
}
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) Port(org.apache.airavata.workflow.model.graph.Port) ComponentPort(org.apache.airavata.workflow.model.component.ComponentPort) WSComponentPort(org.apache.airavata.workflow.model.component.ws.WSComponentPort) EPRPort(org.apache.airavata.workflow.model.graph.EPRPort) 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) ComponentPort(org.apache.airavata.workflow.model.component.ComponentPort) WSComponentPort(org.apache.airavata.workflow.model.component.ws.WSComponentPort) WSComponentPort(org.apache.airavata.workflow.model.component.ws.WSComponentPort) EndBlockNode(org.apache.airavata.workflow.model.graph.system.EndBlockNode) EndForEachNode(org.apache.airavata.workflow.model.graph.system.EndForEachNode) ForEachNode(org.apache.airavata.workflow.model.graph.system.ForEachNode) EndForEachNode(org.apache.airavata.workflow.model.graph.system.EndForEachNode)

Example 7 with WSComponentPort

use of org.apache.airavata.workflow.model.component.ws.WSComponentPort in project airavata by apache.

the class OutputNode method edgeWasAdded.

/**
 * Called whan an Edge was added to the parameter port. Change the name of this node.
 *
 * @throws GraphException
 *
 * @see org.apache.airavata.workflow.model.graph.impl.NodeImpl#edgeWasAdded(org.apache.airavata.workflow.model.graph.impl.EdgeImpl)
 */
@Override
protected void edgeWasAdded(Edge edge) throws GraphException {
    super.edgeWasAdded(edge);
    // TODO organize
    Port fromPort = edge.getFromPort();
    if (edge instanceof DataEdge) {
        DataPort fromDataPort = (DataPort) fromPort;
        DataType fromType = fromDataPort.getType();
        List<DataEdge> edges = getEdges();
        if (edges.size() == 1) {
            setParameterType(fromType);
            if (!isConfigured() && fromDataPort instanceof WSPort) {
                setName(fromDataPort.getName());
                WSComponentPort componentPort = ((WSPort) fromDataPort).getComponentPort();
                setDescription(componentPort.getDescription());
                setMetadata(componentPort.getAppinfo());
            }
        } else {
            throw new GraphException("Cannot connect more than one output ports to the output parameter.");
        }
    }
}
Also used : DataPort(org.apache.airavata.workflow.model.graph.DataPort) WSPort(org.apache.airavata.workflow.model.graph.ws.WSPort) GraphException(org.apache.airavata.workflow.model.graph.GraphException) DataEdge(org.apache.airavata.workflow.model.graph.DataEdge) DataPort(org.apache.airavata.workflow.model.graph.DataPort) WSPort(org.apache.airavata.workflow.model.graph.ws.WSPort) WSComponentPort(org.apache.airavata.workflow.model.component.ws.WSComponentPort) Port(org.apache.airavata.workflow.model.graph.Port) DataType(org.apache.airavata.model.application.io.DataType) WSComponentPort(org.apache.airavata.workflow.model.component.ws.WSComponentPort)

Example 8 with WSComponentPort

use of org.apache.airavata.workflow.model.component.ws.WSComponentPort in project airavata by apache.

the class S3InputNode method copyDefaultConfiguration.

/**
 * @param toWSPort
 */
private void copyDefaultConfiguration(WSPort toWSPort) {
    // TODO support recursive search for WSPort in case the input is
    // connected to special nodes.
    setName(toWSPort.getName());
    WSComponentPort componentPort = toWSPort.getComponentPort();
    setDescription(componentPort.getDescription());
    setDefaultValue(componentPort.getDefaultValue());
    setMetadata(componentPort.getAppinfo());
}
Also used : WSComponentPort(org.apache.airavata.workflow.model.component.ws.WSComponentPort)

Aggregations

WSComponentPort (org.apache.airavata.workflow.model.component.ws.WSComponentPort)8 ArrayList (java.util.ArrayList)2 ComponentPort (org.apache.airavata.workflow.model.component.ComponentPort)2 Port (org.apache.airavata.workflow.model.graph.Port)2 InputNode (org.apache.airavata.workflow.model.graph.system.InputNode)2 OutputNode (org.apache.airavata.workflow.model.graph.system.OutputNode)2 DataType (org.apache.airavata.model.application.io.DataType)1 SystemComponentDataPort (org.apache.airavata.workflow.model.component.system.SystemComponentDataPort)1 DataEdge (org.apache.airavata.workflow.model.graph.DataEdge)1 DataPort (org.apache.airavata.workflow.model.graph.DataPort)1 EPRPort (org.apache.airavata.workflow.model.graph.EPRPort)1 GraphException (org.apache.airavata.workflow.model.graph.GraphException)1 Node (org.apache.airavata.workflow.model.graph.Node)1 BlockNode (org.apache.airavata.workflow.model.graph.system.BlockNode)1 ConstantNode (org.apache.airavata.workflow.model.graph.system.ConstantNode)1 EndBlockNode (org.apache.airavata.workflow.model.graph.system.EndBlockNode)1 EndForEachNode (org.apache.airavata.workflow.model.graph.system.EndForEachNode)1 EndifNode (org.apache.airavata.workflow.model.graph.system.EndifNode)1 ForEachNode (org.apache.airavata.workflow.model.graph.system.ForEachNode)1 IfNode (org.apache.airavata.workflow.model.graph.system.IfNode)1