use of org.apache.airavata.model.application.io.DataType in project airavata by apache.
the class SimpleOrchestratorImpl method createAndSaveInputDataStagingTasks.
public List<String> createAndSaveInputDataStagingTasks(ProcessModel processModel, String gatewayId) throws RegistryException, AiravataException {
List<String> dataStagingTaskIds = new ArrayList<>();
List<InputDataObjectType> processInputs = processModel.getProcessInputs();
sortByInputOrder(processInputs);
if (processInputs != null) {
for (InputDataObjectType processInput : processInputs) {
DataType type = processInput.getType();
switch(type) {
case STDERR:
break;
case STDOUT:
break;
case URI:
case URI_COLLECTION:
try {
TaskModel inputDataStagingTask = getInputDataStagingTask(processModel, processInput, gatewayId);
String taskId = (String) orchestratorContext.getRegistry().getExperimentCatalog().add(ExpCatChildDataType.TASK, inputDataStagingTask, processModel.getProcessId());
inputDataStagingTask.setTaskId(taskId);
dataStagingTaskIds.add(inputDataStagingTask.getTaskId());
} catch (TException | AppCatalogException | TaskException e) {
throw new RegistryException("Error while serializing data staging sub task model");
}
break;
default:
// nothing to do
break;
}
}
}
return dataStagingTaskIds;
}
use of org.apache.airavata.model.application.io.DataType in project airavata by apache.
the class OutputNode method getParameterType.
/**
* Returns the type of the parameter
*
* @return The type of the parameter (e.g. string, int)
*/
@Override
public DataType getParameterType() {
List<DataEdge> edges = getEdges();
DataType parameterType = super.getParameterType();
if (parameterType == null && getEdges().size() > 0) {
Edge edge = edges.get(0);
WSPort fromPort = (WSPort) edge.getFromPort();
setParameterType(fromPort.getType());
}
return parameterType;
}
use of org.apache.airavata.model.application.io.DataType 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.model.application.io.DataType 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.model.application.io.DataType in project airavata by apache.
the class EndForEachNode method portTypeChanged.
/**
* @see org.apache.airavata.workflow.model.graph.system.SystemNode#portTypeChanged(org.apache.airavata.workflow.model.graph.system.SystemDataPort)
*/
@Override
protected void portTypeChanged(SystemDataPort port) throws GraphException {
super.portTypeChanged(port);
List<DataPort> inputPorts = getInputPorts();
List<DataPort> outputPorts = getOutputPorts();
Kind kind = port.getKind();
int index;
if (kind == Kind.DATA_IN) {
index = inputPorts.indexOf(port);
} else if (kind == Kind.DATA_OUT) {
index = outputPorts.indexOf(port);
} else {
throw new WorkflowRuntimeException();
}
SystemDataPort inputPort = (SystemDataPort) inputPorts.get(index);
SystemDataPort outputPort = (SystemDataPort) outputPorts.get(index);
DataType inputType = inputPort.getType();
DataType outputType = outputPort.getType();
DataType portType = port.getType();
if (portType == null || portType.equals(WSConstants.XSD_ANY_TYPE)) {
// Do nothing
return;
}
if (port == inputPort) {
// input -> output
if (outputType.equals(WSConstants.XSD_ANY_TYPE)) {
outputPort.copyType(port, 1);
} else if (outputType.equals(portType)) {
// Do nothing.
} else {
// XXX cannot parse array from WSDL.
// String message = "The type of input " + index + " ("
// + inputType + ") of " + getID()
// + " must be same as the type of output " + index + " ("
// + outputType + ").";
// throw new GraphException(message);
}
} else if (port == outputPort) {
// output -> input1
if (inputType.equals(WSConstants.XSD_ANY_TYPE)) {
inputPort.copyType(port, -1);
} else if (inputType.equals(portType)) {
// Do nothing.
} else {
// XXX cannot parse array from WSDL.
// String message = "The type of input " + index + " ("
// + inputType + ") of " + getID()
// + " must be same as the type of output " + index + " ("
// + outputType + ").";
// throw new GraphException(message);
}
} else {
throw new WorkflowRuntimeException();
}
}
Aggregations