[jboss-user] [Microcontainer] - Re: Annotations scanning nightmare
alesj
do-not-reply at jboss.com
Mon Jan 26 14:52:11 EST 2009
This is all already done. ;-)
- http://anonsvn.jboss.org/repos/jbossas/projects/jboss-deployers/trunk/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/annotations/
The entry point to this is
- http://anonsvn.jboss.org/repos/jbossas/projects/jboss-deployers/trunk/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/annotations/AnnotationEnvironmentDeployer.java
where you can then access the information via
- http://anonsvn.jboss.org/repos/jbossas/projects/jboss-deployers/trunk/deployers-spi/src/main/java/org/jboss/deployers/spi/annotations/AnnotationEnvironment.java
There is one AnnotationEnvironment instance per Module (classloading info) instance in deployment.
AnnotationEnvironment instance is kept in DeploymentUnit,
so, if you can get access to DeploymentUnit, you have an access to annotations info.
See how Seam-int gets access to DeploymentUnit/AnnotationEnvironment:
- http://anonsvn.jboss.org/repos/jbossas/projects/jboss-seam-int/trunk/jbossas/src/main/java/org/jboss/seam/integration/jbossas/vdf/AnnotationEnvironmentVDFConnector.java
- http://anonsvn.jboss.org/repos/jbossas/projects/jboss-seam-int/trunk/jbossas/src/main/java/org/jboss/seam/integration/jbossas/vdf/VFSDeploymentUnitVDFConnector.java
The nice part about this annotation scanning is, that it's Javassist based, meaning it doesn't actually load classes until really needed.
And doing this over Module means you already follow all the import/export classloading rules.
e.g. you won't have access to 'hidden' resources
In JBossAS this is already used for EJB3 annotation scanning.
And there are already plans to use this more tightly in Seam/JSR299.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4204797#4204797
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4204797
More information about the jboss-user
mailing list