[jboss-user] [JBoss Microcontainer Development] New message: "Re: another annotation scanner requirement"

Ales Justin do-not-reply at jboss.com
Thu Jan 7 17:54:48 EST 2010


User development,

A new message was posted in the thread "another annotation scanner requirement":

http://community.jboss.org/message/518868#518868

Author  : Ales Justin
Profile : http://community.jboss.org/people/alesj

Message:
--------------------------------------------------------------
> My first question is, what is the right API to write a deployer that scans annotations?  AnnotationEnvironment?  
> 
Yes #1.
> Or is there a new one coming down the pipe?
>  
Yes #2.
 
The idea that I have is to allow for plugable resource indexing.
I have some prototype code locally which I plan to push as https://jira.jboss.org/jira/browse/JBMCSCAN project.
 
We need to scan all resources once anyway, hence let's make sure it's really just once.
And while doing this we could build whatever indexes those plugins come up with.
Annotations being just one of the indexes.
Others would include Hibernate's .hbm.xml, Seam's .page.xml, etc ...
 
In your case you would build interface+annotation index.
 
You can wait for this feature or go ahead and do it,
as I really haven't done much, apart from refactoring my previous annotations scanning attempts to be more generic, hence no big waste.
 
This is what I've done for annotations scanning: http://anonsvn.jboss.org/repos/jbossas/projects/mc-ann/trunk/
The idea is to
* have work split into pre-indexed and runtime-indexing if pre doesn't exist
* use VFS visitor pattern to do the work
* use MC's CL resource pattern to do the work
* use JBoss Reflect (its Javassist config) to do the lazy class reading
 
What is missing is the nice API to plug-in additional indexers and expose the to be read.
> A query for all classes that implement an interface annotated with a specific annotation.
Currently this is a pita, pretty slow.
You can ask the AnnotationRepository (renamed from AnntationEnvironment) for all classes that are annotated with your annotation.
As we don't keep any class hierarchy info, you would now need to go over all classes again,
and check for those who implement your previously found interfaces.
 
Let me know if you decide to take the first route.
We can discuss the dev here, and I can pitch in once I'm done with MC releases.

--------------------------------------------------------------

To reply to this message visit the message page: http://community.jboss.org/message/518868#518868




More information about the jboss-user mailing list