Search in sources :

Example 1 with HPCProfileApplicationType

use of org.ggf.schemas.jsdl.x2006.x07.jsdlHpcpa.HPCProfileApplicationType 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 2 with HPCProfileApplicationType

use of org.ggf.schemas.jsdl.x2006.x07.jsdlHpcpa.HPCProfileApplicationType in project airavata by apache.

the class JSDLUtils method getOrCreateHPCProfileApplication.

public static HPCProfileApplicationType getOrCreateHPCProfileApplication(JobDefinitionType value) {
    ApplicationType application = getOrCreateApplication(value);
    if (getPOSIXApplication(value) != null) {
        // TODO handle: creating HPC element if POSIX already exists
        return getHPCProfileApplication(value);
    }
    if (getHPCProfileApplication(value) == null) {
        XmlCursor acursor = application.newCursor();
        acursor.toEndToken();
        acursor.insertElement(HPC_PROFILE_APPLICATION);
        acursor.dispose();
    }
    return getHPCProfileApplication(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 3 with HPCProfileApplicationType

use of org.ggf.schemas.jsdl.x2006.x07.jsdlHpcpa.HPCProfileApplicationType 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 4 with HPCProfileApplicationType

use of org.ggf.schemas.jsdl.x2006.x07.jsdlHpcpa.HPCProfileApplicationType in project airavata by apache.

the class JSDLUtils method getOrCreateHPCProfileApplication.

public static HPCProfileApplicationType getOrCreateHPCProfileApplication(JobDefinitionType value) {
    ApplicationType application = getOrCreateApplication(value);
    if (getPOSIXApplication(value) != null) {
        // TODO handle: creating HPC element if POSIX already exists
        return getHPCProfileApplication(value);
    }
    if (getHPCProfileApplication(value) == null) {
        XmlCursor acursor = application.newCursor();
        acursor.toEndToken();
        acursor.insertElement(HPC_PROFILE_APPLICATION);
        acursor.dispose();
    }
    return getHPCProfileApplication(value);
}
Also used : HPCProfileApplicationType(org.ggf.schemas.jsdl.x2006.x07.jsdlHpcpa.HPCProfileApplicationType) POSIXApplicationType(org.ggf.schemas.jsdl.x2005.x11.jsdlPosix.POSIXApplicationType) ApplicationType(org.ggf.schemas.jsdl.x2005.x11.jsdl.ApplicationType) SPMDApplicationType(org.ogf.schemas.jsdl.x2007.x02.jsdlSpmd.SPMDApplicationType) XmlCursor(org.apache.xmlbeans.XmlCursor)

Aggregations

XmlCursor (org.apache.xmlbeans.XmlCursor)4 HPCProfileApplicationType (org.ggf.schemas.jsdl.x2006.x07.jsdlHpcpa.HPCProfileApplicationType)4 XmlObject (org.apache.xmlbeans.XmlObject)2 POSIXApplicationType (org.ggf.schemas.jsdl.x2005.x11.jsdlPosix.POSIXApplicationType)2 SPMDApplicationType (org.ogf.schemas.jsdl.x2007.x02.jsdlSpmd.SPMDApplicationType)2 ApplicationType (org.ggf.schemas.jsdl.x2005.x11.jsdl.ApplicationType)1