简体   繁体   English

将OSGI包加载到另一个包中并使用其服务

[英]Loading of an OSGI bundle into another bundle and use its services

I want to use one bundle or more into other bundle dynamically by selecting from a UI in java fx . 我想通过从java fx中的UI中进行选择,动态地将一个或多个bundle用于其他bundle。 On selecting a bundle name I'm able to install it using 在选择包名称时,我可以使用它来安装它

Bundle b = Cntxt.installBundle(file.toURI().toString()); Bundle b = Cntxt.installBundle(file.toURI()。toString());

when I run the application and give ss it shows it has been installed but how can I change the state from installed to resolved and then to active hence use the other bundle??? 当我运行应用程序并给ss它显示它已经安装但我如何将状态从安装更改为已解决然后再激活因此使用另一个捆绑???

You need to start it so it becomes active: 您需要启动它以使其变为活动状态:

b.start();

That will work unless the bundle has dependencies that cannot be resolved, in which case it will throw an exception and refuse to start. 除非bundle具有无法解析的依赖项,否则它将起作用,在这种情况下,它将抛出异常并拒绝启动。

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

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