[jboss-dev-forums] [Design of POJO Server] - Re: Using AnnotationEnvironment in Seam
alesj
do-not-reply at jboss.com
Tue Aug 19 09:35:44 EDT 2008
"pete.muir at jboss.org" wrote :
| 1) We currently only scan artifacts which have seam.properties (or META-INF/seam.properties or META-INF/components.xml). This includes:
|
| * WEB-INF/classes
| * Any lib in WEB-INF/lib
| * Any lib declared in the manifest
| * Any lib declared in the ear (e.g. in lib/, declared as an ejb in application.xml, declared in the manifest)
| * Any lib in our parent classloaders
|
| How do we replicate this behaviour?
|
Basically you're saying you scan the whole classpath,
but only do real lookup from the root of those deployments/classpath entries
that have some Seam specific resource present?
The AnnEnv handles this already since it does lookup at the classloading layer,
we could perhaps exclude deployments that don't contain any Seam specific resource before we actually do some reading from AnnEnv.
"pete.muir at jboss.org" wrote :
| 2) We have other deployment handlers
|
| e.g. org.jboss.seam.deployment.ComponentsXmlDeploymentHandler::handle
|
| public void handle(String name, ClassLoader classLoader)
| | {
| | if (name.endsWith(".component.xml") || name.endsWith("/components.xml"))
| | {
| | // we want to skip over known meta-directories since Seam will
| | // auto-load these without a scan
| | if (!name.startsWith("WEB-INF/") && !name.startsWith("META-INF/"))
| | {
| | resources.add(name);
| | }
| | }
| |
| | }
|
| For this approach to decrease deployment time, we need to not scan at all (or scan a very limited set of files), so can we get this metadata (files, based on their filename) from the MC?
|
| If you want to look at the handlers which are relevant:
|
| * org.jboss.seam.deployment.AnnotationDeploymentHandler (support for users to specify their own annotations to handle, the AnnotationEnv backed version can just be a facade)
| * org.jboss.seam.deployment.ComponentDeploymentHandler
| * org.jboss.seam.deployment.ComponentsXmlDeploymentHandler
| * org.jboss.seam.deployment.DotPageDotXmlDeploymentHandler
| * org.jboss.seam.deployment.NamespaceDeploymentHandler
| * org.jboss.seam.bpm.PageflowDeploymentHandler
|
We could add this in a similar way we do annotation scanning -
as ResourceVisitor on Module.
Or we could visit deployment's root,
excluding deployments metadata locations.
The result should be then put as attachment to deployment unit's attachments.
Let me know what exactly you need,
and I'll try to put the code into seam-int/microcontainer module.
Or you can do it, and learn a few tricks about MC. :-)
"pete.muir at jboss.org" wrote :
| 3) For the future, can we add support for metaannotations support? This will make it supereasy to use for WB.
|
| E.g.
|
| public interface AnnotationEnvironment
| | {
| | ...
| | boolean hasClassMetaAnnotatedWith(Class<? extends Annotation> annotation);
| |
| | // etc.
| |
| annotationEnvironment.hasClassMetaAnnotatedWith(javax.webbeans.DeploymentType.class);
|
You mean this:
| @DeploymentType
| public @interface SomeType {}
|
| @SomeType
| public class MyTypeImpl {}
|
Where you would like to get MyTypeImpl class?
Should be easy to add.
I'll have a look.
"pete.muir at jboss.org" wrote :
| 4) How does it handle exceptions loading classes? Throw them for us to catch?
|
AnnEnv doesn't load classes. ;-)
But it will throw RuntimeException when you ask for it and it fails.
Annotation scanning deployer by default doesn't fail if it has some problems
reading the annotations. But this is optional.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4171269#4171269
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4171269
More information about the jboss-dev-forums
mailing list