While I was poking around trying to solve a different jndi issue (which turned out to not be a jndi issue at all) I came across a possible solution to another bit of my architecture which is currently inelegant.

Right now, bundles I'm developing tend to have a ContextHolder singleton that other classes in the same bundle use to get access to the BundleContext.

in the osgi enterprise spec, pg 394/395, I found "A JNDI client can also obtain the BundleContext of the owning bundle by using the osgi: scheme namespace with the framework/bundleContext name. The following URL must return the Bundle Context of the owning bundle: osgi:framework/bundleContext "

Does this mean "if you're lucky enough to already have the jndi service, retrieved by some other place that already had the bundle context, then you can get the bundle context too" or does it mean there's a jndi way of getting the bundle context without requiring service lookup (which would itself require the bundle context)?

Or, I may be thinking about the problem wrong and there may be some other way of dumping the singleton I'm using. In other words, I might be missing something that's pretty foundational to OSGi programming, I'm not sure. I'm posting to this list because I found it in the osgi-enterprise-jndi section and aries is an osgi jndi implementer.. thoughts?

-Jamie

Reply via email to