use of org.xmlpull.infoset.XmlElement in project airavata by apache.
the class Workflow method clone.
/**
* @see java.lang.Object#clone()
*/
@Override
public Workflow clone() {
XmlElement originalXML = toXML();
try {
XmlElement newXML = XMLUtil.deepClone(originalXML);
Workflow newWorkflow = new Workflow(newXML);
return newWorkflow;
} catch (GraphException e) {
// This should not happen.
throw new WorkflowRuntimeException(e);
} catch (WorkflowException e) {
// This should not happen.
throw new WorkflowRuntimeException(e);
} catch (AiravataException e) {
// This should not happen.
throw new WorkflowRuntimeException(e);
}
}
use of org.xmlpull.infoset.XmlElement in project airavata by apache.
the class XMLUtil method stringToXmlElement.
/**
* Parses a specified string and returns the XmlElement (XPP5).
*
* @param string
* @return The XmlElement (XPP5) parsed.
*/
public static org.xmlpull.infoset.XmlElement stringToXmlElement(String string) {
XmlDocument document = BUILDER.parseString(string);
org.xmlpull.infoset.XmlElement element = document.getDocumentElement();
return element;
}
use of org.xmlpull.infoset.XmlElement in project airavata by apache.
the class XMLUtil method removeElements.
/**
* @param xml
* @param name
*/
public static void removeElements(XmlElement xml, String name) {
Iterable<XmlElement> removeElements = xml.elements(null, name);
LinkedList<XmlElement> removeList = new LinkedList<XmlElement>();
for (XmlElement xmlElement : removeElements) {
removeList.add(xmlElement);
}
for (XmlElement xmlElement : removeList) {
xml.removeChild(xmlElement);
}
Iterable children = xml.children();
for (Object object : children) {
if (object instanceof XmlElement) {
XmlElement element = (XmlElement) object;
removeElements(element, name);
}
}
}
use of org.xmlpull.infoset.XmlElement in project airavata by apache.
the class InstanceNode method parseConfiguration.
/**
* @see org.apache.airavata.workflow.model.graph.impl.NodeImpl#parseConfiguration(org.xmlpull.infoset.XmlElement)
*/
@Override
protected void parseConfiguration(XmlElement configElement) {
super.parseConfiguration(configElement);
// new instance
XmlElement element = configElement.element(null, NEW_TAG_NAME);
if (element != null) {
for (Object child : element.children()) {
this.startNewInstance = Boolean.valueOf((String) child).booleanValue();
}
}
if (this.startNewInstance) {
// ami id
XmlElement element2 = configElement.element(null, AMI_ID_TAG_NAME);
if (element != null) {
for (Object child : element2.children()) {
this.amiId = (String) child;
}
}
// instance type
XmlElement element3 = configElement.element(null, INSTANCE_TYPE_TAG_NAME);
if (element != null) {
for (Object child : element3.children()) {
this.instanceType = (String) child;
}
}
} else {
// instance id
XmlElement element2 = configElement.element(null, INSTANCE_ID_TAG_NAME);
if (element != null) {
for (Object child : element2.children()) {
this.instanceId = (String) child;
}
}
}
// username
XmlElement element2 = configElement.element(null, USERNAME_TAG_NAME);
if (element != null) {
for (Object child : element2.children()) {
this.username = (String) child;
}
}
}
use of org.xmlpull.infoset.XmlElement in project airavata by apache.
the class TerminateInstanceNode 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_TERMINATE);
return nodeElement;
}
Aggregations