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;
}
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;
}
}
Aggregations