Package org.ogce.schemas.gfac.documents

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


    HostDescriptionDocument hostDescDoc = HostDescriptionDocument.Factory.newInstance();
    HostDescriptionType hostDesc = hostDescDoc.addNewHostDescription();
   
    hostDesc.setHostName(host.getHostName().trim());
    HostConfigurationType hostConf = hostDesc.getHostConfiguration();
    if (hostConf == null) {
      hostConf = hostDesc.addNewHostConfiguration();
    }
    // Added to support extra fields
    if (!host.getGateKeeperendPointReference().isEmpty()) {
      GlobusGatekeeperType gatekeeperType;
      if (hostConf.sizeOfGlobusGatekeeperArray() == 0) {
        gatekeeperType = hostConf.addNewGlobusGatekeeper();
      } else {
        gatekeeperType = hostConf.getGlobusGatekeeperArray(0);
      }
      gatekeeperType.setEndPointReference(host
          .getGateKeeperendPointReference());
      gatekeeperType.setWsGram(host.isWsGram());
      gatekeeperType.setName(host.getGateKeeperName());
      if (host.getGateKeeperJobManager() != null) {
        String jobmanager = host.getGateKeeperJobManager();
        if (jobmanager.equals(GlobusJobManagerType.CONDOR.toString())) {
          gatekeeperType
              .setJobmanagertype(GlobusJobManagerType.CONDOR);
        } else if (jobmanager.equals(GlobusJobManagerType.FORK
            .toString())) {
          gatekeeperType.setJobmanagertype(GlobusJobManagerType.SGE);
        } else if (jobmanager.equals(GlobusJobManagerType.SGE
            .toString())) {
          gatekeeperType
              .setJobmanagertype(GlobusJobManagerType.LOADLEVELER);
        } else if (jobmanager.equals(GlobusJobManagerType.LOADLEVELER
            .toString())) {
          gatekeeperType
              .setJobmanagertype(GlobusJobManagerType.LOADLEVELER);
        } else if (jobmanager.equals(GlobusJobManagerType.LSF
            .toString())) {
          gatekeeperType.setJobmanagertype(GlobusJobManagerType.LSF);
        } else if (jobmanager.equals(GlobusJobManagerType.MULTI
            .toString())) {
          gatekeeperType
              .setJobmanagertype(GlobusJobManagerType.MULTI);
        } else if (jobmanager.equals(GlobusJobManagerType.PBS
            .toString())) {
          gatekeeperType.setJobmanagertype(GlobusJobManagerType.PBS);
        } else if (jobmanager.equals(GlobusJobManagerType.SPRUCE
            .toString())) {
          gatekeeperType
              .setJobmanagertype(GlobusJobManagerType.SPRUCE);
        }

      }
    }
    if (!host.getGridFtpendPointReference().isEmpty()) {
      GridFTPType gridFTPType;
      if (hostConf.sizeOfGridFTPArray() == 0) {
        gridFTPType = hostConf.addNewGridFTP();
      } else {
        gridFTPType = hostConf.getGridFTPArray(0);
      }
      gridFTPType
          .setEndPointReference(host.getGridFtpendPointReference());
      gridFTPType.setName(host.getGridFtpName());
    }

    hostConf.setGFacPath(host.getGFacPath());
    hostConf.setTmpDir(host.getTmpDir());

    PortRangeType portRangeType = hostConf.getPortRange();
    if (portRangeType == null) {
      portRangeType = hostConf.addNewPortRange();
    }
    if (host.getPortRangeStart() > 0 && host.getPortRangeEnd() > 0) {
      portRangeType.setStart(Integer.valueOf(host.getPortRangeStart()));
      portRangeType.setEnd(Integer.valueOf(host.getPortRangeEnd()));
    }

    PackageType javaInstallation;
    if (hostConf.getJavaArray() != null
        && hostConf.getJavaArray().length > 0) {
      javaInstallation = hostConf.getJavaArray(0);
    } else {
      javaInstallation = hostConf.addNewJava();
    }
    String jdkName = host.getJdkName();
    javaInstallation.setName(jdkName);
    javaInstallation.setHome(host.getJdkPath());
    // FIXME: hostBean should not be needed
    javaInstallation.setVersion(jdkName.replaceAll("java", ""));

    if (host.getHostEnv() != null) {
      HashMap<String, NameValuePairType> envMap = new HashMap<String, NameValuePairType>();
      if (hostConf.getHostEnvArray() != null) {
        for (NameValuePairType pair : hostConf.getHostEnvArray()) {
          envMap.put(pair.getName(), pair);
        }
      }

      StringTokenizer tokernizer = new StringTokenizer(host.getHostEnv(),
          ";");
      while (tokernizer.hasMoreTokens()) {
        String nameVal = tokernizer.nextToken();

        int index = nameVal.indexOf('=');
        if (index <= 0) {
          throw new GFacSchemaException("Illegal Name value Pairs "
              + host.getHostEnv() + " at parsing " + nameVal);
        }
        String name = nameVal.substring(0, index);
        NameValuePairType nmPair = envMap.get(name);
        if (nmPair == null) {
          nmPair = hostConf.addNewHostEnv();
        }
        nmPair.setName(name);
        nmPair.setValue(nameVal.substring(index + 1));
      }
    }
View Full Code Here


        hostDesc = hostDescDoc.addNewHostDescription();
      } else {
        hostDesc = hostDescDoc.getHostDescription();
      }
      hostDesc.setHostName(host.getHostName().trim());
      HostConfigurationType hostConf = hostDesc.getHostConfiguration();
      if (hostConf == null) {
        hostConf = hostDesc.addNewHostConfiguration();
      }
      // Added to support extra fields
      if(!host.getGateKeeperendPointReference().isEmpty()){
      GlobusGatekeeperType gatekeeperType;
      if (hostConf.sizeOfGlobusGatekeeperArray() == 0) {
        gatekeeperType = hostConf.addNewGlobusGatekeeper();
      } else {
        gatekeeperType = hostConf.getGlobusGatekeeperArray(0);
      }
      gatekeeperType.setEndPointReference(host
          .getGateKeeperendPointReference());
      gatekeeperType.setWsGram(host.isWsGram());
      gatekeeperType.setName(host.getGateKeeperName());
      if (host.getGateKeeperJobManager() != null) {
        String jobmanager = host.getGateKeeperJobManager();
        if (jobmanager.equals(GlobusJobManagerType.CONDOR.toString())) {
          gatekeeperType
              .setJobmanagertype(GlobusJobManagerType.CONDOR);
        } else if (jobmanager.equals(GlobusJobManagerType.FORK
            .toString())) {
          gatekeeperType.setJobmanagertype(GlobusJobManagerType.FORK);
        } else if (jobmanager.equals(GlobusJobManagerType.LOADLEVELER
            .toString())) {
          gatekeeperType
              .setJobmanagertype(GlobusJobManagerType.LOADLEVELER);
        } else if (jobmanager.equals(GlobusJobManagerType.LSF
            .toString())) {
          gatekeeperType.setJobmanagertype(GlobusJobManagerType.LSF);
        } else if (jobmanager.equals(GlobusJobManagerType.MULTI
            .toString())) {
          gatekeeperType
              .setJobmanagertype(GlobusJobManagerType.MULTI);
        } else if (jobmanager.equals(GlobusJobManagerType.PBS
            .toString())) {
          gatekeeperType.setJobmanagertype(GlobusJobManagerType.PBS);
        } else if (jobmanager.equals(GlobusJobManagerType.SPRUCE
            .toString())) {
          gatekeeperType
              .setJobmanagertype(GlobusJobManagerType.SPRUCE);
        }

      }
      }
      if(!host.getGridFtpendPointReference().isEmpty()){
      GridFTPType gridFTPType;
      if (hostConf.sizeOfGridFTPArray() == 0) {
        gridFTPType = hostConf.addNewGridFTP();
      } else {
        gridFTPType = hostConf.getGridFTPArray(0);
      }
      gridFTPType
          .setEndPointReference(host.getGridFtpendPointReference());
      gridFTPType.setName(host.getGridFtpName());
      }
     
      hostConf.setGFacPath(host.getGFacPath());
      hostConf.setTmpDir(host.getTmpDir());

      PortRangeType portRangeType = hostConf.getPortRange();
      if (portRangeType == null) {
        portRangeType = hostConf.addNewPortRange();
      }
      if (host.getPortRangeStart() > 0 && host.getPortRangeEnd() > 0) {
        portRangeType.setStart(Integer
            .valueOf(host.getPortRangeStart()));
        portRangeType.setEnd(Integer.valueOf(host.getPortRangeEnd()));
      }

      PackageType javaInstallation;
      if (hostConf.getJavaArray() != null
          && hostConf.getJavaArray().length > 0) {
        javaInstallation = hostConf.getJavaArray(0);
      } else {
        javaInstallation = hostConf.addNewJava();
      }
      String jdkName = host.getJdkName();
      javaInstallation.setName(jdkName);
      javaInstallation.setHome(host.getJdkPath());
      //FIXME: this should not be needed
      javaInstallation.setVersion(jdkName.replaceAll("java", ""));

      if (host.getHostEnv() != null) {
        HashMap<String, NameValuePairType> envMap = new HashMap<String, NameValuePairType>();
        if (hostConf.getHostEnvArray() != null) {
          for (NameValuePairType pair : hostConf.getHostEnvArray()) {
            envMap.put(pair.getName(), pair);
          }
        }

        StringTokenizer tokernizer = new StringTokenizer(host
            .getHostEnv(), ";");
        while (tokernizer.hasMoreTokens()) {
          String nameVal = tokernizer.nextToken();

          int index = nameVal.indexOf('=');
          if (index <= 0) {
            throw new GfacException("Illegal Name value Pairs "
                + host.getHostEnv() + " at parsing " + nameVal,
                FaultCode.InvaliedLocalArgumnet);
          }
          String name = nameVal.substring(0, index);
          NameValuePairType nmPair = envMap.get(name);
          if (nmPair == null) {
            nmPair = hostConf.addNewHostEnv();
          }
          nmPair.setName(name);
          nmPair.setValue(nameVal.substring(index + 1));
        }
      }
View Full Code Here

        hostDesc = hostDescDoc.addNewHostDescription();
      } else {
        hostDesc = hostDescDoc.getHostDescription();
      }
      hostDesc.setHostName(host.getHostName().trim());
      HostConfigurationType hostConf = hostDesc.getHostConfiguration();
      if (hostConf == null) {
        hostConf = hostDesc.addNewHostConfiguration();
      }
      // Added to support extra fields
      if(!host.getGateKeeperendPointReference().isEmpty()){
      GlobusGatekeeperType gatekeeperType;
      if (hostConf.sizeOfGlobusGatekeeperArray() == 0) {
        gatekeeperType = hostConf.addNewGlobusGatekeeper();
      } else {
        gatekeeperType = hostConf.getGlobusGatekeeperArray(0);
      }
      gatekeeperType.setEndPointReference(host
          .getGateKeeperendPointReference());
      gatekeeperType.setWsGram(host.isWsGram());
      gatekeeperType.setName(host.getGateKeeperName());
      if (host.getGateKeeperJobManager() != null) {
        String jobmanager = host.getGateKeeperJobManager();
        if (jobmanager.equals(GlobusJobManagerType.CONDOR.toString())) {
          gatekeeperType
              .setJobmanagertype(GlobusJobManagerType.CONDOR);
        } else if (jobmanager.equals(GlobusJobManagerType.FORK
            .toString())) {
          gatekeeperType.setJobmanagertype(GlobusJobManagerType.FORK);
        } else if (jobmanager.equals(GlobusJobManagerType.LOADLEVELER
            .toString())) {
          gatekeeperType
              .setJobmanagertype(GlobusJobManagerType.LOADLEVELER);
        } else if (jobmanager.equals(GlobusJobManagerType.LSF
            .toString())) {
          gatekeeperType.setJobmanagertype(GlobusJobManagerType.LSF);
        } else if (jobmanager.equals(GlobusJobManagerType.MULTI
            .toString())) {
          gatekeeperType
              .setJobmanagertype(GlobusJobManagerType.MULTI);
        } else if (jobmanager.equals(GlobusJobManagerType.PBS
            .toString())) {
          gatekeeperType.setJobmanagertype(GlobusJobManagerType.PBS);
        } else if (jobmanager.equals(GlobusJobManagerType.SPRUCE
            .toString())) {
          gatekeeperType
              .setJobmanagertype(GlobusJobManagerType.SPRUCE);
        }

      }
      }
      if(!host.getGridFtpendPointReference().isEmpty()){
      GridFTPType gridFTPType;
      if (hostConf.sizeOfGridFTPArray() == 0) {
        gridFTPType = hostConf.addNewGridFTP();
      } else {
        gridFTPType = hostConf.getGridFTPArray(0);
      }
      gridFTPType
          .setEndPointReference(host.getGridFtpendPointReference());
      gridFTPType.setName(host.getGridFtpName());
      }
     
      hostConf.setGFacPath(host.getGFacPath());
      hostConf.setTmpDir(host.getTmpDir());

      PortRangeType portRangeType = hostConf.getPortRange();
      if (portRangeType == null) {
        portRangeType = hostConf.addNewPortRange();
      }
      if (host.getPortRangeStart() > 0 && host.getPortRangeEnd() > 0) {
        portRangeType.setStart(Integer
            .valueOf(host.getPortRangeStart()));
        portRangeType.setEnd(Integer.valueOf(host.getPortRangeEnd()));
      }

      PackageType javaInstallation;
      if (hostConf.getJavaArray() != null
          && hostConf.getJavaArray().length > 0) {
        javaInstallation = hostConf.getJavaArray(0);
      } else {
        javaInstallation = hostConf.addNewJava();
      }
      String jdkName = host.getJdkName();
      javaInstallation.setName(jdkName);
      javaInstallation.setHome(host.getJdkPath());
      //FIXME: this should not be needed
      javaInstallation.setVersion(jdkName.replaceAll("java", ""));

      if (host.getHostEnv() != null) {
        HashMap<String, NameValuePairType> envMap = new HashMap<String, NameValuePairType>();
        if (hostConf.getHostEnvArray() != null) {
          for (NameValuePairType pair : hostConf.getHostEnvArray()) {
            envMap.put(pair.getName(), pair);
          }
        }

        StringTokenizer tokernizer = new StringTokenizer(host
            .getHostEnv(), ";");
        while (tokernizer.hasMoreTokens()) {
          String nameVal = tokernizer.nextToken();

          int index = nameVal.indexOf('=');
          if (index <= 0) {
            throw new GfacException("Illegal Name value Pairs "
                + host.getHostEnv() + " at parsing " + nameVal,
                FaultCode.InvaliedLocalArgumnet);
          }
          String name = nameVal.substring(0, index);
          NameValuePairType nmPair = envMap.get(name);
          if (nmPair == null) {
            nmPair = hostConf.addNewHostEnv();
          }
          nmPair.setName(name);
          nmPair.setValue(nameVal.substring(index + 1));
        }
      }
View Full Code Here

TOP

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

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.