The lookup for the inventory implementation that we tried to make on startup failed and caused the failure of the start operation. This is because we had stopped the "Bookshelf Inventory Impl - Mock" bundle.
Looking at the bundle listing, we find the newly installed bundle in the Resolved
state:
g! lb
START LEVEL 3
ID|State |Level|Name
0|Active | 0|System Bundle (3.0.1)
1|Active | 1|Apache Felix Bundle Repository (1.6.2)
2|Active | 1|Apache Felix Gogo Command (0.6.0)
3|Active | 1|Apache Felix Gogo Runtime (0.6.0)
4|Active | 1|Apache Felix Gogo Shell (0.6.0)
5|Active | 2|Bookshelf Inventory API (1.4.0)
6|Resolved | 2|Bookshelf Inventory Impl - Mock (1.4.0)
7|Resolved | 3|Bookshelf Service (1.7.0)
Let's start the mock inventory implementation and make it available again:
Now that the dependency is satisfied, starting the Bookshelf Service should work as follows:
g! start 8
Signing in. . .
Adding books. . .
Searching for books with author like: %Doe
- Group 2: Book 4 Title from Jane Doe [0]
- Group 1: Book 1 Title from John Doe [0]
- Group 2: Book 3 Title from John Doe [0]
Everything looks alright now; a quick check shows all our bundles in Active
state:
g! lb
START LEVEL 3
ID|State |Level|Name
0|Active | 0|System Bundle (3.0.1)
1|Active | 1|Apache Felix Bundle Repository (1.6.2)
2|Active | 1|Apache Felix Gogo Command (0.6.0)
3|Active | 1|Apache Felix Gogo Runtime (0.6.0)
4|Active | 1|Apache Felix Gogo Shell (0.6.0)
5|Active | 2|Bookshelf Inventory API (1.4.0)
6|Active | 2|Bookshelf Inventory Impl - Mock (1.4.0)
7|Active | 3|Bookshelf Service (1.7.0)
The following image shows the flow of control between the bookshelf service and the inventory implementation bundles.
This is a partial flow as the interactions with the BundleContext
are not shown.
When you decide to replace this inventory implementation with another one, all you'll need to do is uninstall the existing implementation and install the new one. The next lookup will catch the new bundle implementation. The same applies for bundle version upgrades.