Search in sources :

Example 1 with ComponentPort

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

the class WSPort method getComponentPort.

/**
 * @see org.apache.airavata.workflow.model.graph.impl.PortImpl#getComponentPort()
 */
@Override
public WSComponentPort getComponentPort() {
    if (this.componentPort == null) {
        ComponentPort port = super.getComponentPort();
        if (port instanceof WSComponentPort) {
            this.componentPort = (WSComponentPort) port;
        }
        if (port instanceof SystemComponentDataPort) {
            // XXX to handle the xwf created by version 2.6.2_XX or earlier.
            SystemComponentDataPort systemPort = (SystemComponentDataPort) port;
            this.componentPort = new WSComponentPort(systemPort.getName(), systemPort.getType(), null);
        }
    }
    return this.componentPort;
}
Also used : SystemComponentDataPort(org.apache.airavata.workflow.model.component.system.SystemComponentDataPort) 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)

Example 2 with ComponentPort

use of org.apache.airavata.workflow.model.component.ComponentPort 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)

Aggregations

ComponentPort (org.apache.airavata.workflow.model.component.ComponentPort)2 WSComponentPort (org.apache.airavata.workflow.model.component.ws.WSComponentPort)2 SystemComponentDataPort (org.apache.airavata.workflow.model.component.system.SystemComponentDataPort)1 EPRPort (org.apache.airavata.workflow.model.graph.EPRPort)1 Node (org.apache.airavata.workflow.model.graph.Node)1 Port (org.apache.airavata.workflow.model.graph.Port)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 InputNode (org.apache.airavata.workflow.model.graph.system.InputNode)1 MemoNode (org.apache.airavata.workflow.model.graph.system.MemoNode)1 OutputNode (org.apache.airavata.workflow.model.graph.system.OutputNode)1 WSNode (org.apache.airavata.workflow.model.graph.ws.WSNode)1