You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by Bernhard Huemer <be...@gmail.com> on 2008/10/26 20:16:53 UTC
[Orchestra] Drawbacks of Orchestra I'd like to discuss
Hi folks,
I've been using Orchestra for a few months now and in doing so I've been
questioning some major implementation decisions, to be more specific I
really want to discuss if it's really necessary to bind beans to a
certain conversation (and therefore also a certein persistence
context!). Let me give you some examples:
Example 1)
I've developed some views for a search dialog that I wanted to use in at
least two different conversations. Everything worked fine for the first
conversation. The following code listing should give you an idea of the
problem.
///
view.xhtml
<h:inputText value="#{conversationBean.value}" />
spring-bean-config.xml
<bean id="conversationBean" class="..." scope="conversation.manual"
orchestra:conversationName="conversationA" />
\\\
Maybe some of you have realized my problem by now: The bean somehow
depends on the conversation and as the view depends on the bean I can't
use it with a different conversation (or at least I'm missing a major
feature of Orchestra). :-f
I've solved this issue by creating some Facelets components so that I'm
able to pass the conversation bean as parameter. However, I had to
duplicate navigation rules, etc, i.e. now I've got the following structure:
///
viewA.xhtml
<my:view bean="#{conversationABean}" />
viewB.xhtml
<my:view bean="#{conversationBBean}" />
view.xhtml
<h:inputText value="#{bean.value}" />
spring-bean-config.xml
<bean id="conversationABean" class="..." scope="conversation.manual"
orchestra:conversationName="conversationA" />
<bean id="conversationBBean" class="..." scope="conversation.manual"
orchestra:conversationName="conversationB" />
\\\
Example 2)
In a different part of the same application I've created a view that
should serve for three different usecases. Basically the view doesn't
change for these usecases at all, but the logic of the backing bean
does. My first approach was to determine the specific page bean at
runtime in the action method that navigates to this view. This action
method was supposed to register the specific page bean under a common
name. So somehow it can be said that I wanted to use "polymorphic beans".
///
public String action() {
Conversation conversation = getCurrentConversation();
switch (criterium) {
case CASE_A:
conversation.setAttribute("commonBean", specificBeanA);
break;
case CASE_B:
conversation.setAttribute("commonBean", specificBeanB);
break;
case CASE_C:
conversation.setAttribute("commonBean", specificBeanC);
break;
default:
throw new IllegalStateException(); // shouldn't occur anway
}
return outcome;
}
view.xhtml
<h:commandButton action="#{commonBean.save}" />
\\\
However, that wouldn't work for two reasons:
- Orchestra only knows how to resolve Spring beans as the bean
definition determines the conversation being used (well, Orchestra
doesn't know how to resolve anything, actually it's the
EL-/VariableResolver of Spring that does this job in this case). It's
only possible to resolve such variables if the view knows which
conversation it should access (i.e. if one would develop a custom
ELResolver that knows how to resolve expressions like
#{conversation.conversationA.commonBean} - *cough* problem of the first
example *cough*).
- Orchestra wouldn't create a persistence context for that bean as the
persistence interceptor only gets attached to Spring beans. (No, I'm not
telling you to modify the setAttribute method so that advices will be
attached. I'm rather telling you to use conversation listeners instead
for persistence support, just like Web Flow does).
I was able to work around this issue by introducing an additional
indirection, i.e. I'm resolving that bean with the expression
#{pageAccessor['commonBean']}, but that's just not intuitional.
However, please don't get me wrong. I don't want to hear anything about
certain workarounds that I could have used in these cases as I think
that these usecases aren't exceptional enough to justify workarounds. Of
course, the current approach has got its advantages too (e.g. switching
arbitrarily between different conversations as there is no hierarchical
structure), but at least I haven't needed this feature yet.
Summarizing it can be stated that I'd propose you to rewrite
conversation handling for the next major release and I'd be willing to
contribute. Note that I don't want to drop support for these "named
conversations", but I think that this usecase is not the default one for
conversations.
regards,
Bernhard Huemer
Re: [Orchestra] Drawbacks of Orchestra I'd like to discuss
Posted by Bernhard Huemer <be...@gmail.com>.
Hello,
> (1) we often mix access to beans in different conversations (ie with
> different lifetimes) on the same page. One common example is a page
> displaying a persistent bean, a search-criteria and a results list.
> AIUI your suggestion introduces a "default" conversation for the
> request, but these different things might be in the "default"
> conversation in some views, and not in others.
I've already mentioned a few times that such use-cases can't be
implemented with a single conversation model and that's the reason why
we can't drop the current approach entirely, but I do think that some of
those use-cases can be implemented with nested conversations too.
For example, determining search criteria is something that you could
either do on the same page or in a different dialog. If you provide
according JSF input components on the same page, you can use the request
scope and if you're providing a special dialog that enables the user to
specify the search criteria, you can use a nested conversation.
Of course, now you're gonna tell me some usecases where neither the
"request scope"-approach nor the "nested-conversation"-approach will
work, but that doesn't matter as I've already "admitted" that there are
such use-cases, but those are not usual ones (or at least not ones that
you can't solve differently).
Orchestra has been developed so that it's possible to use multiple
conversations on the same view, simply because you need multiple
conversations on the same view. I do not and most importantly neither do
others too, because otherwise noone would be using Web Flow or Seam.
However, don't get me wrong as it's a great thing that Orchestra
supports usecases that other frameworks don't support, but these
usecases shouldn't be the reason for limiting the user's possibilites.
> (2) As mario mentioned, ensuring endConversation is called
> appropiately is basically impossible. WebFlow might be able to arrange
> it because it insists that the webapp documents every valid navigation
> transition and so can detect navigations that are not in its list. But
> orchestra doesn't want to go down that road. I don't mean that the
> WebFlow approach is wrong, just that Orchestra currently has a
> low-configuration JSF-ish approach and that has its benefits too.
Why is ensuring an according "endConversation" method is called
impossible? If you don't call "conversation.invalidate()" by now the
EntityManager won't be closed (I'm ignoring the timeout for now) and I
don't think that this is a problem either? I really don't see any
difference here.
Of course, a low-configuration approach has got its benefits too,
otherwise I wouldn't have started this discussion as I'd be using Spring
Web Flow all the time. However, I think that this doesn't introduce
further configuration overhead.
> (3) If something calls startConversation, then how does it get
> access to the stuff that was in the previous "default conversation"?
Well, first of all I want to clarify that there's nothing like a
"default conversation". There's just the current conversation which
might be "null" if the user hasn't called startConversation yet (or
whatever approach you'd like to implement for starting conversations).
You can access the calling conversation with a method like
"conversation.getParentConversation()" or something like that, but I
think that's not what you want to know, is it? Most probably you're
looking for something that allows you to inject a bean of a certain
conversation into one of another conversation, aren't you?
Actually, it's even possible to do that, but you have to allow it, i.e.
you have to pass those beans as parameters. However, no additional API
is needed for that as you only have to register them as attributes
(However, special care has to be taken regarding lifecycle callbacks of
such "parameter attributes", but that's an implementation detail again ..).
Furthermore I'd like to keep the current conversation model, so you're
still able to configure which conversation to use for a certain bean,
the difference is just that I'd like to build it on top of a single
conversation model.
regards,
Bernhard Huemer
On 10/27/2008 +0100,
Simon Kitching <sk...@apache.org> wrote:
> Mario Ivankovits schrieb:
>>> Simply said, yes that's true, but the flow description doesn't have to
>>> be an XML flow definition. What I'd like to see, is an Orchestra API
>>> that allows me to describe my flows programmatically at runtime as this
>>> is a much more powerful approach for managing conversations.
>>>
>> You can create your own flow implementation on top of orchestra and use a special conversation scope implementation which uses the conversation name "_main" as a fixed string. Then, the only thing you have to deal with is the conversationContext.
>> If your custom scope avoids creating the conversation if it doesn't exist you even can try to implement the @Create stuff.
>>
>> I think in Orchestra everything is there to help you developing your ideas without rewriting the core of Orchestra.
>>
>
> I would second Mario's suggestion.
>
> AIUI, your suggestion effectively introduces a "default" conversation,
> and beans can be declared as being in the "default" conversation. The
> default conversation for a specific conversationContext gets changed via
> API calls. And something sets up the persistence-context for the default
> conversation as soon as the request starts rather than waiting for a
> method-call to a specific bean. That sounds like something that could be
> implemented now, without changing Orchestra much or at all, just by
> having a conversation with a magic name like "_main".
>
> If something is missing in the Orchestra API to allow this then we can
> talk about adding it in to make your approach possible. But Orchestra
> does work right now, for some real-world projects. So it would seem
> reasonable to test the new idea rather than ripping everything up first
> if we can.
>
> Having a conversation (and associated persistence context) set up as
> soon as the request starts (rather than only setting it up while a
> method on a conversation-scoped bean is running) would be nice. But
> there are a lot of potential issues with this too, like:
>
> (1) we often mix access to beans in different conversations (ie with
> different lifetimes) on the same page. One common example is a page
> displaying a persistent bean, a search-criteria and a results list. AIUI
> your suggestion introduces a "default" conversation for the request, but
> these different things might be in the "default" conversation in some
> views, and not in others.
>
> (2) As mario mentioned, ensuring endConversation is called appropiately
> is basically impossible. WebFlow might be able to arrange it because it
> insists that the webapp documents every valid navigation transition and
> so can detect navigations that are not in its list. But orchestra
> doesn't want to go down that road. I don't mean that the WebFlow
> approach is wrong, just that Orchestra currently has a low-configuration
> JSF-ish approach and that has its benefits too.
>
> (3) If something calls startConversation, then how does it get access to
> the stuff that was in the previous "default conversation"?
>
> Regards,
> Simon
>
>
Re: [Orchestra] Drawbacks of Orchestra I'd like to discuss
Posted by Simon Kitching <sk...@apache.org>.
Mario Ivankovits schrieb:
>
>> Simply said, yes that's true, but the flow description doesn't have to
>> be an XML flow definition. What I'd like to see, is an Orchestra API
>> that allows me to describe my flows programmatically at runtime as this
>> is a much more powerful approach for managing conversations.
>>
>
> You can create your own flow implementation on top of orchestra and use a special conversation scope implementation which uses the conversation name "_main" as a fixed string. Then, the only thing you have to deal with is the conversationContext.
> If your custom scope avoids creating the conversation if it doesn't exist you even can try to implement the @Create stuff.
>
> I think in Orchestra everything is there to help you developing your ideas without rewriting the core of Orchestra.
>
I would second Mario's suggestion.
AIUI, your suggestion effectively introduces a "default" conversation,
and beans can be declared as being in the "default" conversation. The
default conversation for a specific conversationContext gets changed via
API calls. And something sets up the persistence-context for the default
conversation as soon as the request starts rather than waiting for a
method-call to a specific bean. That sounds like something that could be
implemented now, without changing Orchestra much or at all, just by
having a conversation with a magic name like "_main".
If something is missing in the Orchestra API to allow this then we can
talk about adding it in to make your approach possible. But Orchestra
does work right now, for some real-world projects. So it would seem
reasonable to test the new idea rather than ripping everything up first
if we can.
Having a conversation (and associated persistence context) set up as
soon as the request starts (rather than only setting it up while a
method on a conversation-scoped bean is running) would be nice. But
there are a lot of potential issues with this too, like:
(1) we often mix access to beans in different conversations (ie with
different lifetimes) on the same page. One common example is a page
displaying a persistent bean, a search-criteria and a results list. AIUI
your suggestion introduces a "default" conversation for the request, but
these different things might be in the "default" conversation in some
views, and not in others.
(2) As mario mentioned, ensuring endConversation is called appropiately
is basically impossible. WebFlow might be able to arrange it because it
insists that the webapp documents every valid navigation transition and
so can detect navigations that are not in its list. But orchestra
doesn't want to go down that road. I don't mean that the WebFlow
approach is wrong, just that Orchestra currently has a low-configuration
JSF-ish approach and that has its benefits too.
(3) If something calls startConversation, then how does it get access to
the stuff that was in the previous "default conversation"?
Regards,
Simon
Re: [Orchestra] Drawbacks of Orchestra I'd like to discuss
Posted by Simon Kitching <sk...@apache.org>.
Mario Ivankovits schrieb:
> Which does not mean that I am against your ideas. The opposite is the case, if all your promises turn out to be true, and if this realy adds some value, well, why not drop the way Orchestra currently works in favor of your way.
> Just, I need to see it in action.
>
I feel the same as Mario here. Your ideas are interesting, and *might*
turn out great. But as the recent thread shows, we both have a number of
significant questions about how this would work in various scenarios.
Immediately investing a large amount of time completely rewriting
Orchestra from the beginning is a brave step to take; it would be very
awkward if it turned out that the new idea didn't work out so well in
practice.
It would seem more reasonable to add the new functionality as an
extension to the existing code rather than as a rewrite. Yes, it might
not be so elegant to implement but it would be less to write (you don't
need to implement all the existing behaviour on top of your new ideas).
And *then* if it works we can talk about refactoring to clean things up.
If you do take the approach we suggest: build *on* the existing code,
then you can create an svn branch of the orchestra trunk and work there.
Then we can reasonably easily merge those changes into trunk if things
work out (orchestra core is now fairly stable). And because the new
branch is an *enhancement* only, it is no big deal to even release new
orchestra versions with your enhancements - the new code won't break
existing users because the old code is still the same. This allows
people (including Mario and I) to try out the new functionality in our
existing large & complex systems to see how it works in the real world.
That won't be possible if you start again from scratch unless you are
*very* careful to replicate the existing functionality correctly.
Of course if you really want to implement everything at once (a big
rewrite) then that's up to you. If you can come up with a super new
implementation that does everything the old implementation does and more
then great. But that's quite a big task..incremental development would
seem easier.
However you choose to work, I'm happy to answer any questions you have
about the existing code & functionality, but am not likely to contribute
code directly (at least until there is something that I can actually
test). Orchestra works adequately for me in its current form...
Regards,
Simon
Re: [Orchestra] Drawbacks of Orchestra I'd like to discuss
Posted by Bernhard Huemer <be...@gmail.com>.
Hello again,
> However due to the "map" based approach, the impact of not having a
> converation closed is much less, and if the user navigates back it
> can resume the work automagically.
Of course that's a nice feature of Orchestra by now, but that's what I'd
call an implementation detail, because you can provide this behaviour
with a single conversation model too.
> Manual conversations also have a timeout; when not used for a while
> they are garbage-collected. Will this work as well in your approach?
> The "not used" thing won't work so well, yes?
Why shouldn't it work too? I meen, what's the matter with saving the
last-access-time? Of course this will work too.
>> Reloading the page, however, doesn't matter. Well, of course, it
>> creates another conversation but sooner a later a timeout will
>> invalidate the one that has been created first.
>
> But then you can not talk about "nested conversations", then you
> too have the same "flat" structure as Orchestra has by today.
> When you talk about "nested conversation" you normally also mean
> to invalidate all child conversations once the parent timeout.
> This clearly can not work for your scenario.
Well, I think that a parent conversation can't time out if there are any
child conversations. Actually I really ment to invalidate only the child
conversation that has been created first. However, I don't see why this
should require a "flat" structure. If I refresh a page, the action
method will be executed again, of course. However, it doesn't know
anything about the conversation that has already been created before,
because there's no indication for it (the URL has changed as we're just
refreshing, the state remains the same, ..).
>>
>> The NavigationHandler was just supposed to be an example. However,
>> somewhere, of course, you have to implement that logic, i.e. some
>> callback method is needed in order to handle the "conversation
>> selection", for example, you could use a ViewController for GET
>> Requests.
>
> But then again you do not know if you'd like to start or end a
> conversation without specific external configuration. You can not
> state this as implementation detail. Starting and ending a
> conversation in a reasonable and controlled way is what it is all
> about. Orchestra just allowes to handle it in a less hot way.
Again, Orchestra wouldn't provide such a NavigationHandler or
ViewController implementation, because as you've already said, specific
external configuration would be needed in that case. The developer who
is using Orchestra would have to provide such a NavigationHandler or
ViewController by himself, which is no problem as it's a rather easy task.
> How many levels do you want the developer to keep in mind? If you
> separate the conversation from the persistence scope you also have
> to be aware that, once the persistence context dies all
> the conversation cached in a conversation bean is detached. Creating
> a new persistence scope and pulling in conversation beans with
> entites loaded using another persistence scope will not work.
>
> The only workaround is to NOT cache any entity in the conversation
> bean and look it up from the persistence context each and every time.
> Which is doable, for clustering probably needed, but hard to code.
That might be true for a "flat" conversation structure, but it isn't for
a nested conversation structure. I'll give you an exemplary structure:
Start Conversation #1: (+ Persistence Context)
Start Conversation #2
Start Conversation #3
Stop Conversation #3
Stop Conversation #2
Stop Conversation #1 (close Entity Manager)
It's perfectly fine to cache entities in a nested conversation. However,
if you pass entities to a totally different conversation, then of
course, you've got a problem. However, using nested conversations I'm
able to use the same persistence context within conversations that I'd
like to invalidate earlier.
However, I think I'll just have to convince you by implementing my idea,
but I'm going to use a seperate branch just as Simon suggested it. ;-)
regards,
Bernhard Huemer
On 10/28/2008 +0100,
Mario Ivankovits <ma...@ops.co.at> wrote:
> Hi!
>
>>> The problem is, that it is hard to ensure having a stopConversation
>>> for each startConversation, and what about reloading the page where
>>> possibly the startConversation gets called twice.
>> Well, if I'm not completely mistaken, you also have to invalidate all
>> Orchestra conversations manually by now.
>
> Well, for conversation.access this is no problem, they die with any request not accessing any bean in the conversation.
> For manual-scoped conversations, this is true.
>
> However due to the "map" based approach, the impact of not having a converation closed is much less, and if the user navigates back it can resume the work automagically.
>
> Manual conversations also have a timeout; when not used for a while they are garbage-collected. Will this work as well in your approach? The "not used" thing won't work so well, yes?
>
>
>> I don't see the point, why forcing the user to stop
>> the conversation manually is a problem.
>
> Normally the user wont play nicely - and a web application should not force the user to do so. But, to say the truth, we often use the conversation.access for the persistence stuff and conversation.manual for storing non-persistence state of the conversation which allows to restart easily.
> This gives the user a great application experience I think.
>
>
>> Reloading the page, however, doesn't matter. Well, of course, it
>> creates
>> another conversation but sooner a later a timeout will invalidate the
>> one that has been created first.
>
> But then you can not talk about "nested conversations", then you too have the same "flat" structure as Orchestra has by today.
> When you talk about "nested conversation" you normally also mean to invalidate all child conversations once the parent timeout. This clearly can not work for your scenario.
>
> So you too have to distinguish between "nested conversations" and start a new "conversation".
>
> Currently "nested conversations" are supported through Orchestra Flow ... which also requires some sort of configuration/convention for the flow demarcation.
>
>
>>> Another problem ist that not each and every page-flow is triggered
>>> by a navigation-handler event, what about get requests - e.g. from
>>> the main menu.
>> The NavigationHandler was just supposed to be an example. However,
>> somewhere, of course, you have to implement that logic, i.e. some
>> callback method is needed in order to handle the "conversation
>> selection", for example, you could use a ViewController for GET
>> Requests.
>
> But then again you do not know if you'd like to start or end a conversation without specific external configuration. You can not state this as implementation detail. Starting and ending a conversation in a reasonable and controlled way is what it is all about. Orchestra just allowes to handle it in a less hot way.
>
>
>> Of course, it's best practice not to pass any entities between
>> Orchestra
>> conversations, but that's just true because each Orchestra conversation
>> has got its own persistence context. Seperating conversations and
>> persistence contexts allows you to use the conversation scope in a more
>> fine-grained way (for example, I'd like to reset filter criteria of a
>> search conversation without closing the persistence context).
>
> How many levels do you want the developer to keep in mind? If you separate the conversation from the persistence scope you also have to be aware that, once the persistence context dies all
> the conversation cached in a conversation bean is detached. Creating a new persistence scope and pulling in conversation beans with entites loaded using another persistence scope will not work.
>
> The only workaround is to NOT cache any entity in the conversation bean and look it up from the persistence context each and every time. Which is doable, for clustering probably needed, but hard to code.
>
> And yes, the "reset filter criteria" is just what is easily possible (and used) with orchestra. Simply invalidate the conversation which holds the criteria.
> BTW: This conversation lives in a scope which does not use any persistence context at all here. This is just a matter of scope configuration.
>
>
>> You could count it as "example 3" of things I don't like in Orchestra. I
>> have to use a single persistence context for a certain dialog (I'm
>> calling it dialog now so that you don't mix it up with Orchestra
>> conversations). Now I'd like to split this dialog into seperate
>> conversations, but I can't because I have to reuse the persistence
>> context so I'm actually reseting some values manually. :-f
>
> This is just not true, you can use as many persistence contexts as you would like to. You just have to be aware how to pass information from one conversation to another one.
> That you should not pass entities between persistence contexts is a limitation of the persistence framework - and nothing which is a real problem in any application, is it?
>
> I don't know what you mean by "split this dialog" as no persistence framework allows you to "split" its session, but if you'd like to
> push the data to other conversation scoped beans you are free to do so - technically spoken.
>
>
>> However, actually I wanted to talk about my search-use-case as I think
>> that's no problem. Even with a single conversation model it's still
>> possible to create nested conversations (which would meet all
>> requirements for this use-case).
>
> If the user uses some sort of global navigation you do not know which conversation to end. This is NOT trivial to solve without flow configurations.
>
> Nested-Conversations without external flow configuration won't work, I promise.
>
>
>> Probably there are even further more examples where a NavigationHandler
>> won't work, but that actually really doesn't matter, because using an
>> API the user has got the possibility to adapt Orchestra to his/her
>> needs. (Btw. implementing another scope that fulfills ones requirements
>> is somehow "extending Orchestra" and not really "using Orchestra" ..).
>
> But to test out your ideas you first have to extend Orchestra, as it clearly does not fit your needs, and then we can decide making it the new best practice.
> Orchestra has a sandbox, no problem to start there.
>
>
>> I think you've answered that already on your own. If "hacking around"
>> is
>> needed for something "trivial" like that, something has to be done, at
>> least in my opinion.
>
> Sorry that "hacking around" triggered somehting like that. With "hacking around" I just meant developing your idea.
> Orchestra is using another philosophy you have in mind. There is not much to say about that.
>
> Implementing and using your "trivial" (your word ;-) ) idea is anything else than trivial I think.
>
>
>> Well, basically you've told me to implement my own conversation scope
>> and my own approach to persistence context handling, if I really feel
>> the need for something like that. But what remains of "the core of
>> Orchestra"? - the ConversationContext.
>
> Yes, and if it is really that good we can use that as new system ground for Orchestra, what is bad with that?
> You also do not have to go the "proxied" bean way. You simply can use a filter to setup the persistence. That is really easy. Just lookup the conversation and call bind/unbind on the persistence provider.
>
>
>
> The problem I see is that I still do not understand how your implementation will work with all the scenarios we are currently using - we can not drop these scenarios.
>
> For me, nested-conversations won't work without some sort of flow description (external or annotations does not matter) which will assure that the conversation stack is always clean and in known state.
> I also can not see how a single-conversation model will be able to emulate the multi-conversation model Orchestra currently uses later on then.
>
> Unfortunately I am not able to convince you about the beauty of Orchestra. But that is ok, differente people have different views and needs. Going the scope way has been discussed with others and at that time we came to the conclusio that this is a well-known pattern and easy to understand. And as I said, it works very well here and is easy to code with.
>
> BTW: I never cared how other frameworks worked as I wanted to implement the vision which has been built in my head after some discussions with other developers. That other frameworks work different does not mean that they are better, even if the framework is that company-backed (and thus more accepted) like JBoss Seam or Spring WebFlow.
>
> Clearly I can not welcome a rewrite of Orchestra as long as I do not get to the point you vision. We are at Version 1.3 and Orchestra is used, even in the wild.
>
> Which does not mean that I am against your ideas. The opposite is the case, if all your promises turn out to be true, and if this realy adds some value, well, why not drop the way Orchestra currently works in favor of your way.
> Just, I need to see it in action.
>
>
> You have to understand that this can not be demonstrated by rewriting Orchestra trunk, thus, I suggested to "hack-around" your idea into the current Orchestra API. Which you declined.
> Next thing I can propose is to create a branch of Orchestra and start rewriting it there. Since I do not understand all your visions you have to do the main work.
>
> Keep in mind that stuff like
> * Orchestra Flow - handling dialog scenarios
> * allowing converters/validators using persistence
> * allowing multiple, different configured, conversations at the same time (same request/same view) (long-living criteria-selector whith short-living criteria-result-view)
> * allow to jump in the application back and forth using the navigation by not creating new conversations all the time, reuse the conversation (if still living) so the user can resume the work
> * allow to timout other conversations if not accessed any more. (order-processing, customer-update scenario)
> has to work with your new design too.
>
> Also keep in mind that the current solution just requires to call "Conversation.invalidate" in some cases. So Orchestra supports the "do not clutter your code with persistence stuff" paradigm. The main idea of most ORM frameworks.
> Also, please keep in mind that Orchestra has to be different to the others e.g. Seam and WebFlow, else we have to stand the question why to use Orchestra ... something I will not spend my time for - to say the truth, even I would use the "orignals" then.
>
>
> Is this an acceptable proposal? I really would like to see it work and incorporate it into Orchestra then.
>
> If not, the last thing I see is to start another project, which surely is suboptimal; to say its best.
>
> Ciao,
> Mario
>
RE: [Orchestra] Drawbacks of Orchestra I'd like to discuss
Posted by Mario Ivankovits <ma...@ops.co.at>.
Hi!
> > The problem is, that it is hard to ensure having a stopConversation
> > for each startConversation, and what about reloading the page where
> > possibly the startConversation gets called twice.
>
> Well, if I'm not completely mistaken, you also have to invalidate all
> Orchestra conversations manually by now.
Well, for conversation.access this is no problem, they die with any request not accessing any bean in the conversation.
For manual-scoped conversations, this is true.
However due to the "map" based approach, the impact of not having a converation closed is much less, and if the user navigates back it can resume the work automagically.
Manual conversations also have a timeout; when not used for a while they are garbage-collected. Will this work as well in your approach? The "not used" thing won't work so well, yes?
> I don't see the point, why forcing the user to stop
> the conversation manually is a problem.
Normally the user wont play nicely - and a web application should not force the user to do so. But, to say the truth, we often use the conversation.access for the persistence stuff and conversation.manual for storing non-persistence state of the conversation which allows to restart easily.
This gives the user a great application experience I think.
> Reloading the page, however, doesn't matter. Well, of course, it
> creates
> another conversation but sooner a later a timeout will invalidate the
> one that has been created first.
But then you can not talk about "nested conversations", then you too have the same "flat" structure as Orchestra has by today.
When you talk about "nested conversation" you normally also mean to invalidate all child conversations once the parent timeout. This clearly can not work for your scenario.
So you too have to distinguish between "nested conversations" and start a new "conversation".
Currently "nested conversations" are supported through Orchestra Flow ... which also requires some sort of configuration/convention for the flow demarcation.
> > Another problem ist that not each and every page-flow is triggered
> > by a navigation-handler event, what about get requests - e.g. from
> > the main menu.
>
> The NavigationHandler was just supposed to be an example. However,
> somewhere, of course, you have to implement that logic, i.e. some
> callback method is needed in order to handle the "conversation
> selection", for example, you could use a ViewController for GET
> Requests.
But then again you do not know if you'd like to start or end a conversation without specific external configuration. You can not state this as implementation detail. Starting and ending a conversation in a reasonable and controlled way is what it is all about. Orchestra just allowes to handle it in a less hot way.
> Of course, it's best practice not to pass any entities between
> Orchestra
> conversations, but that's just true because each Orchestra conversation
> has got its own persistence context. Seperating conversations and
> persistence contexts allows you to use the conversation scope in a more
> fine-grained way (for example, I'd like to reset filter criteria of a
> search conversation without closing the persistence context).
How many levels do you want the developer to keep in mind? If you separate the conversation from the persistence scope you also have to be aware that, once the persistence context dies all
the conversation cached in a conversation bean is detached. Creating a new persistence scope and pulling in conversation beans with entites loaded using another persistence scope will not work.
The only workaround is to NOT cache any entity in the conversation bean and look it up from the persistence context each and every time. Which is doable, for clustering probably needed, but hard to code.
And yes, the "reset filter criteria" is just what is easily possible (and used) with orchestra. Simply invalidate the conversation which holds the criteria.
BTW: This conversation lives in a scope which does not use any persistence context at all here. This is just a matter of scope configuration.
> You could count it as "example 3" of things I don't like in Orchestra. I
> have to use a single persistence context for a certain dialog (I'm
> calling it dialog now so that you don't mix it up with Orchestra
> conversations). Now I'd like to split this dialog into seperate
> conversations, but I can't because I have to reuse the persistence
> context so I'm actually reseting some values manually. :-f
This is just not true, you can use as many persistence contexts as you would like to. You just have to be aware how to pass information from one conversation to another one.
That you should not pass entities between persistence contexts is a limitation of the persistence framework - and nothing which is a real problem in any application, is it?
I don't know what you mean by "split this dialog" as no persistence framework allows you to "split" its session, but if you'd like to
push the data to other conversation scoped beans you are free to do so - technically spoken.
> However, actually I wanted to talk about my search-use-case as I think
> that's no problem. Even with a single conversation model it's still
> possible to create nested conversations (which would meet all
> requirements for this use-case).
If the user uses some sort of global navigation you do not know which conversation to end. This is NOT trivial to solve without flow configurations.
Nested-Conversations without external flow configuration won't work, I promise.
> Probably there are even further more examples where a NavigationHandler
> won't work, but that actually really doesn't matter, because using an
> API the user has got the possibility to adapt Orchestra to his/her
> needs. (Btw. implementing another scope that fulfills ones requirements
> is somehow "extending Orchestra" and not really "using Orchestra" ..).
But to test out your ideas you first have to extend Orchestra, as it clearly does not fit your needs, and then we can decide making it the new best practice.
Orchestra has a sandbox, no problem to start there.
> I think you've answered that already on your own. If "hacking around"
> is
> needed for something "trivial" like that, something has to be done, at
> least in my opinion.
Sorry that "hacking around" triggered somehting like that. With "hacking around" I just meant developing your idea.
Orchestra is using another philosophy you have in mind. There is not much to say about that.
Implementing and using your "trivial" (your word ;-) ) idea is anything else than trivial I think.
> Well, basically you've told me to implement my own conversation scope
> and my own approach to persistence context handling, if I really feel
> the need for something like that. But what remains of "the core of
> Orchestra"? - the ConversationContext.
Yes, and if it is really that good we can use that as new system ground for Orchestra, what is bad with that?
You also do not have to go the "proxied" bean way. You simply can use a filter to setup the persistence. That is really easy. Just lookup the conversation and call bind/unbind on the persistence provider.
The problem I see is that I still do not understand how your implementation will work with all the scenarios we are currently using - we can not drop these scenarios.
For me, nested-conversations won't work without some sort of flow description (external or annotations does not matter) which will assure that the conversation stack is always clean and in known state.
I also can not see how a single-conversation model will be able to emulate the multi-conversation model Orchestra currently uses later on then.
Unfortunately I am not able to convince you about the beauty of Orchestra. But that is ok, differente people have different views and needs. Going the scope way has been discussed with others and at that time we came to the conclusio that this is a well-known pattern and easy to understand. And as I said, it works very well here and is easy to code with.
BTW: I never cared how other frameworks worked as I wanted to implement the vision which has been built in my head after some discussions with other developers. That other frameworks work different does not mean that they are better, even if the framework is that company-backed (and thus more accepted) like JBoss Seam or Spring WebFlow.
Clearly I can not welcome a rewrite of Orchestra as long as I do not get to the point you vision. We are at Version 1.3 and Orchestra is used, even in the wild.
Which does not mean that I am against your ideas. The opposite is the case, if all your promises turn out to be true, and if this realy adds some value, well, why not drop the way Orchestra currently works in favor of your way.
Just, I need to see it in action.
You have to understand that this can not be demonstrated by rewriting Orchestra trunk, thus, I suggested to "hack-around" your idea into the current Orchestra API. Which you declined.
Next thing I can propose is to create a branch of Orchestra and start rewriting it there. Since I do not understand all your visions you have to do the main work.
Keep in mind that stuff like
* Orchestra Flow - handling dialog scenarios
* allowing converters/validators using persistence
* allowing multiple, different configured, conversations at the same time (same request/same view) (long-living criteria-selector whith short-living criteria-result-view)
* allow to jump in the application back and forth using the navigation by not creating new conversations all the time, reuse the conversation (if still living) so the user can resume the work
* allow to timout other conversations if not accessed any more. (order-processing, customer-update scenario)
has to work with your new design too.
Also keep in mind that the current solution just requires to call "Conversation.invalidate" in some cases. So Orchestra supports the "do not clutter your code with persistence stuff" paradigm. The main idea of most ORM frameworks.
Also, please keep in mind that Orchestra has to be different to the others e.g. Seam and WebFlow, else we have to stand the question why to use Orchestra ... something I will not spend my time for - to say the truth, even I would use the "orignals" then.
Is this an acceptable proposal? I really would like to see it work and incorporate it into Orchestra then.
If not, the last thing I see is to start another project, which surely is suboptimal; to say its best.
Ciao,
Mario
Re: [Orchestra] Drawbacks of Orchestra I'd like to discuss
Posted by Bernhard Huemer <be...@gmail.com>.
> The problem is, that it is hard to ensure having a stopConversation
> for each startConversation, and what about reloading the page where
> possibly the startConversation gets called twice.
Well, if I'm not completely mistaken, you also have to invalidate all
Orchestra conversations manually by now. Could you explain this problem
a little bit more? I don't see the point, why forcing the user to stop
the conversation manually is a problem.
Reloading the page, however, doesn't matter. Well, of course, it creates
another conversation but sooner a later a timeout will invalidate the
one that has been created first. I think that's just a matter of
implementation and shouldn't affect the design decisions.
> Another problem ist that not each and every page-flow is triggered
> by a navigation-handler event, what about get requests - e.g. from
> the main menu.
The NavigationHandler was just supposed to be an example. However,
somewhere, of course, you have to implement that logic, i.e. some
callback method is needed in order to handle the "conversation
selection", for example, you could use a ViewController for GET Requests.
> Also, what about your search-use-case? If you navigate from the
> page to the search dialog and came back, you (or, at least I)
> want to throw away the persistence junk collected through the
> search-flow. Having just one conversation means you keep tons of
> entities (and possibly stale data). In contrast, using
> startConversation from within the search leads you to the same
> problems (and even more) than you have with Orchestra which forbid
> you (or, at least it is not best practice) to pass entities between
> conversations.
Of course, it's best practice not to pass any entities between Orchestra
conversations, but that's just true because each Orchestra conversation
has got its own persistence context. Seperating conversations and
persistence contexts allows you to use the conversation scope in a more
fine-grained way (for example, I'd like to reset filter criteria of a
search conversation without closing the persistence context).
You could count it as "example 3" of things I don't like in Orchestra. I
have to use a single persistence context for a certain dialog (I'm
calling it dialog now so that you don't mix it up with Orchestra
conversations). Now I'd like to split this dialog into seperate
conversations, but I can't because I have to reuse the persistence
context so I'm actually reseting some values manually. :-f
However, actually I wanted to talk about my search-use-case as I think
that's no problem. Even with a single conversation model it's still
possible to create nested conversations (which would meet all
requirements for this use-case). In doing so, you've got the advantag
that you know which conversation has been calling you, for example in
order to reuse the persistence context of the calling conversation.
>> For example, in this case I'd prefer to write a NavigationHandler for
>> my
>
> See my concerns about get request.
Probably there are even further more examples where a NavigationHandler
won't work, but that actually really doesn't matter, because using an
API the user has got the possibility to adapt Orchestra to his/her
needs. (Btw. implementing another scope that fulfills ones requirements
is somehow "extending Orchestra" and not really "using Orchestra" ..).
> Orchestras API should be open enough to implement any sort of system
> as long as you proxy your beans to setup the persistence context. You
> might be able to even ___hack around___ that as you could grab the
> persistence context from the conversation attributes map and
> bind/unbind it at request start/end as long as you know which
> conversation to bind to. Probably by using a special named _main
> conversation.
I think you've answered that already on your own. If "hacking around" is
needed for something "trivial" like that, something has to be done, at
least in my opinion.
> I think in Orchestra everything is there to help you developing your
> ideas without rewriting the core of Orchestra.
Well, basically you've told me to implement my own conversation scope
and my own approach to persistence context handling, if I really feel
the need for something like that. But what remains of "the core of
Orchestra"? - the ConversationContext.
Please don't get me wrong, but implementing such a scope is just the
wrong thing to do. You've already mentioned that it will work as long as
I create proxies for my beans to bind the persistence context. Well, I
don't need such proxies if I could use a ConversationListener. Assuming
that I'm not referencing a conversation-scoped bean as dependency I
don't need a proxy at all (of course only in some certain cases, i.e.
when I'm not using Spring AOP features). That's just one reason why I
think that implementing such a scope is just not right.
regards,
Bernhard Huemer
On 10/27/2008 +0100,
Mario Ivankovits <ma...@ops.co.at> wrote:
> Hi!
>
>>> The main problem I see with this approach is that you HAVE to use a
>>> flow definition, else Orchestra has no chance to determine when to end
>>> a conversation and when to reuse the current one.
>> Well, no, you don't have to use a flow definition. Managing the
>> conversation from a user's perspective is clearly defined as an
>> according API will be provided. If the user doesn't call a method like
>> "conversation.invalidate()" the conversation won't end.
>>
>> For example, I'm thinking of creating a configurable artifact that
>> manages the lifecycle of a conversation - a so-called
>> "ConversationManager". The basic implementation would require the user
>> to call the method "manager.startConversation()"
>
> The problem is, that it is hard to ensure having a stopConversation for each startConversation, and what about reloading the page where possibly the startConversation gets called twice.
> Another problem ist that not each and every page-flow is triggered by a navigation-handler event, what about get requests - e.g. from the main menu.
>
> Also, what about your search-use-case? If you navigate from the page to the search dialog and came back, you (or, at least I) want to throw away the persistence junk collected through the search-flow. Having just one conversation means you keep tons of entities (and possibly stale data). In contrast, using startConversation from within the search leads you to the same problems (and even more) than you have with Orchestra which forbid you (or, at least it is not best practice) to pass entities between conversations.
>
>
>> Well, I'm not particularly against named conversations. I'm just saying
>> that neither the view nor a Spring bean is responsible for determining
>> the name of this conversation, but a special "flow logic" is (and I'm
>> still not talking about flow definitions).
>
> Ok, so start with a scope implementation which overrides getConversationName() (or something like that). Couldn't you just plug the logic in there?
> The point is, once the bean has been instatiated the persistence context is not allowed to change. What if the bean holds entites as strong reference, if the persistence context changed these objects gets detached (or simply reuse an already closed persistence session)
>
>
>> For example, in this case I'd prefer to write a NavigationHandler for
>> my
>
> See my concerns about get request.
>
>
>> application that knows how to deal with this usecase. Basically it uses
>> the according API to suspend the current conversation and resume the
>> according one. Of course, Orchestra could only do that automatically if
>> there was something like a flow definition, but I'd prefer to expose an
>> API so that the user is able to write such a NavigationHandler on his
>> own.
>
> Orchestras API should be open enough to implement any sort of system as long as you proxy your beans to setup the persistence context. You might be able to even hack around that as you could grab the persistence context from the conversation attributes map and bind/unbind it at request start/end as long as you know which conversation to bind to. Probably by using a special named _main conversation.
>
> This should allow you to jump start with your idea and see if it really fits your application needs.
>
>
>>> Also no user-interaction is required (pause, restart, etc) and no
>>> other sort of convention.
>> Well, of course you could say that this is a burden for the user, but
>> it
>> comes with great flexibility too (see my master-/detail-view example).
>
> It is not only a burden for the user, it is impossible to ensure from within your application I think (still).
>
>
>> Simply said, yes that's true, but the flow description doesn't have to
>> be an XML flow definition. What I'd like to see, is an Orchestra API
>> that allows me to describe my flows programmatically at runtime as this
>> is a much more powerful approach for managing conversations.
>
> You can create your own flow implementation on top of orchestra and use a special conversation scope implementation which uses the conversation name "_main" as a fixed string. Then, the only thing you have to deal with is the conversationContext.
> If your custom scope avoids creating the conversation if it doesn't exist you even can try to implement the @Create stuff.
>
> I think in Orchestra everything is there to help you developing your ideas without rewriting the core of Orchestra.
>
>
> Ciao,
> Mario
RE: [Orchestra] Drawbacks of Orchestra I'd like to discuss
Posted by Mario Ivankovits <ma...@ops.co.at>.
Hi!
> > The main problem I see with this approach is that you HAVE to use a
> > flow definition, else Orchestra has no chance to determine when to end
> > a conversation and when to reuse the current one.
>
> Well, no, you don't have to use a flow definition. Managing the
> conversation from a user's perspective is clearly defined as an
> according API will be provided. If the user doesn't call a method like
> "conversation.invalidate()" the conversation won't end.
>
> For example, I'm thinking of creating a configurable artifact that
> manages the lifecycle of a conversation - a so-called
> "ConversationManager". The basic implementation would require the user
> to call the method "manager.startConversation()"
The problem is, that it is hard to ensure having a stopConversation for each startConversation, and what about reloading the page where possibly the startConversation gets called twice.
Another problem ist that not each and every page-flow is triggered by a navigation-handler event, what about get requests - e.g. from the main menu.
Also, what about your search-use-case? If you navigate from the page to the search dialog and came back, you (or, at least I) want to throw away the persistence junk collected through the search-flow. Having just one conversation means you keep tons of entities (and possibly stale data). In contrast, using startConversation from within the search leads you to the same problems (and even more) than you have with Orchestra which forbid you (or, at least it is not best practice) to pass entities between conversations.
> Well, I'm not particularly against named conversations. I'm just saying
> that neither the view nor a Spring bean is responsible for determining
> the name of this conversation, but a special "flow logic" is (and I'm
> still not talking about flow definitions).
Ok, so start with a scope implementation which overrides getConversationName() (or something like that). Couldn't you just plug the logic in there?
The point is, once the bean has been instatiated the persistence context is not allowed to change. What if the bean holds entites as strong reference, if the persistence context changed these objects gets detached (or simply reuse an already closed persistence session)
> For example, in this case I'd prefer to write a NavigationHandler for
> my
See my concerns about get request.
> application that knows how to deal with this usecase. Basically it uses
> the according API to suspend the current conversation and resume the
> according one. Of course, Orchestra could only do that automatically if
> there was something like a flow definition, but I'd prefer to expose an
> API so that the user is able to write such a NavigationHandler on his
> own.
Orchestras API should be open enough to implement any sort of system as long as you proxy your beans to setup the persistence context. You might be able to even hack around that as you could grab the persistence context from the conversation attributes map and bind/unbind it at request start/end as long as you know which conversation to bind to. Probably by using a special named _main conversation.
This should allow you to jump start with your idea and see if it really fits your application needs.
> > Also no user-interaction is required (pause, restart, etc) and no
> > other sort of convention.
>
> Well, of course you could say that this is a burden for the user, but
> it
> comes with great flexibility too (see my master-/detail-view example).
It is not only a burden for the user, it is impossible to ensure from within your application I think (still).
> Simply said, yes that's true, but the flow description doesn't have to
> be an XML flow definition. What I'd like to see, is an Orchestra API
> that allows me to describe my flows programmatically at runtime as this
> is a much more powerful approach for managing conversations.
You can create your own flow implementation on top of orchestra and use a special conversation scope implementation which uses the conversation name "_main" as a fixed string. Then, the only thing you have to deal with is the conversationContext.
If your custom scope avoids creating the conversation if it doesn't exist you even can try to implement the @Create stuff.
I think in Orchestra everything is there to help you developing your ideas without rewriting the core of Orchestra.
Ciao,
Mario
Re: [Orchestra] Drawbacks of Orchestra I'd like to discuss
Posted by Bernhard Huemer <be...@gmail.com>.
Hello,
> The main problem I see with this approach is that you HAVE to use a
> flow definition, else Orchestra has no chance to determine when to end
> a conversation and when to reuse the current one.
Well, no, you don't have to use a flow definition. Managing the
conversation from a user's perspective is clearly defined as an
according API will be provided. If the user doesn't call a method like
"conversation.invalidate()" the conversation won't end.
For example, I'm thinking of creating a configurable artifact that
manages the lifecycle of a conversation - a so-called
"ConversationManager". The basic implementation would require the user
to call the method "manager.startConversation()", i.e. the user would
have to configure the beans so that a ConversationManager will be
injected. However, another ConversationManager could possibly know how
to deal with annotations like @Create or @End. It would be even possible
to configure a special ConversationManager that automatically creates a
new conversation if you try to access it (i.e. just as it is now) and of
course there's the possibility of using a flow definition for that purpose.
> In a web-application, where you have global menues where the user is
> able to "suspend" the current conversation and jump right to the start
> of another one (or resume it) it is hard to find the conversation
> demarcation without a flow description. In fact I tried such thing in
> Orchestra BEFORE I started to go the named-conversation way. Orchestra
> just fits way better with this "free-floating-named-conversations" in
> our application.
Well, I'm not particularly against named conversations. I'm just saying
that neither the view nor a Spring bean is responsible for determining
the name of this conversation, but a special "flow logic" is (and I'm
still not talking about flow definitions).
For example, in this case I'd prefer to write a NavigationHandler for my
application that knows how to deal with this usecase. Basically it uses
the according API to suspend the current conversation and resume the
according one. Of course, Orchestra could only do that automatically if
there was something like a flow definition, but I'd prefer to expose an
API so that the user is able to write such a NavigationHandler on his own.
However, this approach enables you to control conversations in a more
fine-grained way. For example, if you've got a master-/detail-view being
surrounded by global navigation menus, you could use the exposed API so
that you'll resume the conversation for the detail you've choosen
previously if you select it again (of course, assuming that you only
have suspended the conversation, i.e. you've clicked on a global menu
entry before).
> Also no user-interaction is required (pause, restart, etc) and no
> other sort of convention.
Well, of course you could say that this is a burden for the user, but it
comes with great flexibility too (see my master-/detail-view example).
Convenient default implementations could then reduce the complexity
without limitating the user's flexibility.
> For me the single-conversation approach looks like a limitation,
> which to break out requires a flow-description.
Simply said, yes that's true, but the flow description doesn't have to
be an XML flow definition. What I'd like to see, is an Orchestra API
that allows me to describe my flows programmatically at runtime as this
is a much more powerful approach for managing conversations.
regards,
Bernhard
On 10/27/2008 +0100,
Mario Ivankovits <ma...@ops.co.at> wrote:
> Hi!
>
>> Well, basically I'd refactor the ConversationContext so that it's
>> actually the main conversation of Orchestra. The conversation itself is
>> almost independent of Spring (of course, there's still an according
>> implementation of the Scope interface, but it will be implemented way
>> easier). It's possible to nest conversations, i.e. a there's a certain
>> hierarchy of conversations.
>
> The main problem I see with this approach is that you HAVE to use a flow definition, else Orchestra has no chance to determine when to end a conversation and when to reuse the current one.
> In a web-application, where you have global menues where the user is able to "suspend" the current conversation and jump right to the start of another one (or resume it) it is hard to find the conversation demarcation without a flow description. In fact I tried such thing in Orchestra BEFORE I started to go the named-conversation way. Orchestra just fits way better with this "free-floating-named-conversations" in our application.
>
> As far as I know Spring WebFlow is such a system and is able to deal with persistence contexts already.
>
>
>> Each conversation has got it's own lifecycle and therefore it's
>> possible
>> to register so-called "conversation listeners" in order to hook logic
>> into such lifecycle phases.
>
> Some of the events you outlined are already there in Orchestra. Also using Orchestra without persistence at all works great, on a per-scope-configuration basis!
>
>
> Still, the beauty of Orchestra is that it supports use-cases like:
> 1) Doing Order-Processing
> 2) Suspend task 1 and do some different things like, update customers master-data
> 3) Go back to Order-Processing and continue
>
> All this works without a single line of flow-description and by nicely separate the persistence contexts, so the memory of task 2 has been freed while task 1 is stil there.
> Also no user-interaction is required (pause, restart, etc) and no other sort of convention.
>
> On top of THAT we built the flow, so each flow separates even more by still keeping the easy-to-use multiple conversation feature. Where a flow is required (e.g. search-pages) you can use them now.
>
>
> So, it is not only using two conversations during the same render-request, no, it is about using different parallel conversations for different tasks without additional configuration on view level.
> In fact, if one finds a method how Orchestra can determin what is the CURRENT conversation we could get rid of the viewController-scope, but since Orchestra talks about beans and not about views in its innerst, that is hard to find.
>
> For me the single-conversation approach looks like a limitation, which to break out requires a flow-description.
>
> Sorry, at all it is hard for me to see what is better to do it like Spring WebFlow.
>
> Ciao,
> Mario
RE: [Orchestra] Drawbacks of Orchestra I'd like to discuss
Posted by Mario Ivankovits <ma...@ops.co.at>.
Hi!
> Well, basically I'd refactor the ConversationContext so that it's
> actually the main conversation of Orchestra. The conversation itself is
> almost independent of Spring (of course, there's still an according
> implementation of the Scope interface, but it will be implemented way
> easier). It's possible to nest conversations, i.e. a there's a certain
> hierarchy of conversations.
The main problem I see with this approach is that you HAVE to use a flow definition, else Orchestra has no chance to determine when to end a conversation and when to reuse the current one.
In a web-application, where you have global menues where the user is able to "suspend" the current conversation and jump right to the start of another one (or resume it) it is hard to find the conversation demarcation without a flow description. In fact I tried such thing in Orchestra BEFORE I started to go the named-conversation way. Orchestra just fits way better with this "free-floating-named-conversations" in our application.
As far as I know Spring WebFlow is such a system and is able to deal with persistence contexts already.
> Each conversation has got it's own lifecycle and therefore it's
> possible
> to register so-called "conversation listeners" in order to hook logic
> into such lifecycle phases.
Some of the events you outlined are already there in Orchestra. Also using Orchestra without persistence at all works great, on a per-scope-configuration basis!
Still, the beauty of Orchestra is that it supports use-cases like:
1) Doing Order-Processing
2) Suspend task 1 and do some different things like, update customers master-data
3) Go back to Order-Processing and continue
All this works without a single line of flow-description and by nicely separate the persistence contexts, so the memory of task 2 has been freed while task 1 is stil there.
Also no user-interaction is required (pause, restart, etc) and no other sort of convention.
On top of THAT we built the flow, so each flow separates even more by still keeping the easy-to-use multiple conversation feature. Where a flow is required (e.g. search-pages) you can use them now.
So, it is not only using two conversations during the same render-request, no, it is about using different parallel conversations for different tasks without additional configuration on view level.
In fact, if one finds a method how Orchestra can determin what is the CURRENT conversation we could get rid of the viewController-scope, but since Orchestra talks about beans and not about views in its innerst, that is hard to find.
For me the single-conversation approach looks like a limitation, which to break out requires a flow-description.
Sorry, at all it is hard for me to see what is better to do it like Spring WebFlow.
Ciao,
Mario
Re: [Orchestra] Drawbacks of Orchestra I'd like to discuss
Posted by Bernhard Huemer <be...@gmail.com>.
Hello,
> Any new ideas that could improve Orchestra would be great.
> I'm not sure at the moment exactly what this "rewrite"
> would do; what exactly are you proposing?
Well, basically I'd refactor the ConversationContext so that it's
actually the main conversation of Orchestra. The conversation itself is
almost independent of Spring (of course, there's still an according
implementation of the Scope interface, but it will be implemented way
easier). It's possible to nest conversations, i.e. a there's a certain
hierarchy of conversations.
Each conversation has got it's own lifecycle and therefore it's possible
to register so-called "conversation listeners" in order to hook logic
into such lifecycle phases.
- listener.conversationStarted(ConversationEvent event);
This method will be called once a conversation starts as the name
implies. The default implementation requires the user to start
conversations explicitly, for example by calling
"manager.startConversation()" where "manager" is a ConversationManager
that you can inject into your beans (or lookup via an EL-expression).
- listener.conversationResumed(ConversationEvent event);
This method will be called once the user accesses a URL with the
according request parameter of the conversation, i.e. if the user
accesses the URL "http://localhost:8080/something.jsf?conversationId=1".
- listener.conversationSuspended(ConversationEvent event);
This method will be called once such a request as above has been processed.
- listener.conversationEnded(ConversationEvent event);
This method will be called once the user invalidates a conversation.
The following example describes the most obvious usecase:
JpaPersistenceListener
- listener.conversationStarted():
Create the persistence context and put it into the conversation.
- listener.conversationResumed():
Bind the persistence context of the conversation
- listener.conversationSuspended():
Unbind the persistence context of the conversation
- listener.conversationEnded():
Close the persistence context
No additional proxy class is needed in that case and a persistence
context is available to the whole application (you don't have to call
DAO methods through conversation-scoped beans). If you don't persistence
context support, then just don't configure the JpaPersistenceListener.
Those who know Spring Web Flow will think that I'm just proposing to do
it like Spring Web Flow does - and yeah, they're right as I think that's
the way to go. However, there's still the need for a persistence
interceptor as you're still able to use the current conversation model
of Orchestra. The difference is that such conversations will be nested
within the main conversation of Orchestra and not within a
ConversationContext.
In doing so, it's not required to specify the conversation you'd like to
use on your bean definitions, as there's just one conversation: the
current one and Orchestra is responsible for determining that one. Of
course, this approach doesn't allow you to use two different
conversations on the same view, but then you can still use the previous
conversation model of Orchestra.
The SpringSingleConversationScope (or whatever it was called like) was a
start in the right direction, but I think it's wrong to implement a
single conversation-model on a named conversation-model. I'd propose to
do it the other way around.
regards,
Bernhard Huemer
On 10/27/2008 +0100,
Simon Kitching <sk...@apache.org> wrote:
> Hi Bernhard,
>
> It's great to see some design discussion about Orchestra!
>
> Bernhard Huemer schrieb:
>> Hi folks,
>>
>> I've been using Orchestra for a few months now and in doing so I've
>> been questioning some major implementation decisions, to be more
>> specific I really want to discuss if it's really necessary to bind
>> beans to a certain conversation (and therefore also a certein
>> persistence context!). Let me give you some examples:
>>
>>
>> Example 1)
>> I've developed some views for a search dialog that I wanted to use in
>> at least two different conversations. Everything worked fine for the
>> first conversation. The following code listing should give you an idea
>> of the problem.
>>
>> ///
>>
>> view.xhtml
>> <h:inputText value="#{conversationBean.value}" />
>>
>> spring-bean-config.xml
>> <bean id="conversationBean" class="..." scope="conversation.manual"
>> orchestra:conversationName="conversationA" />
>>
>> \\\
>>
>> Maybe some of you have realized my problem by now: The bean somehow
>> depends on the conversation and as the view depends on the bean I
>> can't use it with a different conversation (or at least I'm missing a
>> major feature of Orchestra). :-f
>
> The approach we (Mario & I) use in these kind of situations is to
> deliberately *not* share a conversation between the calling and called
> pages. We pass "input parameters" to the called page (your search
> dialog) and it returns some values. But it doesn't use the conversation
> of the caller. Of course this means that it cannot access the
> persistence context of the caller; in particular it cannot perform
> persistence operations within the persistence context associated with
> the caller. In the case of a "search" type page, that means that the
> search dialog just returns the *key* of the record that the user
> selected and the caller must then load that object again by key. We
> don't find that any major inconvenience.
>
> I actually think this design is an advantage; when a java method calls a
> method on a different class, the called code cannot mess with the
> private members of the caller, and this is *good*. Equally, when a JSF
> view "calls" another, I don't think that allowing the called view to
> mess with the conversation-state of the caller is good. JSF already is
> such a "loose" programming language that we are losing all the benefits
> of a strictly-typed programming language; JSF apps can easily degenerate
> into spaghetti code and I think allowing free access to
> conversation-state from anywhere makes things more dangerous (though
> possibly more convenient in the short term).
>
> Mario's reply mentioned the new "orchestra flow" stuff that I have been
> working on. However that works in the same way, just a little more
> convenient: the called view(s) still run in their own environment
> without access to the caller except for parameters that are explicitly
> passed in. In fact, orchestra-flow isolates things even more strongly as
> the called flow runs not just in a new conversation, but in a completely
> different conversation-context so cannot access existing beans in other
> conversation-contexts at all.
>
> An alternative approach might be for the called view to require some
> kind of "helper" object to be passed to it. You can do this via
> f:setPropertyActionListener in the calling page. The helper object can
> provide methods to do persistence operations, and they will run in
> whatever conversation the helper object is in, regardless of what
> conversation the "called" view's backing bean is in. Of course the
> helper object could be the backing bean for the calling view itself.
> Note that I haven't tried this; however I can't see any reason why it
> wouldn't work.
>> Example 2)
>> In a different part of the same application I've created a view that
>> should serve for three different usecases. Basically the view doesn't
>> change for these usecases at all, but the logic of the backing bean
>> does. My first approach was to determine the specific page bean at
>> runtime in the action method that navigates to this view. This action
>> method was supposed to register the specific page bean under a common
>> name. So somehow it can be said that I wanted to use "polymorphic beans".
>>
>> ///
>>
>> public String action() {
>> Conversation conversation = getCurrentConversation();
>>
>> switch (criterium) {
>> case CASE_A:
>> conversation.setAttribute("commonBean", specificBeanA);
>> break;
>>
>> case CASE_B:
>> conversation.setAttribute("commonBean", specificBeanB);
>> break;
>>
>> case CASE_C:
>> conversation.setAttribute("commonBean", specificBeanC);
>> break;
>>
>> default:
>> throw new IllegalStateException(); // shouldn't occur anway
>> }
>>
>> return outcome;
>> }
>>
>> view.xhtml
>> <h:commandButton action="#{commonBean.save}" />
>>
>> \\\
>>
>> However, that wouldn't work for two reasons:
>> - Orchestra only knows how to resolve Spring beans as the bean
>> definition determines the conversation being used (well, Orchestra
>> doesn't know how to resolve anything, actually it's the
>> EL-/VariableResolver of Spring that does this job in this case). It's
>> only possible to resolve such variables if the view knows which
>> conversation it should access (i.e. if one would develop a custom
>> ELResolver that knows how to resolve expressions like
>> #{conversation.conversationA.commonBean} - *cough* problem of the
>> first example *cough*).
>> - Orchestra wouldn't create a persistence context for that bean as
>> the persistence interceptor only gets attached to Spring beans. (No,
>> I'm not telling you to modify the setAttribute method so that advices
>> will be attached. I'm rather telling you to use conversation listeners
>> instead for persistence support, just like Web Flow does).
>
> The "bean name" is just a label that then somehow retrieves an
> appropriate bean. But a single label can only convey one piece of
> information. You want to specify two pieces of information:
> (a) which bean to use
> (b) which conversation to associate it with
> I just cannot see how one name can imply two things.
>
> Could you please explain what you mean by "conversation listeners"? I
> don't know what you mean here, but am very interested..
>
>> I was able to work around this issue by introducing an additional
>> indirection, i.e. I'm resolving that bean with the expression
>> #{pageAccessor['commonBean']}, but that's just not intuitional.
> Agreed. But this is then using *two* labels to specify *two* values: the
> first label (pageAccessor) provides information about which conversation
> and the second label (commonBean) specifies which bean. You clearly want
> to flatten this down to a single label that expresses both pieces of
> information but I can't currently see how you propose to do that...
>>
>>
>> However, please don't get me wrong. I don't want to hear anything
>> about certain workarounds that I could have used in these cases as I
>> think that these usecases aren't exceptional enough to justify
>> workarounds. Of course, the current approach has got its advantages
>> too (e.g. switching arbitrarily between different conversations as
>> there is no hierarchical structure), but at least I haven't needed
>> this feature yet.
>>
>> Summarizing it can be stated that I'd propose you to rewrite
>> conversation handling for the next major release and I'd be willing to
>> contribute. Note that I don't want to drop support for these "named
>> conversations", but I think that this usecase is not the default one
>> for conversations.
> Any new ideas that could improve Orchestra would be great. I'm not sure
> at the moment exactly what this "rewrite" would do; what exactly are you
> proposing?
>
> Regards,
> Simon
>
>
Re: [Orchestra] Drawbacks of Orchestra I'd like to discuss
Posted by Simon Kitching <sk...@apache.org>.
Hi Bernhard,
It's great to see some design discussion about Orchestra!
Bernhard Huemer schrieb:
> Hi folks,
>
> I've been using Orchestra for a few months now and in doing so I've
> been questioning some major implementation decisions, to be more
> specific I really want to discuss if it's really necessary to bind
> beans to a certain conversation (and therefore also a certein
> persistence context!). Let me give you some examples:
>
>
> Example 1)
> I've developed some views for a search dialog that I wanted to use in
> at least two different conversations. Everything worked fine for the
> first conversation. The following code listing should give you an idea
> of the problem.
>
> ///
>
> view.xhtml
> <h:inputText value="#{conversationBean.value}" />
>
> spring-bean-config.xml
> <bean id="conversationBean" class="..." scope="conversation.manual"
> orchestra:conversationName="conversationA" />
>
> \\\
>
> Maybe some of you have realized my problem by now: The bean somehow
> depends on the conversation and as the view depends on the bean I
> can't use it with a different conversation (or at least I'm missing a
> major feature of Orchestra). :-f
The approach we (Mario & I) use in these kind of situations is to
deliberately *not* share a conversation between the calling and called
pages. We pass "input parameters" to the called page (your search
dialog) and it returns some values. But it doesn't use the conversation
of the caller. Of course this means that it cannot access the
persistence context of the caller; in particular it cannot perform
persistence operations within the persistence context associated with
the caller. In the case of a "search" type page, that means that the
search dialog just returns the *key* of the record that the user
selected and the caller must then load that object again by key. We
don't find that any major inconvenience.
I actually think this design is an advantage; when a java method calls a
method on a different class, the called code cannot mess with the
private members of the caller, and this is *good*. Equally, when a JSF
view "calls" another, I don't think that allowing the called view to
mess with the conversation-state of the caller is good. JSF already is
such a "loose" programming language that we are losing all the benefits
of a strictly-typed programming language; JSF apps can easily degenerate
into spaghetti code and I think allowing free access to
conversation-state from anywhere makes things more dangerous (though
possibly more convenient in the short term).
Mario's reply mentioned the new "orchestra flow" stuff that I have been
working on. However that works in the same way, just a little more
convenient: the called view(s) still run in their own environment
without access to the caller except for parameters that are explicitly
passed in. In fact, orchestra-flow isolates things even more strongly as
the called flow runs not just in a new conversation, but in a completely
different conversation-context so cannot access existing beans in other
conversation-contexts at all.
An alternative approach might be for the called view to require some
kind of "helper" object to be passed to it. You can do this via
f:setPropertyActionListener in the calling page. The helper object can
provide methods to do persistence operations, and they will run in
whatever conversation the helper object is in, regardless of what
conversation the "called" view's backing bean is in. Of course the
helper object could be the backing bean for the calling view itself.
Note that I haven't tried this; however I can't see any reason why it
wouldn't work.
>
> Example 2)
> In a different part of the same application I've created a view that
> should serve for three different usecases. Basically the view doesn't
> change for these usecases at all, but the logic of the backing bean
> does. My first approach was to determine the specific page bean at
> runtime in the action method that navigates to this view. This action
> method was supposed to register the specific page bean under a common
> name. So somehow it can be said that I wanted to use "polymorphic beans".
>
> ///
>
> public String action() {
> Conversation conversation = getCurrentConversation();
>
> switch (criterium) {
> case CASE_A:
> conversation.setAttribute("commonBean", specificBeanA);
> break;
>
> case CASE_B:
> conversation.setAttribute("commonBean", specificBeanB);
> break;
>
> case CASE_C:
> conversation.setAttribute("commonBean", specificBeanC);
> break;
>
> default:
> throw new IllegalStateException(); // shouldn't occur anway
> }
>
> return outcome;
> }
>
> view.xhtml
> <h:commandButton action="#{commonBean.save}" />
>
> \\\
>
> However, that wouldn't work for two reasons:
> - Orchestra only knows how to resolve Spring beans as the bean
> definition determines the conversation being used (well, Orchestra
> doesn't know how to resolve anything, actually it's the
> EL-/VariableResolver of Spring that does this job in this case). It's
> only possible to resolve such variables if the view knows which
> conversation it should access (i.e. if one would develop a custom
> ELResolver that knows how to resolve expressions like
> #{conversation.conversationA.commonBean} - *cough* problem of the
> first example *cough*).
> - Orchestra wouldn't create a persistence context for that bean as
> the persistence interceptor only gets attached to Spring beans. (No,
> I'm not telling you to modify the setAttribute method so that advices
> will be attached. I'm rather telling you to use conversation listeners
> instead for persistence support, just like Web Flow does).
The "bean name" is just a label that then somehow retrieves an
appropriate bean. But a single label can only convey one piece of
information. You want to specify two pieces of information:
(a) which bean to use
(b) which conversation to associate it with
I just cannot see how one name can imply two things.
Could you please explain what you mean by "conversation listeners"? I
don't know what you mean here, but am very interested..
>
> I was able to work around this issue by introducing an additional
> indirection, i.e. I'm resolving that bean with the expression
> #{pageAccessor['commonBean']}, but that's just not intuitional.
Agreed. But this is then using *two* labels to specify *two* values: the
first label (pageAccessor) provides information about which conversation
and the second label (commonBean) specifies which bean. You clearly want
to flatten this down to a single label that expresses both pieces of
information but I can't currently see how you propose to do that...
>
>
>
> However, please don't get me wrong. I don't want to hear anything
> about certain workarounds that I could have used in these cases as I
> think that these usecases aren't exceptional enough to justify
> workarounds. Of course, the current approach has got its advantages
> too (e.g. switching arbitrarily between different conversations as
> there is no hierarchical structure), but at least I haven't needed
> this feature yet.
>
> Summarizing it can be stated that I'd propose you to rewrite
> conversation handling for the next major release and I'd be willing to
> contribute. Note that I don't want to drop support for these "named
> conversations", but I think that this usecase is not the default one
> for conversations.
Any new ideas that could improve Orchestra would be great. I'm not sure
at the moment exactly what this "rewrite" would do; what exactly are you
proposing?
Regards,
Simon
Re: [Orchestra] Drawbacks of Orchestra I'd like to discuss
Posted by Simon Kitching <sk...@apache.org>.
Link [1] is obsolete; it is there only for historical purposes.
Link [2] is mostly up-to-date. There have been a few changes to the code
that are not reflected here, but it is 95% correct and certainly good
enough for a general understanding of orchestra-flow.
Regards,
Simon
Gerhard Petracek schrieb:
> hello,
>
> are the wiki pages [1] and [2] up-to-date?
>
> regards,
> gerhard
>
> [1] http://wiki.apache.org/myfaces/OrchestraDialogPageFlowDesign1
> [2] http://wiki.apache.org/myfaces/OrchestraDialogPageFlowDesign2
>
Re: [Orchestra] Drawbacks of Orchestra I'd like to discuss
Posted by Gerhard Petracek <ge...@gmail.com>.
hello,
are the wiki pages [1] and [2] up-to-date?
regards,
gerhard
[1] http://wiki.apache.org/myfaces/OrchestraDialogPageFlowDesign1
[2] http://wiki.apache.org/myfaces/OrchestraDialogPageFlowDesign2
2008/10/27 Mario Ivankovits <ma...@ops.co.at>
> Hi!
>
> > Example 1)
> > I've developed some views for a search dialog that I wanted to use in
> > at
> > least two different conversations. Everything worked fine for the first
> > conversation. The following code listing should give you an idea of the
> > problem.
>
> Simon developed Orchestra Flow which might solve this problem as it creates
> an all new conversation context for this flow and thus can reuse the
> conversation setup.
> Simon is still working on it to make it work with our latest requirements,
> but it should work for many use-cases already. I am not sure if there is a
> detailed documentation already.
>
>
> > Example 2)
> > In a different part of the same application I've created a view that
> > should serve for three different usecases. Basically the view doesn't
> > change for these usecases at all, but the logic of the backing bean
> > does. My first approach was to determine the specific page bean at
> > runtime in the action method that navigates to this view. This action
> > method was supposed to register the specific page bean under a common
> > name. So somehow it can be said that I wanted to use "polymorphic
> > beans".
>
> You might treat it as "workaround" (which you don't want to hear), but the
> latest Orchestra provides the method
> convObject = ConversationUtils.bindToCurrent(object)
> which allows you to attach all the aspects to any bean you'd like to.
> Allowing to use that from within the spring configuration is on our todo
> list.
>
>
> > I don't want to hear anything about
> > certain workarounds that I could have used in these cases as I think
> > that these usecases aren't exceptional enough to justify workarounds.
>
> It is hard to know what you treat as workaround and what we treat as "by
> design" ;-)
> However, the missing flow part is nearly there and already usable.
>
>
> > Summarizing it can be stated that I'd propose you to rewrite
> > conversation handling for the next major release and I'd be willing to
> > contribute. Note that I don't want to drop support for these "named
> > conversations", but I think that this usecase is not the default one
> > for
> > conversations.
>
> I know from the past that you would like to rewrite this stuff, but I've
> never seen a proposal what exactly and how.
> Don't get me wrong, but if you'd like to make the "naming-conversation-way"
> optional you need another way how to deal with the persistence context.
> Orchestra IS different to Seam here and probably different to Webflow.
>
> If the naming-conversations are exceptional ... I don't know, we use it
> heavily, and now with Orchestra Flow the last missing bit has been developed
> and Orchestra fits VERY nicely within our application. Probably how we built
> our application is exceptional (for the good and the bad ;-) )
>
>
> Well, now with Orchestra Flow it might be possible to reach what you want.
> If I understood that right.
> You'd like to have a single conversation active for the request instead for
> a bean. So, creating a SingleConversationScope, this scope then should hold
> the persistence context in the conversationContext and bind/unbind it on
> request start/end.
> Different conversations then are only possible by utilizing Orchestra Flow.
> How parallel running conversations should work in such a setup, I don't know
> yet ...
>
> Ciao,
> Mario
>
--
http://www.irian.at
Your JSF powerhouse -
JSF Consulting, Development and
Courses in English and German
Professional Support for Apache MyFaces
Re: [Orchestra] Drawbacks of Orchestra I'd like to discuss
Posted by Simon Kitching <sk...@apache.org>.
Mario Ivankovits schrieb:
> Hi!
>
>
>>>> Example 1)
>>>> I've developed some views for a search dialog that I wanted to use in at
>>>> least two different conversations. Everything worked fine for the first
>>>> conversation. The following code listing should give you an idea of the
>>>> problem.
>>>>
>
>
>> However (as noted in my other email) flow won't solve this issue. In
>> fact it sets up even more strict isolation between caller and called
>> views - deliberately. The called view cannot access any
>> conversation-scoped data except its own - and whatever parameters it
>> gets explicitly passed.
>>
>
> I thought Bernhard is searching a way how to do solve this problem, and Orchestra Flow clearly shows how to solve the search-flow-use-case without having to build your own parameter passing framework.
> For me it was clear that passing entities between conversations is a no-go; as with any framework which allows multiple persistence context.
>
Agreed. The possible solutions for this kind of "shared search dialog" are:
(a) have the backing bean for the search dialog run in the same
persistence context as the caller (Berhhard's proposal)
(b) have the persistence contexts completely separated, and just pass
*keys* between the caller and called views
(the approach that we currently use at OPS)
(c) have the caller pass a "helper" object to the called view. The
called view's backing bean then runs in its own persistence context, but
methods invoked on the helper can run in the caller's persistence
context (or anything else the caller sets up).
* Option (a) is currently not supported by Orchestra core. We have
considered it before, but I'm not at all sure it is the right approach.
It is convenient in the short term, but IMO leads fairly directly to
hard-to-maintain code. And I'm not sure how it could be implemented either..
* Option (b) works and is reasonable.
* Option (c) hasn't been tried anywhere AFAIK, but also seems reasonable.
Orchestra-flow just builds on orchestra-core, so doesn't support (a)
either. It does make implementing (b) and (c) easier but doesn't change
the orchestra-core fundamental design.
>>>> Example 2)
>>>> In a different part of the same application I've created a view that
>>>> should serve for three different usecases. Basically the view
>>>> doesn't
>>>>
>
>
>>> You might treat it as "workaround" (which you don't want to hear),
>>> but the latest Orchestra provides the method
>>> convObject = ConversationUtils.bindToCurrent(object)
>>> which allows you to attach all the aspects to any bean you'd like to.
>>> Allowing to use that from within the spring configuration is on our
>>> todo list.
>>>
>
>
>
>> I'm not sure how the new Conversationutils.bindToCurrent would help
>> here..
>>
>
> In your main bean you can have this switch/case to create the bean and put it into a specific conversation, your main bean then provides a method like getImplementation.
> In your view then you write #{mainBean.implementation.xyz}.
>
I think this is the same as the solution Bernhard described in his
original email, but that he didn't like, ie the
"#{pageAccessor['commonBean']}" approach. IMO this approach is quite
reasonable. I would personally write the EL expression as
#{myview.helper.x} or #{myview.impl.x}. Or just write some delegation
methods on the backing bean, so that myview.x always just passes the
call on to its helper object.
Note that the "helper" instance should be bound to the appropriate
conversation by using ConversationUtils.bindToCurrent(), so that all
methods on it run in the appropriate conversation scope.
There is another ugly solution: rather than trying to put the backing
bean into the conversation as an attribute, instead put it into
session-scope. It will be found there before any attempt to locate a
spring bean occurs. It's not very nice though; the most significant
problem is that the bean needs to be explicitly removed from
session-scope at some time.
>
>
>> The SingleConversationScope class was recently deleted from Orchestra -
>> as discussed on the list. Partly because there did not seem to be any
>> use-case that it was useful for.
>>
>> We can resurrect it if such a use-case is found. But I don't understand
>> the above description...how exactly does it solve the two issues that
>> Bernhard had?
>>
>
> >From discussions in the past with Bernhard I got the feeling that he don't like the "multiple-conversations per request" approach. Which forced us to create something like the view-controller scope, however, I still see no way around that. Having the "request" conversation defined by the view controller is the best we can do I think.
>
Ok, I see. BTW, I'm not a great fan of the "view controller scope",
although I have to admit I don't see a better solution at the moment.
Cheers,
Simon
--
-- Emails in "mixed" posting style will be ignored
-- (http://en.wikipedia.org/wiki/Posting_style)
Re: [Orchestra] Drawbacks of Orchestra I'd like to discuss
Posted by Mario Ivankovits <ma...@ops.co.at>.
Hi!
> >> Example 1)
> >> I've developed some views for a search dialog that I wanted to use in at
> >> least two different conversations. Everything worked fine for the first
> >> conversation. The following code listing should give you an idea of the
> >> problem.
> However (as noted in my other email) flow won't solve this issue. In
> fact it sets up even more strict isolation between caller and called
> views - deliberately. The called view cannot access any
> conversation-scoped data except its own - and whatever parameters it
> gets explicitly passed.
I thought Bernhard is searching a way how to do solve this problem, and Orchestra Flow clearly shows how to solve the search-flow-use-case without having to build your own parameter passing framework.
For me it was clear that passing entities between conversations is a no-go; as with any framework which allows multiple persistence context.
> >> Example 2)
> >> In a different part of the same application I've created a view that
> >> should serve for three different usecases. Basically the view
> >> doesn't
> > You might treat it as "workaround" (which you don't want to hear),
> > but the latest Orchestra provides the method
> > convObject = ConversationUtils.bindToCurrent(object)
> > which allows you to attach all the aspects to any bean you'd like to.
> > Allowing to use that from within the spring configuration is on our
> > todo list.
> I'm not sure how the new Conversationutils.bindToCurrent would help
> here..
In your main bean you can have this switch/case to create the bean and put it into a specific conversation, your main bean then provides a method like getImplementation.
In your view then you write #{mainBean.implementation.xyz}.
> The SingleConversationScope class was recently deleted from Orchestra -
> as discussed on the list. Partly because there did not seem to be any
> use-case that it was useful for.
>
> We can resurrect it if such a use-case is found. But I don't understand
> the above description...how exactly does it solve the two issues that
> Bernhard had?
>From discussions in the past with Bernhard I got the feeling that he don't like the "multiple-conversations per request" approach. Which forced us to create something like the view-controller scope, however, I still see no way around that. Having the "request" conversation defined by the view controller is the best we can do I think.
Ciao,
Mario
Re: AW: [Orchestra] Drawbacks of Orchestra I'd like to discuss
Posted by Simon Kitching <sk...@apache.org>.
Mario Ivankovits schrieb:
> Hi!
>
>
>> Example 1)
>> I've developed some views for a search dialog that I wanted to use in
>> at
>> least two different conversations. Everything worked fine for the first
>> conversation. The following code listing should give you an idea of the
>> problem.
>>
>
> Simon developed Orchestra Flow which might solve this problem as it creates an all new conversation context for this flow and thus can reuse the conversation setup.
> Simon is still working on it to make it work with our latest requirements, but it should work for many use-cases already. I am not sure if there is a detailed documentation already.
>
Documentation is partially there, on the website and on the wiki. But as
the code is changing rapidly the docs are lagging somewhat behind.
However I think it likely that that things will stabilise into their
final form during this week.
However (as noted in my other email) flow won't solve this issue. In
fact it sets up even more strict isolation between caller and called
views - deliberately. The called view cannot access any
conversation-scoped data except its own - and whatever parameters it
gets explicitly passed.
Of course it is possible to pass as a parameter a "helper" object that
*can* access conversation-scope elsewhere. But that is also possible to
do without using orchestra-flow.
>
>
>> Example 2)
>> In a different part of the same application I've created a view that
>> should serve for three different usecases. Basically the view doesn't
>> change for these usecases at all, but the logic of the backing bean
>> does. My first approach was to determine the specific page bean at
>> runtime in the action method that navigates to this view. This action
>> method was supposed to register the specific page bean under a common
>> name. So somehow it can be said that I wanted to use "polymorphic
>> beans".
>>
>
> You might treat it as "workaround" (which you don't want to hear), but the latest Orchestra provides the method
> convObject = ConversationUtils.bindToCurrent(object)
> which allows you to attach all the aspects to any bean you'd like to.
> Allowing to use that from within the spring configuration is on our todo list.
>
I'm not sure how the new Conversationutils.bindToCurrent would help here..
It is very useful when a conversation-scoped backing bean wants to pass
one of its member objects to some other object. But I don't see how it
applies to this caller/callee situation.
>
>
> Well, now with Orchestra Flow it might be possible to reach what you want. If I understood that right.
> You'd like to have a single conversation active for the request instead for a bean. So, creating a SingleConversationScope, this scope then should hold the persistence context in the conversationContext and bind/unbind it on request start/end.
> Different conversations then are only possible by utilizing Orchestra Flow. How parallel running conversations should work in such a setup, I don't know yet ...
>
The SingleConversationScope class was recently deleted from Orchestra -
as discussed on the list. Partly because there did not seem to be any
use-case that it was useful for.
We can resurrect it if such a use-case is found. But I don't understand
the above description...how exactly does it solve the two issues that
Bernhard had?
Regards,
Simon
AW: [Orchestra] Drawbacks of Orchestra I'd like to discuss
Posted by Mario Ivankovits <ma...@ops.co.at>.
Hi!
> Example 1)
> I've developed some views for a search dialog that I wanted to use in
> at
> least two different conversations. Everything worked fine for the first
> conversation. The following code listing should give you an idea of the
> problem.
Simon developed Orchestra Flow which might solve this problem as it creates an all new conversation context for this flow and thus can reuse the conversation setup.
Simon is still working on it to make it work with our latest requirements, but it should work for many use-cases already. I am not sure if there is a detailed documentation already.
> Example 2)
> In a different part of the same application I've created a view that
> should serve for three different usecases. Basically the view doesn't
> change for these usecases at all, but the logic of the backing bean
> does. My first approach was to determine the specific page bean at
> runtime in the action method that navigates to this view. This action
> method was supposed to register the specific page bean under a common
> name. So somehow it can be said that I wanted to use "polymorphic
> beans".
You might treat it as "workaround" (which you don't want to hear), but the latest Orchestra provides the method
convObject = ConversationUtils.bindToCurrent(object)
which allows you to attach all the aspects to any bean you'd like to.
Allowing to use that from within the spring configuration is on our todo list.
> I don't want to hear anything about
> certain workarounds that I could have used in these cases as I think
> that these usecases aren't exceptional enough to justify workarounds.
It is hard to know what you treat as workaround and what we treat as "by design" ;-)
However, the missing flow part is nearly there and already usable.
> Summarizing it can be stated that I'd propose you to rewrite
> conversation handling for the next major release and I'd be willing to
> contribute. Note that I don't want to drop support for these "named
> conversations", but I think that this usecase is not the default one
> for
> conversations.
I know from the past that you would like to rewrite this stuff, but I've never seen a proposal what exactly and how.
Don't get me wrong, but if you'd like to make the "naming-conversation-way" optional you need another way how to deal with the persistence context.
Orchestra IS different to Seam here and probably different to Webflow.
If the naming-conversations are exceptional ... I don't know, we use it heavily, and now with Orchestra Flow the last missing bit has been developed and Orchestra fits VERY nicely within our application. Probably how we built our application is exceptional (for the good and the bad ;-) )
Well, now with Orchestra Flow it might be possible to reach what you want. If I understood that right.
You'd like to have a single conversation active for the request instead for a bean. So, creating a SingleConversationScope, this scope then should hold the persistence context in the conversationContext and bind/unbind it on request start/end.
Different conversations then are only possible by utilizing Orchestra Flow. How parallel running conversations should work in such a setup, I don't know yet ...
Ciao,
Mario