Search code examples
javaeclipseuser-interfaceosgie4

A separate GUI for a set of OSGI Bundles


I have a set of OSGI bundles (around 10, those who have activate/deactivate declarations), which are united under one .product file and together makes a java application. Those bundles do lots of work but as an ouput they just print some important logging data on the console.

What I want to do - I want a simple GUI, that allows 3 things: 1) a button for activating all those bundles (run the whole program), 2) a window, where I will see all the output logging data, 3) a button for deactivating all those bundles (end the program).

Initially I planned to use e4 RCP. The problem is, that I cannot just add a new GUI plug-in (bundle) in this big project, because there is a bitness conflict: JNA is used in those bundles and it loads 32 bit native libraries. That means, all the stuff should run on 32 bit jvm as well. BUT, it runs on 64 bit eclipse target platform (taking externally only old equinox launcher, that still supports 32 bit) and this tp is something like a gold standard in my firma, so I cannot just switch to eclipse 32 bit target platform for all bundles and be happy. However, as far as I understood, you cannot just do the same trick with 32 bit SWT libraries as with equinox launcher, because they are an essential part of eclipse and should keep the same bitness as eclipse has. And eclipse allows to use partially 32/64 bit libraries with option to auto-select the needed ones only for < 4.10 releases. I have to use the newest eclipse release.

That makes me to look for the other concepts of organizing a relationship between the GUI and the main logic, especially when I could do this seprartely: f.e. I code my GUI in my 32bit target platform as a completely separate project and then somehow call the stuff (in runtime?) from the main project. And here I am stuck with. If I have 10 bundles in one project, how could I activate/deactivate them from the other (GUI)project? How to organize this communication properly, with clicking on buttons and so on? Is it actually possible? Maybe not with e4, but with some other instruments?

I'm a bit newbie in OSGI development, if I said something weird - sorry in advance.


Solution

  • The obvious solution seems to use Swing? Swing has no native dependencies.

    You can redirect System.out/err inside Java so you can easily capture the output and show it in a Swing component. You can put this code in its own bundle.