-
1. Re: What about qualifying a conversation?
nickarls Nov 19, 2009 12:54 PM (in response to agori)I don't quite follow. Are you talking about Specialization? Or are you referring to filtering the stuff in the conversation scope somehow?
-
2. Re: What about qualifying a conversation?
agori Nov 19, 2009 2:37 PM (in response to agori)Yes specialization.
One conversation should inject ABean, another conversation could inject BBean, another one CBean, depending on some parameter I pass to the conversation.If a Facelets page is under the first conversation and I code:
#{bean}
Expression Language should return an instanceof of type ABean. Do you understand?
This is the API I have in mind, but it could be achievable in some other way that I don't know...
-
3. Re: What about qualifying a conversation?
gavin.king Nov 19, 2009 8:53 PM (in response to agori)It sounds a bit like the
activities
stuff we had in older drafts of the CDI spec (which was removed). It sounds like you want a set of bean definitions that are local to a certain business task or process. Weld does not support this, however, you can localize bean definitions to a certain module. I would say that is your best bet, if I'm understanding your requirements correctly. Put eachtask
orprocess
in its own jar. -
4. Re: What about qualifying a conversation?
nickarls Nov 19, 2009 9:06 PM (in response to agori)Is the activity-stuff going away from Weld, too, or is there some use for it?
-
5. Re: What about qualifying a conversation?
gavin.king Nov 19, 2009 9:58 PM (in response to agori)Does Weld actually implement that stuff?? I didn't know...
Yes, it's useful. It could easily find it's way back into CDI 1.1.
-
6. Re: What about qualifying a conversation?
nickarls Nov 20, 2009 8:05 AM (in response to agori)I don't know if it's functional/used, just noticed some references to it in BeanManager. And since most other obsolete stuff has been cleaned out, I assumed it's there for a reason...
-
7. Re: What about qualifying a conversation?
agori Nov 20, 2009 9:23 AM (in response to agori)I don't know what is an
activity
in CDI. Anyway modularization in different jar or packages doesn't fit well in my situation.
I could explain with a use case. We have a web application for insurances. User login, then:- select an insurance product, named
prod1
. - WELD start a conversation, the main bean is ProductBean
- ProductBean cooperate with interface Service. Every Service implementation should has the same name, because product.xhtml references the bean: #{myService}
Ok, here developer coded two Service implementation: Prod1ServiceBean, and Prod2ServiceBean.
If user selectedprod1
then WELD should inject Prod1ServiceBean into ProductBean. Ifprod2
was selected WELD should inject Prod2ServiceBean...It's like deciding injection rules at runtime.
- select an insurance product, named
-
8. Re: What about qualifying a conversation?
nickarls Nov 20, 2009 9:59 AM (in response to agori)Sounds like a job for @Produces?
@Inject @Any Instance<ProdService> allProdServices; @Produces @ConversationScoped ProdService getProdService() { if (reallyComplexlogic) { return allProdServices.selectStuff; } else { return allProdServices.selectOtherStuff; } }
scoping may wary depending on where the choise is made. For mid-conversation changes, you might even want to work directly with the InstanceBean...
-
9. Re: What about qualifying a conversation?
agori Nov 20, 2009 10:12 AM (in response to agori)Yes thanks, after explosing clearly the problem I realized too that it could be job for @Produces ;).
-
10. Re: What about qualifying a conversation?
nickarls Nov 20, 2009 1:39 PM (in response to agori)Speaking of obsolete stuff, is the concept of
policy
also something of the past? There are plenty of refs around in the code but I didn't find anything in the specs -
11. Re: What about qualifying a conversation?
nickarls Nov 20, 2009 2:15 PM (in response to agori)Nevermind, seems to be alternatives
-
12. Re: What about qualifying a conversation?
pmuir Dec 15, 2009 6:51 PM (in response to agori)
Nicklas Karlsson wrote on Nov 20, 2009 08:05:
I don't know if it's functional/used, just noticed some references to it in BeanManager. And since most other obsolete stuff has been cleaned out, I assumed it's there for a reason...Yup, Gavin told me to keep it in as IBM wanted it :-)