将 AOP 与 OSGI 结合使用的最佳解决方案?

发布于 2024-09-06 22:09:31 字数 145 浏览 7 评论 0原文

我正在使用 Equinox,因此 Equinox Aspect 项目似乎是理所当然的,但该项目似乎处于非活动状态,并且只有一页文档,让我最终悬而未决。

除了那个项目之外,我没有看到在 OSGI 中使用 AOP 的很多选项。让我知道你们的想法以及可能性,谢谢:)

I am using Equinox, so the Equinox Aspect project seems like a no-brainer, but that project appears to be inactive and has only one page of documentation that leaves me hanging at the end.

Other than that project, I do not see many options for using AOP in OSGI. Let me know what you all think and what the possibilities are, thanks :)

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

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

发布评论

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

评论(3

樱娆 2024-09-13 22:09:31

我不知道有什么其他选择,但我不认为 Equinox Aspects 不活跃。它甚至在即将发布的 Helios 发布。

I don't know of any alternative, but I didn't think Equinox Aspects was inactive. It's even receiving new features in the upcoming Helios release.

一人独醉 2024-09-13 22:09:31

显然,最大的问题是缺乏标准化的加载时间编织; Equinox Aspects 和 weaver(AJDT 使用)是目前唯一的选择。好消息是 OSGi 工作组正在积极推进字节码编织的所有辉煌,并将“很快”实现标准化。如果您现在确实需要可靠运行的东西,那么最好的选择仍然是编译时编织。恕我直言,无论如何,这都是一个更好的方法,至少对于 AOP 作为设计时活动来说,正如最初设想的那样。

The big issue is obviously with the lack of standardized loadtime weaving; Equinox Aspects and the weaver (used by AJDT) has been the only option for now. The good news is that bytecode weaving in all its glory is actively in progress in the OSGi working group and will "soon" be standardized. If you really need something that works reliably right now, your best bet is still compile-time weaving. IMHO that is a much better approach anyway, at least for AOP as design-time activity as it was originally envisioned..

烟凡古楼 2024-09-13 22:09:31

作为替代方案,您还可以考虑使用 Apache Felix 依赖管理器,它允许您在运行时向现有 OSGi 服务添加拦截器。当然,这绝不是完整的 AOP 替代品,但对于某些用例来说可能就足够了。

您可以在此处找到更多文档和示例:

http ://felix.apache.org/site/apache-felix-dependency-manager-osgi-design-patterns.html

As an alternative, you could also consider using the Apache Felix Dependency Manager, which allows you to at runtime add interceptors to existing OSGi services. Of course this is in no way a full AOP replacement, but for some use cases it might be enough.

You can find more documentation and an example here:

http://felix.apache.org/site/apache-felix-dependency-manager-osgi-design-patterns.html

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