I have to pass parameters between parent application and embeded OSGi. I use equinox and run OSGi by FrameworkFactory in my Launcher class, then I install and start bundles. It is possible to pass object reference or even some primitive type to bundle or service?

有帮助吗?

解决方案

After launching the framework, you can get the system bundle context and access and call services registered by bundles in the framework. Care must be taken about the service types since the are likely loaded from bundles and thus the types are not directly visible to your launching code. But you can use reflection. Or you can put those types in the framework classloader and export them from the system bundle via org.osgi.framework.system.packages.extra framework property your launcher sets.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top