VisitorAttributes va = new VisitorAttributes();
va.setLeavesOnly(true);
SuffixesExcludeFilter noJars = new SuffixesExcludeFilter(Arrays.asList(".zip", ".ear", ".jar", ".rar", ".war", ".sar",".har", ".aop")); // TODO: Where should these come from?
va.setRecurseFilter(noJars);
FilterVirtualFileVisitor visitor = new FilterVirtualFileVisitor(new VirtualFileFilterAdapter(filter), va);
for(VirtualFile root : classPath)
{
try
{
// The class path can contain subdirectories of other entries
// these must be ignored.
if(isChildOf(classPath, root))
continue;
if( root.isLeaf() == false )
root.visit(visitor);
}
catch (IOException e)
{
throw new RuntimeException(e);
}
}
final List<VirtualFile> matches = visitor.getMatched();
final List<org.jboss.ejb3.vfs.spi.VirtualFile> wrappedMatches = new ArrayList<org.jboss.ejb3.vfs.spi.VirtualFile>(matches.size());
for(VirtualFile match : matches)
{
wrappedMatches.add(new VirtualFileWrapper(match));
}