Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What do these OSGi commands really do?

Using Felix / Equinox, what do the following do under the hood?

osgi:install
osgi:refresh
osgi:resolve
osgi:restart
osgi:update

Is there a state-machine diagram or more concise documentation somewhere?

like image 245
wulfgarpro Avatar asked Dec 07 '11 05:12

wulfgarpro


2 Answers

The best documentation for this is the OSGi Core Specification. The section and page numbers below refer to Release 4.3 (April 2011) of the spec.

osgi:install means install a bundle from a file or stream, and it maps to the BundleContext.installBundle method in the API. Refer to section 4.4.3 on page 90.

osgi:refresh performs a "refresh packages" operation, which allows exports/imports to be rewired after installing or updating a set of bundles. For example, bundles that are currently wired to a particular exporter of a package may be rewired to a newly installed bundle that exports the same package. See section 7.6.1, page 148.

osgi:resolve is similar to refresh, but it only wires up bundles that are currently in the INSTALLED state. I.e. it will not rewire existing wires belonging to bundles that are already in the RESOLVED sate.

osgi:restart stops and restarts a specific bundle. This does not cause the bundle implementation to be updated, it simply stops and starts. See section 4.4.5 page 91 and 4.4.7 page 95.

osgi:update requests for a single bundle to be updated (i.e. reloaded from its original location). This may involve stopping, re-resolving and starting the bundle, depending on what state it was in before the update. See section 4.4.9 page 95.

The state diagram for all the OSGi bundle states is in section 4.4.2 (Figure 4.4) page 90.

like image 91
Neil Bartlett Avatar answered Nov 15 '22 15:11

Neil Bartlett


For the details of what the Felix shell commands do, you might just look at their source code, at http://svn.apache.org/repos/asf/felix/trunk/shell/src/main/java/org/apache/felix/shell/impl/ - most of them are short and simple.

like image 24
Bertrand Delacretaz Avatar answered Nov 15 '22 14:11

Bertrand Delacretaz