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