类似 osgi 的框架,没有导入/导出限制?

发布于 2024-08-11 02:42:10 字数 221 浏览 4 评论 0原文

我喜欢 OSGi,但是导入/导出限制和缺少上下文类加载器在尝试使用第 3 方库时会造成严重破坏(例如,某些库尝试在 META-INF 中查找 file.xml,期望在所有 jar 中找到所有此类文件)要返回,其他库使用ServiceLoader)。

我想要 OSGi 的动态加载、处理同一库的多个版本的能力以及服务框架。

那么我的选择是什么?我知道 JPF,正在寻找不那么 xmlish 的东西。

I like OSGi, but the import/export restrictions and the lack of context class loader creates havoc when trying to use 3rd party libraries (e.g., some libraries try to find file.xml in META-INF, expecting for all such files in all jars to be returned, other libraries use ServiceLoader).

I want OSGi's dynamic loading, ability for handling several versions of the same library, and service framework.

So what are my alternatives? I know of JPF, looking for something less xmlish.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

北陌 2024-08-18 02:42:10

我遇到了将 java 邮件包与 java 激活包分开的问题。您可以使用以下选项来获取 1 个包以查看其他包的 META-INF 中的文件(即不是 java 资源,而是诸如 xml 文件之类的文件)。

1)将捆绑包合并在一起。对于项目来说,这通常很难处理,或者并非不可能。

2) 让需要共享资源的bundle是需要读取资源的bundle的bundle片段。捆绑包片段由 OSGi 规范定义,允许单独的捆绑包共享资源,就像它们合并在一起一样。

I had this problem with having a java mail bundle separate from my java activation bundle. You have the following options to get 1 bundle to see files (ie. not java resources but things like xml files) in META-INF of other bundles.

1) Merge the bundles together. This is often icky to deal with or just not impossible for the project.

2) Have the bundles that need to share resources be bundle fragments of the bundle that needs to read up the resources. Bundle fragments are defined by the OSGi spec and allow separate bundles to share resources as though they were merged together.

作业与我同在 2024-08-18 02:42:10

您是否尝试过用谷歌搜索每个库+ osgi?快速浏览一下可以看到其他一些经验和(看起来)成功。

对于“只需谷歌它的答案”感到抱歉,但由于我没有在我的 OSGi 应用程序中积极使用这些库,所以我只能建议我如何为我的一些库处理这个问题......这是谷歌。

这并不是一个很好的答案,但我不希望这个问题被埋在评论中。

Have you tried googling for each library + osgi? A quick glance shows some others experiences and (it would seem) successes.

Sorry for the "just google it answer" but since I don't actively use these libraries in my OSGi app I can only suggest how I've handled this for some of my libraries ... which was google.

This is not really a good answer, but I don't want this buried in comments.

怀里藏娇 2024-08-18 02:42:10

我想要 OSGi 的动态加载、处理同一库的多个版本的能力以及服务框架。

还有其他服务框架,但据我所知,OSGi 没有其他服务框架来实现动态加载和同一类的多个版本。

而且,现在 OSGi 似乎终于获得了一些关注,图书馆“表现得很好”的压力正在上升。例如 SpringSource 维护着不断增长的 OSGified 库集合。您需要的包可能已经在那里。

I want OSGi's dynamic loading, ability for handling several versions of the same library, and service framework.

There are other service frameworks, but to get dynamic loading and several versions of the same class there is nothing else by OSGi that I know of.

Also, now that OSGi seems to finally gain some traction, the pressure on libraries to "play nice" is rising. SpringSource for example maintains a growing collection of OSGified libraries. The package you need may already be there.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文