Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PeaberryActivationModule should provide a reference to OSGi BundleContext #56

Open
mcculls opened this issue Jun 22, 2015 · 6 comments
Open

Comments

@mcculls
Copy link
Member

mcculls commented Jun 22, 2015

Originally reported on Google Code with ID 53

If the user uses the automatic bootstrapping of Peaberry bundles, there is NO way to
get the BundleContext object.

Reported by yungkce on 2010-10-13 11:24:00

@mcculls
Copy link
Member Author

mcculls commented Jun 22, 2015

As Todor mentioned on the mailing list, just @Inject BundleContext wherever you need
it.

Reported by mcculls on 2010-10-13 18:00:03

@mcculls
Copy link
Member Author

mcculls commented Jun 22, 2015

But what if I would like to refer to the BundleContext in the PeaberryActivationModule's
configure() method? It is before Guice @Inject the BundleContext object.

Reported by yungkce on 2010-10-14 07:42:26

@mcculls
Copy link
Member Author

mcculls commented Jun 22, 2015

Can you elaborate on what you need to use the BundleContext for in the module itself?
Binding modules are usually small and side-effect free, so I'm just wondering why you
need the context when setting up bindings.

Reported by mcculls on 2010-10-14 10:48:22

@mcculls
Copy link
Member Author

mcculls commented Jun 22, 2015

Since I would like to use the Manifest header of the bundle for setting the attributes
of the exported services inside the configure() method, the only way to get those header
is from the BundleContext.getBundle().getHeaders() method unless I can export the services
outside the configure() method.

Reported by yungkce on 2010-11-12 10:53:02

@mcculls
Copy link
Member Author

mcculls commented Jun 22, 2015

It seems best to pass the BundleContext to the module constructor. Currently we expect
the module to have a default constructor. We could support a constructor with a BundleContext
as well. I am not sure how nice this will be since now there are two ways to obtain
the BundleContext and the users cat try to bind it a second time.

Stuart what do you think?

Reported by Rinsvind on 2010-11-12 13:48:48

@mcculls
Copy link
Member Author

mcculls commented Jun 22, 2015

Reported by mcculls on 2012-08-04 21:41:37

  • Labels added: Peaberry-Extension

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant