[JBoss JIRA] (CDI-271) Provide a way to inject Event metadata into an observer method
by Mark Struberg (JIRA)
[ https://issues.jboss.org/browse/CDI-271?page=com.atlassian.jira.plugin.sy... ]
Mark Struberg commented on CDI-271:
-----------------------------------
Well, this is the same like with ProducerMethods which have an InjectionPoint but only got triggered by BeanManager#getReference(), right?
> Provide a way to inject Event metadata into an observer method
> --------------------------------------------------------------
>
> Key: CDI-271
> URL: https://issues.jboss.org/browse/CDI-271
> Project: CDI Specification Issues
> Issue Type: Feature Request
> Components: Events
> Reporter: Arne Limburg
> Assignee: Arne Limburg
> Fix For: 1.1.PFD
>
>
> Currently there is no way for observer methods to access the qualifiers of the fired event (i.e. to access @Nonbinding members).
> Consider the following example:
> {code}
> @Inject @MyQualifier
> Event<MyObject> event;
> public void fireEvent(MyObject object, MyTypeValue type) {
> event.select(new MyTypeAnnotationLiteral(type)).fire(object);
> }
> {code}
> Currently no observer can receive the value of MyTypeValue. I suggest to introduce an interface AnnotatedEvent that extends Annotated and contains this information. It then could be injected via the InjectionPoint like this:
> {code}
> public void observeEvent(@Observes @MyType MyObject object, InjectionPoint ip) {
> MyType annotation = ip.getAnnotated().getAnnotation(MyType.class);
> MyTypeValue value = annotation.value();
> ...
> }
> {code}
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
11 years, 10 months
[JBoss JIRA] (CDI-271) Provide a way to inject Event metadata into an observer method
by Jozef Hartinger (JIRA)
[ https://issues.jboss.org/browse/CDI-271?page=com.atlassian.jira.plugin.sy... ]
Jozef Hartinger reopened CDI-271:
---------------------------------
What happens when an observer defines an InjectionPoint parameter but the event was fired using BeanManager instead of Event? The spec does not currently seem to define this.
> Provide a way to inject Event metadata into an observer method
> --------------------------------------------------------------
>
> Key: CDI-271
> URL: https://issues.jboss.org/browse/CDI-271
> Project: CDI Specification Issues
> Issue Type: Feature Request
> Components: Events
> Reporter: Arne Limburg
> Assignee: Arne Limburg
> Fix For: 1.1.PFD
>
>
> Currently there is no way for observer methods to access the qualifiers of the fired event (i.e. to access @Nonbinding members).
> Consider the following example:
> {code}
> @Inject @MyQualifier
> Event<MyObject> event;
> public void fireEvent(MyObject object, MyTypeValue type) {
> event.select(new MyTypeAnnotationLiteral(type)).fire(object);
> }
> {code}
> Currently no observer can receive the value of MyTypeValue. I suggest to introduce an interface AnnotatedEvent that extends Annotated and contains this information. It then could be injected via the InjectionPoint like this:
> {code}
> public void observeEvent(@Observes @MyType MyObject object, InjectionPoint ip) {
> MyType annotation = ip.getAnnotated().getAnnotation(MyType.class);
> MyTypeValue value = annotation.value();
> ...
> }
> {code}
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
11 years, 10 months
[JBoss JIRA] (CDI-304) Clarify Producers for injection into generic types
by Pete Muir (JIRA)
[ https://issues.jboss.org/browse/CDI-304?page=com.atlassian.jira.plugin.sy... ]
Pete Muir commented on CDI-304:
-------------------------------
I thought about this, and you do get an error in the source code, so that is enough to be required.
> Clarify Producers for injection into generic types
> --------------------------------------------------
>
> Key: CDI-304
> URL: https://issues.jboss.org/browse/CDI-304
> Project: CDI Specification Issues
> Issue Type: Clarification
> Components: Beans
> Affects Versions: 1.1.PRD
> Reporter: Mark Struberg
> Assignee: Pete Muir
> Fix For: 1.1.PFD
>
>
> There is a discussion over in DeltaSpike whether an injection point
> {code}
> @Inject
> private JsfMessage<SomeMessageClass>;
> {code}
> with a producer method
> {code}
> @Produces @Dependent
> JsfMessage createMessage(InjectionPoint ip)
> {code}
> 5.2 imo only defines the other way around. Having a raw type at the injection point and a parameterized producer method.
> We should define how this is intended to work.
> Please note that the producer above works in all existing containers so far but not in Weld2-beta1.
> Here is the link to the DS issue: https://issues.apache.org/jira/browse/DELTASPIKE-295
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
11 years, 10 months
[JBoss JIRA] (CDI-304) Clarify Producers for injection into generic types
by Jozef Hartinger (JIRA)
[ https://issues.jboss.org/browse/CDI-304?page=com.atlassian.jira.plugin.sy... ]
Jozef Hartinger commented on CDI-304:
-------------------------------------
Just for the record, there are other combinations of required/bean type where CDI assignability rules are different from Java assignability rules. However, I do not have a strong argument against the proposed solution.
Pete, you originally mentioned that a warning should be generated in such a case. Will this be a spec requirement?
> Clarify Producers for injection into generic types
> --------------------------------------------------
>
> Key: CDI-304
> URL: https://issues.jboss.org/browse/CDI-304
> Project: CDI Specification Issues
> Issue Type: Clarification
> Components: Beans
> Affects Versions: 1.1.PRD
> Reporter: Mark Struberg
> Assignee: Pete Muir
> Fix For: 1.1.PFD
>
>
> There is a discussion over in DeltaSpike whether an injection point
> {code}
> @Inject
> private JsfMessage<SomeMessageClass>;
> {code}
> with a producer method
> {code}
> @Produces @Dependent
> JsfMessage createMessage(InjectionPoint ip)
> {code}
> 5.2 imo only defines the other way around. Having a raw type at the injection point and a parameterized producer method.
> We should define how this is intended to work.
> Please note that the producer above works in all existing containers so far but not in Weld2-beta1.
> Here is the link to the DS issue: https://issues.apache.org/jira/browse/DELTASPIKE-295
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
11 years, 10 months
Cancelled: CDI 1.1 weekly meeting
by Peter Muir
The following meeting has been cancelled:
Subject: CDI 1.1 weekly meeting
Organiser: "Peter Muir" <pmuir(a)redhat.com>
Time: 5:00:00 PM - 7:00:00 PM GMT +00:00 Britain, Ireland, Portugal
Recurrence : Every 1 weeks on No end date Effective 29 Oct, 2012
Invitees: bergmark(a)us.ibm.com; cbrock(a)redhat.com; cdi-dev(a)lists.jboss.org
*~*~*~*~*~*~*~*~*~*
11 years, 10 months
CDI 1.1 weekly meeting
by pmuir@redhat.com
The following is a new meeting request:
Subject: CDI 1.1 weekly meeting
Organiser: Peter Muir <pmuir(a)redhat.com>
Time: 17:00:00 GMT+00:00 - 19:00:00 GMT+00:00
Recurrence: Every Monday. End by Feb 17, 2013. Effective Oct 29, 2012.
Invitees: Mike Brock <cbrock(a)redhat.com>, "cdi-dev(a)lists.jboss.org" <cdi-dev(a)lists.jboss.org>, Joseph Bergmark/Durham/IBM <bergmark(a)us.ibm.com>
*~*~*~*~*~*~*~*~*~*
Fixing the time of the meeting post DST changes in UK/something going wrong with the invite!
Weekly CDI 1.1 meeting
http://www.timeanddate.com/worldclock/converted.html?iso=20120803T15&p1=0...
We will try to use Google Hangout, join #jsr346 10 minutes before the meeting to request an invite. Otherwise switch to the phone teleconference, see https://docs.google.com/spreadsheet/pub?key=0ApqHbXzB1R1gdGRFWXB4TVpNeWFJ... for details.
11 years, 10 months
[JBoss JIRA] (CDI-228) Clarify that _all_ @Dependent beans created for a containers method invocation will get destroyed after the method exits
by Arne Limburg (JIRA)
[ https://issues.jboss.org/browse/CDI-228?page=com.atlassian.jira.plugin.sy... ]
Arne Limburg commented on CDI-228:
----------------------------------
All normal-scoped beans are independent by definition. So adding the annotation (no matter how it is named) to a normal-scoped bean would simply have no effect.
Conclusion: this ticket is all about @Dependent beans (or, to be more precise: about pseudo-scoped beans). So imho @Independent still makes sense.
We even could throw a definition error when the annotation is applied to a normal-scoped bean parameter, but I wouldn't do so, since it would couple the method to the implementation of the dependency, which is not needed here.
> Clarify that _all_ @Dependent beans created for a containers method invocation will get destroyed after the method exits
> ------------------------------------------------------------------------------------------------------------------------
>
> Key: CDI-228
> URL: https://issues.jboss.org/browse/CDI-228
> Project: CDI Specification Issues
> Issue Type: Clarification
> Components: Contexts
> Affects Versions: 1.1.EDR
> Reporter: Mark Struberg
> Assignee: Pete Muir
> Priority: Critical
> Fix For: 1.1.PFD
>
>
> This clarification is intended for all methods which gets invoked by the CDI container and create a new @Dependent contextual instance especially for this invocation. This can happen in @Observes, @Produces, @Disposal and @Inject methods as well as in @Inject contructors. Basically any @Dependent method-parameter InjectionPoint.
> Despite it's atm not specified whether this @Dependent instance will get stored, most containers store it in the CreationalContext of the bean containing the invoked method. This behaviour can lead to mem leaks and non-serializibility issues.
> TASK: Define that any @Dependent contextual instance will get properly destroyed after such method invocations.
> There are 2 things we need to think about:
> 1.) any @PreDestroy method of those beans will get invoked after the method invocation, even if the @Dependent instance will stored away in a member field and still being used later. This will not make any problems in most cases. We just need to make people aware that this will happen.
> 2.) As any Decorator or Interceptor is also an @Dependent instance on our 'temporary' created @Dependent method parameter, those Interceptors and Decorators will _not_ be available after the method invocation. Storing away this bean and re-using it later will probably cause an Exception.
> I still think this is a small problem compared to creating tons of mem leaks. There are quite a few workarounds possible:
> *) Instead of @Inject methods you can use @Inject field + @PostConstruct to initialize it.
> *) We might add an additional annotation which denotes either @Transactional or au contraire: @Keep for the method-param InjectionPoint
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
11 years, 10 months
[JBoss JIRA] (CDI-271) Provide a way to inject Event metadata into an observer method
by Pete Muir (JIRA)
[ https://issues.jboss.org/browse/CDI-271?page=com.atlassian.jira.plugin.sy... ]
Pete Muir commented on CDI-271:
-------------------------------
https://github.com/jboss/cdi/pull/158
> Provide a way to inject Event metadata into an observer method
> --------------------------------------------------------------
>
> Key: CDI-271
> URL: https://issues.jboss.org/browse/CDI-271
> Project: CDI Specification Issues
> Issue Type: Feature Request
> Components: Events
> Reporter: Arne Limburg
> Assignee: Arne Limburg
> Fix For: 1.1.PFD
>
>
> Currently there is no way for observer methods to access the qualifiers of the fired event (i.e. to access @Nonbinding members).
> Consider the following example:
> {code}
> @Inject @MyQualifier
> Event<MyObject> event;
> public void fireEvent(MyObject object, MyTypeValue type) {
> event.select(new MyTypeAnnotationLiteral(type)).fire(object);
> }
> {code}
> Currently no observer can receive the value of MyTypeValue. I suggest to introduce an interface AnnotatedEvent that extends Annotated and contains this information. It then could be injected via the InjectionPoint like this:
> {code}
> public void observeEvent(@Observes @MyType MyObject object, InjectionPoint ip) {
> MyType annotation = ip.getAnnotated().getAnnotation(MyType.class);
> MyTypeValue value = annotation.value();
> ...
> }
> {code}
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
11 years, 10 months
[JBoss JIRA] (CDI-271) Provide a way to inject Event metadata into an observer method
by John Ament (JIRA)
[ https://issues.jboss.org/browse/CDI-271?page=com.atlassian.jira.plugin.sy... ]
John Ament commented on CDI-271:
--------------------------------
Where's the link to the pull request?
> Provide a way to inject Event metadata into an observer method
> --------------------------------------------------------------
>
> Key: CDI-271
> URL: https://issues.jboss.org/browse/CDI-271
> Project: CDI Specification Issues
> Issue Type: Feature Request
> Components: Events
> Reporter: Arne Limburg
> Assignee: Arne Limburg
> Fix For: 1.1.PFD
>
>
> Currently there is no way for observer methods to access the qualifiers of the fired event (i.e. to access @Nonbinding members).
> Consider the following example:
> {code}
> @Inject @MyQualifier
> Event<MyObject> event;
> public void fireEvent(MyObject object, MyTypeValue type) {
> event.select(new MyTypeAnnotationLiteral(type)).fire(object);
> }
> {code}
> Currently no observer can receive the value of MyTypeValue. I suggest to introduce an interface AnnotatedEvent that extends Annotated and contains this information. It then could be injected via the InjectionPoint like this:
> {code}
> public void observeEvent(@Observes @MyType MyObject object, InjectionPoint ip) {
> MyType annotation = ip.getAnnotated().getAnnotation(MyType.class);
> MyTypeValue value = annotation.value();
> ...
> }
> {code}
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
11 years, 10 months