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;
}
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;
}
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();
// }
}
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;
}
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);
}
Aggregations