Bak Attila wrote: > > Hi Patrik, > > Ok. And the operation params would need also some additional infos like > @PathVariable? Or for the first run we can generate pretty good defaults > as you say. Or can you post me an example how a param would look like in > this case with the @Pathv. >
I don't think we should support everything in the model that is available in the Spring annotations. Those cases that goes outside the normal can be supported with gap methods, i.e. hand written subclass. Bak Attila wrote: > > (Even if we do not change the metamodel based on the service itself a > controller can be generated quite easily :) ) > I have looked yesterday in detail into the dsl and code generation model > trafos, generation so i have got quite a good overview of it. > > In the example you provided it would be fast enough not to have a separate > model element for the Controller because if a Service is restful it gets a > Controller generated. > The Controller is just a thin layer and basically delegates always to the > service. > > But as the Boss of the project i ask you to please make this decision and > then i will proceed along that path. > > I think you should go for the simplest solution, i.e. start without adding separate Controller in meta model. If you later feel that it would be benefits from having a separate class you can easily introduce it later. I think a controller should have the same delegation mechanisms as a service, i.e. delegate to another service or repository. It should also support gap in the same way as service, i.e. if no delegation then a subclass is generated in src/main/java and hand written code can be addded. Patrik Nordwall wrote: > > Hi Attila, I'm happy to see you are back in the team again. > > We also need to decide if we need separate DslController or if we can use > DslService, with some additions. > > Service PlanetService { > restful > > @Planet findById(Long id) restPath="/planet/{id}" restMethod=GET > delegates to PlanetRepository.findById; > > save(@Planet planet) restPath="/planet" restMethod="POST" > delegates to PlanetRepository.save; > } > > > We can probably come up with good defaults for restPath and restMethod > based on naming conventions, so that it is optional to define them. > > > Another design decision is if we should have a separate Controller in the > meta model, that is used by the code generation templates. You know we > have a transformation between dsl model and code generation model, so they > don't have to have the same structure. > Maybe a Controller extends Service is nice in the meta model, because then > it is easy to use polymorphism in the xpand templates. > > /Patrik > > > > Bak Attila wrote: >> >> Hi Patrik, >> >> How would you image this one in the dsl as annotated? >> I mean how should it look in the textual language? >> The problem ist that operations and params need "annotations" there. >> Could you give me an example? >> >> @RequestMapping(value = "/inquiry/{id}", method = RequestMethod.GET) >> public String show(@PathVariable("id") Long id, ModelMap modelMap) >> throws InquiryNotFoundException >> >> Thanks >> attila >> >> >> > > -- View this message in context: http://old.nabble.com/-sculptor--RESTful-Services-tp25407858s17564p29489564.html Sent from the Fornax-Platform mailing list archive at Nabble.com. ------------------------------------------------------------------------------ This SF.net email is sponsored by Make an app they can't live without Enter the BlackBerry Developer Challenge http://p.sf.net/sfu/RIM-dev2dev _______________________________________________ Fornax-developer mailing list Fornax-developer@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/fornax-developer