3 Replies Latest reply on Sep 22, 2008 9:32 AM by socken

    modifying seam-gen

      Hi all


      I'm looking into modifying the way seam-gen creates entity classes, test classes, the ui etc. I saw that it uses templates in seam-gen in which, placeholders are used (@placeholder@).
      Is there any documentation how you can modify and extend these templates? Who replaces these placeholders, seamgen itself? And how exactly?


      I think if you can adopt the template building process to your specific needs, seamgen makes for a really powerfull tool.


      Thanks for any hints


      Cheers
      Patrick

        • 1. Re: modifying seam-gen
          nimo22

          You can change your seam-gen easily:


          Go to your seam-gen-folder in your seam-distribution:



          jboss-seam\seam-gen



          and open the file 'build.properties'.


          The 'build.properties' will exist after you have made a project-setup with your seam-generator.


          Then you have your folder


          seam-gen\build-scripts



          in which you can change the ant-files to your needs.It s self-explained.

          • 2. Re: modifying seam-gen
            dan.j.allen

            I wouldn't go so far as to say that it is self-explanatory. However, if you are proficient with builds, then seam-gen should be a walk in the park to hack. The code generation is based on Hibernate reverse engineering tools and Freemarker. Take a look at the seam-gen/view and seam-gen/src directories and try playing with the templates to see what results you get. The possibilities are endless because Hibernate reverse engineering gives you complete access to the entity mappings at an API level.


            Don't feel that what seam-gen has today is what you have to go with.

            • 3. Re: modifying seam-gen

              Thanks a lot for the answers. The view and src folders look very interesting, looks like you really have a lot of possibilities to modify what is actually being generated.
              I never heard of Freemarker, so I'll definitely take a look at that too.


              The build process itself doesn't look to bad for our purposes, I'm really more interested in changing the output itself, what Java classes are generated etc.


              I think a big drawback from seam-gen is, that all elements on the XHTML pages are practically hardcoded and we're looking into using a more generic approach.