1 2 Previous Next 16 Replies Latest reply on Dec 9, 2005 5:35 AM by landels

    Conversation start with @Factory ?

    lcoetzee

      Hi all,

      I am trying to start a conversation through the @Factory tag:

      @Factory("contentLoaded")
      @Begin
      public String findAllNapContent() {
      .
      


      in this method I add stuff to the conversation context which I later access:
      Contexts.getConversationContext().set("allLanguagesMapped",allLanguagesMapped);
      


      Accoring to Gavin's initial post regarding the @Factory tag
      http://www.jboss.com/index.html?module=bb&op=viewtopic&t=72267
      the conversation is supposed to be started. Unfortunately it doesn't appear to be the case. Somewhere else I try and do the following (still in the same conversation):
      Context ctx = Contexts.getConversationContext();
      Map<String, LanguageEnum> map = (Map<String, LanguageEnum>) ctx
       .get("allLanguagesMapped");
      

      Unfortunately my ctx does not contain a value for that key (actually it is completely empty e.g. nothing associated with that conversation).

      Does the @Factory allow for the start of a conversation? If not, any suggestions as to start the conversation ?
      I am using the CVS version of Seam.

      Thanks

      Louis


        • 1. Re: Conversation start with @Factory ?
          gavin.king

          What you are trying to do is conceptually correct and should work.

          What does the seam log say is happening?

          What happens if you debug into the call to findAllNapContent()? Does ConversationInterceptor start a long-running conversation?

          • 2. Re: Conversation start with @Factory ?
            lcoetzee

            Unfortunately I am doing this the hard way (haven't tried to setup an interactive environment for debugging). (Another topic I assume .. configure eclipse with JbossIDE and Seam.)

            The log file says that a long running conversation has been started. It loads all the things it is suppose to. Displays the page with the correctly populated stuff. On submit if fails however. The log file says Seam did not find a conversation.

             [org.jboss.seam.interceptors.ConversationInterceptor] Beginning long-running conversation
            .
            .
            
            2005-12-01 17:11:46,417 DEBUG [org.jboss.seam.core.Manager] No stored conversation
            


            L


            • 3. Re: Conversation start with @Factory ?
              gavin.king

              So .... this seems to be unrelated to the @Factory annotation?

              • 4. Re: Conversation start with @Factory ?
                lcoetzee

                Correct. The @Factory does what it is suppose to. Load initial stuff. It seems as if the @Begin starts the conversation. But somewhere the conversation gets lost.

                Without the @Factory, the conversation behavior is as expected (initiating the process through a a button submit).

                Does the @Factory method gets executed everytime Seam sees the variable in the JSF ? (@Factory("variable") with maybe ..renedered="#{variable} occuring a few times in the page).

                L

                • 5. Re: Conversation start with @Factory ?
                  theute

                   

                  "lcoetzee" wrote:
                  (haven't tried to setup an interactive environment for debugging). (Another topic I assume .. configure eclipse with JbossIDE and Seam.)


                  That topic is covered in the Wiki:
                  http://wiki.jboss.org/wiki/Wiki.jsp?page=UseJBossEclipseIDEToDoJBossSeamsBookingExample
                  and in a flash movie to show step by step:
                  http://www.jboss.com/products/seam/EclipseCVS.html


                  • 6. Re: Conversation start with @Factory ?
                    gavin.king

                     

                    "lcoetzee" wrote:
                    Does the @Factory method gets executed everytime Seam sees the variable in the JSF ? (@Factory("variable") with maybe ..renedered="#{variable} occuring a few times in the page).


                    It only gets called when the context variable is null.

                    • 7. Re: Conversation start with @Factory ?
                      gavin.king

                      Post me the whole seam log of the GET request.

                      • 8. Re: Conversation start with @Factory ?
                        lcoetzee

                        Email or through Forum ? (Quite a large file)

                        In the meantime I tried the email to your jboss account name.


                        L

                        • 9. Re: Conversation start with @Factory ?
                          lcoetzee

                          Thomas,

                          That topic is covered in the Wiki:
                          http://wiki.jboss.org/wiki/Wiki.jsp?page=UseJBossEclipseIDEToDoJBossSeamsBookingExample
                          


                          Excellent. Just the bandwidth fight to get the JBossIDE into Africa. Painful ;-)

                          L


                          • 10. Re: Conversation start with @Factory ?
                            lcoetzee

                            Hi,

                            I have managed to step through my app (and the Seam code). It seems as if the @Factory stuff gets done (loads all my content). Then it starts the conversation (@Begin) (at least while stepping through the code the endOrBeginLongRunningConversation in ConversationInterceptor.java gets executed after all the stuff was loaded).

                            I assume that it starts a new conversation at that point, thus throwing away the stuff that inserted in the Conversation context ? But it can't be... as then my JSF won't be showing the loaded content. Confusing...

                            I am on very thin ice here (not really having looked into the Seam code before).



                            L


                            • 11. Re: Conversation start with @Factory ?
                              gavin.king

                              Nope, @Begin methods don't really start conversations. Rather, they promote a short-running conversation to long-running mode. :-)

                              ie. keeping the existing context around.

                              • 12. Re: Conversation start with @Factory ?
                                lcoetzee

                                I wrote a small test using both @Factory and @Begin. Works perfectly. Important though to label the @Factory("variable") to have a conversation scope (@Out(scope=ScopeType.Conversation) private String variable;).

                                Unfortunately my original usage is still broken. But at least I know that it is suppose to work !

                                L

                                • 13. Re: Conversation start with @Factory ?
                                  gavin.king

                                  Please keep us informed.

                                  • 14. Re: Conversation start with @Factory ?
                                    landels

                                    Hi lcoetzee,

                                    Did you get it working? We have similar problem right now. And I was wondering about the return value of your @Factory and @Begin method. The docu says:

                                    @Begin: Specifies that a long-running conversation begins when this method returns a non-null outcome without exception.

                                    ... and your method is void, right? Has this been changed? In the special case of @Factory and @Begin? On the other hand -> which outcome should be returned here...

                                    cu,

                                    1 2 Previous Next