2 Replies Latest reply on May 6, 2008 5:32 PM by Tom Nichols

    Dynamically updating seam context

    tek no Novice

      Does seam provide any hooks for dynamically updating its context without redeploying everything. For example, if I want to create a new component at runtime. can i add to the seam context somehow? Is it possible to provide seam with a list of classpaths to look for new components?


        • 1. Re: Dynamically updating seam context
          Clint Popetz Apprentice

          Check out the docs for hot deployment without redeploying.

          You can construct Components by instantiating them...there are several constructors that are public, for example:

          Component newComponent = new Component(SomeClass.class,"myComponentName");

          Note that this isn't a documented API, is probably discouraged, and is in general subject to change.  That having been said, it's a lot of fun, will teach you a lot about how Seam works, and can be used for cool tricks (for example, we use it to allow our test cases to use @In to grab DAOs to aid in setting up test scenarios.)  You should take a look at how Init.installComponents, because some component functionality like @Filter and @Autocreate won't work if you don't call some methods in Init.

          • 2. Re: Dynamically updating seam context
            Tom Nichols Newbie

            Actually Component is a documented class in the Seam API, so it is part of the public interface I believe...


            Although those JavaDocs could be better documented.  How does creating a new Component compare to simply creating an object and adding it to a context instance like

            myContext.set( 'bob', myObj );

            When a new instance is added to the context, do @In annotations get processed?