仅在servicemix上列出捆绑包ID [英] List bundle ID's only on servicemix
问题描述
我正在使用ServiceMix,并且试图列出一些捆绑软件并仅检索那里的捆绑软件ID. 我正在尝试执行以下操作:
I'm using ServiceMix and I was trying to list some bundles and retrieve only there bundle ID. I'm trying to do the following:
osgi:list | grep -i | awk xxx
osgi:list | grep -i | awk xxx
我尝试使用awk,但ServiceMix中未提供. 我也试图像这样使用shell:exec:
I tried to use awk but that's not provided in ServiceMix. I also tried to use shell:exec like this:
osgi:list | grep -i | shell:exec
awk 'xxx'
但是那也不起作用,也许我的方法是完全错误的. 其他人是否有一些经验,我如何才能实现仅检索捆绑商品ID的目标?
But that doesn't work either, maybe my approach is completely wrong. Does anybody else have some experience how I could achieve my goal of only retrieving the id's of a bundle?
推荐答案
您始终可以使用Karaf的外壳语言(从karaf 2.3.1开始使用)
You can always make use of Karaf's shell language (Works as of karaf 2.3.1)
bundles = $.context bundles ;
echo "Printing bundle information" ;
each ($bundles) {
symbolicName = $it symbolicName ;
bundleId = (($it bundleid) toString) ;
echo "Symbolic name : " $symbolicName " Bundle Id : " $bundleId ;
}
运行时,将输出类似的内容:
When ran this will output something similiar to :
Symbolic name : org.apache.felix.framework Bundle Id : 0
Symbolic name : org.ops4j.pax.url.mvn Bundle Id : 1
Symbolic name : org.ops4j.pax.url.wrap Bundle Id : 2
Symbolic name : org.ops4j.pax.logging.pax-logging-service Bundle Id : 3
这篇关于仅在servicemix上列出捆绑包ID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!