You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by nc...@apache.org on 2014/05/15 16:44:58 UTC

git commit: AMBARI-5749. Store cluster installed state as part of the Cluster resource - 2 (Jonathan Hurley via ncole)

Repository: ambari
Updated Branches:
  refs/heads/trunk 5d9649f92 -> 73538ee1f


AMBARI-5749. Store cluster installed state as part of the Cluster resource - 2 (Jonathan Hurley via ncole)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/73538ee1
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/73538ee1
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/73538ee1

Branch: refs/heads/trunk
Commit: 73538ee1fe887a89cc83369deecd17e228274d89
Parents: 5d9649f
Author: Nate Cole <nc...@hortonworks.com>
Authored: Thu May 15 10:44:13 2014 -0400
Committer: Nate Cole <nc...@hortonworks.com>
Committed: Thu May 15 10:44:19 2014 -0400

----------------------------------------------------------------------
 .../controller/AmbariManagementControllerImpl.java  |  3 +--
 .../server/orm/entities/ClusterStateEntity.java     | 16 +++++-----------
 2 files changed, 6 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/73538ee1/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
index f8eac9b..003d56e 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
@@ -1041,10 +1041,9 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle
     
     // set the provisioning state of the cluster
     if (null != request.getProvisioningState()) {
-      State provisioningState;
       State oldProvisioningState = cluster.getProvisioningState();
+      State provisioningState = State.valueOf(request.getProvisioningState());
 
-      provisioningState = State.valueOf(request.getProvisioningState());
       if (provisioningState != State.INIT
           && provisioningState != State.INSTALLED) {
         LOG.warn(

http://git-wip-us.apache.org/repos/asf/ambari/blob/73538ee1/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ClusterStateEntity.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ClusterStateEntity.java b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ClusterStateEntity.java
index 3b357d5..49afa84 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ClusterStateEntity.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ClusterStateEntity.java
@@ -23,17 +23,12 @@ import static org.apache.commons.lang.StringUtils.defaultString;
 import javax.persistence.Basic;
 import javax.persistence.Column;
 import javax.persistence.Entity;
-import javax.persistence.EnumType;
-import javax.persistence.Enumerated;
 import javax.persistence.Id;
 import javax.persistence.JoinColumn;
 import javax.persistence.OneToOne;
-import javax.persistence.Table;
-
-import org.apache.ambari.server.state.State;
 
+@javax.persistence.Table(name = "clusterstate")
 @Entity
-@Table(name = "clusterstate")
 public class ClusterStateEntity {
 
   @Id
@@ -41,9 +36,8 @@ public class ClusterStateEntity {
   private Long clusterId;
 
   @Basic
-  @Enumerated(value = EnumType.STRING)
   @Column(name = "current_cluster_state", insertable = true, updatable = true)
-  private State currentClusterState = State.INIT; 
+  private String currentClusterState = "";
 
   @Basic
   @Column(name = "current_stack_version", insertable = true, updatable = true)
@@ -61,11 +55,11 @@ public class ClusterStateEntity {
     this.clusterId = clusterId;
   }
 
-  public State getCurrentClusterState() {
-    return currentClusterState;
+  public String getCurrentClusterState() {
+    return defaultString(currentClusterState);
   }
 
-  public void setCurrentClusterState(State currentClusterState) {
+  public void setCurrentClusterState(String currentClusterState) {
     this.currentClusterState = currentClusterState;
   }