use of org.apache.airavata.workflow.model.graph.system.SystemDataPort in project airavata by apache.
the class WSGraphFactory method createPort.
public PortImpl createPort(XmlElement portElement) {
String type = portElement.attributeValue(GraphSchema.NS, GraphSchema.PORT_TYPE_ATTRIBUTE);
if (type == null) {
// Old graphs don't have the namespace for the attribute.
type = portElement.attributeValue(GraphSchema.PORT_TYPE_ATTRIBUTE);
}
PortImpl port;
if (GraphSchema.PORT_TYPE_WS_DATA.equals(type)) {
port = new WSPort(portElement);
} else if (GraphSchema.PORT_TYPE_SYSTEM_DATA.equals(type)) {
port = new SystemDataPort(portElement);
} else if (GraphSchema.PORT_TYPE_CONTROL.equals(type)) {
port = new ControlPort(portElement);
} else if (GraphSchema.PORT_TYPE_EPR.equals(type)) {
port = new EPRPort(portElement);
} else if (GraphSchema.PORT_TYPE_INSTANCE.equals(type)) {
port = new InstanceDataPort(portElement);
} else {
// Default is WsPort because of backword compatibility
port = new WSPort(portElement);
}
return port;
}
use of org.apache.airavata.workflow.model.graph.system.SystemDataPort in project airavata by apache.
the class WSGraphFactory method createPort.
/**
* @see org.apache.airavata.workflow.model.graph.GraphFactory#createPort(org.xmlpull.infoset.XmlElement)
*/
public PortImpl createPort(JsonObject portObject) {
String type = portObject.getAsJsonPrimitive(GraphSchema.PORT_TYPE_ATTRIBUTE).getAsString();
PortImpl port;
if (GraphSchema.PORT_TYPE_WS_DATA.equals(type)) {
port = new WSPort(portObject);
} else if (GraphSchema.PORT_TYPE_SYSTEM_DATA.equals(type)) {
port = new SystemDataPort(portObject);
} else if (GraphSchema.PORT_TYPE_CONTROL.equals(type)) {
port = new ControlPort(portObject);
/* } else if (GraphSchema.PORT_TYPE_EPR.equals(type)) {
port = new EPRPort(portElement);
} else if (GraphSchema.PORT_TYPE_INSTANCE.equals(type)) {
port = new InstanceDataPort(portElement);*/
} else {
// Default is WsPort because of backword compatibility
port = new WSPort(portObject);
}
return port;
}
use of org.apache.airavata.workflow.model.graph.system.SystemDataPort in project airavata by apache.
the class WorkflowWSDL method addParameter.
/**
* Adds the parameter element.
*
* @param node
* @param sequence
* @param schema
* @return The parameter element
*/
private XmlElement addParameter(ParameterNode node, XmlElement sequence, XmlElement schema) {
XmlElement element;
SystemDataPort port = node.getPort();
element = addParameter(node, port, sequence, schema);
//
// Annotation
//
String description = node.getDescription();
XmlElement appinfo = node.getMetadata();
// description
if (description != null && description.trim().length() != 0) {
XmlElement annotation = element.element(null, WSConstants.ANNOTATION_TAG, true);
XmlElement documentation = annotation.addElement(WSConstants.DOCUMENTATION_TAG);
documentation.setText(node.getDescription());
}
// appinfo
if (appinfo != null) {
XmlElement annotation = element.element(null, WSConstants.ANNOTATION_TAG, true);
try {
annotation.addElement(XMLUtil.deepClone(appinfo));
} catch (AiravataException e) {
log.error(e.getMessage(), e);
}
}
//
if (node instanceof InputNode) {
InputNode inputNode = (InputNode) node;
Object value = inputNode.getDefaultValue();
if (value instanceof String) {
element.setAttributeValue(WSConstants.DEFAULT_ATTRIBUTE, (String) value);
} else if (value instanceof XmlElement) {
// Add the default value in <annotation><default> because there
// is no standard way.
XmlElement valueElement = null;
try {
valueElement = XMLUtil.deepClone((XmlElement) value);
} catch (AiravataException e) {
log.error(e.getMessage(), e);
}
XmlElement annotation = element.element(null, WSConstants.ANNOTATION_TAG, true);
XmlElement defaultElement = annotation.addElement(WSComponentPort.DEFAULT);
defaultElement.addElement(valueElement);
}
}
return element;
}
use of org.apache.airavata.workflow.model.graph.system.SystemDataPort in project airavata by apache.
the class GraphImpl method fixParameterNodes.
// private void createID() {
// Date date = new Date();
// SimpleDateFormat format = new SimpleDateFormat("yyyyMMdd_HHmmss_S");
// String time = format.format(date);
//
// this.id = StringUtil.convertToJavaIdentifier(this.name) + "_" + time;
// }
/**
* @throws GraphException
*/
public void fixParameterNodes() {
// XXX fix the ports of parameter nodes for 2.6.3 or before.
for (InputNode node : GraphUtil.getNodes(this, InputNode.class)) {
DataPort oldPort = node.getOutputPort(0);
if (oldPort instanceof WSPort) {
node.getOutputPorts().remove(oldPort);
this.ports.remove(oldPort);
SystemDataPort newPort = new SystemDataPort();
this.ports.add(newPort);
newPort.setKind(Kind.DATA_OUT);
newPort.setName(oldPort.getName());
newPort.setGraph(this);
newPort.setNode(node);
newPort.createID();
node.getOutputPorts().add(newPort);
for (DataEdge edge : oldPort.getEdges()) {
edge.setFromPort(newPort);
newPort.getEdges().add(edge);
}
}
}
for (OutputNode node : GraphUtil.getNodes(this, OutputNode.class)) {
DataPort oldPort = node.getInputPort(0);
if (oldPort instanceof WSPort) {
node.getInputPorts().remove(oldPort);
this.ports.remove(oldPort);
SystemDataPort newPort = new SystemDataPort();
this.ports.add(newPort);
newPort.setKind(Kind.DATA_IN);
newPort.setName(oldPort.getName());
newPort.setGraph(this);
newPort.setNode(node);
newPort.createID();
node.getInputPorts().add(newPort);
for (DataEdge edge : oldPort.getEdges()) {
edge.setToPort(newPort);
newPort.getEdges().add(edge);
}
}
}
}
use of org.apache.airavata.workflow.model.graph.system.SystemDataPort in project airavata by apache.
the class SystemComponentDataPort method createPort.
/**
* @see org.apache.airavata.workflow.model.component.ComponentPort#createPort()
*/
@Override
public SystemDataPort createPort() {
SystemDataPort port = new SystemDataPort();
port.setArrayDimension(this.arrayDimension);
port.setName(this.name);
port.setComponentPort(this);
return port;
}
Aggregations