osgijunit4osgi-fragment

How can I access an instance method/property of a Host from Test Bundle Fragment?


I have a bundle test.Bundle1 that have some properties fulfilled by Blueprint injections.

I've created one test fragment whose Host is test.Bundle1 and I would like to obtain myClassA instantiated singleton to access those properties.

I know that I could acess the bundle from a class name using FrameworkUtil.getBundle(), but I don't know how to get the instance of this class.

How could I do that?

thanks

Cristiano


Solution

  • One way to go about this is to simply publish that instance as a service, so you can look it up in code that needs it.