[jboss-dev-forums] [Design the new POJO MicroContainer] - Re: EAR structure mock scanning

alesj do-not-reply at jboss.com
Thu May 22 08:49:37 EDT 2008


"alesj" wrote : 
  | OK, I'll try to extract my previous code - or see if it can be directly reused - to add ear scanning for javaee annotations.
  | Or even generic for structure deployers as well.
Wow, this even surprised me.
The code is completely generic *already*. :-)
I just needed to change a single modifier into public - which I don't see why I didn't have it before - and all the code is there. ;-)


  |    private void scanEar(VirtualFile root, List<EarModule> modules) throws IOException
  |    {
  |       ClassLoader classLoader = getClass().getClassLoader();
  |       GenericAnnotationResourceVisitor visitor = new GenericAnnotationResourceVisitor(classLoader);
  |       ClassFilter included = null;
  |       ClassFilter excluded = null;
  |       ResourceFilter filter = visitor.getFilter();
  |       List<VirtualFile> children = root.getChildren();
  |       for (VirtualFile child : children)
  |       {
  |          VFSResourceVisitor.visit(new VirtualFile[]{child}, included, excluded, classLoader, visitor, filter);
  |          AnnotationEnvironment env = visitor.getEnv();
  |          Set<Class<?>> statelessClasses = env.classIsAnnotatedWith(Stateless.class);
  |          // logic here ...
  |          // mark module as EJB3, ...
  |       }
  | 

So, someone needs to explain me now what is the logic behind JEE annotations and how the modules are marked.
e.g. what annotations mark some type (OK, I know the EJB3 one's, but have no clue about the others)

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4152659#4152659

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4152659



More information about the jboss-dev-forums mailing list