incubator-ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From omal...@apache.org
Subject svn commit: r1180800 - in /incubator/ambari/trunk: ./ client/src/main/java/org/apache/ambari/client/ client/src/main/java/org/apache/ambari/common/rest/entities/ controller/ controller/src/main/java/org/apache/ambari/controller/
Date Mon, 10 Oct 2011 07:25:43 GMT
Author: omalley
Date: Mon Oct 10 07:25:42 2011
New Revision: 1180800

URL: http://svn.apache.org/viewvc?rev=1180800&view=rev
Log:
AMBARI-50. Refactor the REST apis. (omalley)

Modified:
    incubator/ambari/trunk/CHANGES.txt
    incubator/ambari/trunk/client/src/main/java/org/apache/ambari/client/ClusterCreate.java
    incubator/ambari/trunk/client/src/main/java/org/apache/ambari/common/rest/entities/Blueprint.java
    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/ClusterState.java
    incubator/ambari/trunk/client/src/main/java/org/apache/ambari/common/rest/entities/Component.java
    incubator/ambari/trunk/client/src/main/java/org/apache/ambari/common/rest/entities/ConfigurationCategory.java
    incubator/ambari/trunk/client/src/main/java/org/apache/ambari/common/rest/entities/Node.java
    incubator/ambari/trunk/client/src/main/java/org/apache/ambari/common/rest/entities/NodeAttributes.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/ObjectFactory.java
    incubator/ambari/trunk/client/src/main/java/org/apache/ambari/common/rest/entities/Role.java
    incubator/ambari/trunk/controller/pom.xml
    incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/Blueprints.java
    incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/Clusters.java
    incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/Nodes.java

Modified: incubator/ambari/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/CHANGES.txt?rev=1180800&r1=1180799&r2=1180800&view=diff
==============================================================================
--- incubator/ambari/trunk/CHANGES.txt (original)
+++ incubator/ambari/trunk/CHANGES.txt Mon Oct 10 07:25:42 2011
@@ -2,6 +2,8 @@ Ambari Change log
 
 Release 0.1.0 - unreleased
 
+  AMBARI-50. Refactor the REST apis. (omalley)
+
   AMBARI-48. Move Cluster object from rest entities to controller(vgogate)
 
   AMBARI-47. Implement Cluster definition re-visioning(vgogate)
@@ -13,13 +15,15 @@ Release 0.1.0 - unreleased
 
   AMBARI-44. Implemented blueprint name and revision in heartbeat. (Eric Yang)
   
-  AMBARI-39. Bridged cluster reference gap between REST API with State machine. (Eric Yang)
+  AMBARI-39. Bridged cluster reference gap between REST API with State machine.
+  (Eric Yang)
 
   AMBARI-28. Clean up html encoded javadoc. (Eric Yang) 
 
   AMBARI-23. Renamed agent API to /agent, and public API to /rest. (Eric Yang)
 
-  AMBARI-18. Implemented special command to write configuration file. (Eric Yang)
+  AMBARI-18. Implemented special command to write configuration file. (Eric 
+  Yang)
 
   AMBARI-17. Added idle state for agent heartbeat. (Eric Yang)
 
@@ -27,21 +31,24 @@ Release 0.1.0 - unreleased
 
   AMBARI-12. Added transition state STARTING, STOPPING. (Eric Yang)
 
-  AMBARI-11. Implemented Agent to controller heartbeat communication. (Eric Yang)
+  AMBARI-11. Implemented Agent to controller heartbeat communication. (Eric 
+  Yang)
 
   AMBARI-7. Updated Jersey to 1.9 for automating wadl generation. (Eric Yang)
 
   AMBARI-3. Move HMS prototype code to branch 0.0. (Eric Yang)
 
-  AMBARI-2. Added heartbeat/controller response data model, and wadl configuration. (Eric
Yang)
+  AMBARI-2. Added heartbeat/controller response data model, and wadl 
+  configuration. (Eric Yang)
 
-  AMBARI-42. Return the latest blueprint revision if revision is not specified as query parameter.
+  AMBARI-42. Return the latest blueprint revision if revision is not specified
+  as query parameter.
 
   AMBARI-43. Change the API StateMachineInvoker.getStateMachineClusterInstance 
   to take blueprint related arguments. (ddas)
 
-  AMBARI-41. Rename the Role/Cluster/Service classes in the statemachine package to 
-  RoleFSM/ClusterFSM/ServiceFSM (ddas)
+  AMBARI-41. Rename the Role/Cluster/Service classes in the statemachine 
+  package to RoleFSM/ClusterFSM/ServiceFSM (ddas)
 
   AMBARI-37. Tidies up a bit the statemachine API and related classes (ddas)
 
@@ -53,7 +60,8 @@ Release 0.1.0 - unreleased
   AMBARI-34. Address the start cluster part of the statemachine implementation,
   and handle the heartbeat. (ddas)
 
-  AMBARI-32. Remove stack resource Remove the Stack resource from Ambari (vgogate)
+  AMBARI-32. Remove stack resource Remove the Stack resource from Ambari 
+  (vgogate)
 
   AMBARI-25. Clean up the configuration entity to collapse some levels. 
   (omalley)

Modified: incubator/ambari/trunk/client/src/main/java/org/apache/ambari/client/ClusterCreate.java
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/client/src/main/java/org/apache/ambari/client/ClusterCreate.java?rev=1180800&r1=1180799&r2=1180800&view=diff
==============================================================================
--- incubator/ambari/trunk/client/src/main/java/org/apache/ambari/client/ClusterCreate.java
(original)
+++ incubator/ambari/trunk/client/src/main/java/org/apache/ambari/client/ClusterCreate.java
Mon Oct 10 07:25:42 2011
@@ -20,6 +20,7 @@ package org.apache.ambari.client;
 import java.net.URI;
 import java.net.URL;
 import java.util.ArrayList;
+import java.util.Collections;
 import java.util.List;
 import java.util.Properties;
 
@@ -27,8 +28,7 @@ import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.UriBuilder;
 
 import org.apache.ambari.common.rest.entities.ClusterDefinition;
-import org.apache.ambari.common.rest.entities.RoleToNodesMap;
-import org.apache.ambari.common.rest.entities.RoleToNodesMapEntry;
+import org.apache.ambari.common.rest.entities.RoleToNodes;
 import org.apache.commons.cli.CommandLine;
 import org.apache.commons.cli.CommandLineParser;
 import org.apache.commons.cli.GnuParser;
@@ -61,7 +61,7 @@ public class ClusterCreate extends Comma
     String nodeRangeExpressions = null;
     
     Properties roleToNodeExpressions = null;
-    RoleToNodesMap roleToNodeMap = null;
+    List<RoleToNodes> roleToNodeMap = null;
     Boolean wait = false;
     Boolean dry_run = false;
     
@@ -205,37 +205,27 @@ public class ClusterCreate extends Comma
                 "http://localhost:4080/rest/").build();
     }
     
-    public static List<String> parseExpressionString(String exp) {
-        if (exp == null) { return null; }
-        List<String> list = new ArrayList<String>();
-        String[] result = exp.split(";");
-        for (String x: result) {
-            list.add(x.trim());
-        }
-        return list;
-    }
-    
-    public static RoleToNodesMap getRoleToNodesMap (Properties roleToNodeExpressions) {
+    public static 
+    List<RoleToNodes> getRoleToNodesMap (Properties roleToNodeExpressions) {
         if (roleToNodeExpressions == null) { return null; };
         
-        RoleToNodesMap roleToNodesMap = new RoleToNodesMap();
+        List<RoleToNodes> roleToNodesMap = new ArrayList<RoleToNodes>();
         for (String roleName : roleToNodeExpressions.stringPropertyNames()) {
-            RoleToNodesMapEntry e = new RoleToNodesMapEntry();
+            RoleToNodes e = new RoleToNodes();
             e.setRoleName(roleName);
-            e.setNodeRangeExpressions(parseExpressionString(roleToNodeExpressions.getProperty(roleName)));
-            roleToNodesMap.getRoleToNodesMapEntry().add(e);
+            e.setNodes(roleToNodeExpressions.getProperty(roleName));
+            roleToNodesMap.add(e);
         }
         return roleToNodesMap;
     }
     
-    public static void main (String[] args) {
-        String exp = " abc ; pqr ; xyz";
-        List<String> result = parseExpressionString(exp);
-        for (String x : result) {
-            System.out.println("token :<"+x+">");
-        }
+    private List<String> splitServices(String services) {
+      String[] arr = services.split(",");
+      List<String> result = new ArrayList<String>(arr.length);
+      Collections.addAll(result, arr);
+      return result;
     }
-    
+
     public void run() throws Exception {
         /* 
          * Parse the command line to get the command line arguments
@@ -250,11 +240,11 @@ public class ClusterCreate extends Comma
         ClusterDefinition clsDef = new ClusterDefinition();
         clsDef.setName(this.clusterName);
         clsDef.setBlueprintName(this.blueprint);
-        clsDef.setNodeRangeExpressions(parseExpressionString(this.nodeRangeExpressions));
+        clsDef.setNodes(this.nodeRangeExpressions);
         
         clsDef.setGoalState(this.goalState);
         clsDef.setBlueprintRevision(this.blueprint_revision);
-        clsDef.setActiveServices(parseExpressionString(this.activeServices));
+        clsDef.setActiveServices(splitServices(this.activeServices));
         clsDef.setDescription(this.description);
         clsDef.setRoleToNodesMap(getRoleToNodesMap(this.roleToNodeExpressions));
         

Modified: incubator/ambari/trunk/client/src/main/java/org/apache/ambari/common/rest/entities/Blueprint.java
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/client/src/main/java/org/apache/ambari/common/rest/entities/Blueprint.java?rev=1180800&r1=1180799&r2=1180800&view=diff
==============================================================================
--- incubator/ambari/trunk/client/src/main/java/org/apache/ambari/common/rest/entities/Blueprint.java
(original)
+++ incubator/ambari/trunk/client/src/main/java/org/apache/ambari/common/rest/entities/Blueprint.java
Mon Oct 10 07:25:42 2011
@@ -21,6 +21,7 @@ import java.util.List;
 
 import javax.xml.bind.annotation.XmlAccessType;
 import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlAttribute;
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlRootElement;
 import javax.xml.bind.annotation.XmlType;
@@ -32,36 +33,30 @@ import javax.xml.bind.annotation.XmlType
  */
 @XmlAccessorType(XmlAccessType.FIELD)
 @XmlType(name = "Blueprint", propOrder = {
-    "name",
-    "revision",
-    "parentName",
-    "parentRevision",
-    "packageRepositories",
+    "repositories",
     "configuration",
-    "components",
-    "roles"
+    "components"
 })
-@XmlRootElement(name = "Blueprints")
+@XmlRootElement
 public class Blueprint {
 
-    @XmlElement(name = "Name", required = true)
+    @XmlAttribute
     protected String name;
-    @XmlElement(name = "Revision", required = true)
+    @XmlAttribute
     protected String revision;
-    @XmlElement(name = "ParentName", required = true)
+    @XmlAttribute
     protected String parentName;
-    @XmlElement(name = "ParentRevision", required = true)
+    @XmlAttribute
     protected String parentRevision;
-    @XmlElement(name = "PackageRepositories")
-    protected List<PackageRepository> packageRepositories;
-    @XmlElement(name = "Configuration")
+
+    @XmlElement
+    protected List<RepositoryKind> repositories;
+    
+    @XmlElement
     protected Configuration configuration;
     
-    // TODO: Should component include fixed or variable set of properties?
-    @XmlElement(name = "Components")
+    @XmlElement
     protected List<Component> components;
-    @XmlElement(name = "Roles")
-    protected List<Role> roles;
     
     /**
      * @return the name
@@ -115,15 +110,15 @@ public class Blueprint {
     /**
      * @return the packageRepositories
      */
-    public List<PackageRepository> getPackageRepositories() {
-            return packageRepositories;
+    public List<RepositoryKind> getPackageRepositories() {
+            return repositories;
     }
     /**
      * @param packageRepositories the packageRepositories to set
      */
     public void setPackageRepositories(
-                    List<PackageRepository> packageRepositories) {
-            this.packageRepositories = packageRepositories;
+                    List<RepositoryKind> value) {
+            this.repositories = value;
     }
     /**
      * @return the configuration
@@ -149,17 +144,5 @@ public class Blueprint {
     public void setComponents(List<Component> components) {
             this.components = components;
     }
-    /**
-     * @return the roles
-     */
-    public List<Role> getRoles() {
-            return roles;
-    }
-    /**
-     * @param roles the roles to set
-     */
-    public void setRoles(List<Role> roles) {
-            this.roles = roles;
-    }
 
 }

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=1180800&r1=1180799&r2=1180800&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
Mon Oct 10 07:25:42 2011
@@ -21,6 +21,7 @@ import java.util.List;
 
 import javax.xml.bind.annotation.XmlAccessType;
 import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlAttribute;
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlRootElement;
 import javax.xml.bind.annotation.XmlType;
@@ -33,38 +34,33 @@ import javax.xml.bind.annotation.XmlType
  */
 @XmlAccessorType(XmlAccessType.FIELD)
 @XmlType(name = "ClusterDefinition", propOrder = {
-    "name",
-    "description",
-    "blueprintName",
-    "blueprintRevision",
-    "goalState",
     "activeServices",
-    "nodeRangeExpressions",
     "roleToNodesMap"
 })
-@XmlRootElement(name = "ClusterDefinitions")
+@XmlRootElement(name = "Cluster")
 public class ClusterDefinition {
         
     public static final String GOAL_STATE_ACTIVE = "ACTIVE";
     public static final String GOAL_STATE_INACTIVE = "INACTIVE";
     public static final String GOAL_STATE_ATTIC = "ATTIC";
    
-    @XmlElement(name = "Name", required = true)
+    @XmlAttribute
     protected String name = null;
-    @XmlElement(name = "Description")
+    @XmlAttribute
     protected String description = null;
-    @XmlElement(name = "BlueprintName")
+    @XmlAttribute
     protected String blueprintName = null;
-    @XmlElement(name = "BlueprintRevision")
+    @XmlAttribute
     protected String blueprintRevision = null;
-    @XmlElement(name = "GoalState")
+    @XmlAttribute
     protected String goalState = null;
-    @XmlElement(name = "ActiveServices")
+    @XmlElement
     protected List<String> activeServices = null;
-    @XmlElement(name = "NodeRangeExpressions")
-    protected List<String> nodeRangeExpressions = null;
-    @XmlElement(name = "RoleToNodesMap")
-    protected RoleToNodesMap roleToNodesMap = null;
+    @XmlAttribute
+    protected String nodes = null;
+
+    @XmlElement
+    protected List<RoleToNodes> roleToNodesMap = null;
     
     
     /**
@@ -154,28 +150,28 @@ public class ClusterDefinition {
     /**
      * @return the nodeRangeExpressions
      */
-    public List<String> getNodeRangeExpressions() {
-            return nodeRangeExpressions;
+    public String getNodes() {
+            return nodes;
     }
 
     /**
      * @param nodeRangeExpressions the nodeRangeExpressions to set
      */
-    public void setNodeRangeExpressions(List<String> nodeRangeExpressions) {
-            this.nodeRangeExpressions = nodeRangeExpressions;
+    public void setNodes(String nodeRangeExpressions) {
+            this.nodes = nodeRangeExpressions;
     }
 
     /**
      * @return the roleToNodesMap
      */
-    public RoleToNodesMap getRoleToNodesMap() {
+    public List<RoleToNodes> getRoleToNodes() {
             return roleToNodesMap;
     }
 
     /**
      * @param roleToNodesMap the roleToNodesMap to set
      */
-    public void setRoleToNodesMap(RoleToNodesMap roleToNodesMap) {
+    public void setRoleToNodesMap(List<RoleToNodes> roleToNodesMap) {
             this.roleToNodesMap = roleToNodesMap;
     }
 }

Modified: incubator/ambari/trunk/client/src/main/java/org/apache/ambari/common/rest/entities/ClusterState.java
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/client/src/main/java/org/apache/ambari/common/rest/entities/ClusterState.java?rev=1180800&r1=1180799&r2=1180800&view=diff
==============================================================================
--- incubator/ambari/trunk/client/src/main/java/org/apache/ambari/common/rest/entities/ClusterState.java
(original)
+++ incubator/ambari/trunk/client/src/main/java/org/apache/ambari/common/rest/entities/ClusterState.java
Mon Oct 10 07:25:42 2011
@@ -19,14 +19,12 @@ package org.apache.ambari.common.rest.en
 
 import java.util.Date;
 import java.util.GregorianCalendar;
-import java.util.List;
 
 import javax.xml.bind.annotation.XmlAccessType;
 import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlAttribute;
 import javax.xml.bind.annotation.XmlRootElement;
 import javax.xml.bind.annotation.XmlSchemaType;
-import javax.xml.bind.annotation.XmlType;
 import javax.xml.datatype.DatatypeFactory;
 import javax.xml.datatype.XMLGregorianCalendar;
 
@@ -36,13 +34,7 @@ import javax.xml.datatype.XMLGregorianCa
  * 
  */
 @XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "ClusterType", propOrder = {
-    "state",
-    "creationTime",
-    "deployTime",
-    "lastUpdateTime"
-})
-@XmlRootElement(name = "ClusterState")
+@XmlRootElement
 public class ClusterState {
         
     /*
@@ -61,15 +53,15 @@ public class ClusterState {
      */
     public static final String CLUSTER_STATE_ATTIC = "ATTIC";
     
-    @XmlElement(name = "State", required = true)
+    @XmlAttribute(required = true)
     protected String state;
-    @XmlElement(name = "CreationTime", required = true)
+    @XmlAttribute(required = true)
     @XmlSchemaType(name = "dateTime")
     protected XMLGregorianCalendar creationTime;
-    @XmlElement(name = "DeployTime")
+    @XmlAttribute
     @XmlSchemaType(name = "dateTime")
     protected XMLGregorianCalendar deployTime;
-    @XmlElement(name = "LastUpdateTime", required = true)
+    @XmlAttribute
     @XmlSchemaType(name = "dateTime")
     protected XMLGregorianCalendar lastUpdateTime;
 

Modified: incubator/ambari/trunk/client/src/main/java/org/apache/ambari/common/rest/entities/Component.java
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/client/src/main/java/org/apache/ambari/common/rest/entities/Component.java?rev=1180800&r1=1180799&r2=1180800&view=diff
==============================================================================
--- incubator/ambari/trunk/client/src/main/java/org/apache/ambari/common/rest/entities/Component.java
(original)
+++ incubator/ambari/trunk/client/src/main/java/org/apache/ambari/common/rest/entities/Component.java
Mon Oct 10 07:25:42 2011
@@ -17,10 +17,10 @@
  */
 package org.apache.ambari.common.rest.entities;
 
-import java.util.ArrayList;
 import java.util.List;
 import javax.xml.bind.annotation.XmlAccessType;
 import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlAttribute;
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlRootElement;
 import javax.xml.bind.annotation.XmlType;
@@ -32,16 +32,24 @@ import javax.xml.bind.annotation.XmlType
  */
 @XmlAccessorType(XmlAccessType.FIELD)
 @XmlType(name = "CategoryType", propOrder = {
-    "name",
-    "property"
+    "definition",
+    "roles"
 })
-@XmlRootElement(name = "Components")
+@XmlRootElement
 public class Component {
 
-    @XmlElement(name = "Name", required = true)
+    @XmlAttribute(required = true)
     protected String name;
-    @XmlElement(name = "Properties", required = true)
-    protected List<Property> property;
+    @XmlAttribute
+    protected String architecture;
+    @XmlAttribute
+    protected String version;
+    @XmlAttribute
+    protected String provider;
+    @XmlElement
+    protected ComponentDefinition definition;
+    @XmlElement
+    protected List<Role> roles;
 
     /**
      * Gets the value of the name property.
@@ -68,32 +76,82 @@ public class Component {
     }
 
     /**
-     * Gets the value of the property property.
-     * 
-     * <p>
-     * This accessor method returns a reference to the live list,
-     * not a snapshot. Therefore any modification you make to the
-     * returned list will be present inside the JAXB object.
-     * This is why there is not a <CODE>set</CODE> method for the property property.
-     * 
-     * <p>
-     * For example, to add a new item, do as follows:
-     * <pre>
-     *    getProperty().add(newItem);
-     * </pre>
-     * 
-     * 
-     * <p>
-     * Objects of the following type(s) are allowed in the list
-     * {@link Property }
-     * 
-     * 
+     * Get the roles property
+     * @return the custom configuration for the component
+     */
+    public List<Role> getRoles() {
+      return roles;
+    }
+    
+    /**
+     * Set the roles property
+     * @param roles
+     */
+    public void setRoles(List<Role> roles) {
+      this.roles = roles;
+    }
+
+    /**
+     * Get the architecture of the package to install.
+     * @return the name of the architecture.
+     */
+    public String getArchitecture() {
+      return architecture;
+    }
+    
+    /**
+     * Set the architecture of the package to install.
+     * @param value the new architecture
+     */
+    public void setArchitecture(String value) {
+      architecture = value;
+    }
+    
+    /**
+     * Get the name of the component definition
+     * @return the component definition name
+     */
+    public ComponentDefinition getDefinition() {
+      return definition;
+    }
+    
+    /**
+     * Set the name of the component definition
+     * @param value the new name
      */
-    public List<Property> getProperty() {
-        if (property == null) {
-            property = new ArrayList<Property>();
-        }
-        return this.property;
+    public void setDefinition(ComponentDefinition value) {
+      definition = value;
     }
 
+    /**
+     * Get the version of the package to install
+     * @return the version string
+     */
+    public String getVersion() {
+      return version;
+    }
+    
+    /**
+     * Set the version of the package to install
+     * @param version the new version
+     */
+    public void setVersion(String version) {
+      this.version = version;
+    }
+    
+    /**
+     * Get the provider of the package to install
+     * @return the provider name
+     */
+    public String getProvider() {
+      return provider;
+    }
+    
+    /**
+     * Set the provider of the package to install
+     * @param value the new provider
+     */
+    public void setProvider(String value) {
+      provider = value;
+    }
 }

Modified: incubator/ambari/trunk/client/src/main/java/org/apache/ambari/common/rest/entities/ConfigurationCategory.java
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/client/src/main/java/org/apache/ambari/common/rest/entities/ConfigurationCategory.java?rev=1180800&r1=1180799&r2=1180800&view=diff
==============================================================================
--- incubator/ambari/trunk/client/src/main/java/org/apache/ambari/common/rest/entities/ConfigurationCategory.java
(original)
+++ incubator/ambari/trunk/client/src/main/java/org/apache/ambari/common/rest/entities/ConfigurationCategory.java
Mon Oct 10 07:25:42 2011
@@ -34,7 +34,6 @@ import javax.xml.bind.annotation.XmlType
  */
 @XmlAccessorType(XmlAccessType.FIELD)
 @XmlType(name = "ConfigurationCategory", propOrder = {
-    "name",
     "property"
 })
 @XmlRootElement(name = "ConfigurationCategory")

Modified: incubator/ambari/trunk/client/src/main/java/org/apache/ambari/common/rest/entities/Node.java
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/client/src/main/java/org/apache/ambari/common/rest/entities/Node.java?rev=1180800&r1=1180799&r2=1180800&view=diff
==============================================================================
--- incubator/ambari/trunk/client/src/main/java/org/apache/ambari/common/rest/entities/Node.java
(original)
+++ incubator/ambari/trunk/client/src/main/java/org/apache/ambari/common/rest/entities/Node.java
Mon Oct 10 07:25:42 2011
@@ -17,10 +17,9 @@
  */
 package org.apache.ambari.common.rest.entities;
 
-import java.util.Date;
-
 import javax.xml.bind.annotation.XmlAccessType;
 import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlAttribute;
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlRootElement;
 import javax.xml.bind.annotation.XmlType;
@@ -31,14 +30,13 @@ import javax.xml.bind.annotation.XmlType
  */
 @XmlAccessorType(XmlAccessType.FIELD)
 @XmlType(name = "Node", propOrder = {
-    "name",
     "nodeAttributes",
     "nodeState"
 })
 @XmlRootElement(name = "Nodes")
 public class Node {
     
-    @XmlElement(name = "Name", required = true)
+    @XmlAttribute(required = true)
     protected String name;
     @XmlElement(name = "NodeAttributes")
     protected NodeAttributes nodeAttributes;

Modified: incubator/ambari/trunk/client/src/main/java/org/apache/ambari/common/rest/entities/NodeAttributes.java
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/client/src/main/java/org/apache/ambari/common/rest/entities/NodeAttributes.java?rev=1180800&r1=1180799&r2=1180800&view=diff
==============================================================================
--- incubator/ambari/trunk/client/src/main/java/org/apache/ambari/common/rest/entities/NodeAttributes.java
(original)
+++ incubator/ambari/trunk/client/src/main/java/org/apache/ambari/common/rest/entities/NodeAttributes.java
Mon Oct 10 07:25:42 2011
@@ -19,36 +19,26 @@ package org.apache.ambari.common.rest.en
 
 import javax.xml.bind.annotation.XmlAccessType;
 import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlType;
-
+import javax.xml.bind.annotation.XmlAttribute;
 
 /**
  * <p>Java class for NodeMetricsType complex type. 
  * 
  */
 @XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "NodeMetricsType", propOrder = {
-    "cpuType",
-    "cpuUnits",
-    "cpuCores",
-    "ramInGB",
-    "diskSizeInGB",
-    "diskUnits"
-})
 public class NodeAttributes {
 
-    @XmlElement(name = "CPU_Type", required = true)
+    @XmlAttribute
     protected String cpuType;
-    @XmlElement(name = "CPU_Units")
+    @XmlAttribute
     protected short cpuUnits;
-    @XmlElement(name = "CPU_Cores")
+    @XmlAttribute
     protected short cpuCores;
-    @XmlElement(name = "RAM_InGB")
+    @XmlAttribute
     protected long ramInGB;
-    @XmlElement(name = "DISK_SizeInGB")
+    @XmlAttribute
     protected long diskSizeInGB;
-    @XmlElement(name = "DISK_Units")
+    @XmlAttribute
     protected short diskUnits;
 
     /**

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=1180800&r1=1180799&r2=1180800&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
Mon Oct 10 07:25:42 2011
@@ -17,10 +17,8 @@
  */
 package org.apache.ambari.common.rest.entities;
 
-import java.util.ArrayList;
 import java.util.Date;
 import java.util.GregorianCalendar;
-import java.util.List;
 import javax.xml.bind.annotation.XmlAccessType;
 import javax.xml.bind.annotation.XmlAccessorType;
 import javax.xml.bind.annotation.XmlElement;

Modified: incubator/ambari/trunk/client/src/main/java/org/apache/ambari/common/rest/entities/ObjectFactory.java
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/client/src/main/java/org/apache/ambari/common/rest/entities/ObjectFactory.java?rev=1180800&r1=1180799&r2=1180800&view=diff
==============================================================================
--- incubator/ambari/trunk/client/src/main/java/org/apache/ambari/common/rest/entities/ObjectFactory.java
(original)
+++ incubator/ambari/trunk/client/src/main/java/org/apache/ambari/common/rest/entities/ObjectFactory.java
Mon Oct 10 07:25:42 2011
@@ -60,22 +60,6 @@ public class ObjectFactory {
     }
 
     /**
-     * Create an instance of {@link Roles }
-     * 
-     */
-    public Roles createRolesType() {
-        return new Roles();
-    }
-
-    /**
-     * Create an instance of {@link RoleToNodesMap }
-     * 
-     */
-    public RoleToNodesMap createRoleToNodesMapType() {
-        return new RoleToNodesMap();
-    }
-
-    /**
      * Create an instance of {@link Role }
      * 
      */
@@ -84,11 +68,11 @@ public class ObjectFactory {
     }
 
     /**
-     * Create an instance of {@link RoleToNodesMapEntry }
+     * Create an instance of {@link RoleToNodes }
      * 
      */
-    public RoleToNodesMapEntry createRoleToNodesMapEntryType() {
-        return new RoleToNodesMapEntry();
+    public RoleToNodes createRoleToNodesMapEntryType() {
+        return new RoleToNodes();
     }
 
     /**
@@ -100,11 +84,11 @@ public class ObjectFactory {
     }
 
     /**
-     * Create an instance of {@link PackageRepository }
+     * Create an instance of {@link RepositoryKind }
      * 
      */
-    public PackageRepository createPackageType() {
-        return new PackageRepository();
+    public RepositoryKind createPackageType() {
+        return new RepositoryKind();
     }
 
     /**

Modified: incubator/ambari/trunk/client/src/main/java/org/apache/ambari/common/rest/entities/Role.java
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/client/src/main/java/org/apache/ambari/common/rest/entities/Role.java?rev=1180800&r1=1180799&r2=1180800&view=diff
==============================================================================
--- incubator/ambari/trunk/client/src/main/java/org/apache/ambari/common/rest/entities/Role.java
(original)
+++ incubator/ambari/trunk/client/src/main/java/org/apache/ambari/common/rest/entities/Role.java
Mon Oct 10 07:25:42 2011
@@ -19,6 +19,7 @@ package org.apache.ambari.common.rest.en
 
 import javax.xml.bind.annotation.XmlAccessType;
 import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlAttribute;
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlRootElement;
 import javax.xml.bind.annotation.XmlType;
@@ -29,12 +30,12 @@ import javax.xml.bind.annotation.XmlType
     "name",
     "configuration"
 })
-@XmlRootElement(name = "Roles")
+@XmlRootElement
 public class Role {
 
-    @XmlElement(name = "Name", required = true)
+    @XmlAttribute(required = true)
     protected String name;
-    @XmlElement(name = "Configuration", required = true)
+    @XmlElement(required = true)
     protected Configuration configuration;
 
     /**

Modified: incubator/ambari/trunk/controller/pom.xml
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/controller/pom.xml?rev=1180800&r1=1180799&r2=1180800&view=diff
==============================================================================
--- incubator/ambari/trunk/controller/pom.xml (original)
+++ incubator/ambari/trunk/controller/pom.xml Mon Oct 10 07:25:42 2011
@@ -115,6 +115,9 @@
               </execution>
             </executions>
           </plugin>
+          <plugin>
+            <artifactId>maven-assembly-plugin</artifactId>
+          </plugin>
       </plugins>
     </build>
     <pluginRepositories>

Modified: incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/Blueprints.java
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/Blueprints.java?rev=1180800&r1=1180799&r2=1180800&view=diff
==============================================================================
--- incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/Blueprints.java
(original)
+++ incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/Blueprints.java
Mon Oct 10 07:25:42 2011
@@ -27,7 +27,6 @@ import java.net.URL;
 import java.nio.charset.Charset;
 import java.util.ArrayList;
 import java.util.Arrays;
-import java.util.Collections;
 import java.util.List;
 import java.util.concurrent.ConcurrentHashMap;
 
@@ -38,7 +37,7 @@ import org.apache.ambari.common.rest.ent
 import org.apache.ambari.common.rest.entities.Component;
 import org.apache.ambari.common.rest.entities.Configuration;
 import org.apache.ambari.common.rest.entities.ConfigurationCategory;
-import org.apache.ambari.common.rest.entities.PackageRepository;
+import org.apache.ambari.common.rest.entities.RepositoryKind;
 import org.apache.ambari.common.rest.entities.Property;
 import org.apache.ambari.common.rest.entities.Role;
 import org.apache.ambari.resource.statemachine.ClusterStateFSM;
@@ -60,20 +59,21 @@ public class Blueprints {
         bp.setParentRevision("0");
  
         Component hdfsC = new Component(); hdfsC.setName("hdfs");
-        hdfsC.getProperty().add(getProperty ("dfs.name.dir", "${HADOOP_NN_DIR}"));
-        hdfsC.getProperty().add(getProperty ("dfs.data.dir", "${HADOOP_DATA_DIR}"));
-        Component mapredC = new Component(); mapredC.setName("hdfs");
-        mapredC.getProperty().add(getProperty ("mapred.system.dir", "/mapred/mapredsystem"));
-        mapredC.getProperty().add(getProperty ("mapred.local.dir", "${HADOOP_MAPRED_DIR}"));
-        List<Component> compList = new ArrayList();
+        hdfsC.setArchitecture("x86_64");
+        hdfsC.setVersion("0.20.205.0");
+        Component mapredC = new Component(); mapredC.setName("mapred");
+        mapredC.setVersion("0.20.205.1");
+        List<Component> compList = new ArrayList<Component>();
         compList.add(mapredC);
         compList.add(hdfsC);
         bp.setComponents(compList);
         
-        List<PackageRepository> prList = new ArrayList<PackageRepository>();
-        PackageRepository pr = new PackageRepository();
-        pr.setLocationURL("http://localhost/~vgogate/ambari");
-        pr.setType("RPM");  
+        List<RepositoryKind> prList = new ArrayList<RepositoryKind>();
+        RepositoryKind pr = new RepositoryKind();
+        ArrayList<String> list = new ArrayList<String>();
+        list.add("http://localhost/~vgogate/ambari");
+        pr.setUrls(list);
+        pr.setKind("RPM");  
         bp.setPackageRepositories(prList);
         
         Configuration bpDefaultCfg = new Configuration();
@@ -107,7 +107,7 @@ public class Blueprints {
         roleList.add(mapred_jt_role);
         roleList.add(slaves_role);
         
-        bp.setRoles(roleList);
+        mapredC.setRoles(roleList);
         
         ConcurrentHashMap<Integer, Blueprint> x = new ConcurrentHashMap<Integer,
Blueprint>();
         x.put(new Integer(bp.getRevision()), bp);

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=1180800&r1=1180799&r2=1180800&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
Mon Oct 10 07:25:42 2011
@@ -17,12 +17,9 @@
  */
 package org.apache.ambari.controller;
 
-import java.io.ByteArrayOutputStream;
-import java.io.File;
 import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
-import java.util.Map;
 import java.util.StringTokenizer;
 import java.util.UUID;
 import java.util.concurrent.ConcurrentHashMap;
@@ -33,12 +30,9 @@ import javax.ws.rs.core.Response;
 import org.apache.ambari.common.rest.entities.ClusterDefinition;
 import org.apache.ambari.common.rest.entities.ClusterState;
 import org.apache.ambari.common.rest.entities.Node;
-import org.apache.ambari.common.rest.entities.RoleToNodesMap;
-import org.apache.ambari.common.rest.entities.RoleToNodesMapEntry;
+import org.apache.ambari.common.rest.entities.RoleToNodes;
 import org.apache.ambari.common.util.ExceptionUtil;
-import org.apache.ambari.resource.statemachine.ClusterFSM;
 import org.apache.ambari.resource.statemachine.StateMachineInvoker;
-import org.codehaus.jackson.map.ObjectMapper;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
@@ -80,40 +74,27 @@ public class Clusters {
         activeServices.add("mapred");
         cluster123.setActiveServices(activeServices);
         
-        List<String> nodeRangeExpressions = new ArrayList<String>();
-        String nodes1 = "jt-nodex";
-        String nodes2 = "nn-nodex";
-        String nodes3 = "hostname-1x hostname-2x hostname-3x hostname-4x";
-        String nodes4 = "node-2x node-3x node-4x";  
-        nodeRangeExpressions.add(nodes1);
-        nodeRangeExpressions.add(nodes2);
-        nodeRangeExpressions.add(nodes3);
-        nodeRangeExpressions.add(nodes4);    
-        cluster123.setNodeRangeExpressions(nodeRangeExpressions);
+        String nodes = "jt-nodex,nn-nodex,hostname-1x,hostname-2x,hostname-3x,"+
+                       "hostname-4x,node-2x,node-3x,node-4x";  
+        cluster123.setNodes(nodes);
         
-        RoleToNodesMap rnm = new RoleToNodesMap();
+        List<RoleToNodes> rnm = new ArrayList<RoleToNodes>();
         
-        RoleToNodesMapEntry rnme = new RoleToNodesMapEntry();
+        RoleToNodes rnme = new RoleToNodes();
         rnme.setRoleName("jobtracker-role");
-        nodeRangeExpressions = new ArrayList<String>();
-        nodeRangeExpressions.add(nodes1);
-        rnme.setNodeRangeExpressions(nodeRangeExpressions);
-        rnm.getRoleToNodesMapEntry().add(rnme);
+        rnme.setNodes("jt-nodex");
+        rnm.add(rnme);
         
-        rnme = new RoleToNodesMapEntry();
+        rnme = new RoleToNodes();
         rnme.setRoleName("namenode-role");
-        nodeRangeExpressions = new ArrayList<String>();
-        nodeRangeExpressions.add(nodes2);
-        rnme.setNodeRangeExpressions(nodeRangeExpressions);
-        rnm.getRoleToNodesMapEntry().add(rnme);
+        rnme.setNodes("nn-nodex");
+        rnm.add(rnme);
         
-        rnme = new RoleToNodesMapEntry();
+        rnme = new RoleToNodes();
         rnme.setRoleName("slaves-role");
-        nodeRangeExpressions = new ArrayList<String>();
-        nodeRangeExpressions.add(nodes3);
-        nodeRangeExpressions.add(nodes4);
-        rnme.setNodeRangeExpressions(nodeRangeExpressions);
-        rnm.getRoleToNodesMapEntry().add(rnme);
+        rnme.setNodes("hostname-1x,hostname-2x,hostname-3x,"+
+                       "hostname-4x,node-2x,node-3x,node-4x");
+        rnm.add(rnme);
         
         cluster123.setRoleToNodesMap(rnm);
         /*
@@ -141,40 +122,27 @@ public class Clusters {
         activeServices.add("mapred");
         cluster124.setActiveServices(activeServices);
         
-        nodeRangeExpressions = new ArrayList<String>();
-        nodes1 = "jt-node";
-        nodes2 = "nn-node";
-        nodes3 = "hostname-1 hostname-2 hostname-3 hostname-4";
-        nodes4 = "node-2 node-3 node-4";  
-        nodeRangeExpressions.add(nodes1);
-        nodeRangeExpressions.add(nodes2);
-        nodeRangeExpressions.add(nodes3);
-        nodeRangeExpressions.add(nodes4);    
-        cluster124.setNodeRangeExpressions(nodeRangeExpressions);
+        nodes = "jt-node,nn-node,hostname-1,hostname-2,hostname-3,hostname-4,"+
+                "node-2,node-3,node-4";  
+        cluster124.setNodes(nodes);
         
-        rnm = new RoleToNodesMap();
+        rnm = new ArrayList<RoleToNodes>();
         
-        rnme = new RoleToNodesMapEntry();
+        rnme = new RoleToNodes();
         rnme.setRoleName("jobtracker-role");
-        nodeRangeExpressions = new ArrayList<String>();
-        nodeRangeExpressions.add(nodes1);
-        rnme.setNodeRangeExpressions(nodeRangeExpressions);
-        rnm.getRoleToNodesMapEntry().add(rnme);
+        rnme.setNodes("jt-node");
+        rnm.add(rnme);
         
-        rnme = new RoleToNodesMapEntry();
+        rnme = new RoleToNodes();
         rnme.setRoleName("namenode-role");
-        nodeRangeExpressions = new ArrayList<String>();
-        nodeRangeExpressions.add(nodes2);
-        rnme.setNodeRangeExpressions(nodeRangeExpressions);
-        rnm.getRoleToNodesMapEntry().add(rnme);
+        rnme.setNodes("nn-node");
+        rnm.add(rnme);
         
-        rnme = new RoleToNodesMapEntry();
+        rnme = new RoleToNodes();
         rnme.setRoleName("slaves-role");
-        nodeRangeExpressions = new ArrayList<String>();
-        nodeRangeExpressions.add(nodes3);
-        nodeRangeExpressions.add(nodes4);
-        rnme.setNodeRangeExpressions(nodeRangeExpressions);
-        rnm.getRoleToNodesMapEntry().add(rnme);
+        rnme.setNodes("hostname-1,hostname-2,hostname-3,hostname-4,"+
+                      "node-2,node-3,node-4");
+        rnm.add(rnme);
         
         cluster124.setRoleToNodesMap(rnm);
         
@@ -248,7 +216,7 @@ public class Clusters {
             /*
              * Update cluster nodes reservation. 
              */
-            if (cdef.getNodeRangeExpressions() != null) {
+            if (cdef.getNodes() != null) {
                 updateClusterNodesReservation (cls.getID(), cdef);
             }
             
@@ -259,8 +227,8 @@ public class Clusters {
              * If RoleToNodes map is not specified then derive it based on the node attributes

              *  
              */
-            if (cdef.getRoleToNodesMap() != null) {
-                updateNodeToRolesAssociation(cdef.getNodeRangeExpressions(), cdef.getRoleToNodesMap());
+            if (cdef.getRoleToNodes() != null) {
+                updateNodeToRolesAssociation(cdef.getNodes(), cdef.getRoleToNodes());
             } else {
                 /*
                  * TODO: Derive the role to nodes map based on nodes attributes
@@ -295,7 +263,7 @@ public class Clusters {
      */
     private synchronized void updateClusterNodesReservation (String clusterID, ClusterDefinition
clsDef) throws Exception {
                 
-        List<String> nodeRangeExpressions = clsDef.getNodeRangeExpressions();
+        String nodeRangeExpressions = clsDef.getNodes();
         
         ConcurrentHashMap<String, Node> all_nodes = Nodes.getInstance().getNodes();
         List<String> cluster_node_range = new ArrayList<String>();
@@ -304,9 +272,9 @@ public class Clusters {
         /*
          * Check if all the nodes explicitly specified in the RoleToNodesMap belong the cluster
node range specified 
          */
-        if (clsDef.getRoleToNodesMap() != null) {
+        if (clsDef.getRoleToNodes() != null) {
             List<String> nodes_specified_using_role_association = new ArrayList<String>();
-            for (RoleToNodesMapEntry e : clsDef.getRoleToNodesMap().getRoleToNodesMapEntry())
{
+            for (RoleToNodes e : clsDef.getRoleToNodes()) {
                 List<String> hosts = getHostnamesFromRangeExpressions(e.getNodeRangeExpressions());
                 nodes_specified_using_role_association.addAll(hosts);
                 // TODO: Remove any duplicate nodes from nodes_specified_using_role_association
@@ -400,7 +368,7 @@ public class Clusters {
         }
     }
 
-    private synchronized void updateNodeToRolesAssociation (List<String> nodeRangeExpressions,
RoleToNodesMap roleToNodesMap) throws Exception {
+    private synchronized void updateNodeToRolesAssociation (String nodeRangeExpressions,
List<RoleToNodes> roleToNodesMap) throws Exception {
         /*
          * Associate roles list with node
          */
@@ -412,7 +380,7 @@ public class Clusters {
          * Add list of roles to Node
          * If node is not explicitly associated with any role then assign it w/ default role
          */
-        for (RoleToNodesMapEntry e : roleToNodesMap.getRoleToNodesMapEntry()) {
+        for (RoleToNodes e : roleToNodesMap) {
             List<String> hosts = getHostnamesFromRangeExpressions(e.getNodeRangeExpressions());
             for (String host : hosts) {
               if (Nodes.getInstance().getNodes().get(host).getNodeState().getNodeRoleNames()
== null) {
@@ -499,15 +467,15 @@ public class Clusters {
              * TODO: What if controller is crashed after updateClusterNodesReservation 
              * before updating and adding new revision of cluster definition?
              */
-            if (c.getNodeRangeExpressions() != null) {
-                newcd.setNodeRangeExpressions(c.getNodeRangeExpressions());
+            if (c.getNodes() != null) {
+                newcd.setNodes(c.getNodes());
                 updateClusterNodesReservation (cls.getID(), c);
             } else {
-                newcd.setNodeRangeExpressions(cls.getLatestClusterDefinition().getNodeRangeExpressions());
+                newcd.setNodes(cls.getLatestClusterDefinition().getNodes());
             }
-            if (c.getRoleToNodesMap() != null) {
-                newcd.setRoleToNodesMap(c.getRoleToNodesMap());
-                updateNodeToRolesAssociation(newcd.getNodeRangeExpressions(), c.getRoleToNodesMap());
+            if (c.getRoleToNodes() != null) {
+                newcd.setRoleToNodesMap(c.getRoleToNodes());
+                updateNodeToRolesAssociation(newcd.getNodes(), c.getRoleToNodes());
             }  
             
             /*
@@ -678,13 +646,11 @@ public class Clusters {
    * TODO: Implement proper range expression
    * TODO: Remove any duplicate nodes from the derived list
    */
-  public List<String> getHostnamesFromRangeExpressions (List<String> nodeRangeExpressions)
throws Exception {
+  public List<String> getHostnamesFromRangeExpressions (String nodeRangeExpression)
throws Exception {
       List<String> list = new ArrayList<String>();
-      for (String nodeRangeExpression : nodeRangeExpressions) {
-        StringTokenizer st = new StringTokenizer(nodeRangeExpression);
-        while (st.hasMoreTokens()) {
-            list.add(st.nextToken());
-        }
+      StringTokenizer st = new StringTokenizer(nodeRangeExpression, ",");
+      while (st.hasMoreTokens()) {
+        list.add(st.nextToken());
       }
       return list;
   }

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=1180800&r1=1180799&r2=1180800&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
Mon Oct 10 07:25:42 2011
@@ -41,7 +41,7 @@ import javax.xml.datatype.XMLGregorianCa
 
 import org.apache.ambari.common.rest.entities.ClusterDefinition;
 import org.apache.ambari.common.rest.entities.Node;
-import org.apache.ambari.common.rest.entities.RoleToNodesMapEntry;
+import org.apache.ambari.common.rest.entities.RoleToNodes;
 
 
 public class Nodes {
@@ -80,11 +80,11 @@ public class Nodes {
     public List<Node> getClusterNodes (String clusterName, String roleName, boolean
alive) throws Exception {
         List<Node> list = new ArrayList<Node>();
         ClusterDefinition c = Clusters.getInstance().getClusterDefinition(clusterName);
-        if (c.getNodeRangeExpressions() == null) {
+        if (c.getNodes() == null) {
             String msg = "No nodes are reserved for the cluster. Typically cluster in ATTIC
state does not have any nodes reserved";
             throw new WebApplicationException((new ExceptionResponse(msg, Response.Status.NO_CONTENT)).get());
         }
-        List<String> hosts = Clusters.getInstance().getHostnamesFromRangeExpressions(c.getNodeRangeExpressions());
+        List<String> hosts = Clusters.getInstance().getHostnamesFromRangeExpressions(c.getNodes());
         for (String host : hosts) {
             if (!this.nodes.containsKey(host)) {
                 String msg = "Node ["+host+"] is expected to be registered w/ controller
but not locatable";



Mime
View raw message