At this point, the /bundles directory is only read on startup, however, it wouldn't be too hard to add a polling scanner. The better solution will be to write a GUI that will let you install, uninstall, and upgrade bundles at runtime.
Don On 7/30/07, Frank W. Zammetti <[EMAIL PROTECTED]> wrote: > > Don, could you clarify something for me? You say "Drop the jar into the > /WEB-INF/classes/bundles directory and it will automatically be > installed when the application starts up" ... so if I have a running > application, I have to restart it for the deploy to happen... is that > restart always going to be necessary, or is that just a side-effect of > this being an early release? > > Frank > > Don Brown wrote: > > 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] > > > > > > > > > > > > -- > -- > Frank W. Zammetti > Founder and Chief Software Architect > Omnytex Technologies > http://www.omnytex.com > AIM/Yahoo: fzammetti > MSN: [EMAIL PROTECTED] > Author of "Practical Ajax Projects With Java Technology" > (2006, Apress, ISBN 1-59059-695-1) > and "JavaScript, DOM Scripting and Ajax Projects" > (2007, Apress, ISBN 1-59059-816-4) > Java Web Parts - http://javawebparts.sourceforge.net > Supplying the wheel, so you don't have to reinvent it! > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > >