Apache Karaf如何排序要安装和启动的捆绑软件? [英] How Apache Karaf sorts bundles to install and start?

查看:77
本文介绍了Apache Karaf如何排序要安装和启动的捆绑软件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经定义了四个捆绑包:

I have defined four bundles:

bundle 1 : export package x version 1
bundle 2 : import package x ver [1,2] and export package y;y uses x    
bundle 3 : export package x version 2
bundle 4 : import package y and also import package x version 2

使用apache felix(可分发的二进制文件),我发现我应该手动强加在启动捆绑软件3之前先不解析(或启动)捆绑软件1,然后解析捆绑软件2的方法(否则会出现使用约束问题,因为捆绑软件2将使用软件包x版本1和捆绑软件4中将显示包x版本1和版本2->使用约束违例).
感谢这些帖子的作者:
http://njbartlett.name/2011/02/09/uses-constraints.html
http://blog.springsource.com/2008/10/20/understanding-the-osgi-uses-directive/
我不希望对捆绑软件强加命令,我需要将所有捆绑软件复制到/bundle目录中,然后框架实例安装并启动它们. 我注意到Apache felix对要按字母顺序安装的捆绑软件进行排序(因此将安装捆绑软件1,然后启动第一个捆绑软件). 我尝试使用Apache karaf,将捆绑包复制到/deploy,发现问题消失了,所以我的问题是:

Using apache felix (distribuable binary), I found that I should manually impose to not resolve (or start) the bundle 1 and then bundle 2 before starting the bundle 3 (otherwise a uses constraint problem appears because bundle 2 will use package x version 1 and in bundle 4 will appear package x version 1 and version 2 --> uses constraint violation).
Thanks to the authors of these posts:
http://njbartlett.name/2011/02/09/uses-constraints.html
http://blog.springsource.com/2008/10/20/understanding-the-osgi-uses-directive/
I don't like to impose order to my bundles, I need to copy all my bundles in the /bundle directory and then the instance of framework install and start them. I noticed that Apache felix sorts the bundles to be installed alphabetically (so bundle 1 will be installed and then started the first). I tried with Apache karaf, I copied my bundles into /deploy and I found that the problem disappears, so my question is:

为了避免这些问题,Apache Karaf(或felix文件安装)是否应用了一种策略来强加启动捆绑软件的任何顺序?

Does Apache Karaf, (or felix file install) apply a strategy to impose any order for starting bundles in order to avoid these kind of problems ?

推荐答案

您应尝试将Karaf功能用于此类部署.您创建了一个其中包含一个功能部件的功能部件文件,并将所有捆绑软件添加到该功能部件中.然后,Karaf将加载所有捆绑包,并一口气解析并启动它们.因此,解析器应该能够正确解析您的所有捆绑软件.

You should try to use a Karaf feature for this kind of deployment. You create a feature file with one feature in it and add all the bundles to this feature. Karaf will then load all the bundles and resolve and start them in one pass. So the resolver should bee able to correctly resolve all your bundles.

这篇关于Apache Karaf如何排序要安装和启动的捆绑软件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆