1 25 package org.objectweb.petals.jbi.management.autoload; 26 27 import java.io.File ; 28 import java.io.FilenameFilter ; 29 import java.util.TimerTask ; 30 31 38 public class InstallDirectoryScanner extends TimerTask { 39 40 File installDir; 41 42 AutoLoaderImpl autoLoader; 43 44 ArchiveFileFilter archiveFilter; 45 46 public InstallDirectoryScanner(AutoLoaderImpl autoLoader, File installDir) { 47 this.installDir = installDir; 48 this.autoLoader = autoLoader; 49 archiveFilter = new ArchiveFileFilter(); 50 } 51 52 public void run() { 53 File [] newInstall = installDir.listFiles(archiveFilter); 54 55 if (newInstall != null && newInstall.length > 0) { 56 autoLoader.install(newInstall); 57 } 58 } 59 60 67 private class ArchiveFileFilter implements FilenameFilter { 68 69 72 public boolean accept(File dir, String name) { 73 74 String lcName = name.toLowerCase(); 75 76 if (lcName.endsWith("jar") || lcName.endsWith("zip")) { 77 return true; 78 } 79 return false; 80 } 81 82 } 83 } 84 | Popular Tags |