brooklyn-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ahgittin <...@git.apache.org>
Subject [GitHub] brooklyn-server pull request #866: catalog-init: add support for item/bundle...
Date Tue, 24 Oct 2017 08:46:30 GMT
Github user ahgittin commented on a diff in the pull request:

    https://github.com/apache/brooklyn-server/pull/866#discussion_r146492023
  
    --- Diff: core/src/main/java/org/apache/brooklyn/core/catalog/internal/CatalogInitialization.java
---
    @@ -528,8 +528,60 @@ private void startBundle(OsgiBundleInstallationResult br) throws
BundleException
             }
         }
     
    +    private PersistedCatalogState filterPersistedState(PersistedCatalogState persistedState,
RebindLogger rebindLogger) {
    +        CatalogUpgrades catalogUpgrades = findCatalogUpgrades(rebindLogger);
    +        
    +        if (catalogUpgrades.isEmpty()) {
    +            return persistedState;
    +        } else {
    +            rebindLogger.info("Filtering out persisted catalog: removedBundles="+catalogUpgrades.getRemovedBundles()+";
removedLegacyItems="+catalogUpgrades.getRemovedLegacyItems());
    +        }
    +        
    +        Map<VersionedName, InstallableManagedBundle> bundles = new LinkedHashMap<>();
    +        for (Map.Entry<VersionedName, InstallableManagedBundle> entry : persistedState.getBundles().entrySet())
{
    +            if (catalogUpgrades.isBundleRemoved(entry.getKey())) {
    +                rebindLogger.debug("Filtering out persisted bundle "+entry.getKey());
    +            } else {
    +                bundles.put(entry.getKey(), entry.getValue());
    +            }
    +        }
    +
    +        List<CatalogItem<?, ?>> legacyCatalogItems = new ArrayList<>();
    +        for (CatalogItem<?, ?> legacyCatalogItem : persistedState.getLegacyCatalogItems())
{
    +            if (catalogUpgrades.isLegacyItemRemoved(legacyCatalogItem)) {
    +                rebindLogger.debug("Filtering out persisted legacy catalog item "+legacyCatalogItem.getId());
    +            } else {
    +                legacyCatalogItems.add(legacyCatalogItem);
    +            }
    +        }
    +        
    +        return new PersistedCatalogState(bundles, legacyCatalogItems);
    +    }
    +
    +    private CatalogUpgrades findCatalogUpgrades(RebindLogger rebindLogger) {
    --- End diff --
    
    rename as `collectCatalogUpgradeInstructions` ?


---

Mime
View raw message