Time for action - install the book inventory bundles

We start by listing the target bundles, to make sure they're there and to have their names, for easy copy-and-paste.

g! list book
Bookshelf Inventory API (1.5.0)
Bookshelf Inventory Impl - Mock (1.5.0)

Since we've declared the bookshelf inventory API as a dependency of the mock implementation, we only need to specifically deploy the implementation.

First, we set the initial bundle level to 2 (Tier 3 services), and move the framework level to that level right away:

g! bundlelevel -i 2
g! frameworklevel 2

Then we use the obr:deploy command to deploy the bookshelf implementation:

g! deploy -s "Bookshelf Inventory Impl - Mock"
Target resource(s):
-------------------
Bookshelf Inventory Impl - Mock (1.5.0)
Required resource(s):
---------------------
Bookshelf Inventory API (1.5.0)
Deploying...
Starting Book Inventory Mock Impl

done.

The bundle listing now shows the newly installed bundles:

g! lb
START LEVEL 1
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 | 1|Bookshelf Inventory API (1.5.0)

6|Active | 1|Bookshelf Inventory Impl - Mock (1.5.0)

Bundles 5 and 6 are those we've just installed and started.

What just happened?

Alright, this is cool. Let's go back through it step-by-step.

Someone (in this case, it was us) has deployed a bundle onto their OBR. Now this OBR could be local, as it is here, but could also be hosted online (for example, as is the one for the Felix releases at http://felix.apache.org/obr/releases.xml).

We have registered our releases OBR with the Bundle Repository service (while we were looking at the obr:repos add command earlier), which resulted in it now being aware of the "Bookshelf Inventory API" and the "Bookshelf Implementation - Mock" bundles.

Then we requested the Bundle Repository to start the "Bookshelf Inventory Impl - Mock", calling it by name. The Bundle Repository retrieves the information relating to that bundle, namely, the bundle URI, from its cached listing.

However, the inventory mock implementation bundle declares a dependency on the inventory API. The Bundle Repository matches this dependency with the "Bookshelf Inventory API" bundle and installs it.

Then, as all the dependencies required for the "Bookshelf Inventory Impl - Mock" bundle are satisfied, it installs it.

Having specified the -s flag, the installed bundles are started.

When the "Bookshelf Inventory Impl - Mock" bundle is started, its bundle activator's start() method is called. This is when our message "Starting Book Inventory Mock Impl" is printed on the standard output.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.22.71.106