retreiving BundleContext or BundleActivator from Bundle class [message #43665] |
Thu, 24 June 2004 10:22  |
Eclipse User |
|
|
|
Originally posted by: egglersim.post.ch
i'm working on a service IoC framework for the eclipse osgi runtime. the
problem i most often run into, is accessing the bundle's activator or
context. they only seem accessible at startup time of a bundle
(start(BundleContext)).
when implementing a bundle listener or looking up bundles via the
Platform.getBunde(..) method, i get an instance of the internal
bundlehost object, which hides access to the context nor the activator
(plugin class).
is this the way it's intended to be or is there a possiblity to access
those objects in any other way?
cheers,
simon
|
|
|
|
|
Re: retreiving BundleContext or BundleActivator from Bundle class [message #43819 is a reply to message #43794] |
Mon, 28 June 2004 14:34  |
Eclipse User |
|
|
|
Originally posted by: pascal.ibm.canada
It is unclear what you mean by "inject". If you want to replace the
activator, you are not at the right level.
It seems to me that given the kind of control you want, you should look
at writing your own adaptor (FrameworkAdaptor). The adaptor is basically
the interface between the osgi fwk that contains the logic of classload,
bundle lifecycle, etc. and for short the filesystem and other details
about the internal of the fwk.
The problem with providing your own adaptor is that there can only be
one adaptor in the system running at once.
PaScaL
Eggler Simon, PF52 wrote:
> i'd like to have one bundlelistener that acts o bundle activation. it
> reads the extensions configuration for each bundle, and if specified in
> a custom extension point, looks up the service in the context and
> injects it into the bundle activator.
>
>
> does that make sense?
>
>
>
> Pascal Rapicault wrote:
>
>> All that is intended. You never have to call the activator methods of
>> a bundle directly. They are reserved to the framework. If you want to
>> call start or stop, simply starts and stops bundles.
>>
>> The BundleContext is and must stay private (this is clearly indicated
>> in the OSGi docs). This object represents the identity of a bundle. If
>> I were to get your bundleContext then I could pretend being you and
>> have your priviledge which is pretty bad.
>>
>> Why do you need the bundleContext?
>>
>> PaScaL
>>
>> Eggler Simon, PF52 wrote:
>>
>>> i'm working on a service IoC framework for the eclipse osgi runtime.
>>> the problem i most often run into, is accessing the bundle's
>>> activator or context. they only seem accessible at startup time of a
>>> bundle (start(BundleContext)).
>>>
>>> when implementing a bundle listener or looking up bundles via the
>>> Platform.getBunde(..) method, i get an instance of the internal
>>> bundlehost object, which hides access to the context nor the
>>> activator (plugin class).
>>>
>>> is this the way it's intended to be or is there a possiblity to
>>> access those objects in any other way?
>>>
>>> cheers,
>>> simon
>>>
|
|
|
Powered by
FUDForum. Page generated in 0.04118 seconds