GitHub user aledsage opened a pull request:
https://github.com/apache/brooklyn-server/pull/852
Merge initial catalog and persisted catalog
When starting Brooklyn, the catalog is now populated by merging the initial
catalog (from the default .bom file) with the persisted catalog.
This PR is pretty much a re-write of the `CatalogInitialization` class to
do this.
---
It also cleans up some code, some code paths and some strange things we've
previously supported. Of particular interest...
**No longer auto-populates catalog on
`localManagementContext.getCatalog()`**
Previously `localManagementContext.getCatalog()` would cause the catalog to
be populated if it had not already been done so. This was important for tests
that did not go through the full intialization lifecycle. I've moved that into
the class `LocalManagementContextForTests` - we should restrict the code-paths
for production usage to just those we expect!
The consequence is that any tests relying on it must create the
`LocalManagementContextForTests` rather than a full-blown
`LocalManagementContext` (almost all Brooklyn tests do this already), but this
might affect downstream projects.
**Fewer ways catalog initialization can happen**
We now only support 2 production ways of populating the catalog:
* `populateInitialCatalogOnly`: called if persistence is disabled
* `populateInitialAndPersistedCatalog`: called on rebind
The second way can be called multiple times (e.g. if repeatedly doing it
for `hot-standby`, or if subsequently promoting to `master`).
The method `unofficialPopulateInitialCatalog` is to be only called by tests
(though unfortunately not enforced as such).
**Tidy BasicLauncher's persistence initialization**
* `confirmCatalog` is moved from `Main` to `CatalogInitialization`
* `BasicLauncher.checkConfiguration` now checks that we never enable HA
mode if persistence is disabled. Moves handling of non-persistence out of
`initPersistence`.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/aledsage/brooklyn-server
catalog-init-merge-initial-and-persisted
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/brooklyn-server/pull/852.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #852
----
commit eea6904bc72e33135ba2b2b55bbdb79c457f8c8c
Author: Aled Sage <[email protected]>
Date: 2017-10-02T17:30:10Z
Merge initial catalog and persisted catalog
commit 16d6c7364ababbd92009d54a65f40be6dd0db819
Author: Aled Sage <[email protected]>
Date: 2017-10-04T09:36:19Z
Delete RebindCatalogEntityTest
Was testing use of catalog class loader, not OSGi, with catalog item
requiring custom class loader being added programmatically via
catalog.addItem() and then fiddling with catalog on rebind to add it
back in!
No user should be doing that; the test is not something we want to
support.
----
---