[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [equinox-dev] [OSGi] practices with the bundle context
- From: Benjamin Reed <breed@xxxxxxxxxxxxxxx>
- Date: Tue, 08 Jul 2003 16:30:46 -0700
- Delivered-to: firstname.lastname@example.org
- User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.0) Gecko/20020623 Debian/1.0.0-0.woody.1
What are the regular practice with the bundleContext?
Do you store it?
No, it is a transient object, so storing it will do no good.
Do you make it accessible to other classes in the bundle?
Yes, usually you do. It is important though not to let a BundleContext
leak out to other bundles. The BundleContext is a bundle's interface to
the framework, so a bundle can masquerade as another bundle if it has
that bundle's BundleContext.
Do you surface some of its API in the activator and store the
I wouldn't surface the API in the activator, but certainly you may
surface some of the functionality in other objects. Often though you
just end up passing around the BundleContext.
Basically it offers a lot of functions that are interesting to install
bundles, and get information about the platform.
So how am I supposed to proceed for other classes of my bundle to use
Except for instances where the BundleContext may leak to other bundles,
I wouldn't feel bad about passing around the BundleContext.