use of org.apache.xmlbeans.XmlCursor in project airavata by apache.
the class BESJobSubmissionTask method getApplicationJobStatus.
private JobState getApplicationJobStatus(ActivityStatusType activityStatus) {
if (activityStatus == null) {
return JobState.UNKNOWN;
}
ActivityStateEnumeration.Enum state = activityStatus.getState();
String status = null;
XmlCursor acursor = activityStatus.newCursor();
try {
if (acursor.toFirstChild()) {
if (acursor.getName().getNamespaceURI().equals("http://schemas.ogf.org/hpcp/2007/01/fs")) {
status = acursor.getName().getLocalPart();
}
}
if (status != null) {
if (status.equalsIgnoreCase("Queued") || status.equalsIgnoreCase("Starting") || status.equalsIgnoreCase("Ready")) {
return JobState.QUEUED;
} else if (status.equalsIgnoreCase("Staging-In")) {
return JobState.SUBMITTED;
} else if (status.equalsIgnoreCase("FINISHED")) {
return JobState.COMPLETE;
} else if (status.equalsIgnoreCase("Staging-Out")) {
return JobState.ACTIVE;
} else if (status.equalsIgnoreCase("Executing")) {
return JobState.ACTIVE;
} else if (status.equalsIgnoreCase("FAILED")) {
return JobState.FAILED;
} else if (status.equalsIgnoreCase("CANCELLED")) {
return JobState.CANCELED;
}
} else {
if (ActivityStateEnumeration.CANCELLED.equals(state)) {
return JobState.CANCELED;
} else if (ActivityStateEnumeration.FAILED.equals(state)) {
return JobState.FAILED;
} else if (ActivityStateEnumeration.FINISHED.equals(state)) {
return JobState.COMPLETE;
} else if (ActivityStateEnumeration.RUNNING.equals(state)) {
return JobState.ACTIVE;
}
}
} finally {
if (acursor != null)
acursor.dispose();
}
return JobState.UNKNOWN;
}
use of org.apache.xmlbeans.XmlCursor in project airavata by apache.
the class JSDLUtils method getHPCProfileApplication.
public static HPCProfileApplicationType getHPCProfileApplication(JobDefinitionType value) {
if (value != null && value.getJobDescription() != null && value.getJobDescription().isSetApplication()) {
XmlCursor acursor = value.getJobDescription().getApplication().newCursor();
if (acursor.toFirstChild()) {
do {
if (acursor.getName().equals(HPC_PROFILE_APPLICATION)) {
XmlObject result = acursor.getObject();
acursor.dispose();
return (HPCProfileApplicationType) result;
}
} while (acursor.toNextSibling());
acursor.dispose();
return null;
} else {
acursor.dispose();
return null;
}
} else {
return null;
}
}
use of org.apache.xmlbeans.XmlCursor in project airavata by apache.
the class JSDLUtils method getSPMDApplication.
public static SPMDApplicationType getSPMDApplication(JobDefinitionType value) {
if (value != null && value.getJobDescription() != null && value.getJobDescription().isSetApplication()) {
XmlCursor acursor = value.getJobDescription().getApplication().newCursor();
if (acursor.toFirstChild()) {
do {
if (acursor.getName().equals(SPMD_APPLICATION)) {
XmlObject result = acursor.getObject();
acursor.dispose();
return (SPMDApplicationType) result;
}
} while (acursor.toNextSibling());
acursor.dispose();
return null;
} else {
acursor.dispose();
return null;
}
} else {
return null;
}
}
use of org.apache.xmlbeans.XmlCursor in project airavata by apache.
the class JSDLUtils method getOrCreateSPMDApplication.
public static SPMDApplicationType getOrCreateSPMDApplication(JobDefinitionType value) {
ApplicationType application = getOrCreateApplication(value);
if (getSPMDApplication(value) == null) {
XmlCursor acursor = application.newCursor();
acursor.toEndToken();
acursor.insertElement(SPMD_APPLICATION);
acursor.dispose();
}
return getSPMDApplication(value);
}
use of org.apache.xmlbeans.XmlCursor in project airavata by apache.
the class JSDLUtils method getPOSIXApplication.
public static POSIXApplicationType getPOSIXApplication(JobDefinitionType value) {
if (value != null && value.getJobDescription() != null && value.getJobDescription().isSetApplication()) {
XmlCursor acursor = value.getJobDescription().getApplication().newCursor();
if (acursor.toFirstChild()) {
do {
if (acursor.getName().equals(POSIX_APPLICATION)) {
XmlObject result = acursor.getObject();
acursor.dispose();
return (POSIXApplicationType) result;
}
} while (acursor.toNextSibling());
acursor.dispose();
return null;
} else {
acursor.dispose();
return null;
}
} else {
return null;
}
}
Aggregations