Jan 7th, 2010, 08:07 AM
Listen for executions of JspMetadataListener
I'm playing around with a small addon for roo. What I would like to do is:
1. new command to use in the shell - OK
2. Add annotation to entity and create new methods on entity- OK
3. Create calls from controller to methods, done via a new ITD - OK
4. Add buttons in update.jspx file - NOT OK
Everything works fine until I try to change the update.jspx-file. I've tried making the changes when creating the ITD in my MetadataProvider and from a listener. But in both instances i seems like the file is changed by JspMetadataListener.
Is it possible to do the changes to update.jspx after JspMetataDataListener has finished? In other words listen for executions fo JspMetadataListener.
Jan 8th, 2010, 02:55 AM
Your work seems quite interesting in that you take advantage of a lot of Roo's infrastructure (using ITDs to add new functionalities to entities and controllers) in your addon. However, managing view artifacts such as create.jspx, update.jspx, list.jspx and show.jspx is currently not possible because Roo is not (yet) round-tripping these artifacts. If you take a look at the JspMetadataListener you will notice that we generate an in-memory model of these files and compare it with the existing artifacts in the file system. If they don't match we replace them with the generated DOM model. Unfortunately, the JspMetadataListener is currently not aware of external addons and will therefore replace your additions to these files with the default contents.
We are aware of this (see ROO-8 and related Jira tickets) and will address it with the upcoming Roo 1.1 releases. I am working on prototypes which will round-trip the aforementioned files (rather then replace them) and therefore making it possible for third party addon developers (you) to add functionality to these files. That way JspMetadataListener can still do it's work (which will actually much simplified) while honouring your changes in the file.
So, in short, currently you cannot change a Roo generated update.jspx. However, I am hoping to get started on this issue so that you can soon see the first milestone release of Roo 1.1 which will make your addon work.