|
Re: Extensions & Services [message #94646 is a reply to message #94631] |
Wed, 08 August 2007 22:48 |
Eclipse User |
|
|
|
Originally posted by: alex_blewitt.yahoo.com
Usually, one bundle will scan for the extensions contributed by others, and invoke 'createExecutableExtension' for the things that it wants. That performs the magic to link the bundle wanting the extension to the bundle needing the extension. Most 'Eclipse' clients just use extensions.
However, you don't have to just constrain yourself to using extensions if you want to use OSGi services instead. That's also possible. And, since the extension registry is itself an OSGi bundle that can run on other OSGi environments, then there's no reason you can't ship that as well as your application.
You might like to read:
http://www.eclipsezone.com/eclipse/forums/t97608.rhtml
(and its precursor, if you don't know what it is) as well as
http://www.eclipsezone.com/articles/extensions-vs-services/
Alex.
|
|
|
|
Re: Extensions & Services [message #94674 is a reply to message #94660] |
Thu, 09 August 2007 09:32 |
Eclipse User |
|
|
|
Originally posted by: alex_blewitt.yahoo.com
> You could also use DeclarativeServices to receive your service
> references. That would be the OSGi way not the eclipse way.
Whilst I agree on your point about using DS (the linked article earlier looks into that) bear in mind that the extension registry bundle is an OSGi bundle and can be used in other OGSi environments. It's not necessarily specific to Eclipse.
Alex.
|
|
|
Re: Extensions & Services [message #94689 is a reply to message #94646] |
Thu, 09 August 2007 13:52 |
Brett Humphreys Messages: 17 Registered: July 2009 |
Junior Member |
|
|
Sorry, I don't think I was very clear. I'm using the equinox extension registry to create my
extensions (using the createExecutableExtension mechanism). My extensions are being created just
fine and things are working well.
However it seems to me that extensions and services serve two different purposes and I wanted to
leverage them both. Specifically I was looking for a (clean) way for code instantiated via
"createExecutableExtension" to be able to acquire a reference to a service.
I could use DS, however its status is still red, and I'd really rather go with something more stable.
The solution I've come up with is write some static OSGi Utility methods which can get a bundle from
a given class (possibly an instantiated extension class), from it, get the bundle's context, and
then acquire resources from the service registry. This seems like an acceptable solution to me, but
wondered how other people were solving this issue.
It sounds like the eclipse platform just doesn't deal with the issue at all, and strictly uses
extensions?
-Brett
Alex Blewitt wrote:
> Usually, one bundle will scan for the extensions contributed by others, and invoke 'createExecutableExtension' for the things that it wants. That performs the magic to link the bundle wanting the extension to the bundle needing the extension. Most 'Eclipse' clients just use extensions.
>
> However, you don't have to just constrain yourself to using extensions if you want to use OSGi services instead. That's also possible.. And, since the extension registry is itself an OSGi bundle that can run on other OSGi environments, then there's no reason you can't ship that as well as your application.
>
> You might like to read:
>
> http://www.eclipsezone.com/eclipse/forums/t97608.rhtml
> (and its precursor, if you don't know what it is) as well as
> http://www.eclipsezone.com/articles/extensions-vs-services/
>
> Alex.
|
|
|
Re: Extensions & Services [message #94704 is a reply to message #94689] |
Thu, 09 August 2007 14:33 |
Danail Nachev Messages: 36 Registered: July 2009 |
Member |
|
|
Hi, Brett
I'm not aware of all the possible ways to solve this. I think that the
most common way is to set activator to the bundle where extension class
is lives (the class which is instantiated via
createExecutableExtension()). The instantiated class will reference the
activator class directly and communicate with the framework.
You can always initialize the extension via some defined method and pass
the service (or bundle context object). However, you this means that you
have to get hold of the bundle context object, which means that you need
to find out the bundle which contributed the extension.
I think that the first option is much better, IMHO:)
Danail
Brett Humphreys wrote:
> Sorry, I don't think I was very clear. I'm using the equinox extension
> registry to create my extensions (using the createExecutableExtension
> mechanism). My extensions are being created just fine and things are
> working well.
>
> However it seems to me that extensions and services serve two different
> purposes and I wanted to leverage them both. Specifically I was looking
> for a (clean) way for code instantiated via "createExecutableExtension"
> to be able to acquire a reference to a service.
>
> I could use DS, however its status is still red, and I'd really rather
> go with something more stable.
>
> The solution I've come up with is write some static OSGi Utility methods
> which can get a bundle from a given class (possibly an instantiated
> extension class), from it, get the bundle's context, and then acquire
> resources from the service registry. This seems like an acceptable
> solution to me, but wondered how other people were solving this issue.
>
> It sounds like the eclipse platform just doesn't deal with the issue at
> all, and strictly uses extensions?
>
> -Brett
>
>
>
> Alex Blewitt wrote:
>> Usually, one bundle will scan for the extensions contributed by
>> others, and invoke 'createExecutableExtension' for the things that it
>> wants. That performs the magic to link the bundle wanting the
>> extension to the bundle needing the extension. Most 'Eclipse' clients
>> just use extensions.
>>
>> However, you don't have to just constrain yourself to using extensions
>> if you want to use OSGi services instead. That's also possible.. And,
>> since the extension registry is itself an OSGi bundle that can run on
>> other OSGi environments, then there's no reason you can't ship that as
>> well as your application.
>>
>> You might like to read:
>>
>> http://www.eclipsezone.com/eclipse/forums/t97608.rhtml
>> (and its precursor, if you don't know what it is) as well as
>> http://www.eclipsezone.com/articles/extensions-vs-services/
>>
>> Alex.
|
|
|
Powered by
FUDForum. Page generated in 0.05114 seconds