|Custom OSGi Container vs Virgo [message #1102888]
||Fri, 06 September 2013 06:58
| Soham Ghosh
Registered: September 2013
We have implemented OSGi container as follows. If we move to Virgo what are the advantages we could get? What are the downside of using Virgo?|
OSGi Implementation in our project
• Felix framework is initialized and started by a web application (webapp), which is deployed in Tomcat. Note: Tomcat is not an OSGi bundle.
• Once the Felix framework is initialized, the wepapp (programatically) starts all bundles present in a particular location, say, /etc/bundles. (The deployment process copies all project bundles and the dependent bundles to that location.)
• The above step resolves and activates the bundles present in /etc/bundles but not the Spring contexts of those bundles. The Spring context is created by the Spring DM (Eclipse Blueprint) bundle (present in /etc/bundles).
• To bridge the non-OSGi Tomcat server (that provides HTTP service) and OSGi container (webapp along with the bundles) Apache Felix HTTP Bridge is installed (as a bundle). However, just installing the HTTP bridge doesn't let the bundles use the HTTP service; we had to write a custom bundle, say C, for that. We created another bundle that contains (Spring) application context service tracker and HTTP service tracker. When the (Spring) application context of a bundle, say X, is created, the application context service tracker gets a callback. In the callback, the bundle X is added to the HTTP service tracker. In short, the bundle X (whose application context has been created) will now get a callback if the HTTP service is available (or if not, when it will be available). When the HTTP service tracker for X gets a callback, a web context is created for X and the web context's parent is set as the application context of X.
• We also had to write custom code for the following:
o To support JSP (in the Spring web controllers) in a bundle. Because Tomcat cannot look into the bundle for the path to JSP.
o To support Velocity templates.
|Re: Custom OSGi Container vs Virgo [message #1108119 is a reply to message #1107990]
||Fri, 13 September 2013 11:19
| Florian Waibel
Registered: June 2010
I should have pointed you directly to the chapter "Gemini Web" and Web Application Bundles (WAB - introduced in OSGi Enterprise 4.2 Specification).
If I understand you correctly you are running an OSGi container packaged as a war file within a standard Tomcat.
I have very limited knowledge about the Felix framework and the Apache Felix HTTP Bridge, but in general this sounds like war deployment with Equinox and the Servlet Bridge.
If you upend your deployment and run the servlet container within an OSGi container (Virgo Server for Apache Tomcat, Apache Karaf with PAX Web or Virgo Jetty Server, ...) you:
* Don't need to start all bundles manually,
* get Blueprint for free (Gemini Blueprint or Apache Aries Blueprint),
* don't need to use a servlet bridge,
* don't need to write an OSGi integration from scratch,
* get JSP support out of the box (Gemini Web),
* don't restart/reset the whole OSGi container during each deployment, because you update your application bundles only and not a war file.
Can't say anything about Velocity (never tried that myself within an OSGi container), but with very little effort I was able to use Thymeleaf templates with Virgo.
Please also take into account that the future of Virgo is currently a bit uncertain.
Hope this helps,
[Updated on: Fri, 13 September 2013 11:20]
Report message to a moderator
Powered by FUDForum
. Page generated in 0.02244 seconds