brooklyn-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From neykov <...@git.apache.org>
Subject [GitHub] brooklyn-server pull request: Add catalog.bom application white/bl...
Date Wed, 13 Apr 2016 12:47:38 GMT
Github user neykov commented on a diff in the pull request:

    https://github.com/apache/brooklyn-server/pull/106#discussion_r59540999
  
    --- Diff: core/src/main/java/org/apache/brooklyn/core/catalog/internal/CatalogBomScanner.java
---
    @@ -155,9 +181,42 @@ public void removedBundle(Bundle bundle, BundleEvent bundleEvent,
Iterable<? ext
                     LOG.debug("No BOM found in {} {} {}", bundleIds(bundle));
                 }
     
    +            if (!passesWhiteAndBlacklists(bundle)) {
    +                removeAnyApplications(catalogItems);
    +            }
    +
                 return catalogItems;
             }
     
    +        private void removeAnyApplications(Iterable<? extends CatalogItem<?, ?>>
catalogItems) {
    +
    +            final Iterator<? extends CatalogItem<?, ?>> cit = catalogItems.iterator();
    +            while (cit.hasNext()) {
    +                final CatalogItem<?, ?> item = cit.next();
    +                if (TEMPLATE.equals(item.getCatalogItemType())) {
    +                    removeFromCatalog(item);
    +                    cit.remove();
    +                }
    +            }
    +        }
    +
    +        private boolean passesWhiteAndBlacklists(Bundle bundle) {
    +            final List<String> white = managementContext.getConfig().getConfig(WHITELIST);
    +            final List<String> black = managementContext.getConfig().getConfig(BLACKLIST);
    +
    +            return on(bundle, white) && !on(bundle, black);
    +        }
    +
    +        private boolean on(Bundle bundle, List<String> list) {
    +            for (String candidate : list) {
    +                final String symbolicName = bundle.getSymbolicName();
    +                if (symbolicName.matches(candidate)) {
    --- End diff --
    
    Do we need to trim the individual values? Or does that already happen in the coercion
step? What if there's just only one item?


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