-
1. Re: Annotations scanning nightmare
alesj Jan 26, 2009 2:52 PM (in response to obrien)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. -
2. Re: Annotations scanning nightmare
obrien Jan 26, 2009 3:27 PM (in response to obrien)Wicked! That will keep me busy for some time.
Thanks
Radim