Subversion Repositories DevTools

Rev

Rev 6914 | Blame | Compare with Previous | Last modification | View Log | RSS feed

package com.erggroup.buildtool.ripple;

import com.erggroup.buildtool.utilities.XmlBuilder;

public class ReleaseConfig
{
        /**
         * Identify the Release within release Manager
         */
  private int mRtagId;
  
  /** Identify the build machine with the release
   *  It is globally unique
   * 
   */
  private int mRconId;
  
  /** Mode of the machine
   *    M == Master
   *    S == Slave
   */
  private char mDaemonMode;
  
  /** The name of the machine as provided by the machine
   */
  private String mHostname;
  
  /** The buildfilter to be applied to the build
   */
  private String mBuildfilter;
  
  /** The machine type
   *    ie solaris10_x86'
   */
  private String mMachtype;
  
  /** The machine class
   *    ie: 'Solaris'
   */
  private String mMachclass;

  /**
   * Create a ReleaseConfig entry
   * 
   * @param rtagId      Release RTAG_ID
   * @param rconId      Release RCON_ID
   * @param daemonMode  Daemon Mode, M or S
   * @param hostname    Name of the Host Machine
   * @param buildfilter Machines buildfilter
   * @param machtype    MachType. ie linux_i386
   * @param machclass   Machine Class. ie: Linux
   */
  public ReleaseConfig(int rtagId, int rconId, char daemonMode, String hostname, String buildfilter, String machtype, String machclass)
  {
    mRtagId = rtagId;
    mRconId = rconId;
    mDaemonMode = daemonMode;
    mHostname = hostname;
    mBuildfilter = buildfilter;
    mMachtype = machtype;
    mMachclass = machclass;
  }

  /**accessor method
   */
  public int getRtagId()
  {
    return mRtagId;
  }

  /**accessor method
   */
  public int getRconId()
  {
    return mRconId;
  }

  /**accessor method
   */
  public char getDaemonMode()
  {
    return mDaemonMode;
  }
  
  /**
   * @return the mMachclass
   */
  public String getmMachclass() {
      return mMachclass;
  }

  /**
   * @return the mMachtype
   */
  public String getmMachtype() {
      return mMachtype;
  }

  public XmlBuilder getMachineEntry()
  {
          XmlBuilder entry = new XmlBuilder("machine");
          entry.addAttribute("name", mHostname);
          entry.addAttribute("machtype", getmMachtype());
          entry.addAttribute("machclass", getmMachclass());

      // Only if it is defined
      //    No entry will pick up machine's default filter
      if (mBuildfilter != null && mBuildfilter.length() > 0) {
          entry.addAttribute("buildfilter", mBuildfilter);
      }

      // Only indicate Master. Value not currently used
      if (mDaemonMode  == 'M') {
          entry.addAttribute("master", "M");
      }

      return entry;
  }


}