4 Replies Latest reply on Aug 23, 2006 12:03 PM by patrick_ibg

    components.xml suggestion

    berserksangr

      Hi.

      First of all, where can I find full documentation of the format of components.xml file? Do examples from the documentation show all the features?

      I try to sell Seam to my team in our new mid-big project. I run into few discussions about annotiations-only approach to managed beans definition.
      Hard-coding the component's name+scope pair in the bean's annotation is not
      necessary the best thing in the terms of inter-project component reusage.

      Maybe multiple XML files extending the components.xml file functionality to fully support component properties definition would be a good option?

      Thank you for your hard work,
      Przemek.

        • 1. Re: components.xml suggestion
          zzzz8

          I have some questions about components.xml, too.

          In terms of managed beans and faces-config.xml, I would like to do something similar in components.xml in terms of reusing Seam components. I understand that Seam offers annotations to do this: @Role and @Roles. However, I'd like to set different properties for each role. Do I do this in the components.xml file? What if I wanted to initialize properties with Lists and Maps? TIA.

          • 2. Re: components.xml suggestion

            Gahh, the last thing I want is for Seam to turn into Spring. Still, the option of naming externally would be a plus. Maybe it could even take over managing JSF components in faces-config.xml, though I suppose it might demand more or different metadata.

            I'm not sure what you'd gain by moving scope annotations and initializations out to XML though. My opinion is that semantics belong in code and only code. Spring has us all coding Java in XML, and has given us the worst of the conjunction of Java and XML's inexpressveness with a dynamic interpretation that blows up only (and often) at runtime.

            • 3. Re: components.xml suggestion
              gavin.king

              The CVS version of Seam offers a much more flexible components.xml file (roughly equivalent to the functionality available for normal JSF managed beans).

              • 4. Re: components.xml suggestion
                patrick_ibg

                I too have a bit of an issue with putting @Name, @Scope and @Roles in entity beans. That said, I wouldn't want Spring-style external XML declarations either.

                Would it be possible to have a configurable naming strategy? The default would be the conventional "same as ClassName but lowercase first char", since most people seem to go with that.

                Another way around this would be to always reference entity beans via property accessors on the JSF action classes. (I don't have an issue using @Name/@Scope in the action class.) So instead of:

                #{user}

                One would use:

                #{myActionBean.user}

                Then you can just use bijection within the managed beans to get entity beans in and out of context.

                Opinions?