Search in sources :

Example 1 with POSIXApplicationType

use of org.ggf.schemas.jsdl.x2005.x11.jsdlPosix.POSIXApplicationType 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)

Example 2 with POSIXApplicationType

use of org.ggf.schemas.jsdl.x2005.x11.jsdlPosix.POSIXApplicationType in project airavata by apache.

the class JSDLUtils method addEnvVariable.

public static EnvironmentType addEnvVariable(JobDefinitionType def, String name, String value) {
    POSIXApplicationType posixApp = getOrCreatePOSIXApplication(def);
    EnvironmentType newEnv = posixApp.addNewEnvironment();
    newEnv.setName(name);
    newEnv.setStringValue(value);
    return newEnv;
}
Also used : EnvironmentType(org.ggf.schemas.jsdl.x2005.x11.jsdlPosix.EnvironmentType) POSIXApplicationType(org.ggf.schemas.jsdl.x2005.x11.jsdlPosix.POSIXApplicationType)

Example 3 with POSIXApplicationType

use of org.ggf.schemas.jsdl.x2005.x11.jsdlPosix.POSIXApplicationType in project airavata by apache.

the class JSDLUtils method addEnvVariable.

public static EnvironmentType addEnvVariable(JobDefinitionType def, String name, String value) {
    POSIXApplicationType posixApp = getOrCreatePOSIXApplication(def);
    EnvironmentType newEnv = posixApp.addNewEnvironment();
    newEnv.setName(name);
    newEnv.setStringValue(value);
    return newEnv;
}
Also used : EnvironmentType(org.ggf.schemas.jsdl.x2005.x11.jsdlPosix.EnvironmentType) POSIXApplicationType(org.ggf.schemas.jsdl.x2005.x11.jsdlPosix.POSIXApplicationType)

Example 4 with POSIXApplicationType

use of org.ggf.schemas.jsdl.x2005.x11.jsdlPosix.POSIXApplicationType in project airavata by apache.

the class JSDLUtils method getOrCreatePOSIXApplication.

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

use of org.ggf.schemas.jsdl.x2005.x11.jsdlPosix.POSIXApplicationType 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

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