如何定义OSGi包开始级别? [英] How is the OSGi bundle start level defined?
问题描述
如何定义OSGi包的启动级别?
How is the OSGi bundle start level defined?
我正在使用Apache felix,并希望在框架执行中保持启动级别。我预计不需要在Manifest.MF的所有条目中非常频繁地更改捆绑的起始级别.MF似乎是最明智的。我去了org.osgi.framework.startlevel,但还没有看到一个实际的例子。
I am using Apache felix and would like to persist the start level across framework executions. I do not anticipate a need to change the start level of a bundle very frequently at all an an entry in Manifest.MF seems the most sensible. I've to org.osgi.framework.startlevel but have not seen a practical example.
我还在maven-bundle-plugin中使用maven,如果有一种优雅的方式将POM中的起始级别合并到一起就很棒。
I am also using maven with the maven-bundle-plugin, if there is an elegant way to incorporate the start level in the POM that would be brilliant.
推荐答案
捆绑包在构建时没有定义自己的启动级别;将安装捆绑包的管理员或代理定义到框架中。
Bundles don't define their own start level at build-time; the administrator or agent that installs the bundle into the framework defines it.
核心框架定义开始等级引用:
Start Level API提供以下功能:
The Start Level API provides the following functions:
-
控制OSGi框架的起始启动级别。
Controls the beginning start level of the OSGi Framework.
用于修改活动启动级别框架。
Is used to modify the active start level of the Framework.
可用于为捆绑包指定特定的起始等级。
Can be used to assign a specific start level to a bundle.
可以为新安装的软件包设置初始启动级别。
Can set the initial start level for newly installed bundles.
最后一个两个与您的询问相关。第8.3.4节— 更改捆绑包的起始级别—表示框架将持久存储指定的起始级别。
The last two are relevant to your inquiry here. Section 8.3.4—Changing a Bundle's Start Level—indicates that the framework will store an assigned start level persistently.
如果你是使用Apache Felix,有几种方法可以安装bundle并分配它们的启动级别,无论是显式还是允许它们继承已安装bundle的默认启动级别:
If you're using Apache Felix, there are several ways you can install bundles and assign their start level, whether explicitly or by allowing them to inherit a default start level for installed bundles:
- Felix文件安装(参见
felix.fileinstall.start.level
属性,虽然它不是 per-bundle ) - Felix Bundle Auto-Deploy (参见< a href =http://felix.apache.org/site/apache-felix-framework-configuration-properties.html#ApacheFelixFrameworkConfigurationProperties-launcher =nofollow noreferr呃>
felix.auto.install。< n>
财产) - GoGo Shell Command (参见
bundlelevel
命令)
- Felix File Install (see the
felix.fileinstall.start.level
property, though it's not per-bundle) - Felix Bundle Auto-Deploy (see the
felix.auto.install.<n>
property) - GoGo Shell Command (see the
bundlelevel
command)
另外,请参阅 felix.startlevel.bundle
property ,它控制通过上述方式以外的方式安装的软件包。
Also, see the felix.startlevel.bundle
property, which controls bundles installed through means other than those above.
至于设置一个清单属性(例如在构建时使用Maven),以前有一种方法可以在Equinox中执行此操作—现在已弃用—但是没有标准的方法可以让bundle向框架指示什么它应该是适当的起始水平。
As for setting a manifest property (such as with Maven at build time), there used to be a way to do this in Equinox—now deprecated—but there is no standard means for a bundle to indicate to the framework what its proper start level should be.
这篇关于如何定义OSGi包开始级别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!