brooklyn-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ahgittin <>
Subject [GitHub] incubator-brooklyn pull request: CLI commands for manipulating cat...
Date Mon, 25 May 2015 10:32:19 GMT
Github user ahgittin commented on a diff in the pull request:
    --- Diff: core/src/main/java/brooklyn/entity/rebind/ ---
    @@ -341,38 +340,64 @@ protected void rebuildCatalog() {
    +        // See notes in CatalogInitialization
    -        // Register catalogue items with the management context. Loads the bundles in
the OSGi framework.
    -        CatalogLoadMode catalogLoadMode = managementContext.getConfig().getConfig(BrooklynServerConfig.CATALOG_LOAD_MODE);
    +        Collection<CatalogItem<?, ?>> catalogItems = rebindContext.getCatalogItems();
    +        CatalogInitialization catInit = ((ManagementContextInternal)managementContext).getCatalogInitialization();
    +        catInit.applyCatalogLoadMode();
    +        Collection<CatalogItem<?,?>> itemsForResettingCatalog = null;
    +        boolean needsInitialCatalog;
             if (rebindManager.persistCatalogItemsEnabled) {
    -            boolean shouldResetCatalog = catalogLoadMode == CatalogLoadMode.LOAD_PERSISTED_STATE
    -                    || (!isEmpty && catalogLoadMode == CatalogLoadMode.LOAD_BROOKLYN_CATALOG_URL_IF_NO_PERSISTED_STATE);
    -            boolean shouldLoadDefaultCatalog = catalogLoadMode == CatalogLoadMode.LOAD_BROOKLYN_CATALOG_URL
    -                    || (isEmpty && catalogLoadMode == CatalogLoadMode.LOAD_BROOKLYN_CATALOG_URL_IF_NO_PERSISTED_STATE);
    -            if (shouldResetCatalog) {
    -                // Reset catalog with previously persisted state
    -                logRebindingDebug("RebindManager resetting management context catalog
to previously persisted state");
    -                managementContext.getCatalog().reset(rebindContext.getCatalogItems());
    -            } else if (shouldLoadDefaultCatalog) {
    -                // Load catalogue as normal
    -                // TODO in read-only mode, should do this less frequently than entities
    -                logRebindingDebug("RebindManager loading default catalog");
    -                ((BasicBrooklynCatalog) managementContext.getCatalog()).resetCatalogToContentsAtConfiguredUrl();
    +            if (!catInit.hasRunOfficial() && catInit.isInitialResetRequested())
    --- End diff --
    i've set it up so we distinguish between `unofficial` initialization, `official final`
initialization, and `official transient` initialization.  that last is done if we run rebind
but aren't master, and it allows subsequent runs also to apply initialization.  if we are
master (or are a non-persisting launch sequence) then we set `official final` and subsequent
re-initialization does *not* apply of the parameters.
    added quite a bit more doc around it as well.  unfortunate it is so complex but i'm not
sure of a way around it, unless we distinguished things you could do on first run from on
subsequent run.
    (the edge cases are very edge, as most CLI uses should be when there is no brooklyn running;
but i think we do now handle them nicely.)

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

View raw message