问题描述
我正在研究部署和更新OSGI(特别是Karaf)应用程序的方法.似乎有几种选择.一种是使用OSGi捆绑软件存储库(OBR),另一种是使用Karaf中的功能,第三种是使用卡拉夫洞穴.
I am looking into ways to deploy and update an OSGI (Karaf, specifically) application. It seems that there are several options. One is to use The OSGi Bundle Repository (OBR), another is to use Features in Karaf, and the third is to use Karaf Cave.
我不确定这些选项到底有什么不同.他们似乎都在做同样的事情.它们只是同一功能的不同实现吗?有人可以解释这些差异或提供一些建议吗?
I'm not really sure how these options are really different. They all seem to be doing the same things. Are they just different implementations of the same functionality? Could someone please explain the differences or provide some recommendations?
推荐答案
Karaf功能和OBR是解决(某种)相同问题的不同方法.两者都允许您将OSGi捆绑软件安装到OSGi框架中,但是它们如何决定要安装的捆绑软件却有所不同.
Karaf features and OBR are different ways of solving the (sort of) same problem. Both allow you to install OSGi bundles into an OSGi framework, but how they decide which bundles to install is different.
使用Karaf功能,您将提供一个文件(例如,feature.xml),该文件显式列出该功能的所有捆绑包的URL.它们可以存在于文件系统上,也可以存在于Maven存储库中,也可以存在于URL可以描述的其他任何地方.
With a Karaf feature, you provide a file (feature.xml, say) which explicitly lists URLs for all the bundles for the feature. They can live on the filesystem, or in a maven repository, or anywhere else which can be described by a URL.
OBR根据需求和功能确定要打包的捆绑包.它将计算出您要安装的所有内容的传递性依赖关系,并确保它们都已安装.通常,您将配置一个或多个支持OBR格式的外部存储库,然后在运行时中的OBR解析器将从这些存储库中提供捆绑软件.因此,您可以说我需要org.foo软件包"或我需要实现org.bar的OSGi服务",供应商将决定最适合您需求的捆绑包. OBR比Karaf功能更灵活,更通用,但是如果您只是将一组定义良好的捆绑包安装到已经使用所需基础结构准备就绪的框架中,则OBR可能会过大.如果组成您的应用程序的捆绑包之间没有相互依赖关系,这也无济于事-您仍然需要将所有捆绑包都包括在初始集"中.
OBR, on the other hand, works out what bundles to work out based on requirements and capabilities. It will work out the transitive dependencies of whatever you're installing as your starting point and make sure they all get installed. Usually you'd configure one or more external repositories which support the OBR format, and then an OBR resolver in your runtime would provision bundles from those repositories. So you can say "I need package org.foo" or "I need an OSGi service which implements org.bar" and the provisioner will decide which bundles best suit your requirements. OBR is more flexible and generic than Karaf features, but it might be overkill if you're just installing a well-defined set of bundles into a framework which is already primed with the infrastructure you need. It also doesn't help you if the bundles which make up your application don't have dependencies on each other - you'll still need to include them all in your 'starting set'.
区别变得有些模糊,因为Karaf功能允许您在Maven URL中指定版本范围,因此即使有了该功能,您也可以灵活地配置. Karaf功能还具有与OBR的互操作性,因此您可以根据OBR要求编写功能定义文件.
The distinction gets a bit blurred, because Karaf features allow you to specify version ranges in the maven URLs, so even with a feature you can be a bit flexible in what gets provisioned. Karaf features also have an interoperability with OBR so you can write your feature definition file in terms of OBR requirements.
我相信Karaf Cave是具有某些功能的OBR实现.因此,它是服务器,而不是功能或OBR设置等新的技术".
I believe Karaf Cave is an OBR implementation with some feature-features. So it's a server rather than a new 'technology' like features or OBR provisioning.
-正在运行的Enterprise OSGi: http://www.manning.com/cummins
-- Enterprise OSGi in Action: http://www.manning.com/cummins
这篇关于Karaf和OBR中的功能有什么区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!