What do these OSGi commands really do?

霸气de小男生 提交于 2019-12-20 20:19:27

问题


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?


回答1:


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.




回答2:


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.



来源:https://stackoverflow.com/questions/8410986/what-do-these-osgi-commands-really-do

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!