You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Wolfgang Wagner <ww...@csc.com> on 2008/02/06 00:54:34 UTC

How can I have more than one bean in an orchestra conversation


In my application context i have defined multiple beans with
scope="conversation.manual"
When calling Conversation.getCurrentInstance().invalidate() in an action
method of one of these beans only that bean gets destroyed.

It seems as if there is one conversation object for each of my conversation
scoped beans.
I have expected that newly created beans that are are under conversation
scope join automatically an already running conversation, and get destroyed
whenever the conversation gets destroyed.


Is there a way to have multiple objects in one conversation ??


AG WW


Re: How can I have more than one bean in an orchestra conversation

Posted by Wolfgang Wagner <ww...@csc.com>.
Thanks that worked.

Eventually I woud have found that by myself if I had a description of the
orchestra namespace.
Is there one?




                                                                           
             Mario Ivankovits                                              
             <ma...@ops.co.at>                                             
                                                                        To 
             06.02.2008 10:18          MyFaces Discussion                  
                                       <us...@myfaces.apache.org>          
                                                                        cc 
             Please respond to                                             
                 "MyFaces                                          Subject 
                Discussion"            Re: How can I have more than one    
             <users@myfaces.ap         bean in an orchestra conversation   
                 ache.org>                                                 
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           




Hi!
> I have tried to define a name for my conversation but did not succeed.
All
> I found in the documentation was the hint of some hidden id on page
specs.
>
In your spring config add the orchestra xsd
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:tx="http://www.springframework.org/schema/tx"
       xmlns:aop="http://www.springframework.org/schema/aop"
       xmlns:orchestra="http://myfaces.apache.org/orchestra"
       xsi:schemaLocation="
            http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
            http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-2.0.xsd
            http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-2.0.xsd
            http://myfaces.apache.org/orchestra
http://myfaces.apache.org/orchestra/orchestra.xsd">


and then you'll be able to configure the conversation name

    <bean
        name="bean2"
        class="org.apache.myfaces.examples.multibean.Bean2"
        scope="conversation.manual"
        orchestra:conversationName="multibean">
    </bean>


Ciao,
Mario




Re: How can I have more than one bean in an orchestra conversation

Posted by Mario Ivankovits <ma...@ops.co.at>.
Hi!
> I have tried to define a name for my conversation but did not succeed. All
> I found in the documentation was the hint of some hidden id on page specs.
>   
In your spring config add the orchestra xsd
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:tx="http://www.springframework.org/schema/tx"
       xmlns:aop="http://www.springframework.org/schema/aop"
       xmlns:orchestra="http://myfaces.apache.org/orchestra"
       xsi:schemaLocation="
            http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
            http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-2.0.xsd
            http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-2.0.xsd
            http://myfaces.apache.org/orchestra
http://myfaces.apache.org/orchestra/orchestra.xsd">


and then you'll be able to configure the conversation name

    <bean
        name="bean2"
        class="org.apache.myfaces.examples.multibean.Bean2"
        scope="conversation.manual"
        orchestra:conversationName="multibean">
    </bean>


Ciao,
Mario


Re: How can I have more than one bean in an orchestra conversation

Posted by Wolfgang Wagner <ww...@csc.com>.
Thanks for the answer.
I have tried to define a name for my conversation but did not succeed. All
I found in the documentation was the hint of some hidden id on page specs.

"Orchestra also provides the concept of a "conversation context", which
holds a set of named conversations. A "separateConversationContext" JSF
component creates a new context. When this is a parent of any command
component (eg a commandLink) then a new conversation context is
automatically created when that command is executed. This allows multiple
windows to access the same site while having completely independent sets of
objects that are of "conversation scope". A hidden "id" emitted into pages
specifies what the current conversation context is, ensuring the new
windows "sticks" with its associated conversation context."

Can you please describe how I can define names for my conversations and how
to force my beans to use a spezially named conversation ?

THX
AG WW




                                                                           
             simon                                                         
             <simon.kitching@c                                             
             hello.at>                                                  To 
                                       MyFaces Discussion                  
             06.02.2008 08:16          <us...@myfaces.apache.org>          
                                                                        cc 
                                                                           
             Please respond to                                     Subject 
                 "MyFaces              Re: How can I have more than one    
                Discussion"            bean in an orchestra conversation   
             <users@myfaces.ap                                             
                 ache.org>                                                 
                                                                           
                                                                           
                                                                           
                                                                           





On Wed, 2008-02-06 at 00:54 +0100, Wolfgang Wagner wrote:
>
> In my application context i have defined multiple beans with
> scope="conversation.manual"
> When calling Conversation.getCurrentInstance().invalidate() in an action
> method of one of these beans only that bean gets destroyed.
>
> It seems as if there is one conversation object for each of my
conversation
> scoped beans.
> I have expected that newly created beans that are are under conversation
> scope join automatically an already running conversation, and get
destroyed
> whenever the conversation gets destroyed.
>
>
> Is there a way to have multiple objects in one conversation ??

Yep. Each conversation has a *name*. If you do not specify a name for a
conversation, then conversationName=beanName.

If two beans are assigned to a conversation with the same name, then
invalidating that conversation invalidates both beans.

Regards, Simon




Re: How can I have more than one bean in an orchestra conversation

Posted by simon <si...@chello.at>.
On Wed, 2008-02-06 at 00:54 +0100, Wolfgang Wagner wrote:
> 
> In my application context i have defined multiple beans with
> scope="conversation.manual"
> When calling Conversation.getCurrentInstance().invalidate() in an action
> method of one of these beans only that bean gets destroyed.
> 
> It seems as if there is one conversation object for each of my conversation
> scoped beans.
> I have expected that newly created beans that are are under conversation
> scope join automatically an already running conversation, and get destroyed
> whenever the conversation gets destroyed.
> 
> 
> Is there a way to have multiple objects in one conversation ??

Yep. Each conversation has a *name*. If you do not specify a name for a
conversation, then conversationName=beanName.

If two beans are assigned to a conversation with the same name, then
invalidating that conversation invalidates both beans.

Regards, Simon