// Path: common/src/main/java/org/apache/hms/common/entity/RestSource.java
// @XmlRootElement
// @XmlAccessorType(XmlAccessType.FIELD) 
// @XmlType(name="", propOrder = {})
// public abstract class RestSource {
// 
// }
// 
// Path: common/src/main/java/org/apache/hms/common/entity/Status.java
// @XmlRootElement
// @XmlAccessorType(XmlAccessType.FIELD)
// @XmlType(name = "", propOrder = {})
// public enum Status {
//   UNQUEUED, QUEUED, STARTED, SUCCEEDED, FAILED, INSTALLED, STOPPED;
// 
//   public static class StatusAdapter extends XmlAdapter<String, Status> {
// 
//     @Override
//     public String marshal(Status obj) throws Exception {
//       return obj.toString();
//     }
// 
//     @Override
//     public Status unmarshal(String str) throws Exception {
//       for (Status j : Status.class.getEnumConstants()) {
//         if (j.toString().equals(str)) {
//           return j;
//         }
//       }
//       throw new Exception("Can't convert " + str + " to "
//           + Status.class.getName());
//     }
// 
//   }
// }


import org.apache.hms.common.entity.Status.StatusAdapter;
import java.util.Set;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.adapters.XmlAdapter;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import org.apache.hms.common.entity.RestSource;
import org.apache.hms.common.entity.Status;
    if (stateEntries != null) {
      for (StateEntry a : stateEntries) {
        sb.append(a);
        sb.append(" ");
      }
    }
    return sb.toString();
  }
  
  /**
   * A state entry compose of:
   * 
   * Type of state to record, valid type are: PACKAGE, DAEMON
   * A unique name field to identify the package or daemon
   * Status is the state that a node must maintain.
   * @author eyang
   *
   */
  @XmlRootElement
  @XmlAccessorType(XmlAccessType.FIELD)
  public static class StateEntry {
    private static final int PRIME = 16777619;
    
    @XmlElement
    @XmlJavaTypeAdapter(StateTypeAdapter.class)
    protected StateType type;
    @XmlElement
    protected String name;
    @XmlElement
    @XmlJavaTypeAdapter(StatusAdapter.class)
// Path: common/src/main/java/org/apache/hms/common/entity/RestSource.java
// @XmlRootElement
// @XmlAccessorType(XmlAccessType.FIELD) 
// @XmlType(name="", propOrder = {})
// public abstract class RestSource {
// 
// }
// 
// Path: common/src/main/java/org/apache/hms/common/entity/Status.java
// @XmlRootElement
// @XmlAccessorType(XmlAccessType.FIELD)
// @XmlType(name = "", propOrder = {})
// public enum Status {
//   UNQUEUED, QUEUED, STARTED, SUCCEEDED, FAILED, INSTALLED, STOPPED;
// 
//   public static class StatusAdapter extends XmlAdapter<String, Status> {
// 
//     @Override
//     public String marshal(Status obj) throws Exception {
//       return obj.toString();
//     }
// 
//     @Override
//     public Status unmarshal(String str) throws Exception {
//       for (Status j : Status.class.getEnumConstants()) {
//         if (j.toString().equals(str)) {
//           return j;
//         }
//       }
//       throw new Exception("Can't convert " + str + " to "
//           + Status.class.getName());
//     }
// 
//   }
// }


// Path: common/src/main/java/org/apache/hms/common/entity/cluster/MachineState.java
import org.apache.hms.common.entity.Status.StatusAdapter;
import java.util.Set;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.adapters.XmlAdapter;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import org.apache.hms.common.entity.RestSource;
import org.apache.hms.common.entity.Status;

    if (stateEntries != null) {
      for (StateEntry a : stateEntries) {
        sb.append(a);
        sb.append(" ");
      }
    }
    return sb.toString();
  }
  
  /**
   * A state entry compose of:
   * 
   * Type of state to record, valid type are: PACKAGE, DAEMON
   * A unique name field to identify the package or daemon
   * Status is the state that a node must maintain.
   * @author eyang
   *
   */
  @XmlRootElement
  @XmlAccessorType(XmlAccessType.FIELD)
  public static class StateEntry {
    private static final int PRIME = 16777619;
    
    @XmlElement
    @XmlJavaTypeAdapter(StateTypeAdapter.class)
    protected StateType type;
    @XmlElement
    protected String name;
    @XmlElement
    @XmlJavaTypeAdapter(StatusAdapter.class)
    protected Status status;