外部捆绑中的Osgi Equinox启用组件 [英] Osgi Equinox enable component from external bundle

查看:108
本文介绍了外部捆绑中的Osgi Equinox启用组件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

鉴于这种情况:

捆绑A:组件1A(启用:false) 套件B:组件2B

Bundle A: component 1A (enabled:false) Bundle B: component 2B

如何从捆绑软件B或组件2B中启用组件1A?

How can i enable component 1A from Bundle B or Component 2B?

我试图通过使用componentContext来做到这一点,

I've tried to do it by using componentContext,

dsContext.enableComponent("1A");

但它似乎仅适用于同一捆绑包中的服务.

but it seems to work only with services in the same bundle.

推荐答案

您正在使用一种用于管理的机制,似乎您想在应用程序级别使用它.声明式服务应通过其依赖性或特定于域的方式来启用/禁用.您应该让其他角色启用/禁用组件.使用此路线,您可能会获得非常复杂的系统,因为难以控制时间和顺序.

Your using a mechanism that is intended for management and it seems you want to use it on application level. Declarative services should be enabled/disabled through their dependencies, or through a domain specific means. You should not let another actor that enables/disables a component. Using this route you likely get very complex systems since it is difficult to control the timing and order.

从技术上讲,您应该使用Apache Felix SCR服务来控制DS的启用/禁用,但遗憾的是,这尚未标准化,因此需要Apache Felix SCR作为DS的实现.

Technically, you should use the Apache Felix SCR Service to control the enable/disable of a DS, this is unfortunately not yet standardized and then requires Apache Felix SCR as implementation of DS.

如果您解释了为什么要启用/禁用其他组件,则可能会为您提供更好的解决方案.

If you explain why you want to enable/disable other components it might be possible to point you to better solutions.

这篇关于外部捆绑中的Osgi Equinox启用组件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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