Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 4 » Getting e4-service from OSGi-service
Getting e4-service from OSGi-service [message #1000911] Tue, 15 January 2013 17:10 Go to next message
Anders  Jönsson is currently offline Anders JönssonFriend
Messages: 48
Registered: January 2012
Member
Hi,
I want to use e4 services such as the EModelService and EPartService in an OSGi-services.

My OSGi-services are typically created using gemini blueprint, but that's not terribly important for this issue.

1. How can I get hold of e4 services in the OSGi service context?

2. Is there an OSGi-service providing these e4-services or any other kind of handle that can be reliably* reached from a OSGi-service (*there is the issue of creating the services in the right order, you ideally want them injected by the framework (e.g. blueprint) when they are ready).

3. Can the EventAdmin service be used in any way?

The reason for this is that I want to start my GUI components using an OSGi-service, avoiding a dependency to Eclipse e4.

///Anders
Re: Getting e4-service from OSGi-service [message #1000924 is a reply to message #1000911] Tue, 15 January 2013 17:42 Go to previous messageGo to next message
Eclipse UserFriend
I don't think you can, out of the box. E4 services are requested through an application-specific context, and E4 tries its best to avoid having any kind of singletons to enable hosting multiple application instances within the same VM.

But there's nothing stopping you from exposing your single MAppplication instance as an OSGI service though (e.g., through a model processor).

Brian.
Re: Getting e4-service from OSGi-service [message #1001046 is a reply to message #1000924] Tue, 15 January 2013 23:02 Go to previous messageGo to next message
Anders  Jönsson is currently offline Anders JönssonFriend
Messages: 48
Registered: January 2012
Member
Brian,
Thanks a lot. I needed to hear that.

This means I will proceed by doing something on my own on the "e4 side" to create the OSGi service as you suggest.

I still don't get why it isn't done for you? I mean, I can't see the problem with, for instance, altering the e4 application model from an OSGi service. Makes me a little bit worried...

///Anders
Re: Getting e4-service from OSGi-service [message #1001054 is a reply to message #1001046] Tue, 15 January 2013 23:34 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
As Brian said, workbench services are NOT exposed as OSGi-Services
because we e.g. want things like RAP work as well and then you have
multiple model instances, same is true for IEventBroker, ... they all
need to be isolated to an application *instance*.

You'll also notice that there multiple EPartService types
(ApplicationPartServiceImpl and PartServiceImpl) because an EPartService
is created through an ContextFunction so it's scope is narrowed even
more, same is true for other services, a user of this services inside an
e4 app does not have to and *should not* know about this!

Tom

Am 16.01.13 00:02, schrieb Anders Jönsson:
> Brian,
> Thanks a lot. I needed to hear that.
>
> This means I will proceed by doing something on my own on the "e4 side"
> to create the OSGi service as you suggest.
>
> I still don't get why it isn't done for you? I mean, I can't see the
> problem with, for instance, altering the e4 application model from an
> OSGi service. Makes me a little bit worried...
>
> ///Anders
Re: Getting e4-service from OSGi-service [message #1001209 is a reply to message #1001054] Wed, 16 January 2013 08:51 Go to previous messageGo to next message
Anders  Jönsson is currently offline Anders JönssonFriend
Messages: 48
Registered: January 2012
Member
Tom,

Hmm, I can see the need for e.g. hierarchical contexts or multiple model instances, but it is harder to see what makes it difficult/problematic or even impossible to expose them (all) in an OSGi service? Retrievable by some ID for instance.

The real question here is: Would you recommend AGAINST using my own OSGi service to get hold of, for instance, the EModelService?

This is what I want to do:
1. Create an initial e4 application model with named "placeholders" for my content.
2. Configure gui views "on the fly" in code that does not know about Eclipse e4.
3. Use a OSGi service to launch the views in their right positions inside Eclipse.

Regards
///Anders
Re: Getting e4-service from OSGi-service [message #1001301 is a reply to message #1001209] Wed, 16 January 2013 12:26 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
You can convince me that we publish something like EApplicationService
giving you access to running application instances anything else does
not make sense.

interface EApplicationsService {
public List<ApplicationInstance> getApplications();
public ApplicationInstance getApplication(String id);
}

interface ApplicationInstance {
public String getId(); // UUID of the application
public IEclipseContext getContext();
}

File a bug and cc me on it. Feel free to copy this response to it so
that we have a starting point.

Tom

Am 16.01.13 09:51, schrieb Anders Jönsson:
> Tom,
>
> Hmm, I can see the need for e.g. hierarchical contexts or multiple model
> instances, but it is harder to see what makes it difficult/problematic
> or even impossible to expose them (all) in an OSGi service? Retrievable
> by some ID for instance.
>
> The real question here is: Would you recommend AGAINST using my own OSGi
> service to get hold of, for instance, the EModelService?
>
> This is what I want to do:
> 1. Create an initial e4 application model with named "placeholders" for
> my content.
> 2. Configure gui views "on the fly" in code that does not know about
> Eclipse e4.
> 3. Use a OSGi service to launch the views in their right positions
> inside Eclipse.
>
> Regards
> ///Anders
Re: Getting e4-service from OSGi-service [message #1001364 is a reply to message #1001301] Wed, 16 January 2013 15:10 Go to previous message
Anders  Jönsson is currently offline Anders JönssonFriend
Messages: 48
Registered: January 2012
Member
That sounds like a perfect solution to me!

Now there is Bug 398297 - Publish handle to e4 applications as OSGi service.

This is the missing link Smile

///Anders
Previous Topic:A service to replace Platform.getAdapterManager() ?
Next Topic:Unit tests on a e4 Application.
Goto Forum:
  


Current Time: Thu Apr 18 02:57:35 GMT 2024

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

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

Back to the top