-
1. Re: @Observer annotation should have a scope attribute
pmuir Nov 16, 2007 1:28 PM (in response to dhinojosa)Can you elaborate on the sematics of putting scope onto @Observer?
-
2. Re: @Observer annotation should have a scope attribute
pmuir Nov 16, 2007 1:31 PM (in response to dhinojosa)semantics I meant :) i.e. how would this affect the behaviour of the annotation.
-
3. Re: @Observer annotation should have a scope attribute
dhinojosa Nov 16, 2007 1:38 PM (in response to dhinojosa)Well in the above code snippet, the process method would run when the employee variable is set in the conversation only, and not in any other context.
The motivation behind this would be so that a developer can choose which component AND context to listen to, in case there are two different components with the same name but in different contexts. -
4. Re: @Observer annotation should have a scope attribute
monkeyden Nov 16, 2007 3:09 PM (in response to dhinojosa)This example doesn't know anything about an employee. It just knows the event which it is observing. Seems to me that this shouldn't be a feature of Seam, or the Observer, at all. It's part of your granular business logic.
-
5. Re: @Observer annotation should have a scope attribute
dhinojosa Nov 16, 2007 3:30 PM (in response to dhinojosa)To: MonkeyDen....
#{employee}
is a component that I "created", for this example. and
@Observer("org.jboss.seam.postSetVariable.employee", scope=ScopeType.CONVERSATION)
is a method annotation in another component that is observing when that variable is set. (see 5.1.3. Contextual events), so it is already a feature of Seam. I just want to specify from what context. -
6. Re: @Observer annotation should have a scope attribute
monkeyden Nov 16, 2007 3:48 PM (in response to dhinojosa)http://docs.jboss.com/seam/1.2.0.GA/reference/en/html/events.html#d0e3940
5.1.3. Contextual events
org.jboss.seam.preSetVariable. - called when the context variable is set -
7. Re: @Observer annotation should have a scope attribute
dhinojosa Nov 16, 2007 4:18 PM (in response to dhinojosa)Yep. Of course there are more with 2.0.0.GA
http://docs.jboss.com/seam/2.0.0.GA/reference/en/html/events.html#d0e4140
The observation I am using though is:
org.jboss.seam.postSetVariable.name-- called when the context variable <name> is set
where name in my example is 'employee'. All I am asking is to have the ability to specify context AND variable. Currently, you can only have the name of the variable, which is why I am asking for :@Observer("org.jboss.seam.postSetVariable.employee", scope=ScopeType.CONVERSATION)
-
8. Re: @Observer annotation should have a scope attribute
pmuir Nov 17, 2007 10:20 AM (in response to dhinojosa)I can see the use case for
@Observer("org.jboss.seam.postSetVariable.conversation.employee")
or similar, but not for events in general. -
9. Re: @Observer annotation should have a scope attribute
dhinojosa Nov 17, 2007 11:58 AM (in response to dhinojosa)@Observer("org.jboss.seam.postSetVariable.conversation.employee")
Is that feature available now? or was that just your suggestion? -
10. Re: @Observer annotation should have a scope attribute
pmuir Nov 17, 2007 12:01 PM (in response to dhinojosa)Suggestion - does it meet your requirements?
-
11. Re: @Observer annotation should have a scope attribute
dhinojosa Nov 17, 2007 12:22 PM (in response to dhinojosa)Looks easy....
Just wondering wouldn't that make it an inconsistent look and feel from the way we have other annotations in seam like...@Factory(value="pattern", scope=ScopeType.EVENT) public String getSearchPattern() { return searchString==null ? "%" : '%' + searchString.toLowerCase().replace('*', '%') + '%'; }
Or is the idea that any annotation that has scope=* is meant purely to map components not to listen to them or provide any other behaviors. -
12. Re: @Observer annotation should have a scope attribute
pmuir Nov 17, 2007 12:32 PM (in response to dhinojosa)I'm not sure specifying the scope to listen on for events is generally useful (yes, its useful to be able to know which scope a variable was set in, but thats a specific case, not general).