Package org.ogce.schemas.gfac.documents

Examples of org.ogce.schemas.gfac.documents.ApplicationDescriptionDocument


     * @return  Application Name
     * @throws GfacException
     */
  public String updateObject(RegistryService regService, BeanObject applicationObject) throws GfacException {
    ApplicationBean appDesc = (ApplicationBean) applicationObject;
    ApplicationDescriptionDocument oldAppDesc = RegistryUtil.getAppDesc(regService, new QName(appDesc.getObjectNamespace(), appDesc.getApplicationName()), appDesc.getHostName());
    String appDescStr = applicationXMLRequest(regService, appDesc, null);
    if (oldAppDesc != null) {
      regService.removeAppDesc(new QName(appDesc.getObjectNamespace(),appDesc.getApplicationName()).toString(), appDesc.getHostName());
    }
   
View Full Code Here


  public static String applicationXMLRequest(RegistryService regService, ApplicationBean appInfo, ApplicationDescriptionDocument template) throws GfacException {
    return applicationDocument(regService, appInfo, template).xmlText();
  }
 
  public static String simpleAppXMLRequest(ApplicationBean appInfo) throws GfacException {
    ApplicationDescriptionDocument appDescDoc = ApplicationDescriptionDocument.Factory.newInstance();

    ApplicationDescriptionType appType = appDescDoc.getApplicationDescription();
    if (appType == null) {
      appType = appDescDoc.addNewApplicationDescription();
    }
    ApplicationDescriptionType.ApplicationName appName = appType.getApplicationName();
    if (appName == null) {
      appName = appType.addNewApplicationName();
    }
    appName.setStringValue(appInfo.getApplicationName().trim());
    appName.setTargetNamespace(appInfo.getObjectNamespace());
    DeploymentDescriptionType deployment = appType.getDeploymentDescription();
    if (deployment == null) {
      deployment = appType.addNewDeploymentDescription();
    }
    deployment.setHostName(appInfo.getHostName().trim());
    deployment.setExecutable(appInfo.getExecutable());
    if (appInfo.getWorkDir() != null) {
      deployment.setWorkDir(appInfo.getWorkDir());
    }
    if (appInfo.getTmpDir() != null) {
      deployment.setTmpDir(appInfo.getTmpDir());
    }
    if (appInfo.getJobType() != null) {
      appType.setJobType(org.ogce.schemas.gfac.documents.JobTypeType.Enum.forString(appInfo.getJobType()));
    }
    if (appInfo.getLeadNameListFile() != null) {
      deployment.setLeadNameListFile(appInfo.getLeadNameListFile());
    }

    if (appInfo.getMaxWallTime() != null) {
      appType.setMaxWallTime(Integer.valueOf(appInfo.getMaxWallTime()));
    }

    if (appInfo.getPcount() != null) {
      appType.setCount(Integer.valueOf(appInfo.getPcount()));
    }

    if (appInfo.getQueue() != null) {
      appType.addNewQueue().setQueueName(appInfo.getQueue());
    }
    if (appInfo.getProjectName() != null) {
      appType.addNewProject().setProjectName(appInfo.getProjectName());
    }
    if (appInfo.getRslparmName() != null && appInfo.getRslparmValue() != null && appInfo.getRslparmName() != "") {
      RSLParmType rslParmType = appType.addNewRslparm();
      rslParmType.setName(appInfo.getRslparmName());
      rslParmType.setStringValue(appInfo.getRslparmValue());
    }if (appInfo.getMinMemory() != null) {
      appType.setMinMemory(appInfo.getMinMemory());
    }
    if (appInfo.getHostCount() != null) {
      appType.setHostCount(appInfo.getHostCount());
    }
    try {
      SchemaValidator validator = new SchemaValidator(appType);
      validator.validate();
    } catch (GFacSchemaException e) {
       throw new GfacException(e,FaultCode.SchemaValidationError);
    }
    return appDescDoc.xmlText();
  }
View Full Code Here

     * @return applicationRequest
     * @throws GfacException
     */
  public static ApplicationDescriptionDocument applicationDocument(RegistryService regService, ApplicationBean appInfo, ApplicationDescriptionDocument template) throws GfacException {

    ApplicationDescriptionDocument appDescDoc = template;
    if (appDescDoc == null) {
      appDescDoc = ApplicationDescriptionDocument.Factory.newInstance();
    }

    ApplicationDescriptionType appType = appDescDoc.getApplicationDescription();
    if (appType == null) {
      appType = appDescDoc.addNewApplicationDescription();
    }
    ApplicationDescriptionType.ApplicationName appName = appType.getApplicationName();
    if (appName == null) {
      appName = appType.addNewApplicationName();
    }
View Full Code Here

    return appBean;
  }

  public static String simpleAppXMLRequest(ApplicationBean appInfo) throws GFacSchemaException {

    ApplicationDescriptionDocument appDescDoc = ApplicationDescriptionDocument.Factory
        .newInstance();

    ApplicationDescriptionType appType = appDescDoc
        .addNewApplicationDescription();

    ApplicationName appName = appType.addNewApplicationName();

    appName.setStringValue(appInfo.getApplicationName().trim());
    appName.setTargetNamespace(appInfo.getObjectNamespace());
    DeploymentDescriptionType deployment = appType
        .getDeploymentDescription();
    if (deployment == null) {
      deployment = appType.addNewDeploymentDescription();
    }
    deployment.setHostName(appInfo.getHostName().trim());
    deployment.setExecutable(appInfo.getExecutable());
    if (appInfo.getWorkDir() != null) {
      deployment.setWorkDir(appInfo.getWorkDir());
    }
    if (appInfo.getTmpDir() != null) {
      deployment.setTmpDir(appInfo.getTmpDir());
    }
    if (appInfo.getJobType() != null) {
      appType.setJobType(Enum.forString(appInfo.getJobType()));
    }
    if (appInfo.getLeadNameListFile() != null) {
      deployment.setLeadNameListFile(appInfo.getLeadNameListFile());
    }

    if (appInfo.getMaxWallTime() != null) {
      appType.setMaxWallTime(Integer.valueOf(appInfo.getMaxWallTime()));
    }

    if (appInfo.getPcount() != null) {
      appType.setCount(Integer.valueOf(appInfo.getPcount()));
    }

    if (appInfo.getQueue() != null) {
      appType.addNewQueue().setQueueName(appInfo.getQueue());
    }
    if (appInfo.getProjectName() != null) {
      appType.addNewProject().setProjectName(appInfo.getProjectName());
    }
    if (appInfo.getRslparmName() != null
        && appInfo.getRslparmValue() != null
        && appInfo.getRslparmName() != "") {
      RSLParmType rslParmType = appType.addNewRslparm();
      rslParmType.setName(appInfo.getRslparmName());
      rslParmType.setStringValue(appInfo.getRslparmValue());
    }
    if (appInfo.getMinMemory() != null) {
      appType.setMinMemory(appInfo.getMinMemory());
    }
    if (appInfo.getHostCount() != null) {
      appType.setHostCount(appInfo.getHostCount());
    }
   
    SchemaValidator validator = new SchemaValidator(appType);
    validator.validate();

    return appDescDoc.xmlText();
  }
View Full Code Here

TOP

Related Classes of org.ogce.schemas.gfac.documents.ApplicationDescriptionDocument

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.