Search in sources :

Example 1 with AnalyzerGuru

use of org.opensolaris.opengrok.analysis.AnalyzerGuru in project OpenGrok by OpenGrok.

the class IndexDatabase method initialize.

@SuppressWarnings("PMD.CollapsibleIfStatements")
private void initialize() throws IOException {
    synchronized (INSTANCE_LOCK) {
        RuntimeEnvironment env = RuntimeEnvironment.getInstance();
        File indexDir = new File(env.getDataRootFile(), INDEX_DIR);
        if (project != null) {
            indexDir = new File(indexDir, project.getPath());
        }
        if (!indexDir.exists() && !indexDir.mkdirs()) {
            // to avoid race conditions, just recheck..
            if (!indexDir.exists()) {
                throw new FileNotFoundException("Failed to create root directory [" + indexDir.getAbsolutePath() + "]");
            }
        }
        lockfact = pickLockFactory(env);
        indexDirectory = FSDirectory.open(indexDir.toPath(), lockfact);
        ignoredNames = env.getIgnoredNames();
        includedNames = env.getIncludedNames();
        analyzerGuru = new AnalyzerGuru();
        if (env.isGenerateHtml()) {
            xrefDir = new File(env.getDataRootFile(), XREF_DIR);
        }
        listeners = new CopyOnWriteArrayList<>();
        dirtyFile = new File(indexDir, "dirty");
        dirty = dirtyFile.exists();
        directories = new ArrayList<>();
    }
}
Also used : RuntimeEnvironment(org.opensolaris.opengrok.configuration.RuntimeEnvironment) FileNotFoundException(java.io.FileNotFoundException) File(java.io.File) AnalyzerGuru(org.opensolaris.opengrok.analysis.AnalyzerGuru)

Aggregations

File (java.io.File)1 FileNotFoundException (java.io.FileNotFoundException)1 AnalyzerGuru (org.opensolaris.opengrok.analysis.AnalyzerGuru)1 RuntimeEnvironment (org.opensolaris.opengrok.configuration.RuntimeEnvironment)1