Search in sources :

Example 31 with XmlElement

use of org.xmlpull.infoset.XmlElement in project airavata by apache.

the class NodeImpl method parse.

/**
 * @param nodeElement
 * @throws GraphException
 */
protected void parse(XmlElement nodeElement) throws GraphException {
    XmlElement idElement = nodeElement.element(GraphSchema.NODE_ID_TAG);
    this.id = idElement.requiredText();
    XmlElement nameElement = nodeElement.element(GraphSchema.NODE_NAME_TAG);
    this.name = nameElement.requiredText();
    // XmlElement labelElement = nodeElement
    // .element(GraphSchema.NODE_STREAM_LABEL_TAG);
    // if (null != labelElement) {
    // this.label = labelElement.requiredText();
    // }
    Iterable<XmlElement> inputPortElements = nodeElement.elements(null, GraphSchema.NODE_INPUT_PORT_TAG);
    for (XmlElement inputPort : inputPortElements) {
        this.inputPortIDs.add(inputPort.requiredText());
    }
    Iterable<XmlElement> outputPortElements = nodeElement.elements(null, GraphSchema.NODE_OUTPUT_PORT_TAG);
    for (XmlElement outputPort : outputPortElements) {
        this.outputPortIDs.add(outputPort.requiredText());
    }
    XmlElement controlInPortElement = nodeElement.element(GraphSchema.NODE_CONTROL_IN_PORT_TAG);
    if (controlInPortElement != null) {
        this.controlInPortID = controlInPortElement.requiredText();
    }
    Iterable<XmlElement> controlOutPortElements = nodeElement.elements(null, GraphSchema.NODE_CONTROL_OUT_PORT_TAG);
    for (XmlElement controlOutPort : controlOutPortElements) {
        this.controlOutPortIDs.add(controlOutPort.requiredText());
    }
    XmlElement eprPortElement = nodeElement.element(GraphSchema.NODE_EPR_PORT_TAG);
    if (eprPortElement != null) {
        this.eprPortID = eprPortElement.requiredText();
    }
    XmlElement xElement = nodeElement.element(GraphSchema.NODE_X_LOCATION_TAG);
    this.position.x = (int) Double.parseDouble(xElement.requiredText());
    XmlElement yElement = nodeElement.element(GraphSchema.NODE_Y_LOCATION_TAG);
    this.position.y = (int) Double.parseDouble(yElement.requiredText());
    XmlElement configElement = nodeElement.element(GraphSchema.NODE_CONFIG_TAG);
    if (configElement != null) {
        parseConfiguration(configElement);
    }
    XmlElement componentElement = nodeElement.element(GraphSchema.NODE_COMPONENT_TAG);
    if (componentElement != null) {
        // XXX Not used since the introduction of .xwf
        parseComponent(componentElement);
    }
}
Also used : XmlElement(org.xmlpull.infoset.XmlElement)

Example 32 with XmlElement

use of org.xmlpull.infoset.XmlElement in project airavata by apache.

the class ConstantNode method toXML.

@Override
protected XmlElement toXML() {
    XmlElement nodeElement = super.toXML();
    nodeElement.setAttributeValue(GraphSchema.NS, GraphSchema.NODE_TYPE_ATTRIBUTE, GraphSchema.NODE_TYPE_CONSTANT);
    return nodeElement;
}
Also used : XmlElement(org.xmlpull.infoset.XmlElement)

Example 33 with XmlElement

use of org.xmlpull.infoset.XmlElement in project airavata by apache.

the class DoWhileNode method addConfigurationElement.

@Override
protected XmlElement addConfigurationElement(XmlElement nodeElement) {
    XmlElement configElement = nodeElement.addElement(GraphSchema.NS, GraphSchema.NODE_CONFIG_TAG);
    if (this.xpath != null) {
        XmlElement element = configElement.addElement(GraphSchema.NS, XPATH_TAG_NAME);
        element.addChild(this.xpath.toString());
    }
    return configElement;
}
Also used : XmlElement(org.xmlpull.infoset.XmlElement)

Example 34 with XmlElement

use of org.xmlpull.infoset.XmlElement in project airavata by apache.

the class InputNode method addConfigurationElement.

@Override
protected XmlElement addConfigurationElement(XmlElement nodeElement) {
    XmlElement configElement = super.addConfigurationElement(nodeElement);
    if (this.defaultValue != null) {
        XmlElement element = configElement.addElement(GraphSchema.NS, VALUE_TAG_NAME);
        element.addChild(this.defaultValue);
    }
    XmlElement element = configElement.addElement(GraphSchema.NS, VISIBILITY_TAG_NAME);
    element.addChild(Boolean.toString(this.visibility));
    return configElement;
}
Also used : XmlElement(org.xmlpull.infoset.XmlElement)

Example 35 with XmlElement

use of org.xmlpull.infoset.XmlElement in project airavata by apache.

the class OutputNode method toXML.

/**
 * @return the node xml
 */
@Override
public XmlElement toXML() {
    XmlElement nodeElement = super.toXML();
    nodeElement.setAttributeValue(GraphSchema.NS, GraphSchema.NODE_TYPE_ATTRIBUTE, GraphSchema.NODE_TYPE_OUTPUT);
    return nodeElement;
}
Also used : XmlElement(org.xmlpull.infoset.XmlElement)

Aggregations

XmlElement (org.xmlpull.infoset.XmlElement)79 AiravataException (org.apache.airavata.common.exception.AiravataException)5 GraphException (org.apache.airavata.workflow.model.graph.GraphException)5 IOException (java.io.IOException)4 Iterator (java.util.Iterator)4 DataType (org.apache.airavata.model.appcatalog.appinterface.DataType)4 WorkflowRuntimeException (org.apache.airavata.workflow.model.exceptions.WorkflowRuntimeException)4 InputNode (org.apache.airavata.workflow.model.graph.system.InputNode)4 LinkedList (java.util.LinkedList)3 ComponentException (org.apache.airavata.workflow.model.component.ComponentException)3 Workflow (org.apache.airavata.workflow.model.wf.Workflow)3 XmlAttribute (org.xmlpull.infoset.XmlAttribute)3 JsonObject (com.google.gson.JsonObject)2 File (java.io.File)2 AiravataClientException (org.apache.airavata.model.error.AiravataClientException)2 AiravataSystemException (org.apache.airavata.model.error.AiravataSystemException)2 InvalidRequestException (org.apache.airavata.model.error.InvalidRequestException)2 WSComponent (org.apache.airavata.workflow.model.component.ws.WSComponent)2 WorkflowException (org.apache.airavata.workflow.model.exceptions.WorkflowException)2 OutputNode (org.apache.airavata.workflow.model.graph.system.OutputNode)2