brooklyn-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aledsage <...@git.apache.org>
Subject [GitHub] incubator-brooklyn pull request: Allows catalog items to be deprec...
Date Wed, 04 Mar 2015 14:17:44 GMT
Github user aledsage commented on a diff in the pull request:

    https://github.com/apache/incubator-brooklyn/pull/540#discussion_r25776818
  
    --- Diff: usage/rest-server/src/main/java/brooklyn/rest/resources/CatalogResource.java
---
    @@ -311,6 +317,18 @@ public Response getIcon(String itemId, String version) {
             return getCatalogItemIcon(result);
         }
     
    +    @Override
    +    public void setDeprecated(String itemId, boolean deprecated) {
    +        if (!Entitlements.isEntitled(mgmt().getEntitlementManager(), Entitlements.MODIFY_CATALOG_ITEM,
StringAndArgument.of(itemId, "deprecated"))) {
    +            throw WebResourceUtils.unauthorized("User '%s' is not authorized to modify
catalog",
    +                    Entitlements.getEntitlementContext().user());
    +        }
    +        CatalogItem<?, ?> item = CatalogUtils.getCatalogItemOptionalVersion(mgmt(),
itemId);
    +        if (item==null)
    +            throw WebResourceUtils.notFound("Catalog item with id '%s' not found", itemId);
    +        item.setDeprecated(deprecated);
    --- End diff --
    
    This won't be persisted - if you stopped and restarted Brooklyn then the catalog item
would no longer be deprecated (I think).
    
    See things like `RebindCatalogItemTest` for where we're testing catalog persistence.
    
    We're going to have to call something on ` mgmt.getCatalog()....` to tell it to persist
this change.


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