Search in sources :

Example 51 with XmlElement

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

the class InstanceNode method toXML.

/**
 * @see org.apache.airavata.workflow.model.graph.impl.NodeImpl#toXML()
 */
@Override
protected XmlElement toXML() {
    XmlElement nodeElement = super.toXML();
    nodeElement.setAttributeValue(GraphSchema.NS, GraphSchema.NODE_TYPE_ATTRIBUTE, GraphSchema.NODE_TYPE_INSTANCE);
    return nodeElement;
}
Also used : XmlElement(org.xmlpull.infoset.XmlElement)

Example 52 with XmlElement

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

the class WSDLUtil method getNamespaces.

public static List<XmlNamespace> getNamespaces(XmlElement element) {
    LinkedList<XmlNamespace> namespaces = new LinkedList<XmlNamespace>();
    namespaces.add(element.getNamespace());
    Iterable<XmlAttribute> attributes = element.attributes();
    for (XmlAttribute xmlAttribute : attributes) {
        if (xmlAttribute.getNamespace() != null && !namespaces.contains(xmlAttribute.getNamespace())) {
            namespaces.add(xmlAttribute.getNamespace());
        }
        int index = xmlAttribute.getValue().indexOf(':');
        if (-1 != index) {
            String prefix = xmlAttribute.getValue().substring(0, index);
            if (element.lookupNamespaceByPrefix(prefix) != null) {
                namespaces.add(element.lookupNamespaceByPrefix(prefix));
            }
        }
    }
    Iterable children = element.children();
    for (Object object : children) {
        if (object instanceof XmlElement) {
            List<XmlNamespace> newNSs = getNamespaces((XmlElement) object);
            for (XmlNamespace xmlNamespace : newNSs) {
                if (!namespaces.contains(xmlNamespace)) {
                    namespaces.add(xmlNamespace);
                }
            }
        }
    }
    return namespaces;
}
Also used : XmlAttribute(org.xmlpull.infoset.XmlAttribute) XmlNamespace(org.xmlpull.infoset.XmlNamespace) XmlElement(org.xmlpull.infoset.XmlElement) LinkedList(java.util.LinkedList)

Example 53 with XmlElement

use of org.xmlpull.infoset.XmlElement 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();
// }
}
Also used : WSComponent(org.apache.airavata.workflow.model.component.ws.WSComponent) ComponentException(org.apache.airavata.workflow.model.component.ComponentException) XmlElement(org.xmlpull.infoset.XmlElement) WSComponentApplication(org.apache.airavata.workflow.model.component.ws.WSComponentApplication)

Example 54 with XmlElement

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

the class WorkflowNode method toXML.

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

Example 55 with XmlElement

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

the class WSGraphFactory method createGraph.

/**
 * @param graphString
 * @return the graph created
 * @throws GraphException
 */
public static WSGraph createGraph(String graphString) throws GraphException {
    XmlElement graphElement;
    JsonObject graphElementJSON;
    try {
        // graphElement = XMLUtil.stringToXmlElement(graphString);
        graphElementJSON = JSONUtil.stringToJSONObject(graphString);
    } catch (RuntimeException e) {
        throw new GraphException(MessageConstants.XML_ERROR, e);
    }
    return createGraph(graphElementJSON);
}
Also used : GraphException(org.apache.airavata.workflow.model.graph.GraphException) WorkflowRuntimeException(org.apache.airavata.workflow.model.exceptions.WorkflowRuntimeException) XmlElement(org.xmlpull.infoset.XmlElement) JsonObject(com.google.gson.JsonObject)

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