Jelly and OSWorkflow, take 2. Hey James Strachan, I'm ready to start hacking Jelly in to OSWorkflow. Do you (or anyone else) have any tips for me on getting started? [PSquad's Corner]
I guess first off, try using Maven to build OSWorkflow. Then through using Maven you kinda pick up bits of Jelly through osmosis :-).
A more direct way of getting up to speed is probably looking at an example. Maybe a good place to start is JellySwing. There's a link to the sample on the webpage. The example uses SwingTagLibrary class to bind all the Swing widgets to different tags.
Custom actions can be associated with the widgets. Notice how the actions could be some Java beans you've written in Java code or could just be a piece of Jelly script.
This kinda mirrors what a workflow engine does. It has a core model (Process, Step, Action or whatnot) typically implemented via beans (like the Swing widgets) and have their own protocol for connecting themselves together, adding steps to a process etc. Then you want to assign arbitrary actions/scripts to points in the bean graph.
So adding a bit of logic to a certain point in a workflow is kinda similar, from the XML's perspective, to adding a custom action to a control in JellySwing.
In terms of implementation, JellySwing uses a single ComponentTag class to implement all the Swing widgets and a single ActionTag to bind actions to components. Maybe a similar approach could work for OSWorkflow.
DOH! After writing all of this I've just spotted that Blissed, the foundation library on which bob is developing werkflow, already has full Jelly integration. Maybe you could just reuse the Blissed library?
Finally a note on why you'd want to Jellyfy something. Well sure you get an easy way of turning XML into your own beans or plugging in your own actions into some declarative XML. But also you get to reuse all the other Jelly libraries inside your XML documents too. Plus you get the use of expression languages.
e.g. I could create a simple JFrame using JellySwing like this, using dynamic runtime expressions, binding my model to the view etc ... <j:jelly xmlns="jelly:core" xmlns="jelly:swing"> <frame var="myFrame" title="Welcome ${user.name}" size="${user.prefs.frameSize}"> <menuBar> <menu title="File"> <menuItem action="${actions.file.new}"/> </menu> <menu title="Tool"> <!-- lets iterate through some model beans --> <j:forEach var="tool" items="${user.tools}"> <menuItem action="${tool.createAction()}"/> </j:forEach> </menu> </menuBar> </frame> </j:jelly>
The neat thing about this is that this glue code is still just XML. So you can transform this to repurpose it to other kind of rendering formats, to style it to different layouts etc. This approach allows you to focus on your models and your actions and just use simple markup for rending it.
9:49:42 AM
|