public FileIDMigrator(File dataFile, long minReloadIntervalMS) { longToString = new FastByIDMap<String>(100); this.dataFile = Preconditions.checkNotNull(dataFile); if (!dataFile.exists() || dataFile.isDirectory()) { throw new FileNotFoundException(dataFile.toString()); } log.info("Creating FileReadonlyIDMigrator for file {}", dataFile); this.reloadLock = new ReentrantLock(); this.lastModified = dataFile.lastModified(); this.minReloadIntervalMS = minReloadIntervalMS; reload(); }
/** * Recursively collect classes from the supplied directory * * @param arg the directory to search in * @param out output * @param ptrn the pattern (regexp) to filter found files */ private static void collectTests(File root, File arg, List<String> out, String ptrn) { if (arg.isDirectory()) { for (File f : arg.listFiles()) { collectTests(root, f, out, ptrn); } } else { String path = arg.GetAbsolutePath(); String prefix = root.GetAbsolutePath(); String cls = path.Substring(prefix.Length + 1).Replace(File.separator, "."); if(cls.matches(ptrn)) out.Add(cls); } }