private void init(File top, File directory) throws java.io.IOException { File[] dirFiles = directory.listFiles(new FileFilter() { public boolean accept(File pathname) { return pathname.getAbsolutePath().endsWith(".class"); } }); if (dirFiles != null) { for (File file : dirFiles) { entries.add(file.getPath().substring(top.getPath().length() + 1)); } } File[] subDirs = directory.listFiles(new FileFilter() { public boolean accept(File pathname) { return pathname.isDirectory(); } }); if (subDirs != null) { for (File subDir : subDirs) { init(top, subDir); } } }
public Set<Class> getElements() { Set<Class> elements = new HashSet<Class>(); if (getClassLoader()==null) { AnnotationUtils.getLogger().severe("Class loader null"); return elements; } for (String fileName : entries) { // convert to a class name... String className = fileName.replace(File.separatorChar, '.'); className = className.substring(0, className.length()-6); System.out.println("Getting " + className); try { elements.add(classLoader.loadClass(className)); } catch(Throwable cnfe) { AnnotationUtils.getLogger().severe("cannot load " + className + " reason : " + cnfe.getMessage()); } } return elements; } }
private void init(File top, File directory) throws java.io.IOException { File[] dirFiles = directory.listFiles(new FileFilter() { public boolean accept(File pathname) { return pathname.getAbsolutePath().endsWith(".class"); } }); if (dirFiles != null) { for (File file : dirFiles) { entries.add(file.getPath().substring(top.getPath().length() + 1)); } } File[] subDirs = directory.listFiles(new FileFilter() { public boolean accept(File pathname) { return pathname.isDirectory(); } }); if (subDirs != null) { for (File subDir : subDirs) { init(top, subDir); } } }
public Set<Class> getElements() { Set<Class> elements = new HashSet<Class>(); if (getClassLoader()==null) { AnnotationUtils.getLogger().severe("Class loader null"); return elements; } for (String fileName : entries) { // convert to a class name... String className = fileName.replace(File.separatorChar, '.'); className = className.substring(0, className.length()-6); System.out.println("Getting " + className); try { elements.add(classLoader.loadClass(className)); } catch(Throwable cnfe) { AnnotationUtils.getLogger().severe("cannot load " + className + " reason : " + cnfe.getMessage()); } } return elements; } }
public void process(File directory, Object bundleDesc, ClassLoader classLoader) throws IOException { AnnotationUtils.getLogger().finer("dir is " + directory); AnnotationUtils.getLogger().finer("classLoader is " + classLoader); this.directory = directory; this.classLoader = classLoader; init(directory); }
public void process(File directory, Object bundleDesc, ClassLoader classLoader) throws IOException { AnnotationUtils.getLogger().finer("dir is " + directory); AnnotationUtils.getLogger().finer("classLoader is " + classLoader); this.directory = directory; this.classLoader = classLoader; init(directory); }