Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Equinox » get bundleInfo/bundleContext for classes within a bundle outside activator
get bundleInfo/bundleContext for classes within a bundle outside activator [message #105526] Wed, 27 February 2008 15:53 Go to next message
Eclipse UserFriend
Originally posted by: johannes.plassmann.c-lab.de

hi there,
since I'm relatively new to osgi equinox so I have a question concering
bundleContext.

I'm looking out for a method within api,
which allows me to retrieve a bundleContext within a bundle
but outside the activator.

imagine following scenario:

bundle xyz.jar
- activator.java
- class1.java
- class2.java

activator implements BundleActivator,
so activator.java gets info on bundleContext via start/stop methods.

class1 and class2 should have access to a bundlecontext but without
having to implement a method to inject a context obj.

I looking out for methods like:

1. retrieve the framework singleton or get a pointer to the service registry
2. retrieve a bundle (getBundle ("<className or bundleSysmbolicId>") )
3. get the current context for this bundle

so something similar to:

Bundle bundle = Framework.getBundle(<bundleName/className>)

go on further with
bundle. ...


thanks in advance
..--- johannes
Re: get bundleInfo/bundleContext for classes within a bundle outside activator [message #106237 is a reply to message #105526] Wed, 12 March 2008 13:28 Go to previous message
Mickael GAUVIN is currently offline Mickael GAUVINFriend
Messages: 39
Registered: July 2009
Member
It is usually saved statically in the Activator of your bundle.

Johannes Plassmann a écrit :
> hi there,
> since I'm relatively new to osgi equinox so I have a question concering
> bundleContext.
>
> I'm looking out for a method within api,
> which allows me to retrieve a bundleContext within a bundle
> but outside the activator.
>
> imagine following scenario:
>
> bundle xyz.jar
> - activator.java
> - class1.java
> - class2.java
>
> activator implements BundleActivator,
> so activator.java gets info on bundleContext via start/stop methods.
>
> class1 and class2 should have access to a bundlecontext but without
> having to implement a method to inject a context obj.
>
> I looking out for methods like:
>
> 1. retrieve the framework singleton or get a pointer to the service
> registry
> 2. retrieve a bundle (getBundle ("<className or bundleSysmbolicId>") )
> 3. get the current context for this bundle
>
> so something similar to:
>
> Bundle bundle = Framework.getBundle(<bundleName/className>)
>
> go on further with
> bundle. ...
>
>
> thanks in advance
> .--- johannes
>
>
>
Previous Topic:Remote install/start
Next Topic:Is this official API - IExtensionRegistry#addListener(IRegistryEventListener)?
Goto Forum:
  


Current Time: Fri Oct 22 01:26:30 GMT 2021

Powered by FUDForum. Page generated in 0.01932 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top