Github user ahgittin commented on a diff in the pull request:

    https://github.com/apache/brooklyn-server/pull/746#discussion_r127675195
  
    --- Diff: 
core/src/main/java/org/apache/brooklyn/core/catalog/internal/CatalogBundleLoader.java
 ---
    @@ -81,22 +91,54 @@ public CatalogBundleLoader(Predicate<Bundle> 
applicationsPermitted, ManagementCo
             if (null != bom) {
                 LOG.debug("Found catalog BOM in {} {} {}", 
CatalogUtils.bundleIds(bundle));
                 String bomText = readBom(bom);
    -            String bomWithLibraryPath = addLibraryDetails(bundle, bomText);
    -            catalogItems = 
this.managementContext.getCatalog().addItems(bomWithLibraryPath, mb);
    -            for (CatalogItem<?, ?> item : catalogItems) {
    -                LOG.debug("Added to catalog: {}, {}", 
item.getSymbolicName(), item.getVersion());
    +            if (mb==null) {
    +                LOG.warn("Bundle "+bundle+" containing BOM is not managed 
by Brooklyn; using legacy item installation");
    +                legacy = true;
    +            }
    +            if (legacy) {
    +                catalogItems = 
this.managementContext.getCatalog().addItems(bomText, mb, force);
    +                for (CatalogItem<?, ?> item : catalogItems) {
    +                    LOG.debug("Added to catalog: {}, {}", 
item.getSymbolicName(), item.getVersion());
    +                }
    +            } else {
    +                
this.managementContext.getCatalog().addTypesFromBundleBom(bomText, mb, force);
    +                if (validate) {
    +                    Map<RegisteredType, Collection<Throwable>> 
validationErrors = this.managementContext.getCatalog().validateTypes(
    +                        
this.managementContext.getTypeRegistry().getMatching(RegisteredTypePredicates.containingBundle(mb.getVersionedName()))
 );
    +                    if (!validationErrors.isEmpty()) {
    +                        throw Exceptions.propagate("Failed to install 
"+mb.getVersionedName()+", types "+validationErrors.keySet()+" gave errors",
    +                            Iterables.concat(validationErrors.values()));
    +                    }
    +                }
    +            }
    +            
    +            if (!legacy && 
BasicBrooklynCatalog.isNoBundleOrSimpleWrappingBundle(managementContext, mb)) {
    +                
((ManagementContextInternal)managementContext).getOsgiManager().get().addInstalledWrapperBundle(mb);
                 }
             } else {
                 LOG.debug("No BOM found in {} {} {}", 
CatalogUtils.bundleIds(bundle));
             }
     
             if (!applicationsPermitted.apply(bundle)) {
    --- End diff --
    
    agree re whtielist, removed that.
    
    am hesitant about removing some of these methods as i find when i do that 
there's always something using it.  have added a warning and marked the legacy 
one deprecated but left enough that we can use it if we really have to, for one 
version,.


---
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 [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to