You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@brooklyn.apache.org by ge...@apache.org on 2017/03/27 15:21:28 UTC

[2/4] brooklyn-server git commit: Address comments

Address comments


Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/f1d08ee9
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/f1d08ee9
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/f1d08ee9

Branch: refs/heads/master
Commit: f1d08ee96b07105828c228774a6b5a38ec7479ee
Parents: c17ac20
Author: Thomas Bouron <th...@cloudsoftcorp.com>
Authored: Mon Mar 27 13:22:26 2017 +0100
Committer: Thomas Bouron <th...@cloudsoftcorp.com>
Committed: Mon Mar 27 13:22:26 2017 +0100

----------------------------------------------------------------------
 .../apache/brooklyn/rest/resources/CatalogResource.java | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/f1d08ee9/rest/rest-resources/src/main/java/org/apache/brooklyn/rest/resources/CatalogResource.java
----------------------------------------------------------------------
diff --git a/rest/rest-resources/src/main/java/org/apache/brooklyn/rest/resources/CatalogResource.java b/rest/rest-resources/src/main/java/org/apache/brooklyn/rest/resources/CatalogResource.java
index 8155bf6..05cee90 100644
--- a/rest/rest-resources/src/main/java/org/apache/brooklyn/rest/resources/CatalogResource.java
+++ b/rest/rest-resources/src/main/java/org/apache/brooklyn/rest/resources/CatalogResource.java
@@ -246,8 +246,12 @@ public class CatalogResource extends AbstractBrooklynRestResource implements Cat
                 }
             }
 
-            // TODO improve on this - If the FEATURE_LOAD_BUNDLE_CATALOG_BOM is enabled, the REST API won't return the
-            // added items which breaks the contract on the API endpoint.
+            // TODO improve on this - Currently, the added items are returned ONLY if the FEATURE_LOAD_BUNDLE_CATALOG_BOM
+            // is disabled. When enabled, the above code is not executed and the catalog items addition is delegated
+            // to the CatalogBomScanner. The REST API will therefore not know what are the added catalog items and won't
+            // return them.
+            // One way to improved this would be couple agoin the CatalogBomScanner with the CatalogBundleLoader to
+            // retrieve the list of added catalog items per bundle.
             return buildCreateResponse(catalogItems);
         } catch (RuntimeException ex) {
             throw WebResourceUtils.badRequest(ex);
@@ -264,7 +268,9 @@ public class CatalogResource extends AbstractBrooklynRestResource implements Cat
 
         for (CatalogItem<?,?> catalogItem: catalogItems) {
             try {
-                result.put(catalogItem.getId(), CatalogTransformer.catalogItemSummary(brooklyn(), catalogItem, ui.getBaseUriBuilder()));
+                result.put(
+                        catalogItem.getId(),
+                        CatalogTransformer.catalogItemSummary(brooklyn(), catalogItem, ui.getBaseUriBuilder()));
             } catch (Throwable t) {
                 log.warn("Error loading catalog item '"+catalogItem+"' (rethrowing): "+t);
                 // unfortunately items are already added to the catalog and hard to remove,