Search in sources :

Example 61 with XmlCursor

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;
}
Also used : XmlCursor(org.apache.xmlbeans.XmlCursor)

Example 62 with XmlCursor

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;
    }
}
Also used : HPCProfileApplicationType(org.ggf.schemas.jsdl.x2006.x07.jsdlHpcpa.HPCProfileApplicationType) XmlObject(org.apache.xmlbeans.XmlObject) XmlCursor(org.apache.xmlbeans.XmlCursor)

Example 63 with XmlCursor

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;
    }
}
Also used : SPMDApplicationType(org.ogf.schemas.jsdl.x2007.x02.jsdlSpmd.SPMDApplicationType) XmlObject(org.apache.xmlbeans.XmlObject) XmlCursor(org.apache.xmlbeans.XmlCursor)

Example 64 with XmlCursor

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);
}
Also used : POSIXApplicationType(org.ggf.schemas.jsdl.x2005.x11.jsdlPosix.POSIXApplicationType) HPCProfileApplicationType(org.ggf.schemas.jsdl.x2006.x07.jsdlHpcpa.HPCProfileApplicationType) SPMDApplicationType(org.ogf.schemas.jsdl.x2007.x02.jsdlSpmd.SPMDApplicationType) XmlCursor(org.apache.xmlbeans.XmlCursor)

Example 65 with XmlCursor

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;
    }
}
Also used : POSIXApplicationType(org.ggf.schemas.jsdl.x2005.x11.jsdlPosix.POSIXApplicationType) XmlObject(org.apache.xmlbeans.XmlObject) XmlCursor(org.apache.xmlbeans.XmlCursor)

Aggregations

XmlCursor (org.apache.xmlbeans.XmlCursor)160 XmlObject (org.apache.xmlbeans.XmlObject)68 QName (javax.xml.namespace.QName)21 XmlException (org.apache.xmlbeans.XmlException)16 TokenType (org.apache.xmlbeans.XmlCursor.TokenType)14 CTTbl (org.openxmlformats.schemas.wordprocessingml.x2006.main.CTTbl)14 CTP (org.openxmlformats.schemas.wordprocessingml.x2006.main.CTP)10 ArrayList (java.util.ArrayList)9 POSIXApplicationType (org.ggf.schemas.jsdl.x2005.x11.jsdlPosix.POSIXApplicationType)8 HPCProfileApplicationType (org.ggf.schemas.jsdl.x2006.x07.jsdlHpcpa.HPCProfileApplicationType)8 SPMDApplicationType (org.ogf.schemas.jsdl.x2007.x02.jsdlSpmd.SPMDApplicationType)8 IOException (java.io.IOException)5 POIXMLException (org.apache.poi.POIXMLException)5 InputStream (java.io.InputStream)4 DrawPaint (org.apache.poi.sl.draw.DrawPaint)3 ArrayType (org.dmg.pmml.ArrayType)3 ApplicationType (org.ggf.schemas.jsdl.x2005.x11.jsdl.ApplicationType)3 LineString (org.locationtech.jts.geom.LineString)3 CTRow (org.openxmlformats.schemas.wordprocessingml.x2006.main.CTRow)3 CTSdtBlock (org.openxmlformats.schemas.wordprocessingml.x2006.main.CTSdtBlock)3