use of org.apache.airavata.workflow.model.component.ws.WSComponent in project airavata by apache.
the class ComponentSelector method expandTreeLeaf.
private void expandTreeLeaf(ComponentTreeNode selectedNode, List<? extends Component> components) {
ComponentReference componentReference = selectedNode.getComponentReference();
ComponentTreeNode newNode = new ComponentTreeNode(componentReference.getName());
ComponentTreeNode parent = (ComponentTreeNode) selectedNode.getParent();
int index = this.treeModel.getIndexOfChild(parent, selectedNode);
this.treeModel.removeNodeFromParent(selectedNode);
this.treeModel.insertNodeInto(newNode, parent, index);
for (Component component : components) {
WSComponent wsComponent = (WSComponent) component;
String operationName = wsComponent.getOperationName();
ComponentOperationReference reference = new ComponentOperationReference(operationName, wsComponent);
ComponentTreeNode child = new ComponentTreeNode(reference);
this.treeModel.addNodeInto(child, newNode);
}
// expand
TreeNode[] path = newNode.getPath();
this.tree.expandPath(new TreePath(path));
}
use of org.apache.airavata.workflow.model.component.ws.WSComponent in project airavata by apache.
the class WebComponentRegistry method addComponents.
private void addComponents(String name) {
try {
URL wsdlUrl = new URL(this.url, name);
logger.debug("WSDL URL: " + wsdlUrl);
String wsdlString = IOUtil.readToString(wsdlUrl.openStream());
logger.debug("WSDL: " + wsdlString);
List<WSComponent> components = WSComponentFactory.createComponents(wsdlString);
addComponents(name, components);
} catch (MalformedURLException e) {
// Ignore
logger.error(e.getMessage(), e);
} catch (IOException e) {
// Ignore
logger.error(e.getMessage(), e);
} catch (RuntimeException e) {
logger.error(e.getMessage(), e);
}
}
use of org.apache.airavata.workflow.model.component.ws.WSComponent in project airavata by apache.
the class WSNode method parse.
protected void parse(JsonObject nodeObject) {
super.parse(nodeObject);
JsonObject applicationObject = nodeObject.getAsJsonObject("Application");
WSComponentApplication application = WSComponentApplication.parse(applicationObject);
try {
setComponent(new WSComponent(application));
} catch (ComponentException e) {
log.error(e.getMessage(), e);
}
}
use of org.apache.airavata.workflow.model.component.ws.WSComponent in project airavata by apache.
the class WSNode method parse.
/**
* @see org.apache.airavata.workflow.model.graph.impl.NodeImpl#parse(org.xmlpull.infoset.XmlElement)
*/
@Override
protected void parse(XmlElement nodeElement) throws GraphException {
super.parse(nodeElement);
XmlElement element = nodeElement.element(null, "Application");
WSComponentApplication application = WSComponentApplication.parse(element);
try {
setComponent(new WSComponent(application));
} catch (ComponentException e) {
log.error(e.getMessage(), e);
}
// XmlElement wsdlElement = nodeElement.element(null, GraphSchema.NODE_WSDL_QNAME_TAG);
// if (wsdlElement != null) {
// this.wsdlID = wsdlElement.requiredText();
// // String wsdlQNameString = wsdlElement.requiredText();
// // this.wsdlQName = QName.valueOf(wsdlQNameString);
// }
//
// XmlElement portTypeElement = nodeElement.element(null, GraphSchema.NODE_WSDL_PORT_TYPE_TAG);
// if (portTypeElement != null) {
// String portTypeString = portTypeElement.requiredText();
// this.portTypeQName = QName.valueOf(portTypeString);
// }
//
// XmlElement operationElement = nodeElement.element(null, GraphSchema.NODE_WSDL_OPERATION_TAG);
// if (operationElement != null) {
// this.operationName = operationElement.requiredText();
// }
}
use of org.apache.airavata.workflow.model.component.ws.WSComponent in project airavata by apache.
the class WorkflowModifier method createDifference.
/**
* @return The workflow that needs to be executed.
* @throws GraphException
* @throws MonitorException
*/
public Workflow createDifference() throws GraphException, MonitorException {
WSGraph originalGraph = this.modifiedWorkflow.getGraph();
Workflow workflow = this.modifiedWorkflow.clone();
String name = workflow.getName();
name += " (diff)";
workflow.setName(name);
WSGraph graph = workflow.getGraph();
// Remove the finished node.
removeFinishedNodes(originalGraph, graph);
Set<WSPort> originalFromPorts = getFinalOutputPorts(originalGraph, graph);
// Create input nodes for unconnected input ports.
createInputNodes(graph, originalFromPorts);
// Set default values.
for (WSPort originalFromPort : originalFromPorts) {
// TODO handle the case that node is not WSNode.
Node originalFromNode = originalFromPort.getNode();
String fromNodeID = originalFromNode.getID();
String output;
if (originalFromNode instanceof InputNode) {
// notification that includes the input of the workflow.
output = getWorkflowInput(fromNodeID);
} else if (originalFromNode instanceof WSNode) {
// Retrieve input value from notification.
WSComponent component = ((WSNode) originalFromNode).getComponent();
String messageName = component.getOutputTypeName();
String parameterName = originalFromPort.getComponentPort().getName();
output = getOutput(fromNodeID, messageName, parameterName);
} else {
// This should not happen.
throw new WorkflowRuntimeException(originalFromNode.getClass().getName());
}
Port originalToPort = originalFromPort.getToPorts().get(0);
PortImpl toPort = graph.getPort(originalToPort.getID());
InputNode inputNode = (InputNode) toPort.getFromNode();
inputNode.setDefaultValue(output);
}
return workflow;
}
Aggregations