Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How could I get BundleContext in Spring DM?

I am newly on Spring DM and I would like to access Bundlecontext. My problem is that I have a bundle with Activator, but it does not have xml config file. I cannot touch this bundle, then I need to access to BundleContext and serviceReference to obtain the service in my bundle. I am using Spring DM in my bundle. So, how could I get BundleContext?

Thanks!

Regards!

like image 680
Jose Hdez Avatar asked Jul 19 '11 09:07

Jose Hdez


1 Answers

One way is to implement BundleContextAware and the other one, if you don't want to rely on DM and its mechanisms:

BundleContext bundleContext = FrameworkUtil.getBundle(this.getClass()).getBundleContext();
like image 162
omnomnom Avatar answered Oct 22 '22 00:10

omnomnom