本文介绍了Karaf 和 OBR 中的功能有什么区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在研究部署和更新 OSGI(特别是 Karaf)应用程序的方法.似乎有几种选择.一种是使用 OSGi Bundle Repository (OBR),另一种是使用 Karaf 中的 Features,第三种是使用 卡拉夫洞穴.

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, 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.

--企业 OSGi 实战:http://www.manning.com/cummins

-- Enterprise OSGi in Action: http://www.manning.com/cummins

这篇关于Karaf 和 OBR 中的功能有什么区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-21 17:37