brooklyn-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From geomacy <...@git.apache.org>
Subject [GitHub] brooklyn-server pull request #613: Returns catalog items created via REST AP...
Date Mon, 27 Mar 2017 12:04:27 GMT
Github user geomacy commented on a diff in the pull request:

    https://github.com/apache/brooklyn-server/pull/613#discussion_r108149537
  
    --- Diff: rest/rest-resources/src/main/java/org/apache/brooklyn/rest/resources/CatalogResource.java
---
    @@ -261,15 +245,37 @@ public Response createFromArchive(byte[] zipInput) {
                         throw new IllegalArgumentException("Error installing catalog items",
ex);
                     }
                 }
    -            
    -            return Response.status(Status.CREATED).build();
    +
    +            // 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.
    +            return buildCreateResponse(catalogItems);
             } catch (RuntimeException ex) {
                 throw WebResourceUtils.badRequest(ex);
             } finally {
                 if (f!=null) f.delete();
                 if (f2!=null) f2.delete();
             }
         }
    +
    +    private Response buildCreateResponse(Iterable<? extends CatalogItem<?, ?>>
catalogItems) {
    +        log.info("REST created catalog items: "+catalogItems);
    +
    +        Map<String,Object> result = MutableMap.of();
    +
    +        for (CatalogItem<?,?> catalogItem: catalogItems) {
    +            try {
    +                result.put(catalogItem.getId(), CatalogTransformer.catalogItemSummary(brooklyn(),
catalogItem, ui.getBaseUriBuilder()));
    --- End diff --
    
    Can you break this line so it's readable on github?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message