Writing an OSGi plugin for Struts 2 has been something I've been playing with on and off since I put in place the Struts 2 plugin architecture, and I finally completed an end-to-end functional spike of such a beast. My motivation for a Struts 2 OSGi plugin is to easily allow Struts 2 developers to write their applications such that they can install, upgrade, and uninstall sections of it at a time without restarting or reloading the whole application or application server. Think how nice it would be to install a new admin tool in your public, heavily-used web application without affecting any users, or fixing a critical bug without, again, taking the application down even for a few seconds.
The Struts 2 OSGi plugin allows you to separate your application into jars (called bundles), each containing a struts.xml file, Action classes, and Velocity (for now) files. Just by adding a few lines in the jar's manifest.mf: Bundle-Activator: org.apache.struts2.osgi.StrutsActivator Export-Package: com.mycompany.myapp.actions Bundle-Version: 1.0.0 Bundle-SymbolicName: foo.actions The jar is ready to be deployed. Drop the jar into the /WEB-INF/classes/bundles directory and it will automatically be installed when the application starts up. As this was a spike, there are a bunch of limitations and missing features such as: * Only Velocity templates are supported * Application classes, including third-party jars such as Spring, will probably not be available in bundles * No GUI to install, upgrade, and uninstall bundles at runtime * Bundles cannot contain beans or constants (will probably never be allowed) * Most likely improper OSGi usage Still, the code is functional and available in the Struts sandbox: http://svn.apache.org/repos/asf/struts/sandbox/trunk/struts2-osgi-plugin/ One of my side goals in this project is to hide as much of OSGi from the Struts 2 developer as possible, so that bundles will be easy to write and deploy. Therefore, there is probably a lot of OSGi that is hidden, which OSGi experts would lament, but the main goal is to allow Struts actions to be hot deployable, and I think this plugin could make it happen. Don -- copied from my blog post for those too lazy to click links: http://www.jroller.com/mrdon/entry/struts_2_osgi_plugin_spike --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]