扩展包在OSGi框架中的含义 [英] Extension bundle meaning in OSGi framework

查看:130
本文介绍了扩展包在OSGi框架中的含义的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发基于OSGi的应用程序.在介绍OSGi框架的功能时,我偶然发现了扩展捆绑包概念.引用R4规范( OSGi R4 ):

I'm developing an OSGi based application. While documenting myself on the features of the OSGi framework I stumbled on the extension bundle concept. Citing the R4 specification (OSGi R4):

扩展捆绑包可以交付框架的可选部分 实施或提供必须驻留在引导程序上的功能 类路径.这些软件包不能由正常人提供 导入/导出机制.引导类路径扩展是必需的 因为某些程序包实现假定它们位于 引导类路径,或必须对所有客户端可用.一个 引导类路径扩展的示例是 java.sql,例如JSR 169

Extension bundles can deliver optional parts of the Framework implementation or provide functionality that must reside on the boot class path. These packages cannot be provided by the normal import/export mechanisms. Boot class path extensions are necessary because certain package implementations assume that they are on the boot class path or are required to be available to all clients. An example of a boot class path extension is an implementation of java.sql such as JSR 169

可能只是我很蠢,但是我在理解这个概念时遇到了困难.我有几个问题:

Probably it's just me being stupid, but I'm having difficulties on understanding the concept. I have several questions:

  1. 据我了解,扩展包正在执行org.osgi.framework.system.packages.extraorg.osgi.framework.bootdelegation(即com.sun.*sun.*)的相同工作.我对吗?如果没有,它们之间有什么区别?

  1. From what I understood it seems that extension bundles are doing the same work of org.osgi.framework.system.packages.extra and org.osgi.framework.bootdelegation(i.e. com.sun.* or sun.*). Am I right? If not, what are the differences between them?

您能为我展示扩展捆绑包的真实用例场景吗?上面写着:除非使用扩展束,否则您将无法做到!" 此处某人已经尝试提供扩展包示例,但(至少对我来说)似乎可以通过调整org.osgi.framework.system.packages.extraorg.osgi.framework.bootdelegation;

Can you show me a real use case scenario for extension bundles? Something that says: "you can't do it unless you use extension bundles!" Here someone already tried to provide an example for extension bundles but (at least for me) it seems one can achieve the same result by tweaking org.osgi.framework.system.packages.extra and org.osgi.framework.bootdelegation;

我知道已经有此SO答案,但对我来说却没有没有完全达到目的.

I know there is already this SO answer but to me it didn't fully hit the point.

感谢所有回复!

推荐答案

扩展束可用于覆盖任何类,甚至java.lang类.

extension bundles can be used to override any class, even java.lang classes.

例如,您可能想跟踪何时调用System.gc()(例如,将堆栈跟踪写入日志文件)

You might want to trace when System.gc() is called for example (e.g. write a stack trace to a log file)

这篇关于扩展包在OSGi框架中的含义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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