Custom WebScaffold MetadataListener
I know guys you have plan to add GWT/Flex support in Roo 2.0.
But we do not want to wait :-) And we are building custom Web UI generation plugin for Dojo toolkit. It is way different with what you have now mixing JSPX/JSTL/Tiles2/SpringMVC and some Ajax'fing via Dojo. We build pure HTML Web 2.0 Dojo based reusable components for scaffolding backed by JSON-RPC exposed services.
The way we do it now is a bit cumbersome. We took standard JspMetadataListener & Co as an example and created custom DojoMetadataListener (with supported classes) which behaves very similar except it generated different output.
It works, but we have a lot of duplication code borrowed from original JspMetadataListener for doing stuff like implementing MetadataProvider and MetadataNotificationListener. I mean most of the operations like creating WebScaffoldMetadata are very similar between your JspMetadataListener, our DojoMetadataListener and (I guess) proposed GwtMetadataListener and FlexMetadataListener.
Do you guys have anything in mind in order to create something abstract to help develop custom UI Generators w/o doing much of the duplications? Or what ideas are?
Thanks!
controller --type=jsp|flex|gwt|<any custom string>
1. In order to trigger custom Web UI generators I have to create my own MetadataNotificationListener and make it listen on CUSTOM Metadata in upstream. Right? Out of the box it means:
@RooWebScaffold -> JspMetadataListener
So, if I need my custom DojoMetadataListener to take care of UI I need to replace @RooWebScaffold with something like @RooDojoScaffold. In its turn it means 'controller' command should be able to manage correct type of the scaffold respectively.
For instance:
controller --type=jsp|flex|gwt|<any custom string>
will generate
jsp -> @RooWebScaffold
flex -> @RooFlexScaffold
anystring-> @RooAnystringScaffold
Alternatively you probably can do:
jsp -> @RooWebScaffold(type=RooWebScaffold.JSP)
flex -> @RooWebScaffold(type=RooWebScaffold.FLEX)
anystring-> @RooWebScaffold(type="anystring")
Without corresponding ControllerCommands extension in place, I do not think you can write custom UI generator today. Or am I missing something? For now I just listen on @RooWebScaffold and result is JSP generation (caused it is configured out of the box and i cannot turn it off) and my custom Dojo generation which uses separate folder structure for its output.
2. About REST functionality. It would be nice to have content negotiation protocol configured for all controllers right of the box with xml and json. Or at least have an option on 'controller' command to enable it.
3. At least nofity() in JspMetadataListener and in AbstractItdMetadataProvider are all about the same. They are identical except downstream metadata identifier type. Basically it is template method with downstream metadata identifier type as a parameter.