5 Replies Latest reply on Jul 14, 2008 11:41 PM by Pete Muir

    Groovy Navigation: Groovy instead of XML

    Francisco Jose Peredo Noguez Master

      Hi!


      Right now, AFAIK,  the way to externalize the navigation configuration is to use xml. But some times I would like to add some programmatic tricks (like this one) without being forced to patch seam code


      The solution could be to use .groovy files to configure navigation (instead of .xml), that way they can be changed easily after development, and they can be extended at any time with any new functionality we may need...


      In other words, something like Gracelets but for navigation.


      What do you guys think about this?


      Regards,


        • 1. Re: Groovy Navigation: Groovy instead of XML
          Daniel Hinojosa Master

          I like that the idea with some warning.  Using a Groovy DSL type document can make it just as hard to read as XML (I think XML is very readable BTW). Done right though it can look amazing and be very intuitive (like Gracelets), but done in differently it can look like something like Gant .

          • 2. Re: Groovy Navigation: Groovy instead of XML
            Francisco Jose Peredo Noguez Master

            Hi


            I don't want to have Groovy based navigation to increase readability (all I would ask is that readability stays pretty much the same), what worries me is extensibility, I want to be able to customize navigation without having to patch internal seam code (I would be equally happy if a way to add custom tags to the .pages.xml could be added to Seam (custom namespaces perhaps?))


            Mmmm, basically what I would like to have is a mechanism to make it possible to easily plug my own extensions to Seam navigation.


            (Currenty we have JSF Navigation, Seam Navigation, and jPDL navigation... I wonder what do I have to write in components.xml to plug my own navigation (pageflow?) strategy)


            Regards,

            • 3. Re: Groovy Navigation: Groovy instead of XML
              Pete Muir Master

              Surely extensibility of the navigation rules and the way of specifying them are orthogonal - whatever language they are in, the extension points in Seam and JSF remain fixed. I guess being able to specify them in Groovy would allow you to add script in, but I'm not sold atm.


              You can write your own rules currently - it requires extending the Pages component - you should be able to do most customization you like - if you need a method made protected, then ask in JIRA. But, its not pretty trying to understand Pages, which we should fix (probably in the Seam 3 timescale).

              • 4. Re: Groovy Navigation: Groovy instead of XML
                Francisco Jose Peredo Noguez Master

                Hi!


                Basically I would like to do this (please tell if sounds to crazy):


                I need to add certain features to current pageflow strategy  (as a first step I could, for example implement my solution for JBSEAM-1943) and I do not want to patch my Seam 2.02SP1.


                Why? well, I want to be able to go back to the stable Seam 2.02SP1 pageflow strategy or enable my custom pageflow strategy  by just changing an option in components.xml.


                That way I could create my own annotations and my own tags (JBSEAM-1943 is just a first step in that direction), or modify the provided ones, and plug them in when I need them.


                So... does it seem crazy?

                • 5. Re: Groovy Navigation: Groovy instead of XML
                  Pete Muir Master

                  I understand your problem, but I don't agree that writing rules in groovy would help.


                  As I explained, you can customize navigation without patching Seam.