You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by vg...@apache.org on 2011/10/27 01:06:38 UTC
svn commit: r1189525 - in /incubator/ambari/trunk:
client/src/main/java/org/apache/ambari/client/
client/src/main/java/org/apache/ambari/common/rest/entities/
controller/src/main/java/org/apache/ambari/controller/
controller/src/main/java/org/apache/am...
Author: vgogate
Date: Wed Oct 26 23:06:37 2011
New Revision: 1189525
URL: http://svn.apache.org/viewvc?rev=1189525&view=rev
Log:
AMBARI-108
Added:
incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/Stacks.java
- copied, changed from r1189517, incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/Blueprints.java
incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/rest/resources/StackResource.java
- copied, changed from r1189517, incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/rest/resources/BlueprintResource.java
incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/rest/resources/StacksResource.java
- copied, changed from r1189517, incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/rest/resources/BlueprintsResource.java
Removed:
incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/Blueprints.java
incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/rest/resources/BlueprintResource.java
incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/rest/resources/BlueprintsResource.java
Modified:
incubator/ambari/trunk/client/src/main/java/org/apache/ambari/client/ClusterCreate.java
incubator/ambari/trunk/client/src/main/java/org/apache/ambari/client/ClusterUpdate.java
incubator/ambari/trunk/client/src/main/java/org/apache/ambari/common/rest/entities/ClusterDefinition.java
incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/Cluster.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/rest/config/WadlDocGenerator.java
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=1189525&r1=1189524&r2=1189525&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 Wed Oct 26 23:06:37 2011
@@ -210,7 +210,7 @@ public class ClusterCreate extends Comma
// Create Cluster Definition
ClusterDefinition clsDef = new ClusterDefinition();
clsDef.setName(line.getOptionValue("name"));
- clsDef.setBlueprintName(line.getOptionValue("blueprint"));
+ clsDef.setStackName(line.getOptionValue("blueprint"));
clsDef.setNodes(line.getOptionValue("nodes"));
clsDef.setGoalState(line.getOptionValue("goalstate"));
@@ -233,7 +233,7 @@ public class ClusterCreate extends Comma
Stack stack = response.getEntity(Stack.class);
revision = stack.getRevision();
}
- clsDef.setBlueprintRevision(revision);
+ clsDef.setStackRevision(revision);
clsDef.setActiveServices(splitServices(line.getOptionValue("services")));
clsDef.setDescription(line.getOptionValue("desc"));
clsDef.setRoleToNodesMap(getRoleToNodesList(line.getOptionProperties("role")));
Modified: incubator/ambari/trunk/client/src/main/java/org/apache/ambari/client/ClusterUpdate.java
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/client/src/main/java/org/apache/ambari/client/ClusterUpdate.java?rev=1189525&r1=1189524&r2=1189525&view=diff
==============================================================================
--- incubator/ambari/trunk/client/src/main/java/org/apache/ambari/client/ClusterUpdate.java (original)
+++ incubator/ambari/trunk/client/src/main/java/org/apache/ambari/client/ClusterUpdate.java Wed Oct 26 23:06:37 2011
@@ -213,11 +213,11 @@ public class ClusterUpdate extends Comma
// Create Cluster Definition
ClusterDefinition clsDef = new ClusterDefinition();
clsDef.setName(line.getOptionValue("name"));
- clsDef.setBlueprintName(line.getOptionValue("blueprint"));
+ clsDef.setStackName(line.getOptionValue("blueprint"));
clsDef.setNodes(line.getOptionValue("nodes"));
clsDef.setGoalState(line.getOptionValue("goalstate"));
- clsDef.setBlueprintRevision(line.getOptionValue("revision"));
+ clsDef.setStackRevision(line.getOptionValue("revision"));
clsDef.setActiveServices(splitServices(line.getOptionValue("services")));
clsDef.setDescription(line.getOptionValue("desc"));
clsDef.setRoleToNodesMap(getRoleToNodesList(line.getOptionProperties("role")));
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=1189525&r1=1189524&r2=1189525&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 Wed Oct 26 23:06:37 2011
@@ -66,14 +66,14 @@ public class ClusterDefinition {
/**
* @return the blueprintRevision
*/
- public String getBlueprintRevision() {
+ public String getStackRevision() {
return blueprintRevision;
}
/**
* @param blueprintRevision the blueprintRevision to set
*/
- public void setBlueprintRevision(String blueprintRevision) {
+ public void setStackRevision(String blueprintRevision) {
this.blueprintRevision = blueprintRevision;
}
@@ -108,14 +108,14 @@ public class ClusterDefinition {
/**
* @return the blueprintName
*/
- public String getBlueprintName() {
+ public String getStackName() {
return blueprintName;
}
/**
* @param blueprintName the blueprintName to set
*/
- public void setBlueprintName(String blueprintName) {
+ public void setStackName(String blueprintName) {
this.blueprintName = blueprintName;
}
Modified: incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/Cluster.java
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/Cluster.java?rev=1189525&r1=1189524&r2=1189525&view=diff
==============================================================================
--- incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/Cluster.java (original)
+++ incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/Cluster.java Wed Oct 26 23:06:37 2011
@@ -78,9 +78,9 @@ public class Cluster {
clusterDefinitionRevisionsList.put((long)this.latestRevision, c);
definition = c;
// find the plugins for the current definition of the cluster
- Blueprints context = Blueprints.getInstance();
- Stack bp = context.getStack(c.getBlueprintName(),
- Integer.parseInt(c.getBlueprintRevision()));
+ Stacks context = Stacks.getInstance();
+ Stack bp = context.getStack(c.getStackName(),
+ Integer.parseInt(c.getStackRevision()));
//while (!bp.getName().equals(bp.getParentName()) || !bp.getRevision().equals(bp.getParentRevision())) {
while (bp.getParentName() != null) {
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=1189525&r1=1189524&r2=1189525&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 Wed Oct 26 23:06:37 2011
@@ -57,8 +57,8 @@ public class Clusters {
ClusterDefinition cluster123 = new ClusterDefinition();
cluster123.setName("blue.dev.Cluster123");
- cluster123.setBlueprintName("cluster123");
- cluster123.setBlueprintRevision("0");
+ cluster123.setStackName("cluster123");
+ cluster123.setStackRevision("0");
cluster123.setDescription("cluster123 - development cluster");
cluster123.setGoalState(ClusterState.CLUSTER_STATE_ATTIC);
List<String> activeServices = new ArrayList<String>();
@@ -95,8 +95,8 @@ public class Clusters {
*/
ClusterDefinition cluster124 = new ClusterDefinition();
cluster124.setName("blue.research.Cluster124");
- cluster124.setBlueprintName("cluster124");
- cluster124.setBlueprintRevision("0");
+ cluster124.setStackName("cluster124");
+ cluster124.setStackRevision("0");
cluster124.setDescription("cluster124 - research cluster");
cluster124.setGoalState(ClusterState.CLUSTER_STATE_INACTIVE);
activeServices = new ArrayList<String>();
@@ -205,15 +205,15 @@ public class Clusters {
synchronized (cls.getClusterDefinitionRevisionsList()) {
newcd.setName(clusterName);
- if (c.getBlueprintName() != null) {
- newcd.setBlueprintName(c.getBlueprintName());
+ if (c.getStackName() != null) {
+ newcd.setStackName(c.getStackName());
} else {
- newcd.setBlueprintName(cls.getLatestClusterDefinition().getBlueprintName());
+ newcd.setStackName(cls.getLatestClusterDefinition().getStackName());
}
- if (c.getBlueprintRevision() != null) {
- newcd.setBlueprintRevision(c.getBlueprintRevision());
+ if (c.getStackRevision() != null) {
+ newcd.setStackRevision(c.getStackRevision());
} else {
- newcd.setBlueprintRevision(cls.getLatestClusterDefinition().getBlueprintRevision());
+ newcd.setStackRevision(cls.getLatestClusterDefinition().getStackRevision());
}
if (c.getDescription() != null) {
newcd.setDescription(c.getDescription());
@@ -443,28 +443,28 @@ public class Clusters {
throw new WebApplicationException((new ExceptionResponse(msg, Response.Status.BAD_REQUEST)).get());
}
- if (cdef.getBlueprintName() == null || cdef.getBlueprintName().equals("")) {
+ if (cdef.getStackName() == null || cdef.getStackName().equals("")) {
String msg = "Cluster blueprint must be specified and must be non-empty string";
throw new WebApplicationException((new ExceptionResponse(msg, Response.Status.BAD_REQUEST)).get());
}
- if (cdef.getBlueprintRevision() == null || cdef.getBlueprintRevision().equals("")) {
+ if (cdef.getStackRevision() == null || cdef.getStackRevision().equals("")) {
String msg = "Cluster blueprint revision must be specified";
throw new WebApplicationException((new ExceptionResponse(msg, Response.Status.BAD_REQUEST)).get());
}
/*
* Check if the cluster blueprint and its parents exist
- * getBlueprint would throw exception if it does not find the blueprint
+ * getStack would throw exception if it does not find the blueprint
*/
- Stack bp = Blueprints.getInstance()
- .getStack(cdef.getBlueprintName(), Integer.parseInt(cdef.getBlueprintRevision()));
+ Stack bp = Stacks.getInstance()
+ .getStack(cdef.getStackName(), Integer.parseInt(cdef.getStackRevision()));
while (bp.getParentName() != null) {
if (bp.getParentRevision() == null) {
- bp = Blueprints.getInstance()
+ bp = Stacks.getInstance()
.getStack(bp.getParentName(), -1);
} else {
- bp = Blueprints.getInstance()
+ bp = Stacks.getInstance()
.getStack(bp.getParentName(), Integer.parseInt(bp.getParentRevision()));
}
}
@@ -650,15 +650,15 @@ public class Clusters {
}
Cluster cls = this.operational_clusters.get(clusterName);
- String blueprintName = cls.getLatestClusterDefinition().getBlueprintName();
- int blueprintRevision = Integer.parseInt(cls.getLatestClusterDefinition().getBlueprintRevision());
+ String blueprintName = cls.getLatestClusterDefinition().getStackName();
+ int blueprintRevision = Integer.parseInt(cls.getLatestClusterDefinition().getStackRevision());
Stack bp;
if (!expanded) {
- bp = Blueprints.getInstance().getStack(blueprintName, blueprintRevision);
+ bp = Stacks.getInstance().getStack(blueprintName, blueprintRevision);
} else {
// TODO: Get the derived/expanded blueprint
- bp = Blueprints.getInstance().getStack(blueprintName, blueprintRevision);
+ bp = Stacks.getInstance().getStack(blueprintName, blueprintRevision);
}
return bp;
}
Copied: incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/Stacks.java (from r1189517, 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/Stacks.java?p2=incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/Stacks.java&p1=incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/Blueprints.java&r1=1189517&r2=1189525&rev=1189525&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/Stacks.java Wed Oct 26 23:06:37 2011
@@ -46,23 +46,23 @@ import org.codehaus.jettison.json.JSONEx
import org.codehaus.jettison.json.JSONObject;
import org.mortbay.log.Log;
-public class Blueprints {
+public class Stacks {
- private static Blueprints BlueprintsRef=null;
+ private static Stacks StacksRef=null;
- private Blueprints() {
+ private Stacks() {
try {
JAXBContext jaxbContext =
JAXBContext.newInstance("org.apache.ambari.common.rest.entities");
- loadDummyBlueprint(jaxbContext, "hadoop-security", 0);
- loadDummyBlueprint(jaxbContext, "cluster123", 0);
- loadDummyBlueprint(jaxbContext, "cluster124", 0);
+ loadDummyStack(jaxbContext, "hadoop-security", 0);
+ loadDummyStack(jaxbContext, "cluster123", 0);
+ loadDummyStack(jaxbContext, "cluster124", 0);
} catch (JAXBException e) {
throw new RuntimeException("Can't create jaxb context", e);
}
}
- public void loadDummyBlueprint (JAXBContext jaxbContext,
+ public void loadDummyStack (JAXBContext jaxbContext,
String name, int revision) {
try {
Unmarshaller um = jaxbContext.createUnmarshaller();
@@ -83,11 +83,11 @@ public class Blueprints {
}
}
- public static synchronized Blueprints getInstance() {
- if(BlueprintsRef == null) {
- BlueprintsRef = new Blueprints();
+ public static synchronized Stacks getInstance() {
+ if(StacksRef == null) {
+ StacksRef = new Stacks();
}
- return BlueprintsRef;
+ return StacksRef;
}
public Object clone() throws CloneNotSupportedException {
@@ -209,7 +209,7 @@ public class Blueprints {
/*
* Get the list of blueprint revisions
*/
- public List<StackInformation> getBlueprintRevisions(String blueprintName) throws Exception {
+ public List<StackInformation> getStackRevisions(String blueprintName) throws Exception {
List<StackInformation> list = new ArrayList<StackInformation>();
if (!this.stacks.containsKey(blueprintName)) {
String msg = "Stack ["+blueprintName+"] does not exist";
@@ -240,7 +240,7 @@ public class Blueprints {
/*
* Return list of blueprint names
*/
- public List<StackInformation> getBlueprintList() throws Exception {
+ public List<StackInformation> getStackList() throws Exception {
List<StackInformation> list = new ArrayList<StackInformation>();
for (String bpName : this.stacks.keySet()) {
// Get the latest blueprint
@@ -267,12 +267,12 @@ public class Blueprints {
* Delete the specified version of blueprint
* TODO: Check if blueprint is associated with any stack...
*/
- public void deleteBlueprint(String blueprintName, int revision) throws Exception {
+ public void deleteStack(String blueprintName, int revision) throws Exception {
/*
* Check if the specified blueprint revision is used in any cluster definition
*/
- Hashtable<String, String> clusterReferencedBPList = getClusterReferencedBlueprintsList();
+ Hashtable<String, String> clusterReferencedBPList = getClusterReferencedStacksList();
if (clusterReferencedBPList.containsKey(blueprintName+"-"+revision)) {
String msg = "One or more clusters are associated with the specified blueprint";
throw new WebApplicationException((new ExceptionResponse(msg, Response.Status.NOT_ACCEPTABLE)).get());
@@ -290,23 +290,23 @@ public class Blueprints {
/*
* Returns the <key="name-revision", value=""> hash table for cluster referenced stacks
*/
- public Hashtable<String, String> getClusterReferencedBlueprintsList() throws Exception {
- Hashtable<String, String> clusterBlueprints = new Hashtable<String, String>();
+ public Hashtable<String, String> getClusterReferencedStacksList() throws Exception {
+ Hashtable<String, String> clusterStacks = new Hashtable<String, String>();
for (Cluster c : Clusters.getInstance().operational_clusters.values()) {
- String cBPName = c.getLatestClusterDefinition().getBlueprintName();
- String cBPRevision = c.getLatestClusterDefinition().getBlueprintRevision();
+ String cBPName = c.getLatestClusterDefinition().getStackName();
+ String cBPRevision = c.getLatestClusterDefinition().getStackRevision();
Stack bpx = this.getStack(cBPName, Integer.parseInt(cBPRevision));
- clusterBlueprints.put(cBPName+"-"+cBPRevision, "");
+ clusterStacks.put(cBPName+"-"+cBPRevision, "");
while (bpx.getParentName() != null) {
if (bpx.getParentRevision() == null) {
bpx = this.getStack(bpx.getParentName(), -1);
} else {
bpx = this.getStack(bpx.getParentName(), Integer.parseInt(bpx.getParentRevision()));
}
- clusterBlueprints.put(bpx.getName()+"-"+bpx.getRevision(), "");
+ clusterStacks.put(bpx.getName()+"-"+bpx.getRevision(), "");
}
}
- return clusterBlueprints;
+ return clusterStacks;
}
/*
Modified: incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/rest/config/WadlDocGenerator.java
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/rest/config/WadlDocGenerator.java?rev=1189525&r1=1189524&r2=1189525&view=diff
==============================================================================
--- incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/rest/config/WadlDocGenerator.java (original)
+++ incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/rest/config/WadlDocGenerator.java Wed Oct 26 23:06:37 2011
@@ -27,8 +27,8 @@ import javax.xml.bind.JAXBContext;
import javax.xml.bind.Unmarshaller;
import org.apache.ambari.client.ClusterBlueprint;
-import org.apache.ambari.controller.rest.resources.BlueprintResource;
-import org.apache.ambari.controller.rest.resources.BlueprintsResource;
+import org.apache.ambari.controller.rest.resources.StackResource;
+import org.apache.ambari.controller.rest.resources.StacksResource;
import org.apache.ambari.controller.rest.resources.ClusterResource;
import org.apache.ambari.controller.rest.resources.ClustersResource;
Copied: incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/rest/resources/StackResource.java (from r1189517, 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/StackResource.java?p2=incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/rest/resources/StackResource.java&p1=incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/rest/resources/BlueprintResource.java&r1=1189517&r2=1189525&rev=1189525&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/StackResource.java Wed Oct 26 23:06:37 2011
@@ -33,34 +33,34 @@ import javax.ws.rs.core.Response;
import org.apache.ambari.common.rest.entities.Stack;
import org.apache.ambari.common.rest.entities.StackInformation;
-import org.apache.ambari.controller.Blueprints;
+import org.apache.ambari.controller.Stacks;
import org.apache.ambari.controller.ExceptionResponse;
-/** BlueprintResource represents a Hadoop blueprint to be installed on a
- * cluster. Blueprints define a collection of Hadoop components that are
+/** StackResource represents a Hadoop stack to be installed on a
+ * cluster. stacks define a collection of Hadoop components that are
* installed together on a cluster and their configuration.
*/
-@Path(value = "/stacks/{blueprintName}")
-public class BlueprintResource {
+@Path(value = "/stacks/{stackName}")
+public class StackResource {
/**
- * Get a blueprint
+ * Get a stack
*
- * @response.representation.200.doc Get a blueprint
+ * @response.representation.200.doc Get a stack
* @response.representation.200.mediaType application/json
* @response.representation.200.example
*
- * @param blueprintName Name of the blueprint
- * @param revision The optional blueprint revision, if not specified get the latest revision
- * @return blueprint definition
+ * @param stackName Name of the stack
+ * @param revision The optional stack revision, if not specified get the latest revision
+ * @return stack definition
* @throws Exception throws Exception (TBD)
*/
@GET
@Produces({"application/json", "application/xml"})
- public Stack getStack(@PathParam("blueprintName") String blueprintName,
+ public Stack getStack(@PathParam("stackName") String stackName,
@DefaultValue("-1") @QueryParam("revision") String revision) throws Exception {
try {
- return Blueprints.getInstance().getStack(blueprintName, Integer.parseInt(revision));
+ return Stacks.getInstance().getStack(stackName, Integer.parseInt(revision));
}catch (WebApplicationException we) {
throw we;
}catch (Exception e) {
@@ -69,22 +69,22 @@ public class BlueprintResource {
}
/**
- * Get a blueprint's revisions
+ * Get a stack's revisions
*
- * @response.representation.200.doc Get blueprint revisions
+ * @response.representation.200.doc Get stack revisions
* @response.representation.200.mediaType application/json
*
- * @param blueprintName Name of the blueprint
+ * @param stackName Name of the stack
*
- * @return List of blueprint revisions
+ * @return List of stack revisions
* @throws Exception throws Exception (TBD)
*/
@Path(value = "/revisions")
@GET
@Produces({"application/json", "application/xml"})
- public List<StackInformation> getBlueprintRevisions(@PathParam("blueprintName") String blueprintName) throws Exception {
+ public List<StackInformation> getstackRevisions(@PathParam("stackName") String stackName) throws Exception {
try {
- List<StackInformation> list = Blueprints.getInstance().getBlueprintRevisions(blueprintName);
+ List<StackInformation> list = Stacks.getInstance().getStackRevisions(stackName);
if (list.isEmpty()) {
throw new WebApplicationException(Response.Status.NO_CONTENT);
}
@@ -97,25 +97,25 @@ public class BlueprintResource {
}
/**
- * Delete the blueprint
+ * Delete the stack
*
- * @response.representation.200.doc Delete a blueprint
+ * @response.representation.200.doc Delete a stack
* @response.representation.200.mediaType application/json
*
- * @param blueprintName Name of the blueprint
- * @param revision Revision of the blueprint
+ * @param stackName Name of the stack
+ * @param revision Revision of the stack
* @throws Exception throws Exception (TBD)
*/
@DELETE
@Consumes({"application/json", "application/xml"})
- public void deleteBlueprint(@PathParam("blueprintName") String blueprintName,
+ public void deletestack(@PathParam("stackName") String stackName,
@DefaultValue("") @QueryParam("revision") String revision ) throws Exception {
try {
if (revision == null || revision.equals("")) {
String msg = "Revision number not specified";
throw new WebApplicationException ((new ExceptionResponse(msg, Response.Status.BAD_REQUEST)).get());
}
- Blueprints.getInstance().deleteBlueprint(blueprintName, Integer.parseInt(revision));
+ Stacks.getInstance().deleteStack(stackName, Integer.parseInt(revision));
}catch (WebApplicationException we) {
throw we;
}catch (Exception e) {
@@ -124,35 +124,35 @@ public class BlueprintResource {
}
/**
- * Create/Update the blueprint.
+ * Create/Update the stack.
*
- * If named blueprint does not exist already, then it is created with revision zero.
- * If named blueprint exists, then it is updated as new revision.
+ * If named stack does not exist already, then it is created with revision zero.
+ * If named stack exists, then it is updated as new revision.
* Optional locationURL query parameter can specify the location of the repository of
- * of stacks. If specified then blueprint is downloaded from the repository.
+ * of stacks. If specified then stack is downloaded from the repository.
*
- * @response.representation.200.doc Successfully created the new or updated the existing blueprint.
+ * @response.representation.200.doc Successfully created the new or updated the existing stack.
* @response.representation.200.mediaType application/json
- * @response.representation.404.doc Specified blueprint does not exist. In case of creating new one,
+ * @response.representation.404.doc Specified stack does not exist. In case of creating new one,
* it is not found in repository where in case of update, it does not
* exist.
*
- * @param blueprintName Name of the blueprint
- * @param locationURL URL pointing to the location of the blueprint
- * @param stack Input blueprint object specifying the blueprint definition
- * @return Returns the new revision of the blueprint
+ * @param stackName Name of the stack
+ * @param locationURL URL pointing to the location of the stack
+ * @param stack Input stack object specifying the stack definition
+ * @return Returns the new revision of the stack
* @throws Exception throws Exception
*/
@PUT
@Consumes({"application/json", "application/xml"})
- public Stack updateStack(@PathParam("blueprintName") String blueprintName,
+ public Stack updateStack(@PathParam("stackName") String stackName,
@DefaultValue("") @QueryParam("url") String locationURL,
Stack stack) throws Exception {
try {
if (locationURL == null || locationURL.equals("")) {
- return Blueprints.getInstance().addStack(stack);
+ return Stacks.getInstance().addStack(stack);
} else {
- return Blueprints.getInstance().importDefaultStack (locationURL);
+ return Stacks.getInstance().importDefaultStack (locationURL);
}
}catch (WebApplicationException we) {
throw we;
Copied: incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/rest/resources/StacksResource.java (from r1189517, 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/StacksResource.java?p2=incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/rest/resources/StacksResource.java&p1=incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller/rest/resources/BlueprintsResource.java&r1=1189517&r2=1189525&rev=1189525&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/StacksResource.java Wed Oct 26 23:06:37 2011
@@ -34,17 +34,17 @@ import javax.ws.rs.core.Response;
import org.apache.ambari.common.rest.entities.Stack;
import org.apache.ambari.common.rest.entities.StackInformation;
-import org.apache.ambari.controller.Blueprints;
+import org.apache.ambari.controller.Stacks;
import org.apache.ambari.controller.ExceptionResponse;
import org.codehaus.jettison.json.JSONArray;
/**
- * BlueprintResource represents a Hadoop blueprint to be installed on a
- * cluster. Blueprints define a collection of Hadoop components that are
+ * StackResource represents a Hadoop blueprint to be installed on a
+ * cluster. Stacks define a collection of Hadoop components that are
* installed together on a cluster and their configuration.
*/
@Path(value = "/stacks")
-public class BlueprintsResource {
+public class StacksResource {
/**
* Get the list of stacks
@@ -61,7 +61,7 @@ public class BlueprintsResource {
public List<StackInformation> listBlueprints() throws Exception {
List<StackInformation> list;
try {
- list = Blueprints.getInstance().getBlueprintList();
+ list = Stacks.getInstance().getStackList();
if (list.isEmpty()) {
throw new WebApplicationException(Response.Status.NO_CONTENT);
}