3 Replies Latest reply on Oct 6, 2006 7:17 PM by pmuir

    Default namming strategy for components

    sebasfiorent

      Exists a default naming strategy for components?
      I have the following situation:

      I'm starting to build a large-scale app which will contain about 800+ components. I really need the "name" attribute of @Name annotation to be optional. If no "name" is specified, the name will be the className.

      Example

      package a.b;

      @Name
      @Stateful
      public class C{
      ..
      }

      then, component C will be named a.b.C (equals to assign name="a.b.C" in the @Name annotation).

      My intention is to use @In in a seamless way, because with a huge number of components, that would become a knighmare to detect errors (at runtime)

      Regards,
      Sebastian

        • 1. Re: Default namming strategy for components
          pmuir

           

          "sebasfiorent" wrote:
          Exists a default naming strategy for components?


          No.

          But it has been suggested before, as you suggest, perhaps with configuration for how many packaging levels you want to take account of (e.g. 0 levels: foo.bar.Class -> @Name("class"), 1 level: foo.bar.Class -> @Name("bar.class")).

          • 2. Re: Default namming strategy for components
            sebasfiorent

            Yes it would be helpfull.

            In fact, the behavior that I'm trying to achieve is the same that you have when you configure a bean in Spring framework. If you don't set name, the name becomes the same as the package+class name.

            I think that the best way to do this is to have the same notion that exists with Hibernate for naming stategies.

            What can we do? Raise a JIRA issue?

            Regards
            Sebastian

            • 3. Re: Default namming strategy for components
              pmuir

              That would be a start. You could submit a patch.

              The code for auto-naming a component should be straightforward. Tying it into Seam in a plugable fashion might be harder:

              1) Seam sometimes looks directly at the Name annotation, sometimes it delegates to Seam.getComponentName()

              2) It should probably be configured via components.xml, but by then component configuration/instantiation has started