Search in sources :

Example 21 with WorkflowRuntimeException

use of org.apache.airavata.workflow.model.exceptions.WorkflowRuntimeException in project airavata by apache.

the class ComponentSelector method updateSelectedRegistry.

/**
 * @throws ComponentRegistryException
 */
public void updateSelectedRegistry() throws ComponentRegistryException {
    final TreePath[] selectionPathHolder = new TreePath[1];
    try {
        SwingUtilities.invokeAndWait(new Runnable() {

            public void run() {
                selectionPathHolder[0] = ComponentSelector.this.tree.getSelectionPath();
            }
        });
    } catch (InterruptedException e) {
        // Should not happen.
        throw new WorkflowRuntimeException(e);
    } catch (InvocationTargetException e) {
        // Should not happen.
        throw new WorkflowRuntimeException(e);
    }
    TreePath selectionPath = selectionPathHolder[0];
    if (selectionPath == null) {
        // TODO this case should be handled in the menu before comming here.
        return;
    }
    if (selectionPath.getPathCount() >= 2) {
        final ComponentTreeNode selectedNode = (ComponentTreeNode) selectionPath.getPath()[1];
        reloadComponentRegistryNode(selectedNode);
    }
}
Also used : TreePath(javax.swing.tree.TreePath) WorkflowRuntimeException(org.apache.airavata.workflow.model.exceptions.WorkflowRuntimeException) InvocationTargetException(java.lang.reflect.InvocationTargetException)

Example 22 with WorkflowRuntimeException

use of org.apache.airavata.workflow.model.exceptions.WorkflowRuntimeException in project airavata by apache.

the class XBayaUtil method findEndForEachFor.

/**
 * @param node
 * @return
 */
public static Node findEndForEachFor(ForEachNode node) {
    Collection<Node> toNodes = node.getOutputPort(0).getToNodes();
    if (toNodes.size() != 1) {
        throw new WorkflowRuntimeException("ForEach output does not contain single out-edge");
    }
    Node middleNode = toNodes.iterator().next();
    List<DataPort> outputPorts = middleNode.getOutputPorts();
    for (DataPort dataPort : outputPorts) {
        if (dataPort.getToNodes().size() == 1) {
            Node possibleEndForEachNode = dataPort.getToNodes().get(0);
            if (possibleEndForEachNode instanceof EndForEachNode) {
                return possibleEndForEachNode;
            }
        }
    }
    throw new WorkflowRuntimeException("EndForEachNode not found");
}
Also used : DataPort(org.apache.airavata.workflow.model.graph.DataPort) EndForEachNode(org.apache.airavata.workflow.model.graph.system.EndForEachNode) ForEachNode(org.apache.airavata.workflow.model.graph.system.ForEachNode) Node(org.apache.airavata.workflow.model.graph.Node) WorkflowRuntimeException(org.apache.airavata.workflow.model.exceptions.WorkflowRuntimeException) EndForEachNode(org.apache.airavata.workflow.model.graph.system.EndForEachNode)

Example 23 with WorkflowRuntimeException

use of org.apache.airavata.workflow.model.exceptions.WorkflowRuntimeException in project airavata by apache.

the class GraphUtil method getEncodedInputLabels.

/**
 * @param node
 * @return
 */
public static String getEncodedInputLabels(Node node) {
    if (!isAllInputsConnected(node)) {
        throw new WorkflowRuntimeException("Node inputs not connected" + node);
    }
    if (!isAllInputsLabeled(node)) {
        throw new WorkflowRuntimeException("Some or all of the node inputs not labeled" + node);
    }
    List<DataPort> inputPorts = node.getInputPorts();
    String label = "";
    for (DataPort dataPort : inputPorts) {
        label += "#" + dataPort.getEdge(0).getLabel();
    }
    return label;
}
Also used : DataPort(org.apache.airavata.workflow.model.graph.DataPort) WorkflowRuntimeException(org.apache.airavata.workflow.model.exceptions.WorkflowRuntimeException)

Example 24 with WorkflowRuntimeException

use of org.apache.airavata.workflow.model.exceptions.WorkflowRuntimeException in project airavata by apache.

the class WSGraphFactory method createEdge.

/**
 * @see org.apache.airavata.workflow.model.graph.GraphFactory#createEdge(org.apache.airavata.workflow.model.graph.Port,
 *      org.apache.airavata.workflow.model.graph.Port)
 */
public EdgeImpl createEdge(Port fromPort, Port toPort) {
    Kind fromKind = fromPort.getKind();
    Kind toKind = toPort.getKind();
    if (!((fromKind == Kind.DATA_OUT && toKind == Kind.DATA_IN) || (fromKind == Kind.CONTROL_OUT && toKind == Kind.CONTROL_IN) || (fromKind == Kind.EPR && toKind == Kind.DATA_IN))) {
        throw new WorkflowRuntimeException();
    }
    EdgeImpl edge;
    if (toKind == Kind.DATA_IN) {
        edge = new DataEdge();
    } else if (toKind == Kind.CONTROL_IN) {
        edge = new ControlEdge();
    } else {
        // Should not happen.
        throw new WorkflowRuntimeException();
    }
    return edge;
}
Also used : DataEdge(org.apache.airavata.workflow.model.graph.DataEdge) Kind(org.apache.airavata.workflow.model.graph.Port.Kind) EdgeImpl(org.apache.airavata.workflow.model.graph.impl.EdgeImpl) WorkflowRuntimeException(org.apache.airavata.workflow.model.exceptions.WorkflowRuntimeException) ControlEdge(org.apache.airavata.workflow.model.graph.ControlEdge)

Example 25 with WorkflowRuntimeException

use of org.apache.airavata.workflow.model.exceptions.WorkflowRuntimeException in project airavata by apache.

the class InputNode 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 this.
    if (edge instanceof DataEdge) {
        DataEdge dataEdge = (DataEdge) edge;
        DataPort toPort = dataEdge.getToPort();
        DataType toType = toPort.getType();
        List<DataEdge> edges = getEdges();
        if (edges.size() == 1) {
            // The first edge.
            setParameterType(toType);
            if (!isConfigured() && toPort instanceof WSPort) {
                // Copy
                copyDefaultConfiguration((WSPort) toPort);
            }
        } else if (edges.size() > 1) {
            // Not the first edge.
            DataType parameterType = getParameterType();
            if (!toType.equals(WSConstants.XSD_ANY_TYPE) && !parameterType.equals(toType)) {
                throw new GraphException("Cannot connect ports with different types.");
            }
        } else {
            // Should not happen.
            throw new WorkflowRuntimeException("edges.size(): " + edges.size());
        }
    }
}
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) DataType(org.apache.airavata.model.appcatalog.appinterface.DataType) WorkflowRuntimeException(org.apache.airavata.workflow.model.exceptions.WorkflowRuntimeException)

Aggregations

WorkflowRuntimeException (org.apache.airavata.workflow.model.exceptions.WorkflowRuntimeException)41 DataPort (org.apache.airavata.workflow.model.graph.DataPort)25 GraphException (org.apache.airavata.workflow.model.graph.GraphException)13 DataEdge (org.apache.airavata.workflow.model.graph.DataEdge)12 Node (org.apache.airavata.workflow.model.graph.Node)11 DataType (org.apache.airavata.model.application.io.DataType)10 InputNode (org.apache.airavata.workflow.model.graph.system.InputNode)9 ComponentDataPort (org.apache.airavata.workflow.model.component.ComponentDataPort)8 Port (org.apache.airavata.workflow.model.graph.Port)8 Kind (org.apache.airavata.workflow.model.graph.Port.Kind)7 WSNode (org.apache.airavata.workflow.model.graph.ws.WSNode)7 WSPort (org.apache.airavata.workflow.model.graph.ws.WSPort)6 LinkedList (java.util.LinkedList)4 DataType (org.apache.airavata.model.appcatalog.appinterface.DataType)4 EPRPort (org.apache.airavata.workflow.model.graph.EPRPort)4 NodeImpl (org.apache.airavata.workflow.model.graph.impl.NodeImpl)4 Point (java.awt.Point)3 File (java.io.File)3 ArrayList (java.util.ArrayList)3 EndForEachNode (org.apache.airavata.workflow.model.graph.system.EndForEachNode)3