Package org.ogce.schemas.gfac.documents

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


    }

    public static void removeAppDesc(RegistryService registryService, String appDescAsStr)
            throws GfacException {
        try {
            ApplicationDescriptionType appDesc = ApplicationDescriptionDocument.Factory.parse(
                    appDescAsStr).getApplicationDescription();
            registryService.removeAppDesc(appDesc.getApplicationName().getStringValue(), appDesc
                    .getDeploymentDescription().getHostName());
        } catch (XmlException e) {
            throw new GfacException(e,FaultCode.LocalError);
        }
    }
View Full Code Here


     * @throws GfacException
     */
  public Object getBeanObjectInfo(RegistryService regService, String applicationName, String hostName, ApplicationBean bean) throws GfacException {
    String appDescStr = regService.getAppDesc(applicationName, hostName);
    if (appDescStr != null) {
      ApplicationDescriptionType appDescriptionType = GfacUtils.parseAppDescirption(new StringReader(appDescStr));
      return getBean(appDescriptionType,bean);
    } else {
      throw new GfacException("Applcation  " + applicationName + " on " + hostName + " does not exist",FaultCode.InvaliedLocalArgumnet);
    }
  }
View Full Code Here

  }
 
  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) {
View Full Code Here

    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();
    }
    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) {
View Full Code Here

                HostDescriptionType hostDesc = HostDescriptionDocument.Factory.parse(
                    sb.toString()).getHostDescription();
                documentName = hostDesc.getHostName();
                }else if(documentType.equals(ServiceConstants.SEARCH_APPLICATION)){
                ApplicationUtils.createObject(context.getRegService(), sb.toString());
                ApplicationDescriptionType appType = ApplicationDescriptionDocument.Factory.parse(sb.toString()).getApplicationDescription();
                documentName = appType.getApplicationName().getStringValue();
                }else if(documentType.equals(ServiceConstants.SEARCH_SERVICE)){
                ServiceUtils.createObject(context.getRegService(), sb.toString());
                ServiceMapType serviceMap =  ServiceMapDocument.Factory.parse(sb.toString()).getServiceMap();
                documentName = serviceMap.getService().getServiceName().getStringValue();
                }else{
View Full Code Here

    }

    public static ApplicationDescriptionType parseAppDescirption(Reader reader)
            throws GFacSchemaException {
        try {
            ApplicationDescriptionType appDesc = ApplicationDescriptionDocument.Factory.parse(
                    reader).getApplicationDescription();
            SchemaValidator validator = new SchemaValidator(appDesc);
            validator.validate();
            return appDesc;
        } catch (XmlException e) {
View Full Code Here

public class ApplicationUtils {

  public static ApplicationBean simpleApplicationBeanRequest(String appDescStr)
      throws XmlException {

    ApplicationDescriptionType applicationDescriptionType = ApplicationDescriptionDocument.Factory
        .parse(appDescStr).getApplicationDescription();

    ApplicationBean appBean = new ApplicationBean();

    appBean.setHostName(applicationDescriptionType
        .getDeploymentDescription().getHostName());
    ApplicationName appXbeanName = applicationDescriptionType
        .getApplicationName();

    appBean.setApplicationName(appXbeanName.getStringValue());

    appBean.setObjectNamespace(appXbeanName.getTargetNamespace());
    appBean.setExecutable(applicationDescriptionType
        .getDeploymentDescription().getExecutable());
    appBean.setWorkDir(applicationDescriptionType
        .getDeploymentDescription().getWorkDir());
    appBean.setTmpDir(applicationDescriptionType.getDeploymentDescription()
        .getTmpDir());
    if (applicationDescriptionType.isSetProject()) {
      appBean.setProjectName(applicationDescriptionType.getProject()
          .getProjectName());

    }
    if (applicationDescriptionType.getJobType() != null) {
      appBean.setJobType(applicationDescriptionType.getJobType()
          .toString());
    }

    if (applicationDescriptionType.getQueue() != null) {
      appBean.setQueue(applicationDescriptionType.getQueue()
          .getQueueName());
    }

    if (applicationDescriptionType.isSetCount()) {
      appBean.setPcount(applicationDescriptionType.getCount());
    }

    if (applicationDescriptionType.isSetMaxWallTime()) {
      appBean.setMaxWallTime(applicationDescriptionType.getMaxWallTime());
    }
    if (applicationDescriptionType.isSetMinMemory()) {
      appBean.setMinMemory(applicationDescriptionType.getMinMemory());
    }
    if (applicationDescriptionType.getHostCount() > 0) {
      appBean.setHostCount(applicationDescriptionType.getHostCount());
    }
    if (applicationDescriptionType.getRslparmArray() != null) {
      RSLParmType[] rslParmType = applicationDescriptionType
          .getRslparmArray();
      for (RSLParmType rslParmType2 : rslParmType) {
        appBean.setRslparmName(rslParmType2.getName());
        appBean.setRslparmValue(rslParmType2.getStringValue());
      }
    }
    if (applicationDescriptionType.getDeploymentDescription()
        .getLeadNameListFile() != null) {
      appBean.setLeadNameListFile(applicationDescriptionType
          .getDeploymentDescription().getLeadNameListFile());
    }

    return appBean;
  }
View Full Code Here

  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();
View Full Code Here

        // host name
        String hostName = findHostFromServiceMap(registryService, appName);

        // app
        String appDesc = registryService.getAppDesc(appName.toString(), hostName);
        ApplicationDescriptionType appDescType = ApplicationDescriptionDocument.Factory.parse(appDesc).getApplicationDescription();

        // host desc
        String hostDesc = registryService.getHostDesc(hostName);
        HostDescriptionType hostDescType = HostDescriptionDocument.Factory.parse(hostDesc).getHostDescription();

        // application deployment
        DeploymentDescriptionType deploymentDesc = appDescType.getDeploymentDescription();
        String tmpDir = deploymentDesc.getTmpDir();
        if (tmpDir == null && hostDescType != null) {
          tmpDir = hostDescType.getHostConfiguration().getTmpDir();
        }

        if (tmpDir == null) {
          tmpDir = "/tmp";
        }

        String date = new Date().toString();
        date = date.replaceAll(" ", "_");
        date = date.replaceAll(":", "_");

        tmpDir = tmpDir + File.separator + appDescType.getApplicationName().getStringValue() + "_" + date + "_" + UUID.randomUUID();

        String workingDir = deploymentDesc.getWorkDir();
        if (workingDir == null || workingDir.trim().length() == 0) {
          workingDir = tmpDir;
        }

        String stdOut = tmpDir + File.separator + appDescType.getApplicationName().getStringValue() + ".stdout";
        String stderr = tmpDir + File.separator + appDescType.getApplicationName().getStringValue() + ".stderr";
        String executable = deploymentDesc.getExecutable();
        String host = deploymentDesc.getHostName();

        NameValuePairType[] env = deploymentDesc.getApplicationEnvArray();
        Map<String, String> envMap = new HashMap<String, String>();
View Full Code Here

    }
  }

  public static ApplicationDescriptionType parseAppDescirption(Reader reader) throws GfacException {
    try {
      ApplicationDescriptionType appDesc = ApplicationDescriptionDocument.Factory.parse(reader).getApplicationDescription();
      SchemaValidator validator = new SchemaValidator(appDesc);
      validator.validate();
      return appDesc;
    } catch (IOException e) {
      throw new GfacException(e, FaultCode.InvaliedLocalArgumnet);
View Full Code Here

TOP

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

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.