Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » add a RCP gui to an existing Equinox/OSGi environment
add a RCP gui to an existing Equinox/OSGi environment [message #544893] Mon, 05 July 2010 22:24 Go to next message
Rob is currently offline Rob
Messages: 3
Registered: July 2010
Junior Member
Hi guys,

I have developed my Equinox/OSGi application backend with some fancy hardware access via rxtx and other stuff and would like to add an RCP gui for monitoring now. I intend to use some list views and probably gonna add some graphs later on with GEF.

So far I managed to have either the gui running with an "Eclipse Application"-Run configuration or the backend as usual with an "OSGi Framework"-Run configuration. In both I can't get the ui to subscribe to my declarative services in the backend which provide the values I want to display. The application/view does not seem to be activated or started at all, it stays in state "resolved" even after starting it manually in the osgi console. The Activator is never called, but the class instantiated, therefore I can see the View in a Window including the tables I created, but without conent because no services are consumed.

Is there an obvious way to subscribe to my services that I just havn't discovered yet? I read something about extension points and that it is possible to define access to custom services/extension points in the plugin.xml ... would it be possible to access the OSGi Service Registry that way? Or do I have to create some sort of interop module that subscribes to the ds and makes them available as the according extension points?

Thanks for your help,
rob
Re: add a RCP gui to an existing Equinox/OSGi environment [message #545755 is a reply to message #544893] Thu, 08 July 2010 23:22 Go to previous messageGo to next message
Wim Jongman is currently offline Wim Jongman
Messages: 418
Registered: July 2009
Senior Member
Hi Robert,

What you want is just the thing for OSGi, you can run a GUI and a backend in
the same container like you did. If you register the backend services with
the OSGi service registry then you are able to query the same registry in the
view and consume the service.

For this to be automatic take a look at OSGi DS. Neil Bartlett has written
quite a lot about this topic. Here is a starting point:
http://www.eclipsezone.com/eclipse/forums/t96740.html

What you might want to consider is to use Remote OSGi services. In this case
you can run the backend in its own JVM/OSGi container and connect with that
from any client in the network. Here is my blog about it and it contains a
few links in the bottom of the post:
http://industrial-tsi-wim.blogspot.com/2010/06/helios-blogha ton-fun-with-remote.html

AFAIK it is not possible that a plugin stays in the resolved state after you
have started it. Are you sure that this is what happens? Try "diag 123" where
123 is the bundle number to see if there are missing references.

The config.ini in the configuration directory OR the run configuration in
Eclipse lets you specify which bundles to autostart and at what moment
(startlevels). This might help you to start your backend and let it register
the services before your GUI comes up to grab it.

Stick with it cos it sounds to me that you are quite close.

Regards,

Wim


> Hi guys,
>
> I have developed my Equinox/OSGi application backend with some fancy
hardware access via rxtx and other stuff and would like to add an RCP gui for
monitoring now. I intend to use some list views and probably gonna add some
graphs later on with GEF.
>
> So far I managed to have either the gui running with an "Eclipse
Application"-Run configuration or the backend as usual with an "OSGi
Framework"-Run configuration. In both I can't get the ui to subscribe to my
declarative services in the backend which provide the values I want to
display. The application/view does not seem to be activated or started at
all, it stays in state "resolved" even after starting it manually in the osgi
console. The Activator is never called, but the class instantiated, therefore
I can see the View in a Window including the tables I created, but without
conent because no services are consumed.
>
> Is there an obvious way to subscribe to my services that I just havn't
discovered yet? I read something about extension points and that it is
possible to define access to custom services/extension points in the
plugin.xml ... would it be possible to access the OSGi Service Registry that
way? Or do I have to create some sort of interop module that subscribes to
the ds and makes them available as the according extension points?
>
> Thanks for your help,
> rob
Re: add a RCP gui to an existing Equinox/OSGi environment [message #545888 is a reply to message #545755] Fri, 09 July 2010 14:36 Go to previous messageGo to next message
Rob is currently offline Rob
Messages: 3
Registered: July 2010
Junior Member
Hi Wim, thanks for your post ...

the article from Neil Bartlett didn't tell that much I didn't know before but in the last bit there is the one statement I was looking for ...

"Yes, it's registered! And notice one important thing: it appears to have been registered by our bundle, not by the Declarative Services bundle. In fact DS has registered it on behalf of our bundle. We'll look at how it does that a little later on, but for the purposes of this lesson, it's enough to note that consumers of our service don't need to do anything special, in fact they need not even know that we are using Declarative Services. Those consumers can use Declarative Services as well if they wish to, but they can also use straightforward OSGi code."

... so there must be something wrong in my code or configuration, I am just not sure yet what that would be.

Remote services are not a topic at the moment, I just need it to run in one environment at the moment. But its an interesting approach that I might consider in the future, thanks for that.

I know about the states and life cycle of a bundle ... fact is I start the bundle via console and it does not go to "active" ... at least it does not enter the Activator/activate() ... which it will have to in order to be regarded as "active" by the framework, right? Also there are no references listed as missing ... if they were the bundle state should be "unsatisfied", at least that is what I expericenced the last time.

When playing around with the start levels I noticed that bundles with level 7 or higher do not auto-start even if explicitly set to do so ... is that a feature or are the levels limited? If yes why does the editor let me configure these values? Does the framework need some configuration/setting to consider higher values?

As for now the purpose for the gui is just to monitor some values a Swing frame serves well, but eventually I'd like the RCP approach better, so if you guys got any more feedback I'll appreciate it.

cheers
rob
Re: add a RCP gui to an existing Equinox/OSGi environment [message #546045 is a reply to message #545888] Sat, 10 July 2010 09:32 Go to previous message
Rob is currently offline Rob
Messages: 3
Registered: July 2010
Junior Member
Solved!

In case anyone had the same problem ...

I gave myself the answer in the post before ... the start levels do not seem to work with value 7 or higher. Thats why I decreased all the start levels in my configuration by 1 today, kind of leaving the model to start with 4, the controllers with 5 and the views with 6. Now all the bundle service references are satisfied and the console command "osgi> services" lists the correct usages of the registered services.

I suppose the peviously described manual bundle start didn't work because there still were unsatisfied dependencies, but I am not entirely sure, because the bundle shouldn't have been in "resolved" state then.

Anyway, thanks for the hints Wim!
Previous Topic:RCP application freezes
Next Topic:How to add dynamically the shortcut sequence to the tooltip text of a button ?
Goto Forum:
  


Current Time: Tue Sep 16 19:29:01 GMT 2014

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

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