Search in sources :

Example 1 with SystemDataPort

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;
}
Also used : EPRPort(org.apache.airavata.workflow.model.graph.EPRPort) ControlPort(org.apache.airavata.workflow.model.graph.ControlPort) InstanceDataPort(org.apache.airavata.workflow.model.graph.amazon.InstanceDataPort) SystemDataPort(org.apache.airavata.workflow.model.graph.system.SystemDataPort) PortImpl(org.apache.airavata.workflow.model.graph.impl.PortImpl)

Example 2 with SystemDataPort

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;
}
Also used : ControlPort(org.apache.airavata.workflow.model.graph.ControlPort) SystemDataPort(org.apache.airavata.workflow.model.graph.system.SystemDataPort) PortImpl(org.apache.airavata.workflow.model.graph.impl.PortImpl)

Example 3 with SystemDataPort

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;
}
Also used : InputNode(org.apache.airavata.workflow.model.graph.system.InputNode) SystemDataPort(org.apache.airavata.workflow.model.graph.system.SystemDataPort) XmlElement(org.xmlpull.infoset.XmlElement) AiravataException(org.apache.airavata.common.exception.AiravataException)

Example 4 with SystemDataPort

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);
            }
        }
    }
}
Also used : SystemDataPort(org.apache.airavata.workflow.model.graph.system.SystemDataPort) DataPort(org.apache.airavata.workflow.model.graph.DataPort) WSPort(org.apache.airavata.workflow.model.graph.ws.WSPort) InputNode(org.apache.airavata.workflow.model.graph.system.InputNode) DataEdge(org.apache.airavata.workflow.model.graph.DataEdge) OutputNode(org.apache.airavata.workflow.model.graph.system.OutputNode) SystemDataPort(org.apache.airavata.workflow.model.graph.system.SystemDataPort)

Example 5 with SystemDataPort

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;
}
Also used : SystemDataPort(org.apache.airavata.workflow.model.graph.system.SystemDataPort)

Aggregations

SystemDataPort (org.apache.airavata.workflow.model.graph.system.SystemDataPort)5 ControlPort (org.apache.airavata.workflow.model.graph.ControlPort)2 PortImpl (org.apache.airavata.workflow.model.graph.impl.PortImpl)2 InputNode (org.apache.airavata.workflow.model.graph.system.InputNode)2 AiravataException (org.apache.airavata.common.exception.AiravataException)1 DataEdge (org.apache.airavata.workflow.model.graph.DataEdge)1 DataPort (org.apache.airavata.workflow.model.graph.DataPort)1 EPRPort (org.apache.airavata.workflow.model.graph.EPRPort)1 InstanceDataPort (org.apache.airavata.workflow.model.graph.amazon.InstanceDataPort)1 OutputNode (org.apache.airavata.workflow.model.graph.system.OutputNode)1 WSPort (org.apache.airavata.workflow.model.graph.ws.WSPort)1 XmlElement (org.xmlpull.infoset.XmlElement)1