[jboss-cvs] JBossAS SVN: r95123 - projects/annotations/branches/AnnEnv/core/src/main/java/org/jboss/papaki/scanner.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Mon Oct 19 12:15:04 EDT 2009
Author: alesj
Date: 2009-10-19 12:15:03 -0400 (Mon, 19 Oct 2009)
New Revision: 95123
Modified:
projects/annotations/branches/AnnEnv/core/src/main/java/org/jboss/papaki/scanner/DefaultAnnotationScanner.java
projects/annotations/branches/AnnEnv/core/src/main/java/org/jboss/papaki/scanner/JavassistAnnotationScanner.java
Log:
Use cls for pool.
Modified: projects/annotations/branches/AnnEnv/core/src/main/java/org/jboss/papaki/scanner/DefaultAnnotationScanner.java
===================================================================
--- projects/annotations/branches/AnnEnv/core/src/main/java/org/jboss/papaki/scanner/DefaultAnnotationScanner.java 2009-10-19 16:05:31 UTC (rev 95122)
+++ projects/annotations/branches/AnnEnv/core/src/main/java/org/jboss/papaki/scanner/DefaultAnnotationScanner.java 2009-10-19 16:15:03 UTC (rev 95123)
@@ -40,6 +40,7 @@
*/
public class DefaultAnnotationScanner extends AbstractAnnotationScanner<DefaultAnnotationRepository>
{
+ private VirtualFile[] excludedRoots;
private ClassFilter included;
private ClassFilter excluded;
private ResourceFilter recurseFilter;
@@ -59,7 +60,8 @@
{
roots[i] = VFS.getRoot(urls[i]);
}
- ResourceVisitor visitor = createResourceVisitor(repo);
+
+ ResourceVisitor visitor = createResourceVisitor(repo, cls);
ClassLoader classLoader = cls[0];
// something in javassist uses TCL
@@ -67,7 +69,7 @@
Thread.currentThread().setContextClassLoader(classLoader);
try
{
- VFSResourceVisitor.visit(roots, null, included, excluded, cls[0], visitor, visitor.getFilter(), recurseFilter, urls);
+ VFSResourceVisitor.visit(roots, excludedRoots, included, excluded, cls[0], visitor, visitor.getFilter(), recurseFilter, urls);
}
finally
{
@@ -75,11 +77,16 @@
}
}
- protected ResourceVisitor createResourceVisitor(DefaultAnnotationRepository repository)
+ protected ResourceVisitor createResourceVisitor(DefaultAnnotationRepository repository, ClassLoader... cls)
{
return new ReflectionAnnotationResourceVisitor(repository);
}
+ public void setExcludedRoots(VirtualFile[] excludedRoots)
+ {
+ this.excludedRoots = excludedRoots;
+ }
+
public void setIncluded(ClassFilter included)
{
this.included = included;
Modified: projects/annotations/branches/AnnEnv/core/src/main/java/org/jboss/papaki/scanner/JavassistAnnotationScanner.java
===================================================================
--- projects/annotations/branches/AnnEnv/core/src/main/java/org/jboss/papaki/scanner/JavassistAnnotationScanner.java 2009-10-19 16:05:31 UTC (rev 95122)
+++ projects/annotations/branches/AnnEnv/core/src/main/java/org/jboss/papaki/scanner/JavassistAnnotationScanner.java 2009-10-19 16:15:03 UTC (rev 95123)
@@ -26,6 +26,8 @@
import org.jboss.papaki.repository.plugins.javassist.JavassistAnnotationResourceVisitor;
import javassist.ClassPool;
+import javassist.ClassPath;
+import javassist.LoaderClassPath;
/**
* Javassist annotation scanner.
@@ -34,12 +36,22 @@
*/
public class JavassistAnnotationScanner extends DefaultAnnotationScanner
{
- private ClassPool pool = ClassPool.getDefault();
+ private ClassPool pool;
@Override
- protected ResourceVisitor createResourceVisitor(DefaultAnnotationRepository repository)
+ protected ResourceVisitor createResourceVisitor(DefaultAnnotationRepository repository, ClassLoader... cls)
{
- return new JavassistAnnotationResourceVisitor(repository, pool);
+ ClassPool cp = pool;
+ if (cp == null)
+ cp = ClassPool.getDefault();
+
+ for (ClassLoader cl : cls)
+ {
+ ClassPath classPath = new LoaderClassPath(cl);
+ cp.appendClassPath(classPath);
+ }
+
+ return new JavassistAnnotationResourceVisitor(repository, cp);
}
public void setPool(ClassPool pool)
More information about the jboss-cvs-commits
mailing list