We have just released new versions of bundles bookshelf-service
and bookshelf-service-tui
. Before updating them in the framework, the state of the bundle listing should be something like:
g! lb
START LEVEL 5
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.5.0)
6|Active | 2|Bookshelf Inventory Impl - Mock (1.5.0)
7|Active | 3|Bookshelf Service (1.7.0)
8|Active | 5|Bookshelf Service Gogo commands (1.8.0)
The repos refresh
command instructs the OBR service to reload the repositories and update its listings:
g! repos refresh file:///C:/projects/felixbook/releases/repository.xml
Now, by searching for our bundles, we will find:
g! list book
Bookshelf Inventory API (1.5.0)
Bookshelf Inventory Impl - Mock (1.5.0)
Bookshelf Service (1.8.0, ...)
Bookshelf Service Gogo commands (1.8.1, ...)
Notice that the bundles "Bookshelf Service" and "Bookshelf Service Gogo commands" now have the newer versions shown in the list of versions available. The list is shortened with ellipses, which means that other (lower) versions have been omitted.
To get a fuller listing, we can use the verbose option:
g! list -v book
Bookshelf Inventory API
[com.packtpub.felix.bookshelf-inventory-api] (1.5.0)
Bookshelf Inventory Impl - Mock
[com.packtpub.felix.bookshelf-inventory-impl-mock] (1.5.0)
Bookshelf Service
[com.packtpub.felix.bookshelf-service] (1.8.0, 1.7.0)
Bookshelf Service Gogo commands
[com.packtpub.felix.bookshelf-service-tui] (1.8.1, 1.8.0)
Here the "Bookshelf Service" is available with two versions, namely, 1.7.0 and 1.8.0.
To instruct Felix to update its currently installed bundle with its latest version, we use the update
command, which we've seen in Chapter 3. It takes the bundle ID as a parameter and updates the bundle with the latest version:
g! update 7
DEBUG: Using ResourceSelectionStrategy: newest
DEBUG: Using Version 1.8.0 for bundle com.packtpub.felix.bookshelf-service
g!
g! update 8
DEBUG: Using ResourceSelectionStrategy: newest
DEBUG: Using Version 1.8.1 for bundle com.packtpub.felix.bookshelf-service-tui
The resulting bundle listing should be as follows:
g! lb
START LEVEL 5
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.5.0)
6|Active | 2|Bookshelf Inventory Impl - Mock (1.5.0)
7|Active | 3|Bookshelf Service (1.8.0)
8|Active | 5|Bookshelf Service Gogo commands (1.8.1)
And the updated help listing should be:
g! help
book:add
book:search
felix:bundlelevel
felix:cd
felix:frameworklevel
felix:headers
felix:help
felix:inspect
...
The add
command was added to the listing, as expected. Its syntax from the help
command is:
g! help add
add
scope: book
parameters:
String username
String password
String ISBN
String Title
String Author
String Category
int Rating (0..10)
By deploying newer versions of the bookshelf-service
and bookshelf-service-tui
bundles, Maven (with the help of the maven-bundle-plugin)
has updated our releases repository with new entries.
Then the repos refresh
command has instructed the OBR service to go and fetch that file again and to update its listing cache with its latest contents. This has added the versions of the newly deployed bundles to the list.
When we've asked Felix to update the bundle (using the update
command), it has looked at the bundle source location. Bundles installed using the OBR service are given a special URL as the source location (for example, obr://com.packtpub.felix.bookshelf-service/-1284463217828)
.
The OBR service has a stream handler registered for the obr:
protocol; it will intercept requests for load of this bundle. Then check for newer versions of the bundles and return the latest compatible bundle.
In this case, the bundle is already ACTIVE, so the framework will:
If you need to, go back to Chapter 1 to review the states of a bundle in the framework.
3.21.98.207