|
Re: org.osgi.framework.FrameworkUtil.getBundle(Class) method, where is it? [message #543934 is a reply to message #543858] |
Thu, 01 July 2010 07:11 |
|
> The only other option I've seen is to make a static reference to the BundleContext in the Activator, which seems kinda ugly :(
It's not ugly but common practice to set/unset a static reference in
your activator when a bundle is started/stopped. This allows to keep
references to your BundleContext. You could also install service
trackers in your activator and inject those into a factory class of your
own if you. But that just encapsulates the statics into another class. ;)
FrameworkUtil#getBundle(Class) may have some disadvantages (performance,
security). However, in case you need it, simply add "org.osgi.framework"
as Import-Package in your manifest and you'll have it. It's there in
Equinox 3.6.
BTW, have you looked at DS? This might be an alternative if you don't
like dealing with an activator and static references.
-Gunnar
--
Gunnar Wagenknecht
gunnar@wagenknecht.org
http://wagenknecht.org/
|
|
|
|
Powered by
FUDForum. Page generated in 0.02070 seconds