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 #672: Bundle uninstall and snapshot
Date Thu, 11 May 2017 13:35:12 GMT
Github user geomacy commented on a diff in the pull request:

    https://github.com/apache/brooklyn-server/pull/672#discussion_r115987215
  
    --- Diff: rest/rest-resources/src/main/java/org/apache/brooklyn/rest/resources/CatalogResource.java
---
    @@ -158,6 +149,39 @@ public Response createFromYaml(String yaml) {
             }
         }
     
    +    public static class BundleInstallationRestResult {
    +        // as Osgi result, but without bundle, and with maps of catalog items installed
    +        
    +        String message;
    +        ManagedBundle metadata;
    +        OsgiBundleInstallationResult.ResultCode code;
    +        
    +        Map<String,Object> types;
    +        
    +        public String getMessage() {
    +            return message;
    +        }
    +        
    +        @SuppressWarnings("deprecation")
    +        public static BundleInstallationRestResult of(OsgiBundleInstallationResult in,
ManagementContext mgmt, BrooklynRestResourceUtils brooklynU, UriInfo ui) {
    +            BundleInstallationRestResult result = new BundleInstallationRestResult();
    +            result.message = in.getMessage();
    +            result.metadata = in.getMetadata();
    +            result.code = in.getCode();
    +            if (in.getCatalogItemsInstalled()!=null) {
    +                result.types = MutableMap.of();
    +                for (String id: in.getCatalogItemsInstalled()) {
    +                    // TODO prefer to use RegisteredType, but we need transformer for
those in REST
    +                    //RegisteredType ci = mgmt.getTypeRegistry().get(id);
    +                    
    +                    CatalogItem<?, ?> ci = CatalogUtils.getCatalogItemOptionalVersion(mgmt,
id);
    +                    CatalogTransformer.catalogItemSummary(brooklynU, ci, ui.getBaseUriBuilder());
    --- End diff --
    
    Shouldn't this be
    ```
    CatalogItemSummary summary = CatalogTransformer.catalogItemSummary(brooklynU, ci, ui.getBaseUriBuilder());
    result.types().put(id, summary);
    ```


---
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