|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
| Wim Jongman
Registered: July 2009
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:
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:
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.
> 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,
|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
Registered: July 2010
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.
Powered by FUDForum
. Page generated in 0.03207 seconds