On Sat, Jan 10, 2009 at 11:34 AM, Andrew Robinson <andrew.rw.robin...@gmail.com> wrote: > Feel free to use my code for facelets annotation deployment: > > http://jsf-comp.sourceforge.net/components/facelets-deployment/index.html > http://jsf-comp.svn.sourceforge.net/svnroot/jsf-comp/trunk/facelets/annotation-deployment/ > http://jsf-comp.svn.sourceforge.net/viewvc/jsf-comp/trunk/facelets/annotation-deployment/src/main/java/net/sf/jsfcomp/facelets/deploy/ > http://jsf-comp.svn.sourceforge.net/viewvc/jsf-comp/trunk/facelets/annotation-deployment/src/main/java/net/sf/jsfcomp/facelets/deploy/FaceletAnnotationParser.java?view=markup > > TinyURL of the last URL: http://tinyurl.com/9xdgph > > This last java class does all the main scanning work. It isn't reusable for > what you need, but I don't see the need for a 3rd party library as scanning > code is pretty easy. Writing a custom one for MyFaces will probably have > better performance than a reusable one that would probably have more > flexibility code in it.
not sure on the PERF, but if it is really (proven) the case, I am with you. Well... startup time isn't really a big problem, right? :-) > > -Andrew > > On Tue, Jan 6, 2009 at 1:32 PM, Jan-Kees van Andel > <jankeesvanan...@gmail.com> wrote: >> >> Hi, >> >> The JSF 2.0 spec requires an implementation to support several >> annotations, like @ManagedBean. >> Has anyone already thought of a possible implementation for this >> requirement? >> >> IMHO, there is only one option, and that is scanning the classpath at >> application startup, because you don't want the overhead with every EL >> expression. >> >> But there are some issues with this: >> First, what paths to scan? AFAIK the spec doesn't state the classpaths >> to scan. I suppose only /WEB-INF/lib and /WEB-INF/classes need to be >> checked, but I can't find it in the spec. >> >> And second, how to scan? Reading each *.class file, then creating a >> Class instance and then using reflection to scan for annotations is >> probably very expensive. Not only the processing time, but I think it >> will also become a memory issue because every class in the classpath >> will be loaded into memory. >> Scanning the plain *.class files is probably not very practical. I >> don't know, never tried it, but the class files I've seen don't look >> very appealing. :-) >> >> It might be an idea to look at Scannotation, which is an open source >> library for scanning jar files for annotations. It works quite good >> and it has the advantage of being very efficient because it doesn't >> use the default Class/Reflection mechanism. >> http://sourceforge.net/projects/scannotation/ >> The project homepage says it has an Apache 2.0 license, but at the >> same time it has a dependency on Javassist (licensed LGPL or MPL) and >> the source files don't contain any headers, so it may be not an >> option. I don't know, IANAL. >> >> I was playing around with a @ManagedBean annotation parser, but It may >> be a good idea to have a discussion on this subject since it probably >> has some impact. >> >> What do you think? >> >> Regards, >> Jan-Kees > > -- Matthias Wessendorf blog: http://matthiaswessendorf.wordpress.com/ sessions: http://www.slideshare.net/mwessendorf twitter: http://twitter.com/mwessendorf