You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by vg...@apache.org on 2011/09/23 01:36:00 UTC

svn commit: r1174451 - in /incubator/ambari/trunk: ./ client/src/main/java/org/apache/ambari/common/rest/entities/

Author: vgogate
Date: Thu Sep 22 23:36:00 2011
New Revision: 1174451

URL: http://svn.apache.org/viewvc?rev=1174451&view=rev
Log:
left over changes from initial git import

Modified:
    incubator/ambari/trunk/CHANGES.txt
    incubator/ambari/trunk/client/src/main/java/org/apache/ambari/common/rest/entities/ClusterDefinition.java
    incubator/ambari/trunk/client/src/main/java/org/apache/ambari/common/rest/entities/Clusters.java
    incubator/ambari/trunk/client/src/main/java/org/apache/ambari/common/rest/entities/NodeServer.java
    incubator/ambari/trunk/client/src/main/java/org/apache/ambari/common/rest/entities/NodeState.java
    incubator/ambari/trunk/client/src/main/java/org/apache/ambari/common/rest/entities/Nodes.java

Modified: incubator/ambari/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/CHANGES.txt?rev=1174451&r1=1174450&r2=1174451&view=diff
==============================================================================
--- incubator/ambari/trunk/CHANGES.txt (original)
+++ incubator/ambari/trunk/CHANGES.txt Thu Sep 22 23:36:00 2011
@@ -2,6 +2,8 @@ Ambari Change log
 
 Release 0.1.0 - unreleased
 
+  AMBARI-5. Added some left over changes from git repository for Ambari REST APIs
+
   AMBARI-4. Created interface for component plugins. (omalley)
 
   AMBARI-1. Initial code import (omalley)

Modified: incubator/ambari/trunk/client/src/main/java/org/apache/ambari/common/rest/entities/ClusterDefinition.java
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/client/src/main/java/org/apache/ambari/common/rest/entities/ClusterDefinition.java?rev=1174451&r1=1174450&r2=1174451&view=diff
==============================================================================
--- incubator/ambari/trunk/client/src/main/java/org/apache/ambari/common/rest/entities/ClusterDefinition.java (original)
+++ incubator/ambari/trunk/client/src/main/java/org/apache/ambari/common/rest/entities/ClusterDefinition.java Thu Sep 22 23:36:00 2011
@@ -28,7 +28,7 @@ import javax.xml.bind.annotation.XmlType
     "description",
     "blueprintName",
     "goalState",
-    "runningServices",
+    "activeServices",
     "nodes",
     "roleToNodesMap"
 })
@@ -47,8 +47,8 @@ public class ClusterDefinition {
     protected String blueprintName;
 	@XmlElement(name = "GoalState", required = true)
 	protected String goalState;
-	@XmlElement(name = "RunningServices", required = true)
-	protected List<String> runningServices;
+	@XmlElement(name = "ActiveServices", required = true)
+	protected List<String> activeServices;
 	@XmlElement(name = "NodeRangeExpressions", required = true)
 	protected List<String> nodeRangeExpressions;
 	@XmlElement(name = "RoleToNodesMap", required = true)
@@ -112,17 +112,17 @@ public class ClusterDefinition {
 	}
 
 	/**
-	 * @return the runningServices
+	 * @return the activeServices
 	 */
-	public List<String> getRunningServices() {
-		return runningServices;
+	public List<String> getActiveServices() {
+		return activeServices;
 	}
 
 	/**
-	 * @param runningServices the runningServices to set
+	 * @param activeServices the active3Services to set
 	 */
-	public void setRunningServices(List<String> runningServices) {
-		this.runningServices = runningServices;
+	public void setActiveServices(List<String> activeServices) {
+		this.activeServices = activeServices;
 	}
 
 	/**

Modified: incubator/ambari/trunk/client/src/main/java/org/apache/ambari/common/rest/entities/Clusters.java
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/client/src/main/java/org/apache/ambari/common/rest/entities/Clusters.java?rev=1174451&r1=1174450&r2=1174451&view=diff
==============================================================================
--- incubator/ambari/trunk/client/src/main/java/org/apache/ambari/common/rest/entities/Clusters.java (original)
+++ incubator/ambari/trunk/client/src/main/java/org/apache/ambari/common/rest/entities/Clusters.java Thu Sep 22 23:36:00 2011
@@ -142,6 +142,8 @@ public class Clusters {
      */
     private synchronized void updateClusterNodesReservation (Cluster cls, List<String> nodeRangeExpressions) throws Exception {
     	
+    	String cname = cls.getClusterDefinition().getName();
+    	
     	/*
 		 * Reserve the nodes as specified in the node range expressions
 		 * -- throw exception if any nodes are pre-associated with other cluster
@@ -188,14 +190,19 @@ public class Clusters {
 		/*
 		 * Allocate nodes to given cluster
 		 */
+		
 		for (String node_name : nodes_to_allocate) {
 			if (all_nodes.containsKey(node_name)) { 
+				// Set the cluster name in the node 
 				synchronized (all_nodes.get(node_name)) {
-					all_nodes.get(node_name).getNodeState().setClusterName(cls.getClusterDefinition().getName());
-				}
+					all_nodes.get(node_name).reserveNodeForCluster(cname, true);
+				}	
 			} else {
 				Node node = new Node(node_name);
-				node.reserveNodeForCluster(cls.getClusterDefinition().getName(), true);
+				/*
+				 * TODO: Set agentInstalled = true, unless controller uses SSH to setup the agent
+				 */
+				node.reserveNodeForCluster(cname, true);
 				Nodes.getInstance().getNodes().put(node_name, node);
 			}
 		}
@@ -203,7 +210,7 @@ public class Clusters {
 		/*
 		 * deallocate nodes from a given cluster
 		 * TODO: Node agent would check its been deallocated from the cluster and then shutdown any role/servers running it
-		 *       then update the deployment state to be FREE 
+		 *       then 
 		 */
 		for (String node_name : nodes_to_deallocate) {
 			if (all_nodes.containsKey(node_name)) {

Modified: incubator/ambari/trunk/client/src/main/java/org/apache/ambari/common/rest/entities/NodeServer.java
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/client/src/main/java/org/apache/ambari/common/rest/entities/NodeServer.java?rev=1174451&r1=1174450&r2=1174451&view=diff
==============================================================================
--- incubator/ambari/trunk/client/src/main/java/org/apache/ambari/common/rest/entities/NodeServer.java (original)
+++ incubator/ambari/trunk/client/src/main/java/org/apache/ambari/common/rest/entities/NodeServer.java Thu Sep 22 23:36:00 2011
@@ -33,7 +33,8 @@ public class NodeServer {
 	public static final String NODE_SERVER_STATE_DOWN = "DOWN";
 	
 	/*
-	 * name should be component/service name : role name
+	 * name should be component name : role name
+	 * TODO : May be we can have component and role as two separate attributes instead of name
 	 */
 	@XmlElement(name = "Name", required = true)
 	protected String name;
@@ -46,6 +47,10 @@ public class NodeServer {
     protected XMLGregorianCalendar lastStateUpdateTime;
 	
 	/**
+	 * 
+	 */
+	
+	/**
 	 * @return the name
 	 */
 	public String getName() {

Modified: incubator/ambari/trunk/client/src/main/java/org/apache/ambari/common/rest/entities/NodeState.java
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/client/src/main/java/org/apache/ambari/common/rest/entities/NodeState.java?rev=1174451&r1=1174450&r2=1174451&view=diff
==============================================================================
--- incubator/ambari/trunk/client/src/main/java/org/apache/ambari/common/rest/entities/NodeState.java (original)
+++ incubator/ambari/trunk/client/src/main/java/org/apache/ambari/common/rest/entities/NodeState.java Thu Sep 22 23:36:00 2011
@@ -22,7 +22,7 @@ import javax.xml.datatype.XMLGregorianCa
 @XmlType(name = "NodeState", propOrder = {
     "lastHeartbeatTime",
     "clusterName",
-    "allocatedToCluster",
+    "AllocatedToCluster",
     "agentInstalled",
 	"nodeServers"
 })
@@ -39,16 +39,11 @@ public class NodeState {
 	@XmlElement(name = "ClusterName", required = true)
     protected String clusterName;
 
-	/*
-	 * Actual allocation of the node in terms of having components installed on it is reflected 
-     * through this AllocatedToCluster boolean variable. This is updated through hearbeat message
-     * sent by Node.
-	 */
-	@XmlElement(name = "AllocatedToCluster", required = true)
-    protected Boolean allocatedToCluster = false;
-
 	@XmlElement(name = "AgentInstalled", required = true)
     protected Boolean agentInstalled = true;
+
+	@XmlElement(name = "AllocatedToCluster", required = true)
+    protected Boolean allocatedToCluster = false;
 	
 	@XmlElement(name = "NodeServers", required = true)
     protected List<NodeServer> nodeServers = new ArrayList<NodeServer>();
@@ -66,7 +61,7 @@ public class NodeState {
 	public void setAllocatedToCluster(Boolean allocatedToCluster) {
 		this.allocatedToCluster = allocatedToCluster;
 	}
-
+	
 	/**
 	 * @return the agentInstalled
 	 */

Modified: incubator/ambari/trunk/client/src/main/java/org/apache/ambari/common/rest/entities/Nodes.java
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/client/src/main/java/org/apache/ambari/common/rest/entities/Nodes.java?rev=1174451&r1=1174450&r2=1174451&view=diff
==============================================================================
--- incubator/ambari/trunk/client/src/main/java/org/apache/ambari/common/rest/entities/Nodes.java (original)
+++ incubator/ambari/trunk/client/src/main/java/org/apache/ambari/common/rest/entities/Nodes.java Thu Sep 22 23:36:00 2011
@@ -40,6 +40,13 @@ public class Nodes {
 	// Cluster name to Node names hash map
 	protected ConcurrentHashMap<String, ConcurrentHashMap<String, String>> cluster_to_nodes = new ConcurrentHashMap<String, ConcurrentHashMap<String, String>>();
 	
+	/**
+	 * @return the cluster_to_nodes
+	 */
+	public ConcurrentHashMap<String, ConcurrentHashMap<String, String>> getCluster_to_nodes() {
+		return cluster_to_nodes;
+	}
+
 	private static Nodes NodesTypeRef=null;
 	
 	private Nodes() {}