thanks for the quick reply, I'm gonna take a look at these links right away...
I had some ideas on how I would generate the Struts code for my pages, it might be interesting to get some feedback on it from this mailing list. I know you have been playing around with this yourself (or so Matthias once said) so feel free to correct me wherever you think it's needed, since I did not write an implementation yet I am probably overlooking some issues.
This cartridge would need to:
- read activity diagrams from the UML model
- generate form bean code
- generate struts action code, separate abstract and implementation classes
- generate empty jsp pages, with comments inside on what actions to call,
form properties to access, and more...
- generate struts-config.xml
Apparently this means writing extra ScriptHelper functionality. I always write an activity diagram per use-case, this diagram should be complete and should describe all possible scenarios for this use-case. Example: the login use-case, what happens if the user is not known ? if the password is invalid ? if the password is valid but will expire soon ? etc...Generate form bean code
It should be possible to have all information required to generate a skeleton for the Struts front-end in these diagrams, but I will come back to this a little later*.
For each activity diagram there will be one form bean, if the diagram is called login the form bean will be called LoginForm. Plain and simple.Generate struts action code
For each activity diagram there will be one abstract struts action and one implementation struts action, if the diagram is called Login the abstract action will be called LoginAction and it will extend DispatchAction, the implementation will be called LoginActionImpl and will extend the abstract LoginAction. It is built like this:Generate empty jsp pages
I know we can perfectly avoid using an abstract class, but wouldn't regeneration of code suffer from this ? I was thinking along the line of how the andromda-ejb cartridge generates EJB classes.
- the initial state is mapped to the unspecified(...) method, this method calls the first action state method (see next bullet)
- for each action state, there is a method with the same name. 'display logon error message' would become displayLogonErrorMessage(...) all these methods have the mapping, form, request and response arguments. they return an ActionForward. These methods are final.
- for each action state, there is a JSP page, in struts-config.xml these pages will be declared as action-forward paths. The JSPs will have comments indicating to the developer where exactly in the application flow he his, these comments should guide and ease further development.
- a choice pseudostate (yes/no) will be another method in the action, this one will be declared protected and abstract in the abstract class, the implementation class should specify it (this is business logic). The method returns a boolean value.
They have a name corresponding to the name of the action state to which they belong, comments in this page describe which actions can be called and which properties on the form are supposed to be accessed.Generate struts-config.xml
Combining all form beans, action implementation and forwards in one file. Should be straightforward.
File names and package names can all be derived from the model, so that should pose no issues.
*An issue that I immediately spotted was: "Where in the activity diagrams can I specify form properties ?". What I am currently doing is giving the name 'enter $userName and $password' to an action state. As per convention one could scan the name for the $ sign and mark the word as a form property (accessible from within the associated JSP page), the dispatch method name would be in this case : 'enterUserNameAndPassword', but this is just a workaround...
I am going to start writing this ScriptHelper whenever I have the time, in the meanwhile any comments are appreciated.
cheers
Wouter.
Anthony Mowers wrote:
Wouter, Have a look at: http://www.gentleware.com/support/developer/jmi-uml1.4/What you will want to do is design and write your own ScriptHelper that provides you with access to the ActivityDiagram portion of the UML. The ScriptHelper used right now by AndroMDA uses only the 'core' part of the UML. In your case you might be interested in the 'activitygraphs'. For the javadoc API see: http://www.gentleware.com/support/developer/jmi-uml1.4/org/omg/uml/behaviora lelements/activitygraphs/package-summary.html A little bit of code like the following in your ScriptHelper might get you start: UmlPackage umlPackage = (UmlPackage)getModel(); ActivityGraphPackage activityGraphPackage = umlPackage.getActivityGraphs(); Collection allActivityGraphs = activityGraphPackage.getActivityGraph.refAllOfType(); Let me know how you get along. I've been wanting to do a set of Struts templates using ActivityGraphs for quite some time now. Tony-----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Wouter Zoons Sent: Saturday, August 02, 2003 12:11 PM To: [EMAIL PROTECTED] Subject: [Andromda-user] accessing Activity Diagrams hello, anybody has any ideas on how about to have access to the activity diagrams in the UML model, would one need to write extra AndroMDA code ? I am attempting to generate Struts front-end code from my UML model, I wish to use activity diagram for this task (rather that the class diagrams as in the AndroMDA release bundle), but I have issues trying to get the different diagrams and state machines any ideas are appreciated ;-) greetz Wouter. ------------------------------------------------------- This SF.Net email sponsored by: Free pre-built ASP.NET sites including Data Reports, E-commerce, Portals, and Forums are available now. Download today and enter to win an XBOX or Visual Studio .NET. http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072 303_01/01 _______________________________________________ Andromda-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/andromda-user
