1 2 Previous Next 19 Replies Latest reply on Jul 7, 2006 7:03 PM by jtucker Go to original post
      • 15. Re: Seam component with the same name

        How about if this must be controlled by components.xml, which I agree with, that Seam throw an error if there are multiple components with the same name?

        If there is not a deterministic intuitive order that they will be loaded then I think overriding in the componets.xml should be mandatory for components with the same name.

        • 16. Re: Seam component with the same name

          The order-by is less intuitive, however it would be useful for defining drop in overrides. Lets say I wanted to package my component into a JAR and override the default simply by including the JAR in WEB-INF/lib. Allowing me to specify in my JAR's components.xml file that my component should be used instead of the default would ease the installation of these modules. It's a convenience feature to be sure, but it allows users of this module to install it without any additional configuration.

          In the end there is still a need to be able to control things at a top most level and this can be accomplished via overrides in the top most components.xml.

          So, I like being able to override by class attribute. I'd just also like to provide third-party component developers easy discovery, install and override of their components as well. Some order/priority attributed seemed to work well for that.

          • 17. Re: Seam component with the same name
            jtucker

            My main concern with the orderby in the JAR is that it may make tracking down errors more difficult.

            Lets say you install a 3rd party jar where the orderby for X is 2, and you set up another X component but orderby is 1 (thinking it overrides a default of 0), it's going to take a while to track down the orderby setting in the jar to know to set yours to > 2. You are back to relying on the 3rd party jar documentation of the orderby, or looking through the JAR for the components.xml to figure it out.

            How can we make this more obvious? Would including the orderby value in the log output when Seam installs a component be enough? Maybe!

            We also need to think about what happens when 2 components with the same name have the same value for orderby. Who wins?

            • 18. Re: Seam component with the same name

              I like the idea of enhanced log output for orderby showing the order/priority and who is enabled and who isn't. Overrides shouldn't be too common place, but when they happen confusion should be kept to a min.

              I think that if two components have the same orderby, Seam logs an error with description and makes you resolve the situation. Basically the user would be forced to supply a suitable orderby in the top level components.xml in this case (matched on class attribute).

              This was going to be your default case w/o orderby anyway, you just don't have to do this when the orderby doesn't have a problem.

              • 19. Re: Seam component with the same name
                jtucker

                I have uploaded a patch to JIRA which will:

                a) use the class defined in components.xml over an annotated component
                b) recognise a "precedence" attribute on the element in components.xml. The highest numbered class will be loaded.

                It errors and doesn't register a component if it cannot determine precedence (e.g. if no precedence is specified, or has the same precedence) and will issue appropriate warn or info log messages to let you know how the loading has occured.

                1 2 Previous Next