[jboss-dev-forums] [Design the new POJO MicroContainer] - Re: StructureContext and candidate annotations
alesj
do-not-reply at jboss.com
Wed Aug 6 06:28:07 EDT 2008
I've added this to AbstractStructureDeployer:
| /**
| * Create deployment resource loader.
| *
| * @param root the deployment root
| * @return new deployment resource loader
| */
| protected abstract DeploymentResourceLoader createDeploymentResourceLoader(VirtualFile root);
|
| /**
| * Create annotation environment.
| *
| * @param classLoader the classloader
| * @return new annotation environment
| */
| protected abstract AnnotationEnvironment createAnnotationEnvironment(ClassLoader classLoader);
|
| /**
| * Check for candidate annotations.
| *
| * @param context the structure context
| * @param roots the roots to check
| */
| protected void checkCandidateAnnotations(StructureContext context, VirtualFile... roots)
| {
| if (roots == null || roots.length == 0)
| throw new IllegalArgumentException("Null or empty roots");
|
| if (candidateAnnotations == null || candidateAnnotations.isEmpty())
| return;
|
| for(VirtualFile root : roots)
| {
| DeploymentResourceLoader loader = createDeploymentResourceLoader(root);
| ClassLoader cl = new DeploymentResourceClassLoader(loader);
| AnnotationEnvironment env = createAnnotationEnvironment(cl);
| for (Class<? extends Annotation> annotationClass : candidateAnnotations)
| {
| if (env.hasClassAnnotatedWith(annotationClass))
| {
| context.addFoundAnnotation(annotationClass);
| }
| }
| }
| }
|
Where MockEARStructureDepolyer then checks in
Module's StructureContext if we have any matching annotation.
OK?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4168974#4168974
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4168974
More information about the jboss-dev-forums
mailing list