-
1. Re: What parameter should @Requires use - and what should @Requires do?
lightguard Sep 12, 2011 10:28 PM (in response to brandizzi)IIRC, it takes a string to avoid the application blowing up when the class is loaded if the class mentioned in the @Requires isn't on the classpath. It should be fixed in the documentation though. Please create a JIRA for the doc issue in Solder.
-
2. Re: What parameter should @Requires use - and what should @Requires do?
jharting Sep 13, 2011 10:18 AM (in response to brandizzi)Also, @Requires handles classpath level requirements. It does not handle requirements on a CDI Bean level. If you need that, please create a feature request in JIRA.
-
3. Re: What parameter should @Requires use - and what should @Requires do?
brandizzi Sep 13, 2011 11:28 AM (in response to brandizzi)
Jason Porter wrote on Sep 12, 2011 22:28:
It should be fixed in the documentation though. Please create a JIRA for the doc issue in Solder.I submitted a pull request to the Solder project on GitHub. Do you think I should post a bug report too?
(I am not really sure about how to deal with Seam 3 bugs. The project page seems to encourage the use of GitHub. I am new to the Seam community after all :) )
Jozef Hartinger wrote on Sep 13, 2011 10:18:
Also, @Requires handles classpath level requirements. It does not handle requirements on a CDI Bean level. If you need that, please create a feature request in JIRA.I imagined that @Requres managed CDI-level dependencies because the problematic documentation - I really do not need it. However, it seems to me that CDI-level dependency-based vetoing of classes would make more sense than a veto based on a mere lookup in the classloaders. Do you all think that I am wrong in this point?
-
4. Re: What parameter should @Requires use - and what should @Requires do?
lightguard Sep 13, 2011 12:22 PM (in response to brandizzi)
Adam Victor Brandizzi wrote on Sep 13, 2011 11:28:
Jason Porter wrote on Sep 12, 2011 22:28:
It should be fixed in the documentation though. Please create a JIRA for the doc issue in Solder.
I submitted a pull request to the Solder project on GitHub. Do you think I should post a bug report too?
(I am not really sure about how to deal with Seam 3 bugs. The project page seems to encourage the use of GitHub. I am new to the Seam community after all :) )A pull request is great, I missed that you create one. We're using GitHub for VCS and JIRA for bug tracking.
Adam Victor Brandizzi wrote on Sep 13, 2011 11:28:
Jozef Hartinger wrote on Sep 13, 2011 10:18:
Also, @Requires handles classpath level requirements. It does not handle requirements on a CDI Bean level. If you need that, please create a feature request in JIRA.
I imagined that @Requres managed CDI-level dependencies because the problematic documentation - I really do not need it. However, it seems to me that CDI-level dependency-based vetoing of classes would make more sense than a veto based on a mere lookup in the classloaders. Do you all think that I am wrong in this point?You could create an extension, which is what Solder is doing and simple issue the veto() call on the ProcessAnnotatedType. Take a look at http://docs.jboss.org/cdi/api/1.0/javax/enterprise/inject/spi/ProcessAnnotatedType.html. I believe there also some talk going on for something else in this space in CDI 1.1.
-
5. Re: What parameter should @Requires use - and what should @Requires do?
jharting Sep 13, 2011 2:06 PM (in response to brandizzi)
I imagined that @Requres managed CDI-level dependencies because the problematic documentation - I really do not need it. However, it seems to me that CDI-level dependency-based vetoing of classes would make more sense than a veto based on a mere lookup in the classloaders. Do you all think that I am wrong in this point?Classloader lookup is vital for implementing optional parts of a CDI extension. Take a CDI extension that supports multiple templating engines as an example. Support for a particular templating engine (e.g. FreeMarker) is optional and you do not want your beans dealing with it to be registered if FreeMarker is not available. In this case bean-level dependency does not help much since the FreeMarker jar contains no CDI beans. With the current semantics of @Requires, you can make an entire package depend on a particular FreeMarker class instead.
You could create an extension, which is what Solder is doing and simple issue the veto() call on the ProcessAnnotatedType. Take a look at http://docs.jboss.org/cdi/api/1.0/javax/enterprise/inject/spi/ProcessAnnotatedType.html. I believe there also some talk going on for something else in this space in CDI 1.1.This would be kind of tricky to implement since at the time ProcessAnnotatedType is fired, you have no way of detecting whether a bean of particular type (and perhaps qualifiers) is available or not, since this is way before the container is fully initialized.
-
6. Re: What parameter should @Requires use - and what should @Requires do?
brandizzi Sep 14, 2011 9:44 AM (in response to brandizzi)
Jozef Hartinger wrote on Sep 13, 2011 14:06:
Classloader lookup is vital for implementing optional parts of a CDI extension. Take a CDI extension that supports multiple templating engines as an example. Support for a particular templating engine (e.g. FreeMarker) is optional and you do not want your beans dealing with it to be registered if FreeMarker is not available. In this case bean-level dependency does not help much since the FreeMarker jar contains no CDI beans. With the current semantics of @Requires, you can make an entire package depend on a particular FreeMarker class instead.Well, your explanation clarifies the situation to me, and I understand the purpose of @Requires much better now. Thank you, Jozef.
Just one more question: so is @Requires a tool designed more for frameworks developers, then?