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);
}
}
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");
}
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;
}
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;
}
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());
}
}
}
Aggregations