检查文件是否为OSGi捆绑软件(并找到捆绑软件名称),而不将其安装在OSGi框架中 [英] Check whether a file is an OSGi bundle (and find the bundle name) without installing it in the OSGi framework

查看:101
本文介绍了检查文件是否为OSGi捆绑软件(并找到捆绑软件名称),而不将其安装在OSGi框架中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有可能吗?还是我必须尝试安装它?

Is it possible? Or do I have to try to install it?

推荐答案

我假设您正在谈论OSGi版本4,因为在OSGi版本3和更早版本的任何中,有效的JAR文件也是有效的OSGi捆绑包.

I'll assume you're talking about OSGi Release 4, since in OSGi Release 3 and earlier any valid JAR file was also a valid OSGi bundle.

使用java.util.jar包中的标准Java API只需读取JAR的清单.要成为有效的R4捆绑包,所需的最小标头为:

Simply read the JAR's manifest using the standard Java APIs in the java.util.jar package. The minimum headers required to be a valid R4 bundle are:

  • Bundle-ManifestVersion: 2
  • Bundle-SymbolicName: ...
  • Bundle-ManifestVersion: 2
  • Bundle-SymbolicName: ...

正如BJ指出的那样,捆绑软件的"id"是在安装时分配的,但实际上很多人都将其作为捆绑软件的符号名称.

As BJ points out, the "id" of the bundle is assigned when it is installed, but what many people take to be the "id" is actually the Bundle Symbolic Name.

这篇关于检查文件是否为OSGi捆绑软件(并找到捆绑软件名称),而不将其安装在OSGi框架中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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