PDA

View Full Version : ExtJS and OSGI



Grolubao
14 Feb 2013, 7:35 AM
Hi All,
In the product I'm currently working we are using ExtJS 3.4 and we plan on implementing OSGI, so Plugin development. We have a J2EE enterprise application with ExtJS as our frontend.

I would like to know ideas on how to implement OSGI using ExtJS, meaning that I create components in a Plugin that will automatically override parts of the core functionality or add new features to it.

Does anybody has experience with this?

dpishchukhin
15 Feb 2013, 1:53 AM
Hi,

1. from OSGi-side you can use HTTP server with OSGi support (take a look at Eclipse Jetty, Pax Web). For plugin management - look at OSGi bundle fragments (OSGi core spec)

2. from ExtJS-side you have to activate your new *.js files that are stored in fragment bundles. for version 3.4 you have to do it manually, for version 4.x they could be loaded automatically (look at Ext.Loader)

regards,
Dmytro

Grolubao
15 Feb 2013, 2:01 AM
Hi Dmytro,
Thanks for your answer. I was more interested in understanding how one can architecture the Javascript part of it, for example if the application Core should just expose sort of an interface so all the plugins just subscribe to that interface and override it with new stuff. Example:

Application-Core:
Has a menu toolbar with 3 items

New Plugin:
Wants to add a new button to the Application Core toolbar

I was thinking to create sort of a Javascript object that would hold the API (methods) that Plugins can have legal access to and then on the Plugin side I would override the API, but it seems weird in terms of Architecture...



ApplicationCore = {
getMenuItems: function(){
return [new Ext.Button({text: 'Core Button'})]
}
}


Then on the Plugin I would override the getMenuItems calling the Parent, so get the result of getMenuItems and Override it with whatever new menu items I had.

It's just that conceptually to override something that is an API seems wrong...


Hi,

1. from OSGi-side you can use HTTP server with OSGi support (take a look at Eclipse Jetty, Pax Web). For plugin management - look at OSGi bundle fragments (OSGi core spec)

2. from ExtJS-side you have to activate your new *.js files that are stored in fragment bundles. for version 3.4 you have to do it manually, for version 4.x they could be loaded automatically (look at Ext.Loader)

regards,
Dmytro

dpishchukhin
15 Feb 2013, 2:50 AM
As an idea, you can use some JSON config to build UI on the client side. Your OSGi plugins add their details (or some plugins manager does it) to your UI configuration during activation and this configuration is transferred to browser as JSON.

Grolubao
15 Feb 2013, 2:51 AM
As an idea, you can use some JSON config to build UI on the client side. Your OSGi plugins add their details (or some plugins manager does it) to your UI configuration during activation and this configuration is transferred to browser as JSON.

I thought about that too, but seems overly complicated and I really want to maintain that decoupling between the Server side and the UI

Grolubao
15 Feb 2013, 2:56 AM
I currently implemented Wro4J in my application so to maintain the modularity I guess will not be that hard, I'm more concerned with the overall architecture on how to override components, should I override the component directly or should I have a base API to do so.