incubator-ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vgog...@apache.org
Subject svn commit: r1178601 - in /incubator/ambari/trunk/controller/src/main/java/org/apache/ambari/controller: Blueprints.java rest/resources/BlueprintsResource.java
Date Mon, 03 Oct 2011 21:56:51 GMT
Author: vgogate
Date: Mon Oct  3 21:56:51 2011
New Revision: 1178601

URL: http://svn.apache.org/viewvc?rev=1178601&view=rev
Log:
AMBARI-32

Modified:
    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/BlueprintsResource.java

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=1178601&r1=1178600&r2=1178601&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  3 21:56:51 2011
@@ -146,7 +146,7 @@ public class Blueprints {
     /*
      * Add or update the blueprint
      */
-    public void addBlueprint(Blueprint bp) throws Exception {
+    public Blueprint addBlueprint(Blueprint bp) throws Exception {
         
         /*
          * Validate the blueprint
@@ -165,12 +165,14 @@ public class Blueprints {
             x.put(new Integer(bp.getRevision()), bp);
             this.blueprints.put(bp.getName(), x);
         }
+        
+        return bp;
     }
     
     /*
      * Import the default blueprint from the URL location
      */
-    public void importDefaultBlueprint (String locationURL) throws Exception {
+    public Blueprint importDefaultBlueprint (String locationURL) throws Exception {
         Blueprint blueprint;
         URL blueprintUrl;
         try {
@@ -178,7 +180,7 @@ public class Blueprints {
             ObjectMapper m = new ObjectMapper();
             InputStream is = blueprintUrl.openStream();
             blueprint = m.readValue(is, Blueprint.class);
-            addBlueprint(blueprint);
+            return addBlueprint(blueprint);
         } catch (WebApplicationException we) {
             throw we;
         } catch (Exception e) {

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=1178601&r1=1178600&r2=1178601&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
Mon Oct  3 21:56:51 2011
@@ -56,12 +56,12 @@ public class BlueprintsResource {
      */
     @POST
     @Consumes ({"application/json"})
-    public void createBlueprint(@DefaultValue("") @QueryParam("locationURL") String locationURL,
Blueprint blueprint) throws Exception {  
+    public Blueprint createBlueprint(@DefaultValue("") @QueryParam("locationURL") String
locationURL, Blueprint blueprint) throws Exception {  
         try {
             if (locationURL == null || locationURL.equals("")) {
-                Blueprints.getInstance().addBlueprint(blueprint);
+                return Blueprints.getInstance().addBlueprint(blueprint);
             } else {
-                Blueprints.getInstance().importDefaultBlueprint (locationURL);
+                return Blueprints.getInstance().importDefaultBlueprint (locationURL);
             }
         }catch (WebApplicationException we) {
             throw we;



Mime
View raw message