简体   繁体   English

使用AOP和OSGI的最佳解决方案?

[英]Best solution for using AOP with OSGI?

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. 我正在使用Equinox,因此Equinox Aspect项目看起来很简单,但该项目似乎处于非活动状态,并且只有一页文档让我在最后停留。

Other than that project, I do not see many options for using AOP in OSGI. 除了那个项目,我没有看到在OSGI中使用AOP的很多选项。 Let me know what you all think and what the possibilities are, thanks :) 让我知道你们都在想什么以及可能性是什么,谢谢:)

I don't know of any alternative, but I didn't think Equinox Aspects was inactive. 我不知道有什么选择,但我不认为Equinox Aspects不活跃。 It's even receiving new features in the upcoming Helios release. 它甚至在即将发布的Helios版本中获得了新功能。

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. Equinox Aspects和织布工(由AJDT使用)是目前唯一的选择。 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. 好消息是,在OSGi工作组中,字节码编织的所有荣耀正在积极进行,并且将“很快”标准化。 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.. 恕我直言,无论如何,这是一个更好的方法,至少对于AOP来说,它是最初设想的设计时活动。

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. 作为替代方案,您还可以考虑使用Apache Felix依赖管理器,它允许您在运行时向现有OSGi服务添加拦截器。 Of course this is in no way a full AOP replacement, but for some use cases it might be enough. 当然,这绝不是一个完整的AOP替代品,但对于某些用例,它可能就足够了。

You can find more documentation and an example here: 您可以在此处找到更多文档和示例:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM