use of org.apache.airavata.workflow.model.graph.EPRPort in project airavata by apache.
the class MonitorEventHandler method finishPredecessorNodes.
/**
* Make preceding nodes done. This helps the monitoring GUI when a user subscribes from the middle of the workflow
* execution.
*
* @param node
*/
private void finishPredecessorNodes(Node node) {
for (Port inputPort : node.getInputPorts()) {
for (Edge edge : inputPort.getEdges()) {
Port fromPort = edge.getFromPort();
if (!(fromPort instanceof EPRPort)) {
Node fromNode = fromPort.getNode();
finishNode(fromNode);
finishPredecessorNodes(fromNode);
}
}
}
Port controlInPort = node.getControlInPort();
if (controlInPort != null) {
for (Node fromNode : controlInPort.getFromNodes()) {
finishNode(fromNode);
finishPredecessorNodes(fromNode);
}
}
}
use of org.apache.airavata.workflow.model.graph.EPRPort in project airavata by apache.
the class GraphUtil method validateConnection.
/**
* @param edge
* @throws GraphException
*/
public static void validateConnection(Edge edge) throws GraphException {
Port fromPort = edge.getFromPort();
Port toPort = edge.getToPort();
if (edge instanceof ControlEdge) {
if (!(fromPort instanceof ControlPort && toPort instanceof ControlPort)) {
throw new GraphException(MessageConstants.UNEXPECTED_ERROR);
}
} else if (edge instanceof DataEdge) {
if (fromPort instanceof EPRPort) {
// TODO
return;
}
if (!(fromPort instanceof DataPort || fromPort instanceof EPRPort) || !(toPort instanceof DataPort)) {
throw new GraphException(MessageConstants.UNEXPECTED_ERROR);
}
DataPort fromDataPort = (DataPort) fromPort;
DataPort toDataPort = (DataPort) toPort;
DataType fromType = fromDataPort.getType();
DataType toType = toDataPort.getType();
if (toDataPort.getEdges().size() > 1) {
throw new GraphException(MessageConstants.MORE_THAN_ONE_CONNECTIONS);
}
// ok
if (fromPort.getNode() instanceof WSNode) {
if ("registerStream".equals(((WSNode) fromPort.getNode()).getOperationName())) {
return;
}
}
if (!(fromType == null || fromType.equals(WSConstants.XSD_ANY_TYPE) || fromType.equals(new QName(WSConstants.XSD_NS_URI, "anyType")) || toType == null || toType.equals(WSConstants.XSD_ANY_TYPE) || toType.equals(new QName(WSConstants.XSD_NS_URI, "anyType")) || fromType.equals(toType)) && (fromType == null || fromType.equals(WSConstants.LEAD_ANY_TYPE) || fromType.equals(new QName(WSConstants.LEAD_NS_URI, "anyType")) || toType == null || toType.equals(WSConstants.LEAD_ANY_TYPE) || toType.equals(new QName(WSConstants.LEAD_NS_URI, "anyType")) || fromType.equals(toType))) {
throw new GraphException("Cannot connect ports with different types:" + " \nfrom=\t" + fromType + " \nto=\t" + toType + "");
}
}
}
use of org.apache.airavata.workflow.model.graph.EPRPort in project airavata by apache.
the class EndForEachNode method edgeWasAdded.
/**
* @throws GraphException
* @see org.apache.airavata.workflow.model.graph.impl.NodeImpl#edgeWasAdded(org.apache.airavata.workflow.model.graph.Edge)
*/
@Override
protected void edgeWasAdded(Edge edge) throws GraphException {
// XXX cannot detect if the type is array or not from WSDL at this
// point. so no check here.
// super.edgeWasAdded(edge);
Port fromPort = edge.getFromPort();
Port toPort = edge.getToPort();
if (edge instanceof DataEdge) {
if (fromPort instanceof EPRPort) {
// TODO
return;
}
DataPort fromDataPort = (DataPort) fromPort;
DataPort toDataPort = (DataPort) toPort;
DataType fromType = fromDataPort.getType();
DataType toType = toDataPort.getType();
if (fromDataPort.getNode() == this) {
if (!(toType == null || toType.equals(WSConstants.XSD_ANY_TYPE))) {
fromDataPort.copyType(toDataPort);
}
} else if (toDataPort.getNode() == this) {
if (!(fromType == null || fromType.equals(WSConstants.XSD_ANY_TYPE))) {
toDataPort.copyType(fromDataPort);
}
} else {
throw new WorkflowRuntimeException();
}
}
}
use of org.apache.airavata.workflow.model.graph.EPRPort in project airavata by apache.
the class ForEachNode method edgeWasAdded.
/**
* @param edge
* @throws GraphException
*/
@Override
protected void edgeWasAdded(Edge edge) throws GraphException {
// XXX cannot detect if the type is array or not from WSDL at this
// point. so no check here.
// super.edgeWasAdded(edge);
Port fromPort = edge.getFromPort();
Port toPort = edge.getToPort();
if (edge instanceof DataEdge) {
if (fromPort instanceof EPRPort) {
// TODO
return;
}
DataPort fromDataPort = (DataPort) fromPort;
DataPort toDataPort = (DataPort) toPort;
DataType fromType = fromDataPort.getType();
DataType toType = toDataPort.getType();
if (fromDataPort.getNode() == this) {
if (!(toType == null || toType.equals(WSConstants.XSD_ANY_TYPE))) {
fromDataPort.copyType(toDataPort);
}
} else if (toDataPort.getNode() == this) {
if (!(fromType == null || fromType.equals(WSConstants.XSD_ANY_TYPE))) {
toDataPort.copyType(fromDataPort);
}
} else {
throw new WorkflowRuntimeException();
}
}
}
use of org.apache.airavata.workflow.model.graph.EPRPort in project airavata by apache.
the class Component method createPorts.
protected void createPorts(NodeImpl node) {
for (ComponentDataPort input : getInputPorts()) {
DataPort port = input.createPort();
node.addInputPort(port);
}
for (ComponentDataPort output : getOutputPorts()) {
DataPort port = output.createPort();
node.addOutputPort(port);
}
if (this.controlInPort != null) {
ControlPort port = this.controlInPort.createPort();
node.setControlInPort(port);
}
for (ComponentControlPort componentPort : this.controlOutPorts) {
ControlPort port = componentPort.createPort();
node.addControlOutPort(port);
}
if (this.eprPort != null) {
EPRPort port = this.eprPort.createPort();
node.setEPRPort(port);
}
}
Aggregations