1 Reply Latest reply on Apr 19, 2007 12:31 PM by stu2

    Programatic SFSB instantiation and associating w/conversatio

    stu2

      I need to hand off from 1 SFSB to another at a certain point. I see that Manager has everything I need to manipulate conversations.

      But looking through Seam source I didn't see where Seam instantiates beans AND associates them with contexts. I'd like to do this correctly. Should I just do a standard EJB SFSB instantiation, and explicitly associate this with the context? Contexts.lookupInStatefulContexts(String) is clearly how I'd lookup such a bean if it existed.

      ...hmm, it looks like Components.getInstance(String name, boolean create) is how I should do the lookup. Should I then explicitly associate it with a conversation?

      Thanks. Hope these questions aren't too dumb. The seam source is very nicely structured, but it is a lot to understand :-)

      Stu

        • 1. Re: Programatic SFSB instantiation and associating w/convers
          stu2

          Btw, what I think might be the way to do this is the following:

           // get the mapping action
           CatalogMappingAction mappingAction = (CatalogMappingAction) Component.getInstance("catalogMapping", true);
           assert mappingAction != null;
          
           // associate this with the current conversation
           Context conversation = Contexts.getConversationContext();
           conversation.set("catalogMapping", mappingAction);
          


          Here catalogMapping is the @Name of a SFSB. It will not already be in the current conversational context. My intent is to look it up, pass some state, then have this SFSB instance available in the conversation from this point on.

          Thx!