public boolean isTraceEnabled() { return log.isTraceEnabled(); }
/** * Find all resources in the file system that match the given location pattern via the Ant-style PathMatcher. */ protected Set<Resource> doFindMatchingFileSystemResources(File rootDir, String rootDirPath, String subPattern) throws IOException { if (logger.isTraceEnabled()) { logger.trace("Looking for matching resources in directory tree [" + rootDir.getPath() + "]"); } Set<File> matchingFiles = retrieveMatchingFiles(rootDir, subPattern); Set<Resource> result = new LinkedHashSet<Resource>(matchingFiles.size()); boolean isClasspath = rootDirPath.startsWith(Urls.CLASSPATH_ALL_URL_PREFIX) || rootDirPath.startsWith(Urls.CLASSPATH_ONE_URL_PREFIX); int rootDirPathLength = rootDir.getAbsolutePath().length(); String classpathRoot = isClasspath ? rootDirPath.substring(rootDirPath.indexOf(":") + 1) : null; if(null != classpathRoot && classpathRoot.startsWith("/")){ classpathRoot = classpathRoot.substring(1); } for (File file : matchingFiles) { if(isClasspath){ String classpath = classpathRoot + Paths.normalize(file.getAbsolutePath().substring(rootDirPathLength+1)); result.add(new SimpleFileResource(file, classpath)); }else{ result.add(new SimpleFileResource(file)); } } return result; }
if (!rootDir.exists()) { if (logger.isTraceEnabled()) { logger.trace("Skipping [" + rootDir.getAbsolutePath() + "] because it does not exist");
if (logger.isTraceEnabled()) { logger.trace("Resolved location pattern [" + subPattern + "] to resources " + result);
if (logger.isTraceEnabled()) { logger.trace("Looking for matching resources in jar file [" + jarFileUrl + "]");
if (logger.isTraceEnabled()) { logger.trace("Searching directory [" + dir.getAbsolutePath() + "] for files matching pattern [" + fullPattern + "]"); if (content.isDirectory() && getPathMatcher().matchStart(fullPattern, currPath + "/")) { if (!content.canRead()) { if (logger.isTraceEnabled()) { logger.trace("Skipping subdirectory [" + dir.getAbsolutePath() + "] because the application is not allowed to read the directory");