Apr 24th, 2005, 07:26 PM
Integrating SWF and JSF
A colleague pointed me at this thread, and it is of definite interest to me. I would also hope that folks here consider me a "JSF Expert"
Originally Posted by kdonald
When I was at TSSJS in Las Vegas last month, I met with Keith and several of the other Spring developers, and saw a demo of SWF during one of the sessions. I was definitely intrigued, because (in parallel) I had been working on a next generation web application framework that (unlike nearly all current ones) is built on top off JSF, instead of being agnostic to it. That work has been accepted as a Struts subproject called "Shale" -- see the following Wiki page for details:
One of the features on my "must have" list for Shale was good support for what I had called "dialogs" in the initial proposal, and I had done a fairly primitive implementation of dialog management (really, focused more on the problem of saving and restoring state across HTTP requests than on the state transition problem).
Once I saw the SWF demo, and how elegant it was to put flow definitions together, it became clear that this was a much better architecture -- and the queston was what to do next.
At a strategic level, there are two approaches I can see for how you could integrate SWF and JSF together:
* Use JSF simply as a view technology (just forward
to "/foo.faces" instead of "/foo.jsp" and you'll enable
the JSF component rendering capabilities.
* Integrate with JSF's navigation management (at least
when you are within a flow), naturally using JSF pages
to do the actual rendering (as above), but also leveraging
the ability of a JSF action handler (the method that gets
invoked when, say, a submit button is pressed) to return
a logical outcome that could drive the state transition
mechanism of SWF, instead of driving normal page
To explore these ideas further, I've implemented a very simple version of what SWF in Shale, in the "org.apache.shale.dialog" package (the package javadocs for this package in the core library has background info). This would be sufficient if your needs are pretty simple, or if you did not choose to integrate Spring into your Shale based applicaton (athough that works pretty nicely as well -- I use the managed beans integration of Spring 1.1.5 or later in my demo app).
What seems needed in the future, however, is a full blown integration of SWF and JSF that accomplishes both approaches described above. It also seems to make sense, as you've done with other integrations, that the code for this actually live in Spring (where, of course, any Shale user who wants to leverage it can get it for free as an alternative to the simple dialog support already present).
If the SWF developers are interested, I volunteer to help create such an integration layer, and will contribute it to the Spring codebase. If that is of interest, it would probably be appropriate to conduct the detailed design discussions on the Spring developer mailing list, right?