incubator-ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From omal...@apache.org
Subject svn commit: r1174957 [2/3] - in /incubator/ambari/trunk: ./ agent/src/main/python/ambari_agent/ agent/src/main/resources/WEB-INF/ client/src/main/java/org/apache/ambari/common/rest/entities/ controller/src/main/java/org/apache/ambari/controller/ contro...
Date Fri, 23 Sep 2011 19:01:07 GMT
Modified: incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/Clusters.java
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/Clusters.java?rev=1174957&r1=1174956&r2=1174957&view=diff
==============================================================================
--- incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/Clusters.java (original)
+++ incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/Clusters.java Fri Sep 23 19:01:04 2011
@@ -51,9 +51,9 @@ import org.apache.ambari.common.rest.ent
 
 public class Clusters {
 
-	/*
-	 * Operational clusters include both active and inactive clusters
-	 */
+        /*
+         * Operational clusters include both active and inactive clusters
+         */
     protected ConcurrentHashMap<String, ClusterDefinition> operational_clusters = new ConcurrentHashMap<String, ClusterDefinition>();
     
     /* 
@@ -65,18 +65,18 @@ public class Clusters {
     protected ConcurrentHashMap<String, ClusterDefinition> attic_clusters = new ConcurrentHashMap<String, ClusterDefinition>();
     
     private static Clusters ClustersTypeRef=null;
-	
+        
     private Clusters() {}
     
     public static synchronized Clusters getInstance() {
-    	if(ClustersTypeRef == null) {
-    		ClustersTypeRef = new Clusters();
-    	}
-    	return ClustersTypeRef;
+        if(ClustersTypeRef == null) {
+                ClustersTypeRef = new Clusters();
+        }
+        return ClustersTypeRef;
     }
 
     public Object clone() throws CloneNotSupportedException {
-    	throw new CloneNotSupportedException();
+        throw new CloneNotSupportedException();
     }
 
 
@@ -94,62 +94,62 @@ public class Clusters {
      *       are in UNREGISTERED state).  
      */   
     public ClusterDefinition addCluster(ClusterDefinition c) throws Exception {
-    	/*
-    	 * TODO: Validate the cluster definition
-    	 */
-    	if (c.getName() == null ||  c.getName().equals("")) {
-    		Exception e = new Exception("Cluster Name must be specified and must be non-empty string");
-    		throw new WebApplicationException(e, Response.Status.BAD_REQUEST);
-    	}
-    	
-    	synchronized (operational_clusters) {
-    		/* 
-    		 * Check if cluster already exists
-    		 */
-    		if (operational_clusters.containsKey(c.getName())) {
-    			Exception e = new Exception("Cluster ["+c.getName()+"] already exists");
-    			throw new WebApplicationException(e, Response.Status.CONFLICT);
-    		}
-    		
-    		/*
-    		 * Add new cluster to cluster list
-    		 */
-    		Date requestTime = new Date();
-    		Cluster cls = new Cluster();
-    		ClusterState clsState = new ClusterState();
-    		clsState.setCreationTime(requestTime);
-    		clsState.setLastUpdateTime(requestTime);
-    		clsState.setDeployTime((Date)null);
-    		clsState.setRepresentativeState(ClusterState.CLUSTER_STATE_INACTIVE);
-    		
-    		cls.setID(UUID.randomUUID().toString());
-    		cls.setClusterDefinition(c);
-    		cls.setClusterState(clsState);
-    		
-			/*
-			 * Update cluster nodes reservation.
-			 * TODO: REST API should allow roleToNodesMap separately based on the node attributes 
-			 */
-			if (c.getNodeRangeExpressions() != null) {
-				updateClusterNodesReservation (cls, c.getNodeRangeExpressions());
-			}
-			
-			/*
-			 * Update the Node to Roles association if specified
-			 */
-			if (c.getRoleToNodesMap() != null) {
-				updateNodeToRolesAssociation(c.getName(), c.getRoleToNodesMap());
-			}
-			
-    		/*
-    		 * TODO: Persist the cluster definition to data store as a initial version r0. 
-    		 * 		 Persist reserved nodes against the cluster & service/role
-    		 */
-    			
-    		// Add the cluster to list, when definition is persisted
-    		operational_clusters.put(c.getName(), c);
-    	}
-    	return null;
+        /*
+         * TODO: Validate the cluster definition
+         */
+        if (c.getName() == null ||  c.getName().equals("")) {
+                Exception e = new Exception("Cluster Name must be specified and must be non-empty string");
+                throw new WebApplicationException(e, Response.Status.BAD_REQUEST);
+        }
+        
+        synchronized (operational_clusters) {
+                /* 
+                 * Check if cluster already exists
+                 */
+                if (operational_clusters.containsKey(c.getName())) {
+                        Exception e = new Exception("Cluster ["+c.getName()+"] already exists");
+                        throw new WebApplicationException(e, Response.Status.CONFLICT);
+                }
+                
+                /*
+                 * Add new cluster to cluster list
+                 */
+                Date requestTime = new Date();
+                Cluster cls = new Cluster();
+                ClusterState clsState = new ClusterState();
+                clsState.setCreationTime(requestTime);
+                clsState.setLastUpdateTime(requestTime);
+                clsState.setDeployTime((Date)null);
+                clsState.setRepresentativeState(ClusterState.CLUSTER_STATE_INACTIVE);
+                
+                cls.setID(UUID.randomUUID().toString());
+                cls.setClusterDefinition(c);
+                cls.setClusterState(clsState);
+                
+                        /*
+                         * Update cluster nodes reservation.
+                         * TODO: REST API should allow roleToNodesMap separately based on the node attributes 
+                         */
+                        if (c.getNodeRangeExpressions() != null) {
+                                updateClusterNodesReservation (cls, c.getNodeRangeExpressions());
+                        }
+                        
+                        /*
+                         * Update the Node to Roles association if specified
+                         */
+                        if (c.getRoleToNodesMap() != null) {
+                                updateNodeToRolesAssociation(c.getName(), c.getRoleToNodesMap());
+                        }
+                        
+                /*
+                 * TODO: Persist the cluster definition to data store as a initial version r0. 
+                 *               Persist reserved nodes against the cluster & service/role
+                 */
+                        
+                // Add the cluster to list, when definition is persisted
+                operational_clusters.put(c.getName(), c);
+        }
+        return null;
     } 
     
     
@@ -157,188 +157,188 @@ public class Clusters {
      * Update the nodes associated with cluster
      */
     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
-		 */
-    	ConcurrentHashMap<String, Node> all_nodes = Nodes.getInstance().getNodes();
-    	List<String> specified_node_range = new ArrayList<String>();
-    	for (String nodeRangeExpression : nodeRangeExpressions) {
-    		specified_node_range.addAll(getHostnamesFromRangeExpression(nodeRangeExpression));
-    	}
-    	List<String> nodes_currently_allocated = new ArrayList<String>();
-    	for (Node n : Nodes.getInstance().getNodes().values()) {
-    		if (n.getNodeState().getClusterName().equals(cls.getClusterDefinition().getName())) {
-    			nodes_currently_allocated.add(n.getName());
-    		}
-    	}
-    	
-    	List<String> nodes_to_allocate = new ArrayList<String>(specified_node_range);
-    	nodes_to_allocate.removeAll(nodes_currently_allocated);
-    	List<String> nodes_to_deallocate = new ArrayList<String>(nodes_currently_allocated);
-    	nodes_to_deallocate.removeAll(specified_node_range);
-    	
-		/*
-		 * Check for any nodes that are allocated to other cluster
-		 */
-    	List<String> preallocatedhosts = new ArrayList<String>();
-    	for (String n : nodes_to_allocate) {
-    		if (all_nodes.containsKey(n) && all_nodes.get(n).getNodeState().getClusterName() != null) {
-    			preallocatedhosts.add(n);
-    		}
-    	}
-    	
-    	/* 
-		 * Throw exception, if some of the hosts are already allocated to other cluster
-		 */
-		if (!preallocatedhosts.isEmpty()) {
-			/*
-			 * TODO: Return invalid request code and return list of preallocated nodes as a part of
-			 *       response element
-			 */
-			Exception e = new Exception("Some of the nodes specified for the cluster roles are allocated to other cluster: ["+preallocatedhosts+"]");
-    		throw new WebApplicationException(e, Response.Status.CONFLICT);
-		}
-		
-		/*
-		 * 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).reserveNodeForCluster(cname, true);
-				}	
-			} else {
-				Node node = new Node(node_name);
-				/*
-				 * TODO: Set agentInstalled = true, unless controller uses SSH to setup the agent
-				 */
-				node.reserveNodeForCluster(cname, true);
-				Nodes.getInstance().getNodes().put(node_name, node);
-			}
-		}
-		
-		/*
-		 * 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 
-		 */
-		for (String node_name : nodes_to_deallocate) {
-			if (all_nodes.containsKey(node_name)) {
-				synchronized (all_nodes.get(node_name)) {
-					all_nodes.get(node_name).releaseNodeFromCluster();
-				}
-			}
-		}
-		
+        
+        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
+                 */
+        ConcurrentHashMap<String, Node> all_nodes = Nodes.getInstance().getNodes();
+        List<String> specified_node_range = new ArrayList<String>();
+        for (String nodeRangeExpression : nodeRangeExpressions) {
+                specified_node_range.addAll(getHostnamesFromRangeExpression(nodeRangeExpression));
+        }
+        List<String> nodes_currently_allocated = new ArrayList<String>();
+        for (Node n : Nodes.getInstance().getNodes().values()) {
+                if (n.getNodeState().getClusterName().equals(cls.getClusterDefinition().getName())) {
+                        nodes_currently_allocated.add(n.getName());
+                }
+        }
+        
+        List<String> nodes_to_allocate = new ArrayList<String>(specified_node_range);
+        nodes_to_allocate.removeAll(nodes_currently_allocated);
+        List<String> nodes_to_deallocate = new ArrayList<String>(nodes_currently_allocated);
+        nodes_to_deallocate.removeAll(specified_node_range);
+        
+                /*
+                 * Check for any nodes that are allocated to other cluster
+                 */
+        List<String> preallocatedhosts = new ArrayList<String>();
+        for (String n : nodes_to_allocate) {
+                if (all_nodes.containsKey(n) && all_nodes.get(n).getNodeState().getClusterName() != null) {
+                        preallocatedhosts.add(n);
+                }
+        }
+        
+        /* 
+                 * Throw exception, if some of the hosts are already allocated to other cluster
+                 */
+                if (!preallocatedhosts.isEmpty()) {
+                        /*
+                         * TODO: Return invalid request code and return list of preallocated nodes as a part of
+                         *       response element
+                         */
+                        Exception e = new Exception("Some of the nodes specified for the cluster roles are allocated to other cluster: ["+preallocatedhosts+"]");
+                throw new WebApplicationException(e, Response.Status.CONFLICT);
+                }
+                
+                /*
+                 * 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).reserveNodeForCluster(cname, true);
+                                }       
+                        } else {
+                                Node node = new Node(node_name);
+                                /*
+                                 * TODO: Set agentInstalled = true, unless controller uses SSH to setup the agent
+                                 */
+                                node.reserveNodeForCluster(cname, true);
+                                Nodes.getInstance().getNodes().put(node_name, node);
+                        }
+                }
+                
+                /*
+                 * 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 
+                 */
+                for (String node_name : nodes_to_deallocate) {
+                        if (all_nodes.containsKey(node_name)) {
+                                synchronized (all_nodes.get(node_name)) {
+                                        all_nodes.get(node_name).releaseNodeFromCluster();
+                                }
+                        }
+                }
+                
     }
     
-	private synchronized void updateNodeToRolesAssociation (String clusterName, RoleToNodesMap roleToNodesMap) throws Exception {
-		/*
-		 * Associate roles with node
-		 */
-		if (roleToNodesMap != null) {
-			/*
-			 * Generate node to roles hash map 
-			 
-			HashMap<String, List<String>> nodeToRolesHashMap = new HashMap<String, List<String>>();
-			for (RoleToNodesMapEntryType e : roleToNodesMap.getRoleToNodesMapEntry()) {
-				List<String> hosts = getHostnamesFromRangeExpression(e.getNodeRangeExpression());
-				for (String host : hosts) {
-					if (!nodeToRolesHashMap.containsKey(host)) {
-						List<String> x = new ArrayList<String>();
-						x.add(e.getServiceName()+":"+e.getRoleName());
-						nodeToRolesHashMap.put(host, x);
-					} else {
-						nodeToRolesHashMap.get(host).add(e.getServiceName()+":"+e.getRoleName());
-					}
-				}
-			} */
-				
-			/*
-			 * Replace the roles list in for each node
-			 
-			HashMap<String, NodeType> all_nodes = NodesType.getInstance().getNodes();
-			for (String host : nodeToRolesHashMap.keySet()) {
-				if (all_nodes.containsKey(host) && all_nodes.get(host).getClusterName().equals(clusterName)) { 
-					synchronized (all_nodes.get(host)) {
-						all_nodes.get(host).setNodeRoles(nodeToRolesHashMap.get(host));
-					}
-				}
-			} */
-		}
-	}
+        private synchronized void updateNodeToRolesAssociation (String clusterName, RoleToNodesMap roleToNodesMap) throws Exception {
+                /*
+                 * Associate roles with node
+                 */
+                if (roleToNodesMap != null) {
+                        /*
+                         * Generate node to roles hash map 
+                         
+                        HashMap<String, List<String>> nodeToRolesHashMap = new HashMap<String, List<String>>();
+                        for (RoleToNodesMapEntryType e : roleToNodesMap.getRoleToNodesMapEntry()) {
+                                List<String> hosts = getHostnamesFromRangeExpression(e.getNodeRangeExpression());
+                                for (String host : hosts) {
+                                        if (!nodeToRolesHashMap.containsKey(host)) {
+                                                List<String> x = new ArrayList<String>();
+                                                x.add(e.getServiceName()+":"+e.getRoleName());
+                                                nodeToRolesHashMap.put(host, x);
+                                        } else {
+                                                nodeToRolesHashMap.get(host).add(e.getServiceName()+":"+e.getRoleName());
+                                        }
+                                }
+                        } */
+                                
+                        /*
+                         * Replace the roles list in for each node
+                         
+                        HashMap<String, NodeType> all_nodes = NodesType.getInstance().getNodes();
+                        for (String host : nodeToRolesHashMap.keySet()) {
+                                if (all_nodes.containsKey(host) && all_nodes.get(host).getClusterName().equals(clusterName)) { 
+                                        synchronized (all_nodes.get(host)) {
+                                                all_nodes.get(host).setNodeRoles(nodeToRolesHashMap.get(host));
+                                        }
+                                }
+                        } */
+                }
+        }
     
     /*
      * TODO: Implement proper range expression
      */
     public List<String> getHostnamesFromRangeExpression (String nodeRangeExpression) throws Exception {
   
-    	List<String> list = new ArrayList<String>();
-    	StringTokenizer st = new StringTokenizer(nodeRangeExpression);
-    	while (st.hasMoreTokens()) {
-    		list.add(st.nextToken());
-    	}
-    	return list;
+        List<String> list = new ArrayList<String>();
+        StringTokenizer st = new StringTokenizer(nodeRangeExpression);
+        while (st.hasMoreTokens()) {
+                list.add(st.nextToken());
+        }
+        return list;
     }
     
     /* 
      * Update cluster 
     */
     public void updateCluster(String clusterName, ClusterDefinition c) throws Exception {
-    	/*
-    	 * Update the cluster definition. 
-    	 * Always latest version of cluster definition is kept in memory 
-    	 * Revisions for cluster definition is mainly need for agents to know
-    	 * that something is changed in cluster definition?
-    	 * TODO: 
-    	 * 		Make update atomic? i.e. persist the new revision first and then update the 
-    	 * 		definition in memory? make sure get cluster does not get partial definition.. 
-    	 */
-    	int i;
-    	ClusterDefinition cls = null;
-    	for (i=0; i<operational_clusters.size(); i++) {
-    		if (operational_clusters.get(i).equals(clusterName)) {
-    			cls = operational_clusters.get(i);
-    			break;
-    		}
-    	}
-    	
-    	// Throw exception if cluster is not found
-    	if (i == operational_clusters.size()) {
-    		throw new Exception("Specified cluster ["+clusterName+"] does not exists");
-    	}
-    	
-    	synchronized (cls) {
-    		if (c.getDescription() != null) cls.setDescription(c.getDescription());
-    		// Update the last update time
-    		//cls.setLastUpdateTime(new Date());
-    		//cls.setRevision(cls.getRevision()+1);
-    		/*
-    		 * TODO: Persist the latest cluster definition under new revision
-    		*/
-    	}
-    	return;
+        /*
+         * Update the cluster definition. 
+         * Always latest version of cluster definition is kept in memory 
+         * Revisions for cluster definition is mainly need for agents to know
+         * that something is changed in cluster definition?
+         * TODO: 
+         *              Make update atomic? i.e. persist the new revision first and then update the 
+         *              definition in memory? make sure get cluster does not get partial definition.. 
+         */
+        int i;
+        ClusterDefinition cls = null;
+        for (i=0; i<operational_clusters.size(); i++) {
+                if (operational_clusters.get(i).equals(clusterName)) {
+                        cls = operational_clusters.get(i);
+                        break;
+                }
+        }
+        
+        // Throw exception if cluster is not found
+        if (i == operational_clusters.size()) {
+                throw new Exception("Specified cluster ["+clusterName+"] does not exists");
+        }
+        
+        synchronized (cls) {
+                if (c.getDescription() != null) cls.setDescription(c.getDescription());
+                // Update the last update time
+                //cls.setLastUpdateTime(new Date());
+                //cls.setRevision(cls.getRevision()+1);
+                /*
+                 * TODO: Persist the latest cluster definition under new revision
+                */
+        }
+        return;
     }
     
     /*
      * Update role to Nodes Map
     
     private void updateClusterRoleToNodesMap (RoleToNodesMapType s, RoleToNodesMapType t) throws Exception {
-    	for (RoleToNodesMapEntryType se : s.getRoleToNodesMapEntry()) {
-    		for (RoleToNodesMapEntryType te : t.getRoleToNodesMapEntry()) {
-    			if (se.getServiceName().equals(te.getServiceName()) && se.getRoleName().equals(te.getRoleName())) {
-    				te.setNodeRangeExpression(se.getNodeRangeExpression());
-    			} else {
-    				t.getRoleToNodesMapEntry().add(se);
-    			}
-    		}
-    	}
+        for (RoleToNodesMapEntryType se : s.getRoleToNodesMapEntry()) {
+                for (RoleToNodesMapEntryType te : t.getRoleToNodesMapEntry()) {
+                        if (se.getServiceName().equals(te.getServiceName()) && se.getRoleName().equals(te.getRoleName())) {
+                                te.setNodeRangeExpression(se.getNodeRangeExpression());
+                        } else {
+                                t.getRoleToNodesMapEntry().add(se);
+                        }
+                }
+        }
     } */
     
     /*
@@ -347,24 +347,24 @@ public class Clusters {
      * Cluster must be in ATTIC state to be deleted from controller
      
     public void deleteCluster(ClusterType c) throws Exception { 
-    	synchronized (operational_clusters) {
-    		for (int i=0;i<operational_clusters.size();i++) {
-    			if (operational_clusters.get(i).getName().equals(c.getName())) {
-    				synchronized (operational_clusters.get(i)) {
-    					if (operational_clusters.get(i).getCurrentState().equals(ClusterState.CLUSTER_STATE_ATTIC)) {
-    						// TODO: remove the persistent entry from data store
-    						
-    						 // Remove the entry from the in-memory clsuter list
-    						 
-    						operational_clusters.remove(i);
-    					} else {
-    						throw new Exception ("Cluster ["+operational_clusters.get(i).getName()+"] not in ATTIC state");
-    					}
-    				}
-    			}
-    		} 
-    	}
-    	return;
+        synchronized (operational_clusters) {
+                for (int i=0;i<operational_clusters.size();i++) {
+                        if (operational_clusters.get(i).getName().equals(c.getName())) {
+                                synchronized (operational_clusters.get(i)) {
+                                        if (operational_clusters.get(i).getCurrentState().equals(ClusterState.CLUSTER_STATE_ATTIC)) {
+                                                // TODO: remove the persistent entry from data store
+                                                
+                                                 // Remove the entry from the in-memory clsuter list
+                                                 
+                                                operational_clusters.remove(i);
+                                        } else {
+                                                throw new Exception ("Cluster ["+operational_clusters.get(i).getName()+"] not in ATTIC state");
+                                        }
+                                }
+                        }
+                } 
+        }
+        return;
     } */  
     
     
@@ -373,28 +373,28 @@ public class Clusters {
      * TODO: CHECK_IT
      
     public ClusterType getClusterSnapshot(String clusterName) throws Exception {
-    	for (ClusterType cls : operational_clusters) {
-    		ClusterType cls1 = null;
-			if (cls.getName().equals(clusterName)) {
-				synchronized (cls) {
-					//cls1 = cls.clone();
-				}
-			}
-			return cls1;
-		}
-    	throw new Exception ("Cluster:["+clusterName+"] does not exists");
+        for (ClusterType cls : operational_clusters) {
+                ClusterType cls1 = null;
+                        if (cls.getName().equals(clusterName)) {
+                                synchronized (cls) {
+                                        //cls1 = cls.clone();
+                                }
+                        }
+                        return cls1;
+                }
+        throw new Exception ("Cluster:["+clusterName+"] does not exists");
     } */
     
     /* 
      * Get the cluster definition 
     */
     public ClusterDefinition getCluster(String clusterName) throws Exception {
-    	/*for (ClusterDefinition cls : operational_clusters) {
-			if (cls.getName().equals(clusterName)) {
-				return cls;
-			}
-		}*/
-    	throw new Exception ("Cluster:["+clusterName+"] does not exists");
+        /*for (ClusterDefinition cls : operational_clusters) {
+                        if (cls.getName().equals(clusterName)) {
+                                return cls;
+                        }
+                }*/
+        throw new Exception ("Cluster:["+clusterName+"] does not exists");
     }
     
     /*
@@ -402,17 +402,17 @@ public class Clusters {
      * TODO: return the synchronized snapshot of the deployed cluster list
      */
     public List<ClusterDefinition> getDeployedClusterList(String type) {
-    	List<ClusterDefinition> list = new ArrayList<ClusterDefinition>();
-    	if (type.equals("ALL")) {
-    		//list.addAll(this.operational_clusters);
-    		return list;
-    	} else {
-    		//for (ClusterDefinition cls : operational_clusters) {
-    			//if (cls.gcurrentState.equals(type)) {
-    			//	list.add(cls);
-    			//}
-    		//}
-    	}
+        List<ClusterDefinition> list = new ArrayList<ClusterDefinition>();
+        if (type.equals("ALL")) {
+                //list.addAll(this.operational_clusters);
+                return list;
+        } else {
+                //for (ClusterDefinition cls : operational_clusters) {
+                        //if (cls.gcurrentState.equals(type)) {
+                        //      list.add(cls);
+                        //}
+                //}
+        }
         return list;
     } 
     
@@ -421,8 +421,8 @@ public class Clusters {
      * TODO: return synchronized snapshot of the retired cluster list
      */
     public List<ClusterDefinition> getRetiredClusterList() {
-    	List<ClusterDefinition> list = new ArrayList<ClusterDefinition>();
-    	//list.addAll(this.attic_clusters);
+        List<ClusterDefinition> list = new ArrayList<ClusterDefinition>();
+        //list.addAll(this.attic_clusters);
         return list;
     }
     
@@ -431,20 +431,20 @@ public class Clusters {
      * TODO: Get the synchronized snapshot of each cluster definition? 
      
     public List<ClusterType> getClusterList(String type) {
-    	List<ClusterType> list = new ArrayList<ClusterType>();
-    	if (type.equals("ALL")) {
-    		list.addAll(getRetiredClusterList());
-    		list.addAll(getDeployedClusterList("ALL"));
-    	} else if (type.equals("ATTIC")) {
-    		list.addAll(getRetiredClusterList());
-    	} else {
-    		for (ClusterType cls : operational_clusters ) {
-    			if (cls.currentState.equals(type)) {
-    				list.add(cls);
-    			}
-    		}
-    	}
-    	return list;
+        List<ClusterType> list = new ArrayList<ClusterType>();
+        if (type.equals("ALL")) {
+                list.addAll(getRetiredClusterList());
+                list.addAll(getDeployedClusterList("ALL"));
+        } else if (type.equals("ATTIC")) {
+                list.addAll(getRetiredClusterList());
+        } else {
+                for (ClusterType cls : operational_clusters ) {
+                        if (cls.currentState.equals(type)) {
+                                list.add(cls);
+                        }
+                }
+        }
+        return list;
     } */
     
     /*
@@ -453,77 +453,77 @@ public class Clusters {
      * TODO: Use state machine to trigger the state change events  
      */
     public void changeClusterGoalState (String clusterName, String goalState, Date requestTime) throws Exception {
-    	int i;
-    	ClusterDefinition cls = null;
-    	for (i=0; i<operational_clusters.size(); i++) {
-    		if (operational_clusters.get(i).equals(clusterName)) {
-    			cls = operational_clusters.get(i);
-    			break;
-    		}
-    	}
-    	
-    	// Throw exception if cluster is not found
-    	if (i == operational_clusters.size()) {
-    		throw new Exception("Specified cluster ["+clusterName+"] does not exists");
-    	}
-    	
-    	synchronized (cls) {
-    		// Set the goal state
-    		//cls.setLastRequestedGoalState(goalState);
-			//cls.setTimeOflastRequestedGoalState(requestTime);
-    		
-    		/*
-    		 * TODO: Persist the latest cluster definition under new revision
-    		*/
-    	}
-    	
-    	/*
-    	 * send state change event to cluster state machine 
-    	 */
-    	//changeClusterState(this.getName());
+        int i;
+        ClusterDefinition cls = null;
+        for (i=0; i<operational_clusters.size(); i++) {
+                if (operational_clusters.get(i).equals(clusterName)) {
+                        cls = operational_clusters.get(i);
+                        break;
+                }
+        }
+        
+        // Throw exception if cluster is not found
+        if (i == operational_clusters.size()) {
+                throw new Exception("Specified cluster ["+clusterName+"] does not exists");
+        }
+        
+        synchronized (cls) {
+                // Set the goal state
+                //cls.setLastRequestedGoalState(goalState);
+                        //cls.setTimeOflastRequestedGoalState(requestTime);
+                
+                /*
+                 * TODO: Persist the latest cluster definition under new revision
+                */
+        }
+        
+        /*
+         * send state change event to cluster state machine 
+         */
+        //changeClusterState(this.getName());
     }
     
     /*
      * Cluster state change event Handler
      * 
-	 * TODO: 
-	 * 		 -- Make sure cluster definition is complete else throw exception 
-	 * 			-- Check all ClusterType fields have valid values
-	 * 			-- Check if roles have required number of nodes associated with it.
-	 * 		 -- Add the nodes to NodesType list w/ name, cluster name, deployment state etc.
-	 * 		 -- Trigger agent installation on the nodes, if not already done 
-	 * 
-	 * 		 -- Once agent is installed it should register itself w/ controller, get the 
-	 * 			associated latest cluster definition and deploy the stack. If goal state is active
-	 * 			it should get the associated services up. Once sync-ed, it should
-	 * 			update its state w/ controller through heartbeat.
-	 * 
-	 *   	-- Once required number of service nodes are up cluster state should be changed accordingly
-	*/
+         * TODO: 
+         *               -- Make sure cluster definition is complete else throw exception 
+         *                      -- Check all ClusterType fields have valid values
+         *                      -- Check if roles have required number of nodes associated with it.
+         *               -- Add the nodes to NodesType list w/ name, cluster name, deployment state etc.
+         *               -- Trigger agent installation on the nodes, if not already done 
+         * 
+         *               -- Once agent is installed it should register itself w/ controller, get the 
+         *                      associated latest cluster definition and deploy the stack. If goal state is active
+         *                      it should get the associated services up. Once sync-ed, it should
+         *                      update its state w/ controller through heartbeat.
+         * 
+         *      -- Once required number of service nodes are up cluster state should be changed accordingly
+        */
     public void stateChangeEventHandler (String currentState, String goalState) {
-    	synchronized(this) {
-    		/*
-    		 * ATTIC to ACTIVE or INACTIVE
-    		 */
-			if (currentState.equals(ClusterState.CLUSTER_STATE_ATTIC) && goalState.equals(ClusterState.CLUSTER_STATE_ACTIVE)) {
-				
-			}
-    	}
+        synchronized(this) {
+                /*
+                 * ATTIC to ACTIVE or INACTIVE
+                 */
+                        if (currentState.equals(ClusterState.CLUSTER_STATE_ATTIC) && goalState.equals(ClusterState.CLUSTER_STATE_ACTIVE)) {
+                                
+                        }
+        }
     }
     
     /* 
      * Util methods on entities
      */
-	/*
-	 * 
-	 */
-	public List<String> getAssociatedRoleNames(Node n) throws Exception {
-		List<String> list = new ArrayList<String>();
-		if (n.getNodeState().getClusterName() != null) {
-			for (RoleToNodesMapEntry rnme : Clusters.getInstance().getCluster(n.getNodeState().getClusterName()).getRoleToNodesMap().getRoleToNodesMapEntry()) {
-				list.add(rnme.getRoleName());
-			}
-		}
-		return list;
-	}
+        /*
+         * 
+         */
+        public List<String> getAssociatedRoleNames(Node n) throws Exception {
+                List<String> list = new ArrayList<String>();
+                if (n.getNodeState().getClusterName() != null) {
+                        for (RoleToNodesMapEntry rnme : Clusters.getInstance().getCluster(n.getNodeState().getClusterName()).getRoleToNodesMap().getRoleToNodesMapEntry()) {
+                                list.add(rnme.getRoleName());
+                        }
+                }
+                return list;
+        }
 }

Modified: incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/Controller.java
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/Controller.java?rev=1174957&r1=1174956&r2=1174957&view=diff
==============================================================================
--- incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/Controller.java (original)
+++ incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/Controller.java Fri Sep 23 19:01:04 2011
@@ -43,7 +43,7 @@ public class Controller {
   }
   
   public void run() {
-	  
+          
     server = new Server(CONTROLLER_PORT);
 
     try {

Modified: incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/Nodes.java
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/Nodes.java?rev=1174957&r1=1174956&r2=1174957&view=diff
==============================================================================
--- incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/Nodes.java (original)
+++ incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/Nodes.java Fri Sep 23 19:01:04 2011
@@ -37,48 +37,48 @@ import org.apache.ambari.common.rest.ent
 
 
 public class Nodes {
-	
-	public static final String AGENT_DEPLOYMENT_STATE_TOBE_INSTALLED = "AGENT_TOBE_INSTALLED";
-	public static final String AGENT_DEPLOYMENT_STATE_INSTALLED = "AGENT_INSTALLED";
-	
-	
-	public static final short NODE_HEARTBEAT_INTERVAL_IN_MINUTES = 5;
-	public static final short NODE_MAX_MISSING_HEARBEAT_INTERVALS = 3;
-	
-	// One node name to Node hashmap
-	protected ConcurrentHashMap<String, Node> nodes = new ConcurrentHashMap<String, Node>();
-	
-	// 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;
-	}
+        
+        public static final String AGENT_DEPLOYMENT_STATE_TOBE_INSTALLED = "AGENT_TOBE_INSTALLED";
+        public static final String AGENT_DEPLOYMENT_STATE_INSTALLED = "AGENT_INSTALLED";
+        
+        
+        public static final short NODE_HEARTBEAT_INTERVAL_IN_MINUTES = 5;
+        public static final short NODE_MAX_MISSING_HEARBEAT_INTERVALS = 3;
+        
+        // One node name to Node hashmap
+        protected ConcurrentHashMap<String, Node> nodes = new ConcurrentHashMap<String, Node>();
+        
+        // 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() {}
-	    
-	public static synchronized Nodes getInstance() {
-		if(NodesTypeRef == null) {
-			NodesTypeRef = new Nodes();
-		}
-	    return NodesTypeRef;
-	}
+        private static Nodes NodesTypeRef=null;
+        
+        private Nodes() {}
+            
+        public static synchronized Nodes getInstance() {
+                if(NodesTypeRef == null) {
+                        NodesTypeRef = new Nodes();
+                }
+            return NodesTypeRef;
+        }
 
-	public Object clone() throws CloneNotSupportedException {
-		throw new CloneNotSupportedException();
-	}
-	   
-	public ConcurrentHashMap<String, Node> getNodes () {
-		return nodes;
-	}
-	
-	public List<Node> getNodes (String clusterName, String roleName) {
-		
-		return null;
-	}
+        public Object clone() throws CloneNotSupportedException {
+                throw new CloneNotSupportedException();
+        }
+           
+        public ConcurrentHashMap<String, Node> getNodes () {
+                return nodes;
+        }
+        
+        public List<Node> getNodes (String clusterName, String roleName) {
+                
+                return null;
+        }
 }

Modified: incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/rest/resources/BlueprintResource.java
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/rest/resources/BlueprintResource.java?rev=1174957&r1=1174956&r2=1174957&view=diff
==============================================================================
--- incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/rest/resources/BlueprintResource.java (original)
+++ incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/rest/resources/BlueprintResource.java Fri Sep 23 19:01:04 2011
@@ -37,32 +37,32 @@ import org.apache.ambari.common.rest.ent
  */
 @Path(value = "/blueprints/{blueprintName}")
 public class BlueprintResource {
-	
-	/** Get a blueprint
-	 * 
-	 *  <p>
-	 *  REST:<br>
-	 *  &nbsp;&nbsp;&nbsp;&nbsp;URL Path                                    : /blueprints/{blueprintName}<br>
-	 *  &nbsp;&nbsp;&nbsp;&nbsp;HTTP Method                                 : GET <br>
-	 *  &nbsp;&nbsp;&nbsp;&nbsp;HTTP Request Header	                        : <br>
-	 *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Content-type        = application/json <br>
-	 *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Accept              = application/json <br>
-	 *  &nbsp;&nbsp;&nbsp;&nbsp;HTTP Response Header                        : <br>
-	 *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Content-type        = application/json <br>
-	 *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Accept              = application/json <br>
-	 *  <p> 
-	 *  
-	 * 	@param	blueprintName	Name of the blueprint
+        
+        /** Get a blueprint
+         * 
+         *  <p>
+         *  REST:<br>
+         *  &nbsp;&nbsp;&nbsp;&nbsp;URL Path                                    : /blueprints/{blueprintName}<br>
+         *  &nbsp;&nbsp;&nbsp;&nbsp;HTTP Method                                 : GET <br>
+         *  &nbsp;&nbsp;&nbsp;&nbsp;HTTP Request Header                         : <br>
+         *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Content-type        = application/json <br>
+         *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Accept              = application/json <br>
+         *  &nbsp;&nbsp;&nbsp;&nbsp;HTTP Response Header                        : <br>
+         *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Content-type        = application/json <br>
+         *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Accept              = application/json <br>
+         *  <p> 
+         *  
+         *      @param  blueprintName   Name of the blueprint
          *      @param  revision        The optional blueprint revision to get
-	 * 	@return			blueprint definition
-	 * 	@throws	Exception	throws Exception (TBD)
+         *      @return                 blueprint definition
+         *      @throws Exception       throws Exception (TBD)
      */
     @GET
-	@Produces({"application/json", "application/xml"})
+        @Produces({"application/json", "application/xml"})
       public Blueprint getBlueprint(@PathParam("blueprintName") String blueprintName, 
                                     @QueryParam("revision") int revision) throws Exception {
       return null;
-	}
+        }
     
     /* 
      * Delete blueprint
@@ -70,50 +70,50 @@ public class BlueprintResource {
     /** Delete the blueprint
      * 
      *  <p>
-	 *  REST:<br>
-	 *  &nbsp;&nbsp;&nbsp;&nbsp;URL Path                                    : /blueprints/{blueprintName}<br>
-	 *  &nbsp;&nbsp;&nbsp;&nbsp;HTTP Method                                 : DELETE <br>
-	 *  &nbsp;&nbsp;&nbsp;&nbsp;HTTP Request Header	                        : <br>
-	 *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Content-type        = application/json <br>
-	 *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Accept              = application/json <br>
-	 *  &nbsp;&nbsp;&nbsp;&nbsp;HTTP Response Header                        : <br>
-	 *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Content-type        = application/json <br>
-	 *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Accept              = application/json <br>
-	 *  <p> 
-	 *  
-     * @param stackName		Name of the Hadoop stack
-     * @throws Exception	throws Exception (TBD)
+         *  REST:<br>
+         *  &nbsp;&nbsp;&nbsp;&nbsp;URL Path                                    : /blueprints/{blueprintName}<br>
+         *  &nbsp;&nbsp;&nbsp;&nbsp;HTTP Method                                 : DELETE <br>
+         *  &nbsp;&nbsp;&nbsp;&nbsp;HTTP Request Header                         : <br>
+         *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Content-type        = application/json <br>
+         *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Accept              = application/json <br>
+         *  &nbsp;&nbsp;&nbsp;&nbsp;HTTP Response Header                        : <br>
+         *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Content-type        = application/json <br>
+         *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Accept              = application/json <br>
+         *  <p> 
+         *  
+     * @param stackName         Name of the Hadoop stack
+     * @throws Exception        throws Exception (TBD)
      */
     @DELETE
-	@Consumes({"application/json", "application/xml"})
-	public void deleteBlueprint(@PathParam("blueprintName") String blueprintName) throws Exception {
-	}
+        @Consumes({"application/json", "application/xml"})
+        public void deleteBlueprint(@PathParam("blueprintName") String blueprintName) throws Exception {
+        }
     
     /** Update a current blueprint.
      *  <p>
-     * 	Updates a current blueprint to update some of its fields.
+     *  Updates a current blueprint to update some of its fields.
      *  <p>
-	 *  REST:<br>
-	 *  &nbsp;&nbsp;&nbsp;&nbsp;URL Path                                    : /blueprints/{blueprintName}<br>
-	 *  &nbsp;&nbsp;&nbsp;&nbsp;HTTP Method                                 : PUT <br>
-	 *  &nbsp;&nbsp;&nbsp;&nbsp;HTTP Request Header	                        : <br>
-	 *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Content-type        = application/json <br>
-	 *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Accept              = application/json <br>
-	 *  &nbsp;&nbsp;&nbsp;&nbsp;HTTP Response Header                        : <br>
-	 *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Content-type        = application/json <br>
-	 *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Accept              = application/json <br>
-	 *  <p> 
+         *  REST:<br>
+         *  &nbsp;&nbsp;&nbsp;&nbsp;URL Path                                    : /blueprints/{blueprintName}<br>
+         *  &nbsp;&nbsp;&nbsp;&nbsp;HTTP Method                                 : PUT <br>
+         *  &nbsp;&nbsp;&nbsp;&nbsp;HTTP Request Header                         : <br>
+         *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Content-type        = application/json <br>
+         *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Accept              = application/json <br>
+         *  &nbsp;&nbsp;&nbsp;&nbsp;HTTP Response Header                        : <br>
+         *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Content-type        = application/json <br>
+         *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Accept              = application/json <br>
+         *  <p> 
      * 
-     * @param blueprintName		Name of the blueprint
-     * @param blueprint			Input blueprint object specifying the blueprint definition
-     * @return					Returns the new revision of the blueprint
-     * @throws Exception		throws Exception
+     * @param blueprintName             Name of the blueprint
+     * @param blueprint                 Input blueprint object specifying the blueprint definition
+     * @return                                  Returns the new revision of the blueprint
+     * @throws Exception                throws Exception
      */
     @Path(value = "/blueprints/{blueprintName}")
     @PUT
     @Consumes
     public Blueprint updateBlueprint(@PathParam("blueprintName") String blueprintName, Blueprint blueprint) throws Exception {
-    	return null;
+        return null;
     }
     
 }

Modified: incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/rest/resources/BlueprintsResource.java
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/rest/resources/BlueprintsResource.java?rev=1174957&r1=1174956&r2=1174957&view=diff
==============================================================================
--- incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/rest/resources/BlueprintsResource.java (original)
+++ incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/rest/resources/BlueprintsResource.java Fri Sep 23 19:01:04 2011
@@ -40,49 +40,49 @@ public class BlueprintsResource {
  
     /** Creates a new blueprint.
      *  <p>
-     * 	If named blueprint does not exists already, then it creates new one i.e. revision zero.
+     *  If named blueprint does not exists already, then it creates new one i.e. revision zero.
      *  <p>
-	 *  REST:<br>
-	 *  &nbsp;&nbsp;&nbsp;&nbsp;URL Path                                    : /blueprints/<br>
-	 *  &nbsp;&nbsp;&nbsp;&nbsp;HTTP Method                                 : POST <br>
-	 *  &nbsp;&nbsp;&nbsp;&nbsp;HTTP Request Header	                        : <br>
-	 *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Content-type        = application/json <br>
-	 *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Accept              = application/json <br>
-	 *  &nbsp;&nbsp;&nbsp;&nbsp;HTTP Response Header                        : <br>
-	 *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Content-type        = application/json <br>
-	 *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Accept              = application/json <br>
-	 *  <p> 
+         *  REST:<br>
+         *  &nbsp;&nbsp;&nbsp;&nbsp;URL Path                                    : /blueprints/<br>
+         *  &nbsp;&nbsp;&nbsp;&nbsp;HTTP Method                                 : POST <br>
+         *  &nbsp;&nbsp;&nbsp;&nbsp;HTTP Request Header                         : <br>
+         *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Content-type        = application/json <br>
+         *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Accept              = application/json <br>
+         *  &nbsp;&nbsp;&nbsp;&nbsp;HTTP Response Header                        : <br>
+         *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Content-type        = application/json <br>
+         *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Accept              = application/json <br>
+         *  <p> 
      * 
-     * @param blueprint			Input blueprint object specifying the blueprint definition
-     * @return					Returns the newly created revision of the blueprint
-     * @throws Exception		throws Exception
+     * @param blueprint                 Input blueprint object specifying the blueprint definition
+     * @return                                  Returns the newly created revision of the blueprint
+     * @throws Exception                throws Exception
      */
     @POST
     @Consumes
     public Blueprint createBlueprint(Blueprint blueprint) throws Exception {
-    	return null;
+        return null;
     }
 
     /** Get the list of blueprint names
      *  <p>
-	 *  REST:<br>
-	 *  &nbsp;&nbsp;&nbsp;&nbsp;URL Path                                    : /blueprints<br>
-	 *  &nbsp;&nbsp;&nbsp;&nbsp;HTTP Method                                 : GET <br>
-	 *  &nbsp;&nbsp;&nbsp;&nbsp;HTTP Request Header	                        : <br>
-	 *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Content-type        = application/json <br>
-	 *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Accept              = application/json <br>
-	 *  &nbsp;&nbsp;&nbsp;&nbsp;HTTP Response Header                        : <br>
-	 *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Content-type        = application/json <br>
-	 *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Accept              = application/json <br>
-	 *  <p> 
+         *  REST:<br>
+         *  &nbsp;&nbsp;&nbsp;&nbsp;URL Path                                    : /blueprints<br>
+         *  &nbsp;&nbsp;&nbsp;&nbsp;HTTP Method                                 : GET <br>
+         *  &nbsp;&nbsp;&nbsp;&nbsp;HTTP Request Header                         : <br>
+         *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Content-type        = application/json <br>
+         *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Accept              = application/json <br>
+         *  &nbsp;&nbsp;&nbsp;&nbsp;HTTP Response Header                        : <br>
+         *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Content-type        = application/json <br>
+         *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Accept              = application/json <br>
+         *  <p> 
      * 
-     * @return	 				Returns the list of blueprint names
-     * @throws Exception		throws Exception
+     * @return                                  Returns the list of blueprint names
+     * @throws Exception                throws Exception
      */
     @GET
     @Consumes
     public List<String> listBlueprints() throws Exception {
-    	return null;
+        return null;
     }
     
 }

Modified: incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/rest/resources/ClusterResource.java
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/rest/resources/ClusterResource.java?rev=1174957&r1=1174956&r2=1174957&view=diff
==============================================================================
--- incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/rest/resources/ClusterResource.java (original)
+++ incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/rest/resources/ClusterResource.java Fri Sep 23 19:01:04 2011
@@ -42,150 +42,150 @@ import org.apache.ambari.controller.Clus
  */
 @Path(value = "/clusters/{clusterName}")
 public class ClusterResource {
-	
-	/** Get the definition of specified Hadoop cluster.
-	 * 
-	 *  <p>
-	 *  REST:<br>
-	 *  &nbsp;&nbsp;&nbsp;&nbsp;URL Path                                    : /clusters/{clusterName}<br>
-	 *  &nbsp;&nbsp;&nbsp;&nbsp;HTTP Method                                 : GET <br>
-	 *  &nbsp;&nbsp;&nbsp;&nbsp;HTTP Request Header	                        : <br>
-	 *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Content-type        = application/json <br>
-	 *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Accept              = application/json <br>
-	 *  &nbsp;&nbsp;&nbsp;&nbsp;HTTP Response Header                        : <br>
-	 *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Content-type        = application/json <br>
-	 *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Accept              = application/json <br>
-	 *  <p> 
-	 *  
-	 *  @param	clusterName		Name of the cluster; Each cluster is identified w/ unique name
-	 *  @return					Returns the Cluster definition
-	 *  @throws	Exception  		Throws exception (TBD)
-	 */
-	@GET
-	@Produces({"application/json", "application/xml"})
-	public Cluster getCluster(@PathParam("clusterName") String clusterName) throws Exception {
-		//return Clusters.getInstance().getCluster(clusterName);
-		return null;
-	}
+        
+        /** Get the definition of specified Hadoop cluster.
+         * 
+         *  <p>
+         *  REST:<br>
+         *  &nbsp;&nbsp;&nbsp;&nbsp;URL Path                                    : /clusters/{clusterName}<br>
+         *  &nbsp;&nbsp;&nbsp;&nbsp;HTTP Method                                 : GET <br>
+         *  &nbsp;&nbsp;&nbsp;&nbsp;HTTP Request Header                         : <br>
+         *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Content-type        = application/json <br>
+         *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Accept              = application/json <br>
+         *  &nbsp;&nbsp;&nbsp;&nbsp;HTTP Response Header                        : <br>
+         *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Content-type        = application/json <br>
+         *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Accept              = application/json <br>
+         *  <p> 
+         *  
+         *  @param      clusterName             Name of the cluster; Each cluster is identified w/ unique name
+         *  @return                                     Returns the Cluster definition
+         *  @throws     Exception               Throws exception (TBD)
+         */
+        @GET
+        @Produces({"application/json", "application/xml"})
+        public Cluster getCluster(@PathParam("clusterName") String clusterName) throws Exception {
+                //return Clusters.getInstance().getCluster(clusterName);
+                return null;
+        }
     
     /** Update cluster definition.
      *  <p>
      *  Update cluster definition allows updating any sub-elements of cluster definition. Only sub-elements to be 
      *  updated can be specified with new values while others can be "null".
      *  <p>
-	 *  REST:<br>
-	 *  &nbsp;&nbsp;&nbsp;&nbsp;URL Path                                    : /clusters/{clusterName}<br>
-	 *  &nbsp;&nbsp;&nbsp;&nbsp;HTTP Method                                 : PUT <br>
-	 *  &nbsp;&nbsp;&nbsp;&nbsp;HTTP Request Header	                        : <br>
-	 *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Content-type        = application/json <br>
-	 *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Accept              = application/json <br>
-	 *  &nbsp;&nbsp;&nbsp;&nbsp;HTTP Response Header                        : <br>
-	 *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Content-type        = application/json <br>
-	 *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Accept              = application/json <br>
-	 *  <p> 
+         *  REST:<br>
+         *  &nbsp;&nbsp;&nbsp;&nbsp;URL Path                                    : /clusters/{clusterName}<br>
+         *  &nbsp;&nbsp;&nbsp;&nbsp;HTTP Method                                 : PUT <br>
+         *  &nbsp;&nbsp;&nbsp;&nbsp;HTTP Request Header                         : <br>
+         *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Content-type        = application/json <br>
+         *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Accept              = application/json <br>
+         *  &nbsp;&nbsp;&nbsp;&nbsp;HTTP Response Header                        : <br>
+         *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Content-type        = application/json <br>
+         *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Accept              = application/json <br>
+         *  <p> 
      * 
-     * @param	clusterName		Name of the cluster; Each cluster is identified w/ unique name
-     * @param	cluster			Cluster definition with specific sub-elements to be updated
-     * @return					Returns updated cluster definition
-     * @throws	Exception		throws Exception (TBD)
-     */	
+     * @param   clusterName             Name of the cluster; Each cluster is identified w/ unique name
+     * @param   cluster                 Cluster definition with specific sub-elements to be updated
+     * @return                                  Returns updated cluster definition
+     * @throws  Exception               throws Exception (TBD)
+     */ 
     @PUT
-	@Consumes({"application/json", "application/xml"})
-	public Cluster updateClusterDefinition(@PathParam("clusterName") String clusterName, Cluster cluster) throws Exception {
-        //    	if (cluster.getName() == null || cluster.getName().equals("") || !cluster.getName().equals(clusterName)) {
-	//		throw new Exception("Cluster name in URI ["+clusterName+"] does not match with one specified in update request elelemt");
-      //		}
-    	//Clusters.getInstance().updateCluster(clusterName, cluster);
-    	return null;
+        @Consumes({"application/json", "application/xml"})
+        public Cluster updateClusterDefinition(@PathParam("clusterName") String clusterName, Cluster cluster) throws Exception {
+        //      if (cluster.getName() == null || cluster.getName().equals("") || !cluster.getName().equals(clusterName)) {
+        //              throw new Exception("Cluster name in URI ["+clusterName+"] does not match with one specified in update request elelemt");
+      //                }
+        //Clusters.getInstance().updateCluster(clusterName, cluster);
+        return null;
     }
      
     /** Delete the the cluster.
      *  <p>
-     * 	Delete operation will lead the cluster to "ATTIC" state and then the cluster definition is purged from
+     *  Delete operation will lead the cluster to "ATTIC" state and then the cluster definition is purged from
      *  the controller repository. In "ATTIC" state all the cluster services would be stopped and nodes are 
      *  released. All the data on the cluster will be lost.
      *  <p>
-	 *  REST:<br>
-	 *  &nbsp;&nbsp;&nbsp;&nbsp;URL Path                                    : /clusters/{clusterName}/action/terminate<br>
-	 *  &nbsp;&nbsp;&nbsp;&nbsp;HTTP Method                                 : DELETE <br>
-	 *  &nbsp;&nbsp;&nbsp;&nbsp;HTTP Request Header	                        : <br>
-	 *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Content-type        = application/json <br>
-	 *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Accept              = application/json <br>
-	 *  &nbsp;&nbsp;&nbsp;&nbsp;HTTP Response Header                        : <br>
-	 *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Content-type        = application/json <br>
-	 *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Accept              = application/json <br>
-	 *  <p> 
-	 *  
-     * 	@param	clusterName		Name of the cluster; Each cluster is identified w/ unique name
-     * 	@throws	Exception		throws Exception (TBD)
+         *  REST:<br>
+         *  &nbsp;&nbsp;&nbsp;&nbsp;URL Path                                    : /clusters/{clusterName}/action/terminate<br>
+         *  &nbsp;&nbsp;&nbsp;&nbsp;HTTP Method                                 : DELETE <br>
+         *  &nbsp;&nbsp;&nbsp;&nbsp;HTTP Request Header                         : <br>
+         *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Content-type        = application/json <br>
+         *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Accept              = application/json <br>
+         *  &nbsp;&nbsp;&nbsp;&nbsp;HTTP Response Header                        : <br>
+         *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Content-type        = application/json <br>
+         *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Accept              = application/json <br>
+         *  <p> 
+         *  
+     *  @param  clusterName             Name of the cluster; Each cluster is identified w/ unique name
+     *  @throws Exception               throws Exception (TBD)
      */
     @DELETE
-	@Consumes({"application/json", "application/xml"})
-	public void deleteCluster( @PathParam("clusterName") String clusterName) throws Exception {
-		//Clusters.getInstance().changeClusterGoalState (clusterName, Clusters.GOAL_STATE_ATTIC, new Date());
-	}
+        @Consumes({"application/json", "application/xml"})
+        public void deleteCluster( @PathParam("clusterName") String clusterName) throws Exception {
+                //Clusters.getInstance().changeClusterGoalState (clusterName, Clusters.GOAL_STATE_ATTIC, new Date());
+        }
     
     /** Get the cluster state.
-     * 	<p>
-     * 	This provides the run time state of the cluster. Representative cluster state is based on the state of various services running on the cluster. <br>
-     * 	Representative cluster states: <br>
-     *  	"ACTIVE" 	: Hadoop stack is deployed on cluster nodes and required cluster services are running <br>
-     *  	"INACTIVE	: No cluster services are running. Hadoop stack may or may not be deployed on the cluster nodes <br>
-     *  	"ATTIC"		: Only cluster definition is available. No nodes are reserved for the cluster in this state.  <br>
+     *  <p>
+     *  This provides the run time state of the cluster. Representative cluster state is based on the state of various services running on the cluster. <br>
+     *  Representative cluster states: <br>
+     *          "ACTIVE"        : Hadoop stack is deployed on cluster nodes and required cluster services are running <br>
+     *          "INACTIVE       : No cluster services are running. Hadoop stack may or may not be deployed on the cluster nodes <br>
+     *          "ATTIC"         : Only cluster definition is available. No nodes are reserved for the cluster in this state.  <br>
      *  
      *  <p>
-	 *  REST:<br>
-	 *  &nbsp;&nbsp;&nbsp;&nbsp;URL Path                                    : /clusters/{clusterName}/clusterstate<br>
-	 *  &nbsp;&nbsp;&nbsp;&nbsp;HTTP Method                                 : GET <br>
-	 *  &nbsp;&nbsp;&nbsp;&nbsp;HTTP Request Header	                        : <br>
-	 *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Content-type        = application/json <br>
-	 *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Accept              = application/json <br>
-	 *  &nbsp;&nbsp;&nbsp;&nbsp;HTTP Response Header                        : <br>
-	 *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Content-type        = application/json <br>
-	 *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Accept              = application/json <br>
-	 *  <p> 
-	 *  
-     * 	@param	clusterName		Name of the cluster; Each cluster is identified w/ unique name
-     * 	@return					Returns cluster state object.
-     * 	@throws	Exception		throws Exception (TBD)	
+         *  REST:<br>
+         *  &nbsp;&nbsp;&nbsp;&nbsp;URL Path                                    : /clusters/{clusterName}/clusterstate<br>
+         *  &nbsp;&nbsp;&nbsp;&nbsp;HTTP Method                                 : GET <br>
+         *  &nbsp;&nbsp;&nbsp;&nbsp;HTTP Request Header                         : <br>
+         *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Content-type        = application/json <br>
+         *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Accept              = application/json <br>
+         *  &nbsp;&nbsp;&nbsp;&nbsp;HTTP Response Header                        : <br>
+         *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Content-type        = application/json <br>
+         *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Accept              = application/json <br>
+         *  <p> 
+         *  
+     *  @param  clusterName             Name of the cluster; Each cluster is identified w/ unique name
+     *  @return                                 Returns cluster state object.
+     *  @throws Exception               throws Exception (TBD)  
      */
     @Path(value = "/state")
     @GET
-	@Produces({"application/json", "application/xml"})
-	public ClusterState getClusterState(@PathParam("clusterName") String clusterName) throws Exception {
-		//return Clusters.getInstance().getCluster(clusterName).getCurrentState();
-    	return null;
-	}
+        @Produces({"application/json", "application/xml"})
+        public ClusterState getClusterState(@PathParam("clusterName") String clusterName) throws Exception {
+                //return Clusters.getInstance().getCluster(clusterName).getCurrentState();
+        return null;
+        }
     
     /** Get list of nodes associated with the cluster.
      *  <p>
-     *	The "alive" is a boolean variable that specify the type of nodes to return based on their state i.e. live or dead. Live nodes are the ones that are consistently heart beating with the controller. 
+     *  The "alive" is a boolean variable that specify the type of nodes to return based on their state i.e. live or dead. Live nodes are the ones that are consistently heart beating with the controller. 
      *  If both live and dead nodes are need to be returned then specify the alive parameter as null.  
-     *	<p>
-	 *  REST:<br>
-	 *  &nbsp;&nbsp;&nbsp;&nbsp;URL Path                                    : /clusters/{clusterName}/nodes<br>
-	 *  &nbsp;&nbsp;&nbsp;&nbsp;HTTP Method                                 : GET <br>
-	 *  &nbsp;&nbsp;&nbsp;&nbsp;HTTP Request Header	                        : <br>
-	 *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Content-type        = application/json <br>
-	 *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Accept              = application/json <br>
-	 *  &nbsp;&nbsp;&nbsp;&nbsp;HTTP Response Header                        : <br>
-	 *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Content-type        = application/json <br>
-	 *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Accept              = application/json <br>
-	 *  <p> 
-	 *  
-     * 	@param	clusterName		Name of the cluster; Each cluster is identified w/ unique name
-     * 	@param	roleName		Optionally specify the role name to get the nodes associated with the service role
-     * 	@param	alive			Boolean value to specify, if nodes to be returned are alive or dead or both (if alive is set to null) 
-     * 	@return					List of nodes
-     * 	@throws	Exception		throws Exception
+     *  <p>
+         *  REST:<br>
+         *  &nbsp;&nbsp;&nbsp;&nbsp;URL Path                                    : /clusters/{clusterName}/nodes<br>
+         *  &nbsp;&nbsp;&nbsp;&nbsp;HTTP Method                                 : GET <br>
+         *  &nbsp;&nbsp;&nbsp;&nbsp;HTTP Request Header                         : <br>
+         *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Content-type        = application/json <br>
+         *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Accept              = application/json <br>
+         *  &nbsp;&nbsp;&nbsp;&nbsp;HTTP Response Header                        : <br>
+         *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Content-type        = application/json <br>
+         *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Accept              = application/json <br>
+         *  <p> 
+         *  
+     *  @param  clusterName             Name of the cluster; Each cluster is identified w/ unique name
+     *  @param  roleName                Optionally specify the role name to get the nodes associated with the service role
+     *  @param  alive                   Boolean value to specify, if nodes to be returned are alive or dead or both (if alive is set to null) 
+     *  @return                                 List of nodes
+     *  @throws Exception               throws Exception
      */
     @Path(value = "/nodes")
     @GET
     @Produces({"application/json", "application/xml"})
     public List<Node> getNodes (@PathParam("clusterName") String clusterName,
-    								@DefaultValue("") @QueryParam("roleName") String roleName,
-    								@DefaultValue("true") @QueryParam("alive") Boolean alive) throws Exception {
-    	//return NodesType.getInstance().getNodes (clusterName, roleName, allocated, alive);
-    	return null;
-	}
+                                                                @DefaultValue("") @QueryParam("roleName") String roleName,
+                                                                @DefaultValue("true") @QueryParam("alive") Boolean alive) throws Exception {
+        //return NodesType.getInstance().getNodes (clusterName, roleName, allocated, alive);
+        return null;
+        }
 }

Modified: incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/rest/resources/ClustersResource.java
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/rest/resources/ClustersResource.java?rev=1174957&r1=1174956&r2=1174957&view=diff
==============================================================================
--- incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/rest/resources/ClustersResource.java (original)
+++ incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/rest/resources/ClustersResource.java Fri Sep 23 19:01:04 2011
@@ -40,8 +40,8 @@ import javax.ws.rs.core.Response;
 @Singleton
 @Path(value = "/clusters")
 public class ClustersResource {
-	
-    public ClustersResource() throws Exception {	
+        
+    public ClustersResource() throws Exception {        
         ClusterDefinition cluster123 = new ClusterDefinition();
         ClusterDefinition cluster124 = new ClusterDefinition();
         cluster123.setName("blue.dev.Cluster123");
@@ -57,85 +57,85 @@ public class ClustersResource {
     /** Get the list of clusters.
      *  <p>
      *  State: <br>
-     *  &nbsp;&nbsp;&nbsp;&nbsp;"ALL"		: All the clusters (irrespective of their state), 
-     *  &nbsp;&nbsp;&nbsp;&nbsp;"ACTIVE"	: All the active state clusters
-     *  &nbsp;&nbsp;&nbsp;&nbsp;"INACTIVE"	: All the inactive state clusters
-     *  &nbsp;&nbsp;&nbsp;&nbsp;"ATTIC"		: All the retired i.e. ATTIC state clusters
+     *  &nbsp;&nbsp;&nbsp;&nbsp;"ALL"           : All the clusters (irrespective of their state), 
+     *  &nbsp;&nbsp;&nbsp;&nbsp;"ACTIVE"        : All the active state clusters
+     *  &nbsp;&nbsp;&nbsp;&nbsp;"INACTIVE"      : All the inactive state clusters
+     *  &nbsp;&nbsp;&nbsp;&nbsp;"ATTIC"         : All the retired i.e. ATTIC state clusters
      *  
      *  <p>
-	 *  REST:<br>
-	 *  &nbsp;&nbsp;&nbsp;&nbsp;URL Path                                    : /clusters<br>
-	 *  &nbsp;&nbsp;&nbsp;&nbsp;HTTP Method                                 : GET <br>
-	 *  &nbsp;&nbsp;&nbsp;&nbsp;HTTP Request Header	                        : <br>
-	 *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Content-type        = application/json <br>
-	 *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Accept              = application/json <br>
-	 *  &nbsp;&nbsp;&nbsp;&nbsp;HTTP Response Header                        : <br>
-	 *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Content-type        = application/json <br>
-	 *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Accept              = application/json <br>
-	 *  <p> 
-	 *  
-     *  @param	state			The state of the cluster
-     *  @param	search   		Optional search expression to return list of matching clusters
-     *  @return					Returns the list of clusters based on specified state and optional search criteria.
-     *  @throws	Exception		throws Exception (TBD)
+         *  REST:<br>
+         *  &nbsp;&nbsp;&nbsp;&nbsp;URL Path                                    : /clusters<br>
+         *  &nbsp;&nbsp;&nbsp;&nbsp;HTTP Method                                 : GET <br>
+         *  &nbsp;&nbsp;&nbsp;&nbsp;HTTP Request Header                         : <br>
+         *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Content-type        = application/json <br>
+         *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Accept              = application/json <br>
+         *  &nbsp;&nbsp;&nbsp;&nbsp;HTTP Response Header                        : <br>
+         *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Content-type        = application/json <br>
+         *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Accept              = application/json <br>
+         *  <p> 
+         *  
+     *  @param  state                   The state of the cluster
+     *  @param  search                  Optional search expression to return list of matching clusters
+     *  @return                                 Returns the list of clusters based on specified state and optional search criteria.
+     *  @throws Exception               throws Exception (TBD)
      */
     @GET
     @Produces({"application/json", "application/xml"})
     public List<ClusterDefinition> getClusterList (
-    						 @DefaultValue("ALL") @QueryParam("state") String state,
-    		                 @DefaultValue("") @QueryParam("search") String search) throws Exception {
-    	List<ClusterDefinition> searchResults = null;
-    	if (!search.equals("")) {
-    		/*
-    		 * TODO: Implement search 
-    		searchResults = new ArrayList<Cluster>();
-    		for (Cluster cls : Clusters.getInstance().getClusterList(state)) {
-    			if (cls.getName().matches("^.*"+search+".*$")) {
-    				searchResults.add(cls);
-    			}
-    		}
-    		*/
-    	} else {
-    		//searchResults = Clusters.getInstance().getClusterList(state);
-    	}
+                                                 @DefaultValue("ALL") @QueryParam("state") String state,
+                                 @DefaultValue("") @QueryParam("search") String search) throws Exception {
+        List<ClusterDefinition> searchResults = null;
+        if (!search.equals("")) {
+                /*
+                 * TODO: Implement search 
+                searchResults = new ArrayList<Cluster>();
+                for (Cluster cls : Clusters.getInstance().getClusterList(state)) {
+                        if (cls.getName().matches("^.*"+search+".*$")) {
+                                searchResults.add(cls);
+                        }
+                }
+                */
+        } else {
+                //searchResults = Clusters.getInstance().getClusterList(state);
+        }
     
-    	if (searchResults.isEmpty()) {
-    		throw new WebApplicationException(Response.Status.NOT_FOUND);
-    	}
-    	
-    	return searchResults;
+        if (searchResults.isEmpty()) {
+                throw new WebApplicationException(Response.Status.NOT_FOUND);
+        }
+        
+        return searchResults;
     }
     
     /** Add new cluster definition.
-	 *  <p>
-	 *  Cluster goal state can be either "ACTIVE" or "INACTIVE". In the "INACTIVE" state, nodes specified in the 
-	 *  cluster definition will be reserved for the cluster. Although the actual deployment and starting of services 
-	 *  would begin when cluster definition is updated to be "ACTIVE"
+         *  <p>
+         *  Cluster goal state can be either "ACTIVE" or "INACTIVE". In the "INACTIVE" state, nodes specified in the 
+         *  cluster definition will be reserved for the cluster. Although the actual deployment and starting of services 
+         *  would begin when cluster definition is updated to be "ACTIVE"
      *  <p>   
      *  For cluster to be in active state cluster definition needs to be complete & valid 
      *  e.g. number of nodes associated are sufficient for each role, specified blueprint for cluster configuration
      *  should exist etc. 
      *  
      *  <p>
-	 *  REST:<br>
-	 *  &nbsp;&nbsp;&nbsp;&nbsp;URL Path                                    : /clusters/<br>
-	 *  &nbsp;&nbsp;&nbsp;&nbsp;HTTP Method                                 : POST <br>
-	 *  &nbsp;&nbsp;&nbsp;&nbsp;HTTP Request Header	                        : <br>
-	 *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Content-type        = application/json <br>
-	 *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Accept              = application/json <br>
-	 *  &nbsp;&nbsp;&nbsp;&nbsp;HTTP Response Header                        : <br>
-	 *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Content-type        = application/json <br>
-	 *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Accept              = application/json <br>
-	 *  <p> 
+         *  REST:<br>
+         *  &nbsp;&nbsp;&nbsp;&nbsp;URL Path                                    : /clusters/<br>
+         *  &nbsp;&nbsp;&nbsp;&nbsp;HTTP Method                                 : POST <br>
+         *  &nbsp;&nbsp;&nbsp;&nbsp;HTTP Request Header                         : <br>
+         *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Content-type        = application/json <br>
+         *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Accept              = application/json <br>
+         *  &nbsp;&nbsp;&nbsp;&nbsp;HTTP Response Header                        : <br>
+         *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Content-type        = application/json <br>
+         *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Accept              = application/json <br>
+         *  <p> 
      *  
-     *   @param		cluster			Definition of the cluster to be created 
-     *   @return					Returns the cluster definition 
-     *   @throws	Exception		Throws exception (TBD)
+     *   @param         cluster                 Definition of the cluster to be created 
+     *   @return                                        Returns the cluster definition 
+     *   @throws        Exception               Throws exception (TBD)
      */
     @POST
-	@Consumes({"application/json", "application/xml"})
-	public ClusterDefinition addCluster(ClusterDefinition cluster) throws Exception {
-		Clusters.getInstance().addCluster(cluster);
-		return null;
-	}
+        @Consumes({"application/json", "application/xml"})
+        public ClusterDefinition addCluster(ClusterDefinition cluster) throws Exception {
+                Clusters.getInstance().addCluster(cluster);
+                return null;
+        }
 }

Modified: incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/rest/resources/ControllerResource.java
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/rest/resources/ControllerResource.java?rev=1174957&r1=1174956&r2=1174957&view=diff
==============================================================================
--- incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/rest/resources/ControllerResource.java (original)
+++ incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/rest/resources/ControllerResource.java Fri Sep 23 19:01:04 2011
@@ -45,44 +45,44 @@ import org.apache.ambari.common.rest.ent
 import org.apache.ambari.common.rest.entities.agent.ServerStatus;
 
 /** Controller Resource represents Ambari controller.
- *	It provides API for Ambari agents to get the cluster configuration changes
- *	as well as report the node attributes and state of services running the on the 
- *	cluster nodes
+ *      It provides API for Ambari agents to get the cluster configuration changes
+ *      as well as report the node attributes and state of services running the on the 
+ *      cluster nodes
  */
 @Path(value = "/controller")
 public class ControllerResource {
-	
-	/** Update state of the node (Internal API to be used by Ambari agent).
-	 *  <p>
-	 *	This API is invoked by Ambari agent running on a cluster to update the 
-	 *	the state of various services running on the nodes. This API also registers 
-	 *	the node w/ controller (if not already done).
-	 *  <p>
-	 *  REST:<br>
-	 *  &nbsp;&nbsp;&nbsp;&nbsp;URL Path                                    : /controller/agent/{hostname}<br>
-	 *  &nbsp;&nbsp;&nbsp;&nbsp;HTTP Method                                 : PUT <br>
-	 *  &nbsp;&nbsp;&nbsp;&nbsp;HTTP Request Header	                        : <br>
-	 *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Content-type        = application/json <br>
-	 *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Accept              = application/json <br>
-	 *  &nbsp;&nbsp;&nbsp;&nbsp;HTTP Response Header                        : <br>
-	 *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Content-type        = application/json <br>
-	 *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Accept              = application/json <br>
-	 *  <p> 
-	 * 
-	 * @response.representation.200.doc This API is invoked by Ambari agent running
-	 *  on a cluster to update the state of various services running on the node.
-	 * @response.representation.200.mediaType application/json
-	 * @response.representation.500.doc Error in accepting heartbeat message
-	 * @param message Heartbeat message
-	 * @throws Exception	throws Exception
-	 */
+        
+        /** Update state of the node (Internal API to be used by Ambari agent).
+         *  <p>
+         *      This API is invoked by Ambari agent running on a cluster to update the 
+         *      the state of various services running on the nodes. This API also registers 
+         *      the node w/ controller (if not already done).
+         *  <p>
+         *  REST:<br>
+         *  &nbsp;&nbsp;&nbsp;&nbsp;URL Path                                    : /controller/agent/{hostname}<br>
+         *  &nbsp;&nbsp;&nbsp;&nbsp;HTTP Method                                 : PUT <br>
+         *  &nbsp;&nbsp;&nbsp;&nbsp;HTTP Request Header                         : <br>
+         *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Content-type        = application/json <br>
+         *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Accept              = application/json <br>
+         *  &nbsp;&nbsp;&nbsp;&nbsp;HTTP Response Header                        : <br>
+         *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Content-type        = application/json <br>
+         *  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Accept              = application/json <br>
+         *  <p> 
+         * 
+         * @response.representation.200.doc This API is invoked by Ambari agent running
+         *  on a cluster to update the state of various services running on the node.
+         * @response.representation.200.mediaType application/json
+         * @response.representation.500.doc Error in accepting heartbeat message
+         * @param message Heartbeat message
+         * @throws Exception    throws Exception
+         */
   @Path(value = "/agent/{hostname}")
   @POST
   @Consumes(MediaType.APPLICATION_JSON)
   public ControllerResponse heartbeat(HeartBeat message) {
     ControllerResponse response = new ControllerResponse();
-  	return response;
-	}
+        return response;
+        }
 
   /**
    * @response.representation.200.doc Print an example of the Ambari heartbeat message



Mime
View raw message