diff options
author | Simon Brandhof <simon.brandhof@gmail.com> | 2014-02-23 22:39:43 +0100 |
---|---|---|
committer | Simon Brandhof <simon.brandhof@gmail.com> | 2014-02-23 22:39:43 +0100 |
commit | 1715a09211e7adef88a99952d3a0265c485cb68a (patch) | |
tree | 7a4a56eac5c9857b129cfacf05fc04af6afda1b2 /sonar-plugin-api/src | |
parent | ebf7643e81af44e8fd06ac0d7a8cf1175946dba7 (diff) | |
download | sonarqube-1715a09211e7adef88a99952d3a0265c485cb68a.tar.gz sonarqube-1715a09211e7adef88a99952d3a0265c485cb68a.zip |
SONAR-926 Preload files in DefaultModuleFileSystem
Diffstat (limited to 'sonar-plugin-api/src')
-rw-r--r-- | sonar-plugin-api/src/main/java/org/sonar/api/batch/fs/internal/DefaultFileSystem.java | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/fs/internal/DefaultFileSystem.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/fs/internal/DefaultFileSystem.java index e5c201e211c..ad5486a21e3 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/fs/internal/DefaultFileSystem.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/fs/internal/DefaultFileSystem.java @@ -109,6 +109,7 @@ public class DefaultFileSystem implements FileSystem { @Override public InputFile inputFile(FilePredicate predicate) { + doPreloadFiles(); if (predicate instanceof UniqueIndexPredicate) { return cache.inputFile((UniqueIndexPredicate) predicate); } @@ -122,16 +123,19 @@ public class DefaultFileSystem implements FileSystem { @Override public Iterable<InputFile> inputFiles(FilePredicate predicate) { + doPreloadFiles(); return Iterables.filter(cache.inputFiles(), new GuavaPredicate(predicate)); } @Override public boolean hasFiles(FilePredicate predicate) { + doPreloadFiles(); return Iterables.indexOf(cache.inputFiles(), new GuavaPredicate(predicate)) >= 0; } @Override public Iterable<File> files(FilePredicate predicate) { + doPreloadFiles(); return Iterables.transform(inputFiles(predicate), new Function<InputFile, File>() { @Override public File apply(@Nullable InputFile input) { @@ -149,9 +153,17 @@ public class DefaultFileSystem implements FileSystem { @Override public Set<String> languages() { + doPreloadFiles(); return languages; } + /** + * This method is called before each search of files. + */ + protected void doPreloadFiles() { + + } + public static abstract class Cache { protected abstract Iterable<InputFile> inputFiles(); |