diff --git a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/AbstractAnalyzer.java b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/AbstractAnalyzer.java new file mode 100644 index 00000000000..a828e3ec5dc --- /dev/null +++ b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/AbstractAnalyzer.java @@ -0,0 +1,167 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. + * + * See LICENSE.txt included in this distribution for the specific + * language governing permissions and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at LICENSE.txt. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ + +/* + * Copyright (c) 2019 Oracle and/or its affiliates. All rights reserved. + */ +package org.opengrok.indexer.analysis; + +import java.io.IOException; +import java.io.Reader; +import java.io.StringReader; +import java.io.Writer; +import org.apache.lucene.analysis.Analyzer; +import org.apache.lucene.analysis.TokenStream; +import org.apache.lucene.document.Document; +import org.opengrok.indexer.configuration.Project; + +public abstract class AbstractAnalyzer extends Analyzer { + public static final Reader DUMMY_READER = new StringReader(""); + protected AnalyzerFactory factory; + // you analyzer HAS to override this to get proper symbols in results + protected JFlexTokenizer symbolTokenizer; + protected Project project; + protected Ctags ctags; + protected boolean scopesEnabled; + protected boolean foldingEnabled; + + public AbstractAnalyzer(ReuseStrategy reuseStrategy) { + super(reuseStrategy); + } + + public abstract long getVersionNo(); + + /** + * Subclasses should override to produce a value relevant for the evolution + * of their analysis in each release. + * + * @return 0 + */ + protected int getSpecializedVersionNo() { + return 0; // FileAnalyzer is not specialized. + } + + public void setCtags(Ctags ctags) { + this.ctags = ctags; + } + + public void setProject(Project project) { + this.project = project; + } + + public void setScopesEnabled(boolean scopesEnabled) { + this.scopesEnabled = supportsScopes() && scopesEnabled; + } + + public void setFoldingEnabled(boolean foldingEnabled) { + this.foldingEnabled = supportsScopes() && foldingEnabled; + } + + protected abstract boolean supportsScopes(); + + /** + * Get the factory which created this analyzer. + * + * @return the {@code FileAnalyzerFactory} which created this analyzer + */ + public final AnalyzerFactory getFactory() { + return factory; + } + + public AbstractAnalyzer.Genre getGenre() { + return factory.getGenre(); + } + + public abstract String getFileTypeName(); + + public abstract void analyze(Document doc, StreamSource src, Writer xrefOut) + throws IOException, InterruptedException; + + public abstract Xrefer writeXref(WriteXrefArgs args) throws IOException; + + @Override + protected abstract TokenStreamComponents createComponents(String fieldName); + + protected abstract void addNumLines(Document doc, int value); + + protected abstract void addLOC(Document doc, int value); + + @Override + protected abstract TokenStream normalize(String fieldName, TokenStream in); + + /** + * What kind of file is this? + */ + public enum Genre { + /** + * xrefed - line numbered context + */ + PLAIN("p"), + /** + * xrefed - summarizer context + */ + XREFABLE("x"), + /** + * not xrefed - no context - used by diff/list + */ + IMAGE("i"), + /** + * not xrefed - no context + */ + DATA("d"), + /** + * not xrefed - summarizer context from original file + */ + HTML("h"); + private final String typeName; + + Genre(String typename) { + this.typeName = typename; + } + + /** + * Get the type name value used to tag lucene documents. + * + * @return a none-null string. + */ + public String typeName() { + return typeName; + } + + /** + * Get the Genre for the given type name. + * + * @param typeName name to check + * @return {@code null} if it doesn't match any genre, the genre + * otherwise. + * @see #typeName() + */ + public static Genre get(String typeName) { + if (typeName == null) { + return null; + } + for (Genre g : values()) { + if (g.typeName.equals(typeName)) { + return g; + } + } + return null; + } + } +} diff --git a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/AnalyzerFactory.java b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/AnalyzerFactory.java new file mode 100644 index 00000000000..755c1232bb3 --- /dev/null +++ b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/AnalyzerFactory.java @@ -0,0 +1,159 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. + * + * See LICENSE.txt included in this distribution for the specific + * language governing permissions and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at LICENSE.txt. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ + +/* + * Copyright (c) 2019 Oracle and/or its affiliates. All rights reserved. + */ +package org.opengrok.indexer.analysis; + +import java.util.Collections; +import java.util.List; + +public abstract class AnalyzerFactory { + /** + * Cached analyzer object for the current thread (analyzer objects can be + * expensive to allocate). + */ + protected final ThreadLocal cachedAnalyzer; + /** + * List of file names on which this kind of analyzer should be used. + */ + protected List names; + /** + * List of file prefixes on which this kind of analyzer should be + * used. + */ + protected List prefixes; + /** + * List of file extensions on which this kind of analyzer should be + * used. + */ + protected List suffixes; + /** + * List of magic strings used to recognize files on which this kind of + * analyzer should be used. + */ + protected List magics; + /** + * List of matchers which delegate files to different types of + * analyzers. + */ + protected final List matchers; + /** + * The content type for the files recognized by this kind of analyzer. + */ + protected final String contentType; + /** + * The genre for files recognized by this kind of analyzer. + */ + protected AbstractAnalyzer.Genre genre; + + public AnalyzerFactory(FileAnalyzerFactory.Matcher matcher, String contentType) { + cachedAnalyzer = new ThreadLocal<>(); + if (matcher == null) { + this.matchers = Collections.emptyList(); + } else { + this.matchers = Collections.singletonList(matcher); + } + this.contentType = contentType; + } + + /** + * Get the list of file names recognized by this analyzer (names must + * match exactly, ignoring case). + * + * @return list of file names + */ + final List getFileNames() { + return names; + } + + /** + * Get the list of file prefixes recognized by this analyzer. + * + * @return list of prefixes + */ + final List getPrefixes() { + return prefixes; + } + + /** + * Get the list of file extensions recognized by this analyzer. + * + * @return list of suffixes + */ + final List getSuffixes() { + return suffixes; + } + + /** + * Get the list of magic strings recognized by this analyzer. If a file + * starts with one of these strings, an analyzer created by this factory + * should be used to analyze it. + * + *

Note: Currently this assumes that the file is encoded with + * UTF-8 unless a BOM is detected. + * + * @return list of magic strings + */ + final List getMagicStrings() { + return magics; + } + + /** + * Get matchers that map file contents to analyzer factories + * programmatically. + * + * @return list of matchers + */ + final List getMatchers() { + return matchers; + } + + /** + * Get the content type (MIME type) for analyzers returned by this factory. + * + * @return content type (could be {@code null} if it is unknown) + */ + final String getContentType() { + return contentType; + } + + /** + * The genre this analyzer factory belongs to. + * + * @return a genre + */ + public final AbstractAnalyzer.Genre getGenre() { + return genre; + } + + /** + * The user friendly name of this analyzer + * + * @return a genre + */ + public abstract String getName(); + + public abstract AbstractAnalyzer getAnalyzer(); + + public abstract void returnAnalyzer(); + + protected abstract AbstractAnalyzer newAnalyzer(); +} diff --git a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/AnalyzerGuru.java b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/AnalyzerGuru.java index dfef922a63c..f62e2bfbe45 100644 --- a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/AnalyzerGuru.java +++ b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/AnalyzerGuru.java @@ -48,7 +48,6 @@ import java.util.TreeSet; import java.util.logging.Level; import java.util.logging.Logger; - import org.apache.lucene.document.DateTools; import org.apache.lucene.document.Document; import org.apache.lucene.document.Field; @@ -58,7 +57,6 @@ import org.apache.lucene.document.StringField; import org.apache.lucene.document.TextField; import org.apache.lucene.util.BytesRef; -import org.opengrok.indexer.analysis.FileAnalyzer.Genre; import org.opengrok.indexer.analysis.FileAnalyzerFactory.Matcher; import org.opengrok.indexer.analysis.ada.AdaAnalyzerFactory; import org.opengrok.indexer.analysis.archive.BZip2AnalyzerFactory; @@ -67,6 +65,7 @@ import org.opengrok.indexer.analysis.archive.ZipAnalyzerFactory; import org.opengrok.indexer.analysis.c.CAnalyzerFactory; import org.opengrok.indexer.analysis.c.CxxAnalyzerFactory; +import org.opengrok.indexer.analysis.clojure.ClojureAnalyzerFactory; import org.opengrok.indexer.analysis.csharp.CSharpAnalyzerFactory; import org.opengrok.indexer.analysis.data.IgnorantAnalyzerFactory; import org.opengrok.indexer.analysis.data.ImageAnalyzerFactory; @@ -80,24 +79,23 @@ import org.opengrok.indexer.analysis.fortran.FortranAnalyzerFactory; import org.opengrok.indexer.analysis.golang.GolangAnalyzerFactory; import org.opengrok.indexer.analysis.haskell.HaskellAnalyzerFactory; -import org.opengrok.indexer.analysis.lua.LuaAnalyzerFactory; import org.opengrok.indexer.analysis.java.JavaAnalyzerFactory; import org.opengrok.indexer.analysis.javascript.JavaScriptAnalyzerFactory; +import org.opengrok.indexer.analysis.json.JsonAnalyzerFactory; +import org.opengrok.indexer.analysis.kotlin.KotlinAnalyzerFactory; import org.opengrok.indexer.analysis.lisp.LispAnalyzerFactory; +import org.opengrok.indexer.analysis.lua.LuaAnalyzerFactory; import org.opengrok.indexer.analysis.pascal.PascalAnalyzerFactory; import org.opengrok.indexer.analysis.perl.PerlAnalyzerFactory; import org.opengrok.indexer.analysis.php.PhpAnalyzerFactory; import org.opengrok.indexer.analysis.plain.PlainAnalyzerFactory; import org.opengrok.indexer.analysis.plain.XMLAnalyzerFactory; +import org.opengrok.indexer.analysis.powershell.PowershellAnalyzerFactory; import org.opengrok.indexer.analysis.python.PythonAnalyzerFactory; +import org.opengrok.indexer.analysis.ruby.RubyAnalyzerFactory; import org.opengrok.indexer.analysis.rust.RustAnalyzerFactory; import org.opengrok.indexer.analysis.scala.ScalaAnalyzerFactory; -import org.opengrok.indexer.analysis.clojure.ClojureAnalyzerFactory; -import org.opengrok.indexer.analysis.json.JsonAnalyzerFactory; -import org.opengrok.indexer.analysis.kotlin.KotlinAnalyzerFactory; import org.opengrok.indexer.analysis.sh.ShAnalyzerFactory; -import org.opengrok.indexer.analysis.powershell.PowershellAnalyzerFactory; -import org.opengrok.indexer.analysis.ruby.RubyAnalyzerFactory; import org.opengrok.indexer.analysis.sql.PLSQLAnalyzerFactory; import org.opengrok.indexer.analysis.sql.SQLAnalyzerFactory; import org.opengrok.indexer.analysis.swift.SwiftAnalyzerFactory; @@ -153,28 +151,28 @@ public class AnalyzerGuru { /** * The default {@code FileAnalyzerFactory} instance. */ - private static final FileAnalyzerFactory DEFAULT_ANALYZER_FACTORY = new FileAnalyzerFactory(); + private static final AnalyzerFactory DEFAULT_ANALYZER_FACTORY = new FileAnalyzerFactory(); /** * Map from file names to analyzer factories. */ - private static final Map FILE_NAMES = new HashMap<>(); + private static final Map FILE_NAMES = new HashMap<>(); /** * Map from file extensions to analyzer factories. */ - private static final Map ext = new HashMap<>(); + private static final Map ext = new HashMap<>(); /** * Map from file prefixes to analyzer factories. */ - private static final Map pre = new HashMap<>(); + private static final Map pre = new HashMap<>(); /** * Appended when - * {@link #addExtension(java.lang.String, org.opengrok.indexer.analysis.FileAnalyzerFactory)} + * {@link #addExtension(java.lang.String, AnalyzerFactory)} * or - * {@link #addPrefix(java.lang.String, org.opengrok.indexer.analysis.FileAnalyzerFactory)} + * {@link #addPrefix(java.lang.String, AnalyzerFactory)} * are called to augment the value in {@link #getVersionNo()}. */ private static final TreeSet CUSTOMIZATION_KEYS = new TreeSet<>(); @@ -203,7 +201,7 @@ public class AnalyzerGuru { /** * Map from magic strings to analyzer factories. */ - private static final SortedMap magics = + private static final SortedMap magics = new TreeMap<>(descStrlenComparator); /** @@ -215,7 +213,7 @@ public class AnalyzerGuru { /** * List of all registered {@code FileAnalyzerFactory} instances. */ - private static final List factories = new ArrayList<>(); + private static final List factories = new ArrayList<>(); /** * Names of all analysis packages. @@ -233,7 +231,7 @@ public class AnalyzerGuru { * Maps from {@link FileAnalyzer#getFileTypeName()} to * {@link FileAnalyzerFactory} */ - private static final Map FILETYPE_FACTORIES = + private static final Map FILETYPE_FACTORIES = new HashMap<>(); /** @@ -250,7 +248,7 @@ public class AnalyzerGuru { */ static { try { - FileAnalyzerFactory[] analyzers = { + AnalyzerFactory[] analyzers = { DEFAULT_ANALYZER_FACTORY, new IgnorantAnalyzerFactory(), new BZip2AnalyzerFactory(), @@ -298,11 +296,11 @@ public class AnalyzerGuru { new EiffelAnalyzerFactory() }; - for (FileAnalyzerFactory analyzer : analyzers) { + for (AnalyzerFactory analyzer : analyzers) { registerAnalyzer(analyzer); } - for (FileAnalyzerFactory analyzer : analyzers) { + for (AnalyzerFactory analyzer : analyzers) { if (analyzer.getName() != null && !analyzer.getName().isEmpty()) { fileTypeDescriptions.put(analyzer.getAnalyzer().getFileTypeName(), analyzer.getName()); } @@ -330,9 +328,9 @@ public class AnalyzerGuru { * @return a value whose lower 32-bits are a static value * 20171230_00 * for the current implementation and whose higher-32 bits are non-zero if - * {@link #addExtension(java.lang.String, org.opengrok.indexer.analysis.FileAnalyzerFactory)} + * {@link #addExtension(java.lang.String, AnalyzerFactory)} * or - * {@link #addPrefix(java.lang.String, org.opengrok.indexer.analysis.FileAnalyzerFactory)} + * {@link #addPrefix(java.lang.String, AnalyzerFactory)} * has been called. */ public static long getVersionNo() { @@ -360,15 +358,15 @@ public static Map getAnalyzersVersionNos() { return Collections.unmodifiableMap(ANALYZER_VERSIONS); } - public static Map getExtensionsMap() { + public static Map getExtensionsMap() { return Collections.unmodifiableMap(ext); } - public static Map getPrefixesMap() { + public static Map getPrefixesMap() { return Collections.unmodifiableMap(pre); } - public static Map getMagicsMap() { + public static Map getMagicsMap() { return Collections.unmodifiableMap(magics); } @@ -380,38 +378,38 @@ public static Map getfileTypeDescriptions() { return Collections.unmodifiableMap(fileTypeDescriptions); } - public List getAnalyzerFactories() { + public List getAnalyzerFactories() { return Collections.unmodifiableList(factories); } /** * Register a {@code FileAnalyzerFactory} instance. */ - private static void registerAnalyzer(FileAnalyzerFactory factory) { + private static void registerAnalyzer(AnalyzerFactory factory) { for (String name : factory.getFileNames()) { - FileAnalyzerFactory old = FILE_NAMES.put(name, factory); + AnalyzerFactory old = FILE_NAMES.put(name, factory); assert old == null : "name '" + name + "' used in multiple analyzers"; } for (String prefix : factory.getPrefixes()) { - FileAnalyzerFactory old = pre.put(prefix, factory); + AnalyzerFactory old = pre.put(prefix, factory); assert old == null : "prefix '" + prefix + "' used in multiple analyzers"; } for (String suffix : factory.getSuffixes()) { - FileAnalyzerFactory old = ext.put(suffix, factory); + AnalyzerFactory old = ext.put(suffix, factory); assert old == null : "suffix '" + suffix + "' used in multiple analyzers"; } for (String magic : factory.getMagicStrings()) { - FileAnalyzerFactory old = magics.put(magic, factory); + AnalyzerFactory old = magics.put(magic, factory); assert old == null : "magic '" + magic + "' used in multiple analyzers"; } matchers.addAll(factory.getMatchers()); factories.add(factory); - FileAnalyzer fa = factory.getAnalyzer(); + AbstractAnalyzer fa = factory.getAnalyzer(); String fileTypeName = fa.getFileTypeName(); FILETYPE_FACTORIES.put(fileTypeName, factory); ANALYZER_VERSIONS.put(fileTypeName, fa.getVersionNo()); @@ -426,8 +424,8 @@ private static void registerAnalyzer(FileAnalyzerFactory factory) { * extension (if you pass null as the analyzer, you will disable the * analyzer used for that extension) */ - public static void addPrefix(String prefix, FileAnalyzerFactory factory) { - FileAnalyzerFactory oldFactory; + public static void addPrefix(String prefix, AnalyzerFactory factory) { + AnalyzerFactory oldFactory; if (factory == null) { oldFactory = pre.remove(prefix); } else { @@ -449,8 +447,8 @@ public static void addPrefix(String prefix, FileAnalyzerFactory factory) { * analyzer used for that extension) */ public static void addExtension(String extension, - FileAnalyzerFactory factory) { - FileAnalyzerFactory oldFactory; + AnalyzerFactory factory) { + AnalyzerFactory oldFactory; if (factory == null) { oldFactory = ext.remove(extension); } else { @@ -467,7 +465,7 @@ public static void addExtension(String extension, * * @return default FileAnalyzer */ - public static FileAnalyzer getAnalyzer() { + public static AbstractAnalyzer getAnalyzer() { return DEFAULT_ANALYZER_FACTORY.getAnalyzer(); } @@ -477,8 +475,8 @@ public static FileAnalyzer getAnalyzer() { * @param fileTypeName a defined name * @return a defined instance if known or otherwise {@code null} */ - public static FileAnalyzer getAnalyzer(String fileTypeName) { - FileAnalyzerFactory factory = FILETYPE_FACTORIES.get(fileTypeName); + public static AbstractAnalyzer getAnalyzer(String fileTypeName) { + AnalyzerFactory factory = FILETYPE_FACTORIES.get(fileTypeName); return factory == null ? null : factory.getAnalyzer(); } @@ -492,10 +490,10 @@ public static FileAnalyzer getAnalyzer(String fileTypeName) { * @throws java.io.IOException If an error occurs while accessing the data * in the input stream. */ - public static FileAnalyzer getAnalyzer(InputStream in, String file) throws IOException { - FileAnalyzerFactory factory = find(in, file); + public static AbstractAnalyzer getAnalyzer(InputStream in, String file) throws IOException { + AnalyzerFactory factory = find(in, file); if (factory == null) { - FileAnalyzer defaultAnalyzer = getAnalyzer(); + AbstractAnalyzer defaultAnalyzer = getAnalyzer(); if (LOGGER.isLoggable(Level.FINE)) { LOGGER.log(Level.FINE, "{0}: fallback {1}", new Object[]{file, @@ -510,7 +508,7 @@ public static FileAnalyzer getAnalyzer(InputStream in, String file) throws IOExc * Free resources associated with all registered analyzers. */ public static void returnAnalyzers() { - for (FileAnalyzerFactory analyzer : factories) { + for (AnalyzerFactory analyzer : factories) { analyzer.returnAnalyzer(); } } @@ -529,7 +527,7 @@ public static void returnAnalyzers() { * an ineligible link */ public void populateDocument(Document doc, File file, String path, - FileAnalyzer fa, Writer xrefOut) throws IOException, + AbstractAnalyzer fa, Writer xrefOut) throws IOException, InterruptedException, ForbiddenSymlinkException { String date = DateTools.timeToString(file.lastModified(), @@ -578,8 +576,8 @@ public void populateDocument(Document doc, File file, String path, } if (fa != null) { - Genre g = fa.getGenre(); - if (g == Genre.PLAIN || g == Genre.XREFABLE || g == Genre.HTML) { + AbstractAnalyzer.Genre g = fa.getGenre(); + if (g == AbstractAnalyzer.Genre.PLAIN || g == AbstractAnalyzer.Genre.XREFABLE || g == AbstractAnalyzer.Genre.HTML) { doc.add(new Field(QueryBuilder.T, g.typeName(), string_ft_stored_nanalyzed_norms)); } fa.analyze(doc, StreamSource.fromFile(file), xrefOut); @@ -601,7 +599,7 @@ public void populateDocument(Document doc, File file, String path, * stream. */ public static String getContentType(InputStream in, String file) throws IOException { - FileAnalyzerFactory factory = find(in, file); + AnalyzerFactory factory = find(in, file); String type = null; if (factory != null) { type = factory.getContentType(); @@ -620,12 +618,12 @@ public static String getContentType(InputStream in, String file) throws IOExcept * @param project Project the file belongs to * @throws java.io.IOException If an error occurs while creating the output */ - public static void writeXref(FileAnalyzerFactory factory, Reader in, + public static void writeXref(AnalyzerFactory factory, Reader in, Writer out, Definitions defs, Annotation annotation, Project project) throws IOException { Reader input = in; - if (factory.getGenre() == Genre.PLAIN) { + if (factory.getGenre() == AbstractAnalyzer.Genre.PLAIN) { // This is some kind of text file, so we need to expand tabs to // spaces to match the project's tab settings. input = ExpandTabsReader.wrap(in, project); @@ -636,7 +634,7 @@ public static void writeXref(FileAnalyzerFactory factory, Reader in, args.setAnnotation(annotation); args.setProject(project); - FileAnalyzer analyzer = factory.getAnalyzer(); + AbstractAnalyzer analyzer = factory.getAnalyzer(); RuntimeEnvironment env = RuntimeEnvironment.getInstance(); analyzer.setScopesEnabled(env.isScopesEnabled()); analyzer.setFoldingEnabled(env.isFoldingEnabled()); @@ -657,7 +655,7 @@ public static void writeXref(FileAnalyzerFactory factory, Reader in, * @throws java.io.IOException if an error occurs while creating the output */ public static void writeDumpedXref(String contextPath, - FileAnalyzerFactory factory, Reader in, Writer out, + AnalyzerFactory factory, Reader in, Writer out, Definitions defs, Annotation annotation, Project project) throws IOException { @@ -678,7 +676,7 @@ public static void writeDumpedXref(String contextPath, * @param file The file to inspect * @return The genre suitable to decide how to display the file */ - public static Genre getGenre(String file) { + public static AbstractAnalyzer.Genre getGenre(String file) { return getGenre(find(file)); } @@ -689,7 +687,7 @@ public static Genre getGenre(String file) { * @return The genre suitable to decide how to display the file * @throws java.io.IOException If an error occurs while getting the content */ - public static Genre getGenre(InputStream in) throws IOException { + public static AbstractAnalyzer.Genre getGenre(InputStream in) throws IOException { return getGenre(find(in)); } @@ -699,7 +697,7 @@ public static Genre getGenre(InputStream in) throws IOException { * @param factory the analyzer factory to get the genre for * @return The genre of this class (null if not found) */ - public static Genre getGenre(FileAnalyzerFactory factory) { + public static AbstractAnalyzer.Genre getGenre(AnalyzerFactory factory) { if (factory != null) { return factory.getGenre(); } @@ -712,7 +710,7 @@ public static Genre getGenre(FileAnalyzerFactory factory) { * @param fileTypeName a defined instance * @return a defined instance or {@code null} */ - public static FileAnalyzerFactory findByFileTypeName(String fileTypeName) { + public static AnalyzerFactory findByFileTypeName(String fileTypeName) { return FILETYPE_FACTORIES.get(fileTypeName); } @@ -733,7 +731,7 @@ public static FileAnalyzerFactory findByFileTypeName(String fileTypeName) { * @throws NoSuchMethodException if no-argument constructor could not be found * @throws InvocationTargetException if the underlying constructor throws an exception */ - public static FileAnalyzerFactory findFactory(String factoryClassName) + public static AnalyzerFactory findFactory(String factoryClassName) throws ClassNotFoundException, IllegalAccessException, InstantiationException, NoSuchMethodException, InvocationTargetException { Class fcn = null; @@ -815,14 +813,14 @@ public static Class getFactoryClass(String simpleName) { * @throws NoSuchMethodException if no-argument constructor could not be found * @throws InvocationTargetException if the underlying constructor throws an exception */ - private static FileAnalyzerFactory findFactory(Class factoryClass) + private static AnalyzerFactory findFactory(Class factoryClass) throws InstantiationException, IllegalAccessException, NoSuchMethodException, InvocationTargetException { - for (FileAnalyzerFactory f : factories) { + for (AnalyzerFactory f : factories) { if (f.getClass() == factoryClass) { return f; } } - FileAnalyzerFactory f = (FileAnalyzerFactory) factoryClass.getDeclaredConstructor().newInstance(); + AnalyzerFactory f = (AnalyzerFactory) factoryClass.getDeclaredConstructor().newInstance(); registerAnalyzer(f); return f; } @@ -840,9 +838,9 @@ private static FileAnalyzerFactory findFactory(Class factoryClass) * @return the analyzer factory to use * @throws java.io.IOException If a problem occurs while reading the data */ - public static FileAnalyzerFactory find(InputStream in, String file) + public static AnalyzerFactory find(InputStream in, String file) throws IOException { - FileAnalyzerFactory factory = find(file); + AnalyzerFactory factory = find(file); // TODO above is not that great, since if 2 analyzers share one extension // then only the first one registered will own it // it would be cool if above could return more analyzers and below would @@ -859,7 +857,7 @@ public static FileAnalyzerFactory find(InputStream in, String file) * @param file The file name to get the analyzer for * @return the analyzer factory to use */ - public static FileAnalyzerFactory find(String file) { + public static AnalyzerFactory find(String file) { String path = file; int i; @@ -871,7 +869,7 @@ public static FileAnalyzerFactory find(String file) { int dotpos = path.lastIndexOf('.'); if (dotpos >= 0) { - FileAnalyzerFactory factory; + AnalyzerFactory factory; // Try matching the prefix. if (dotpos > 0) { @@ -912,7 +910,7 @@ public static FileAnalyzerFactory find(String file) { * @throws java.io.IOException if an error occurs while reading data from * the stream */ - public static FileAnalyzerFactory find(InputStream in) throws IOException { + public static AnalyzerFactory find(InputStream in) throws IOException { return findForStream(in, ""); } @@ -926,7 +924,7 @@ public static FileAnalyzerFactory find(InputStream in) throws IOException { * @throws java.io.IOException if an error occurs while reading data from * the stream */ - private static FileAnalyzerFactory findForStream(InputStream in, + private static AnalyzerFactory findForStream(InputStream in, String file) throws IOException { in.mark(MAGIC_BYTES_NUM); @@ -944,7 +942,7 @@ private static FileAnalyzerFactory findForStream(InputStream in, content = Arrays.copyOf(content, len); } - FileAnalyzerFactory fac; + AnalyzerFactory fac; // First, do precise-magic Matcher matching for (FileAnalyzerFactory.Matcher matcher : matchers) { @@ -987,13 +985,13 @@ private static FileAnalyzerFactory findForStream(InputStream in, return null; } - private static FileAnalyzerFactory findMagicString(String opening, + private static AnalyzerFactory findMagicString(String opening, String file) throws IOException { // first, try to look up two words in magics String fragment = getWords(opening, 2); - FileAnalyzerFactory fac = magics.get(fragment); + AnalyzerFactory fac = magics.get(fragment); if (fac != null) { if (LOGGER.isLoggable(Level.FINER)) { LOGGER.log(Level.FINER, "{0}: chosen by magic {2}: {1}", @@ -1016,7 +1014,7 @@ private static FileAnalyzerFactory findMagicString(String opening, } // try to match initial substrings (DESC strlen) - for (Map.Entry entry : + for (Map.Entry entry : magics.entrySet()) { String magic = entry.getKey(); if (opening.startsWith(magic)) { @@ -1144,8 +1142,8 @@ private static void addCustomizationKey(String k) { customizationHashCode = Objects.hash(keys); } - private static boolean factoriesDifferent(FileAnalyzerFactory a, - FileAnalyzerFactory b) { + private static boolean factoriesDifferent(AnalyzerFactory a, + AnalyzerFactory b) { String a_name = null; if (a != null) { a_name = a.getName(); diff --git a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/AnalyzerGuruHelp.java b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/AnalyzerGuruHelp.java index 63f368e647e..fe848d5248b 100644 --- a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/AnalyzerGuruHelp.java +++ b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/AnalyzerGuruHelp.java @@ -77,7 +77,7 @@ public static String getUsage() { return b.toString(); } - private static String reportable(FileAnalyzerFactory fac) { + private static String reportable(AnalyzerFactory fac) { String nm = fac.getName(); return nm == null ? fac.getClass().getSimpleName() : nm; } @@ -182,7 +182,7 @@ private static int nextTestWhitespaceLength(boolean match, String str, } private static List byKey( - Map mapped) { + Map mapped) { List res = mapped.entrySet().stream().map((t) -> { return new MappedFactory(t.getKey(), t.getValue()); @@ -196,7 +196,7 @@ private static List byKey( } private static List byFactory( - Map mapped) { + Map mapped) { List res = mapped.entrySet().stream().map((t) -> { return new MappedFactory(t.getKey(), t.getValue()); @@ -218,8 +218,9 @@ private static List byFactory( private static class MappedFactory { public final String key; - public final FileAnalyzerFactory fac; - MappedFactory(String key, FileAnalyzerFactory fac) { + public final AnalyzerFactory fac; + + MappedFactory(String key, AnalyzerFactory fac) { this.key = key; this.fac = fac; } diff --git a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/CompatibleAnalyser.java b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/CompatibleAnalyser.java index 25f14158010..a06f1317aec 100644 --- a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/CompatibleAnalyser.java +++ b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/CompatibleAnalyser.java @@ -57,12 +57,12 @@ protected TokenStreamComponents createComponents(String fieldName) { private JFlexTokenizer createPlainSymbolTokenizer() { return new JFlexTokenizer(new PlainSymbolTokenizer( - FileAnalyzer.dummyReader)); + AbstractAnalyzer.DUMMY_READER)); } private JFlexTokenizer createPlainFullTokenizer() { return new JFlexTokenizer(new PlainFullTokenizer( - FileAnalyzer.dummyReader)); + AbstractAnalyzer.DUMMY_READER)); } @Override diff --git a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/FileAnalyzer.java b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/FileAnalyzer.java index 81c7dab78d5..4a87c472859 100644 --- a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/FileAnalyzer.java +++ b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/FileAnalyzer.java @@ -25,13 +25,10 @@ package org.opengrok.indexer.analysis; import java.io.IOException; -import java.io.Reader; -import java.io.StringReader; import java.io.Writer; import java.util.Locale; import java.util.logging.Level; import java.util.logging.Logger; - import org.apache.lucene.analysis.Analyzer; import org.apache.lucene.analysis.LowerCaseFilter; import org.apache.lucene.analysis.TokenStream; @@ -39,7 +36,6 @@ import org.apache.lucene.document.StoredField; import org.opengrok.indexer.analysis.plain.PlainFullTokenizer; import org.opengrok.indexer.analysis.plain.PlainSymbolTokenizer; -import org.opengrok.indexer.configuration.Project; import org.opengrok.indexer.logger.LoggerFactory; import org.opengrok.indexer.search.QueryBuilder; @@ -59,76 +55,10 @@ * * @author Chandan */ -public class FileAnalyzer extends Analyzer { +public class FileAnalyzer extends AbstractAnalyzer { private static final Logger LOGGER = LoggerFactory.getLogger(FileAnalyzer.class); - protected Project project; - protected Ctags ctags; - protected boolean scopesEnabled; - protected boolean foldingEnabled; - private final FileAnalyzerFactory factory; - - /** - * What kind of file is this? - */ - public enum Genre { - /** - * xrefed - line numbered context - */ - PLAIN("p"), - /** - * xrefed - summarizer context - */ - XREFABLE("x"), - /** - * not xrefed - no context - used by diff/list - */ - IMAGE("i"), - /** - * not xrefed - no context - */ - DATA("d"), - /** - * not xrefed - summarizer context from original file - */ - HTML("h"); - private final String typeName; - - Genre(String typename) { - this.typeName = typename; - } - - /** - * Get the type name value used to tag lucene documents. - * - * @return a none-null string. - */ - public String typeName() { - return typeName; - } - - /** - * Get the Genre for the given type name. - * - * @param typeName name to check - * @return {@code null} if it doesn't match any genre, the genre - * otherwise. - * @see #typeName() - */ - public static Genre get(String typeName) { - if (typeName == null) { - return null; - } - for (Genre g : values()) { - if (g.typeName.equals(typeName)) { - return g; - } - } - return null; - } - } - /** * Gets a version number to be used to tag processed documents so that * re-analysis can be re-done later if a stored version number is different @@ -140,61 +70,23 @@ public static Genre get(String typeName) { * {@link #getSpecializedVersionNo()} to allow changes that affect a few. * @return (20061115_01 << 32) | {@link #getSpecializedVersionNo()} */ + @Override public final long getVersionNo() { final int rootVersionNo = 20061115_01; // Edit comment above too! return ((long)rootVersionNo << 32) | getSpecializedVersionNo(); } - /** - * Subclasses should override to produce a value relevant for the evolution - * of their analysis in each release. - * @return 0 - */ - protected int getSpecializedVersionNo() { - return 0; // FileAnalyzer is not specialized. - } - - public void setCtags(Ctags ctags) { - this.ctags = ctags; - } - - public void setProject(Project project) { - this.project = project; - } - - public void setScopesEnabled(boolean scopesEnabled) { - this.scopesEnabled = supportsScopes() && scopesEnabled; - } - - public void setFoldingEnabled(boolean foldingEnabled) { - this.foldingEnabled = supportsScopes() && foldingEnabled; - } - + @Override protected boolean supportsScopes() { return false; } - /** - * Get the factory which created this analyzer. - * - * @return the {@code FileAnalyzerFactory} which created this analyzer - */ - public final FileAnalyzerFactory getFactory() { - return factory; - } - - public Genre getGenre() { - return factory.getGenre(); - } - - public static Reader dummyReader = new StringReader(""); - /** * Creates a new instance of FileAnalyzer * * @param factory defined instance for the analyzer */ - public FileAnalyzer(FileAnalyzerFactory factory) { + public FileAnalyzer(AnalyzerFactory factory) { super(Analyzer.PER_FIELD_REUSE_STRATEGY); if (factory == null) { throw new IllegalArgumentException("`factory' is null"); @@ -209,7 +101,7 @@ public FileAnalyzer(FileAnalyzerFactory factory) { * @param factory defined instance for the analyzer * @param symbolTokenizer a defined instance relevant for the file */ - protected FileAnalyzer(FileAnalyzerFactory factory, + protected FileAnalyzer(AnalyzerFactory factory, JFlexTokenizer symbolTokenizer) { super(Analyzer.PER_FIELD_REUSE_STRATEGY); @@ -230,6 +122,7 @@ protected FileAnalyzer(FileAnalyzerFactory factory, * * @return Normalized name of the analyzer. */ + @Override public String getFileTypeName() { String name = this.getClass().getSimpleName().toLowerCase(Locale.ROOT); String suffix = "analyzer"; @@ -252,6 +145,7 @@ public String getFileTypeName() { * @throws IOException if any I/O error * @throws InterruptedException if a timeout occurs */ + @Override public void analyze(Document doc, StreamSource src, Writer xrefOut) throws IOException, InterruptedException { // not used @@ -265,14 +159,12 @@ public void analyze(Document doc, StreamSource src, Writer xrefOut) * @return the instance used to write the cross-referencing * @throws java.io.IOException if an error occurs */ + @Override public Xrefer writeXref(WriteXrefArgs args) throws IOException { throw new UnsupportedOperationException( "Base FileAnalyzer cannot write xref"); } - // you analyzer HAS to override this to get proper symbols in results - protected final JFlexTokenizer symbolTokenizer; - @Override protected TokenStreamComponents createComponents(String fieldName) { switch (fieldName) { @@ -301,6 +193,7 @@ protected TokenStreamComponents createComponents(String fieldName) { * @param doc the target document * @param value the number of lines */ + @Override protected void addNumLines(Document doc, int value) { doc.add(new StoredField(QueryBuilder.NUML, value)); } @@ -310,18 +203,19 @@ protected void addNumLines(Document doc, int value) { * @param doc the target document * @param value the loc */ + @Override protected void addLOC(Document doc, int value) { doc.add(new StoredField(QueryBuilder.LOC, value)); } private JFlexTokenizer createPlainSymbolTokenizer() { return new JFlexTokenizer(new PlainSymbolTokenizer( - FileAnalyzer.dummyReader)); + AbstractAnalyzer.DUMMY_READER)); } private JFlexTokenizer createPlainFullTokenizer() { return new JFlexTokenizer(new PlainFullTokenizer( - FileAnalyzer.dummyReader)); + AbstractAnalyzer.DUMMY_READER)); } @Override diff --git a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/FileAnalyzerFactory.java b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/FileAnalyzerFactory.java index b00db248705..5ab022aa835 100644 --- a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/FileAnalyzerFactory.java +++ b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/FileAnalyzerFactory.java @@ -28,35 +28,13 @@ import java.util.Arrays; import java.util.Collections; import java.util.List; -import org.opengrok.indexer.analysis.FileAnalyzer.Genre; /** * Factory class which creates a {@code FileAnalyzer} object and * provides information about this type of analyzers. */ -public class FileAnalyzerFactory { +public class FileAnalyzerFactory extends AnalyzerFactory { - /** Cached analyzer object for the current thread (analyzer objects can be - * expensive to allocate). */ - private final ThreadLocal cachedAnalyzer; - /** List of file names on which this kind of analyzer should be used. */ - private final List names; - /** List of file prefixes on which this kind of analyzer should be - * used. */ - private final List prefixes; - /** List of file extensions on which this kind of analyzer should be - * used. */ - private final List suffixes; - /** List of magic strings used to recognize files on which this kind of - * analyzer should be used. */ - private final List magics; - /** List of matchers which delegate files to different types of - * analyzers. */ - private final List matchers; - /** The content type for the files recognized by this kind of analyzer. */ - private final String contentType; - /** The genre for files recognized by this kind of analyzer. */ - private final Genre genre; /** The user friendly name of this analyzer. */ private final String name; @@ -84,19 +62,13 @@ public class FileAnalyzerFactory { protected FileAnalyzerFactory( String[] names, String[] prefixes, String[] suffixes, String[] magics, Matcher matcher, String contentType, - Genre genre, String name) { - cachedAnalyzer = new ThreadLocal<>(); + AbstractAnalyzer.Genre genre, String name) { + super(matcher, contentType); this.names = asList(names); this.prefixes = asList(prefixes); this.suffixes = asList(suffixes); this.magics = asList(magics); - if (matcher == null) { - this.matchers = Collections.emptyList(); - } else { - this.matchers = Collections.singletonList(matcher); - } - this.contentType = contentType; - this.genre = (genre == null) ? Genre.DATA : genre; + this.genre = (genre == null) ? AbstractAnalyzer.Genre.DATA : genre; this.name = name; } @@ -113,80 +85,11 @@ private static List asList(T[] a) { return Collections.unmodifiableList(Arrays.asList(a)); } - /** - * Get the list of file names recognized by this analyzer (names must - * match exactly, ignoring case). - * - * @return list of file names - */ - final List getFileNames() { - return names; - } - - /** - * Get the list of file prefixes recognized by this analyzer. - * @return list of prefixes - */ - final List getPrefixes() { - return prefixes; - } - - /** - * Get the list of file extensions recognized by this analyzer. - * @return list of suffixes - */ - final List getSuffixes() { - return suffixes; - } - - /** - * Get the list of magic strings recognized by this analyzer. If a file - * starts with one of these strings, an analyzer created by this factory - * should be used to analyze it. - * - *

Note: Currently this assumes that the file is encoded with - * UTF-8 unless a BOM is detected. - * - * @return list of magic strings - */ - final List getMagicStrings() { - return magics; - } - - /** - * Get matchers that map file contents to analyzer factories - * programmatically. - * - * @return list of matchers - */ - final List getMatchers() { - return matchers; - } - - /** - * Get the content type (MIME type) for analyzers returned by this factory. - * @return content type (could be {@code null} if it is unknown) - */ - final String getContentType() { - return contentType; - } - - /** - * The genre this analyzer factory belongs to. - * @return a genre - */ - public final Genre getGenre() { - return genre; - } - - /** - * The user friendly name of this analyzer - * @return a genre - */ - public final String getName() { + @Override + public String getName() { return name; } - + /** * Get an analyzer. If the same thread calls this method multiple times on * the same factory object, the exact same analyzer object will be returned @@ -196,8 +99,9 @@ public final String getName() { * @return a {@code FileAnalyzer} instance * @see #newAnalyzer() */ - public final FileAnalyzer getAnalyzer() { - FileAnalyzer fa = cachedAnalyzer.get(); + @Override + public final AbstractAnalyzer getAnalyzer() { + AbstractAnalyzer fa = cachedAnalyzer.get(); if (fa == null) { fa = newAnalyzer(); cachedAnalyzer.set(fa); @@ -208,6 +112,7 @@ public final FileAnalyzer getAnalyzer() { /** * Free thread-local data. */ + @Override public void returnAnalyzer() { cachedAnalyzer.remove(); } @@ -216,7 +121,8 @@ public void returnAnalyzer() { * Create a new analyzer. * @return an analyzer */ - protected FileAnalyzer newAnalyzer() { + @Override + protected AbstractAnalyzer newAnalyzer() { return new FileAnalyzer(this); } @@ -255,7 +161,7 @@ default String description() { * if they don't match any factory known by this matcher * @throws java.io.IOException in case of any read error */ - FileAnalyzerFactory isMagic(byte[] contents, InputStream in) + AnalyzerFactory isMagic(byte[] contents, InputStream in) throws IOException; /** @@ -263,6 +169,6 @@ FileAnalyzerFactory isMagic(byte[] contents, InputStream in) * {@link #isMagic(byte[], java.io.InputStream)} matches a file. * @return a defined instance */ - FileAnalyzerFactory forFactory(); + AnalyzerFactory forFactory(); } } diff --git a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/HistoryAnalyzer.java b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/HistoryAnalyzer.java index bb2cfe3d0bf..b4a77f12d46 100644 --- a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/HistoryAnalyzer.java +++ b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/HistoryAnalyzer.java @@ -24,9 +24,9 @@ package org.opengrok.indexer.analysis; import org.apache.lucene.analysis.Analyzer; -import org.apache.lucene.analysis.StopFilter; import org.apache.lucene.analysis.CharArraySet; import org.apache.lucene.analysis.LowerCaseFilter; +import org.apache.lucene.analysis.StopFilter; import org.apache.lucene.analysis.TokenStream; import org.opengrok.indexer.analysis.plain.PlainFullTokenizer; @@ -62,7 +62,7 @@ public HistoryAnalyzer() { @Override protected TokenStreamComponents createComponents(String fieldName) { JFlexTokenizer plainfull = new JFlexTokenizer(new PlainFullTokenizer( - FileAnalyzer.dummyReader)); + AbstractAnalyzer.DUMMY_READER)); //we are counting position increments, this might affect the queries //later and need to be in sync, especially for highlighting of results return new TokenStreamComponents(plainfull, new StopFilter(plainfull, diff --git a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/TextAnalyzer.java b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/TextAnalyzer.java index d6b8c0bcdf5..f76fe8a36b9 100644 --- a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/TextAnalyzer.java +++ b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/TextAnalyzer.java @@ -35,7 +35,7 @@ public abstract class TextAnalyzer extends FileAnalyzer { * Creates a new instance of {@link TextAnalyzer}. * @param factory defined instance for the analyzer */ - protected TextAnalyzer(FileAnalyzerFactory factory) { + protected TextAnalyzer(AnalyzerFactory factory) { super(factory); } @@ -44,7 +44,7 @@ protected TextAnalyzer(FileAnalyzerFactory factory) { * @param factory defined instance for the analyzer * @param symbolTokenizer defined instance for the analyzer */ - protected TextAnalyzer(FileAnalyzerFactory factory, + protected TextAnalyzer(AnalyzerFactory factory, JFlexTokenizer symbolTokenizer) { super(factory, symbolTokenizer); } diff --git a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/ada/AdaAnalyzer.java b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/ada/AdaAnalyzer.java index 0be8cdaad77..6b46ad1e3d6 100644 --- a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/ada/AdaAnalyzer.java +++ b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/ada/AdaAnalyzer.java @@ -24,8 +24,8 @@ package org.opengrok.indexer.analysis.ada; import java.io.Reader; -import org.opengrok.indexer.analysis.FileAnalyzer; -import org.opengrok.indexer.analysis.FileAnalyzerFactory; +import org.opengrok.indexer.analysis.AbstractAnalyzer; +import org.opengrok.indexer.analysis.AnalyzerFactory; import org.opengrok.indexer.analysis.JFlexTokenizer; import org.opengrok.indexer.analysis.JFlexXref; import org.opengrok.indexer.analysis.plain.AbstractSourceCodeAnalyzer; @@ -42,9 +42,9 @@ public class AdaAnalyzer extends AbstractSourceCodeAnalyzer { * Creates a new instance of {@link AdaAnalyzer} * @param factory defined instance for the analyzer */ - protected AdaAnalyzer(FileAnalyzerFactory factory) { + protected AdaAnalyzer(AnalyzerFactory factory) { super(factory, new JFlexTokenizer(new AdaSymbolTokenizer( - FileAnalyzer.dummyReader))); + AbstractAnalyzer.DUMMY_READER))); } /** diff --git a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/ada/AdaAnalyzerFactory.java b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/ada/AdaAnalyzerFactory.java index c13d6ad5fc2..2881a5e3da4 100644 --- a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/ada/AdaAnalyzerFactory.java +++ b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/ada/AdaAnalyzerFactory.java @@ -24,8 +24,7 @@ package org.opengrok.indexer.analysis.ada; -import org.opengrok.indexer.analysis.FileAnalyzer; -import org.opengrok.indexer.analysis.FileAnalyzer.Genre; +import org.opengrok.indexer.analysis.AbstractAnalyzer; import org.opengrok.indexer.analysis.FileAnalyzerFactory; /** @@ -43,11 +42,11 @@ public class AdaAnalyzerFactory extends FileAnalyzerFactory { }; public AdaAnalyzerFactory() { - super(null, null, SUFFIXES, null, null, "text/plain", Genre.PLAIN, name); + super(null, null, SUFFIXES, null, null, "text/plain", AbstractAnalyzer.Genre.PLAIN, name); } @Override - protected FileAnalyzer newAnalyzer() { + protected AbstractAnalyzer newAnalyzer() { return new AdaAnalyzer(this); } } diff --git a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/ada/AdaLexHelper.java b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/ada/AdaLexHelper.java index 6309d5956cf..cbc47d4a254 100644 --- a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/ada/AdaLexHelper.java +++ b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/ada/AdaLexHelper.java @@ -24,8 +24,8 @@ package org.opengrok.indexer.analysis.ada; import java.io.IOException; -import org.opengrok.indexer.analysis.Resettable; import org.opengrok.indexer.analysis.JFlexJointLexer; +import org.opengrok.indexer.analysis.Resettable; /** * Represents an API for object's using {@link AdaLexHelper} diff --git a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/archive/BZip2Analyzer.java b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/archive/BZip2Analyzer.java index 3b401f60e3b..1ba6dfc4cea 100644 --- a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/archive/BZip2Analyzer.java +++ b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/archive/BZip2Analyzer.java @@ -30,9 +30,10 @@ import org.apache.lucene.document.Document; import org.apache.lucene.document.Field; import org.apache.tools.bzip2.CBZip2InputStream; +import org.opengrok.indexer.analysis.AbstractAnalyzer; +import org.opengrok.indexer.analysis.AnalyzerFactory; import org.opengrok.indexer.analysis.AnalyzerGuru; import org.opengrok.indexer.analysis.FileAnalyzer; -import org.opengrok.indexer.analysis.FileAnalyzerFactory; import org.opengrok.indexer.analysis.StreamSource; /** @@ -52,7 +53,7 @@ public Genre getGenre() { return super.getGenre(); } - protected BZip2Analyzer(FileAnalyzerFactory factory) { + protected BZip2Analyzer(AnalyzerFactory factory) { super(factory); } @@ -70,7 +71,7 @@ protected int getSpecializedVersionNo() { @Override public void analyze(Document doc, StreamSource src, Writer xrefOut) throws IOException, InterruptedException { - FileAnalyzer fa; + AbstractAnalyzer fa; StreamSource bzSrc = wrap(src); String path = doc.get("path"); diff --git a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/archive/BZip2AnalyzerFactory.java b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/archive/BZip2AnalyzerFactory.java index 4df15fb6448..f807e5b1aac 100644 --- a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/archive/BZip2AnalyzerFactory.java +++ b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/archive/BZip2AnalyzerFactory.java @@ -23,7 +23,7 @@ package org.opengrok.indexer.analysis.archive; -import org.opengrok.indexer.analysis.FileAnalyzer; +import org.opengrok.indexer.analysis.AbstractAnalyzer; import org.opengrok.indexer.analysis.FileAnalyzerFactory; public class BZip2AnalyzerFactory extends FileAnalyzerFactory { @@ -43,7 +43,7 @@ public BZip2AnalyzerFactory() { } @Override - protected FileAnalyzer newAnalyzer() { + protected AbstractAnalyzer newAnalyzer() { return new BZip2Analyzer(this); } } diff --git a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/archive/GZIPAnalyzer.java b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/archive/GZIPAnalyzer.java index 142eb128f23..ab2ee17cc37 100644 --- a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/archive/GZIPAnalyzer.java +++ b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/archive/GZIPAnalyzer.java @@ -33,9 +33,10 @@ import java.util.zip.GZIPInputStream; import org.apache.lucene.document.Document; import org.apache.lucene.document.Field; +import org.opengrok.indexer.analysis.AbstractAnalyzer; +import org.opengrok.indexer.analysis.AnalyzerFactory; import org.opengrok.indexer.analysis.AnalyzerGuru; import org.opengrok.indexer.analysis.FileAnalyzer; -import org.opengrok.indexer.analysis.FileAnalyzerFactory; import org.opengrok.indexer.analysis.StreamSource; import org.opengrok.indexer.logger.LoggerFactory; @@ -58,7 +59,7 @@ public Genre getGenre() { return super.getGenre(); } - protected GZIPAnalyzer(FileAnalyzerFactory factory) { + protected GZIPAnalyzer(AnalyzerFactory factory) { super(factory); } @@ -76,7 +77,7 @@ protected int getSpecializedVersionNo() { @Override public void analyze(Document doc, StreamSource src, Writer xrefOut) throws IOException, InterruptedException { - FileAnalyzer fa; + AbstractAnalyzer fa; StreamSource gzSrc = wrap(src); String path = doc.get("path"); diff --git a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/archive/GZIPAnalyzerFactory.java b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/archive/GZIPAnalyzerFactory.java index 5b7d9827281..433d15304d0 100644 --- a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/archive/GZIPAnalyzerFactory.java +++ b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/archive/GZIPAnalyzerFactory.java @@ -23,7 +23,7 @@ package org.opengrok.indexer.analysis.archive; -import org.opengrok.indexer.analysis.FileAnalyzer; +import org.opengrok.indexer.analysis.AbstractAnalyzer; import org.opengrok.indexer.analysis.FileAnalyzerFactory; public class GZIPAnalyzerFactory extends FileAnalyzerFactory { @@ -43,7 +43,7 @@ public GZIPAnalyzerFactory() { } @Override - protected FileAnalyzer newAnalyzer() { + protected AbstractAnalyzer newAnalyzer() { return new GZIPAnalyzer(this); } } diff --git a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/archive/TarAnalyzer.java b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/archive/TarAnalyzer.java index 80b72ab50e1..85ee147e4bf 100644 --- a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/archive/TarAnalyzer.java +++ b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/archive/TarAnalyzer.java @@ -29,11 +29,11 @@ import org.apache.lucene.document.Document; import org.apache.tools.tar.TarEntry; import org.apache.tools.tar.TarInputStream; +import org.opengrok.indexer.analysis.AnalyzerFactory; import org.opengrok.indexer.analysis.FileAnalyzer; -import org.opengrok.indexer.analysis.FileAnalyzerFactory; import org.opengrok.indexer.analysis.IteratorReader; -import org.opengrok.indexer.analysis.StreamSource; import org.opengrok.indexer.analysis.OGKTextField; +import org.opengrok.indexer.analysis.StreamSource; import org.opengrok.indexer.search.QueryBuilder; import org.opengrok.indexer.web.Util; @@ -44,7 +44,7 @@ */ public class TarAnalyzer extends FileAnalyzer { - protected TarAnalyzer(FileAnalyzerFactory factory) { + protected TarAnalyzer(AnalyzerFactory factory) { super(factory); } diff --git a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/archive/TarAnalyzerFactory.java b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/archive/TarAnalyzerFactory.java index a615dd254ae..78264702f0b 100644 --- a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/archive/TarAnalyzerFactory.java +++ b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/archive/TarAnalyzerFactory.java @@ -23,8 +23,7 @@ package org.opengrok.indexer.analysis.archive; -import org.opengrok.indexer.analysis.FileAnalyzer; -import org.opengrok.indexer.analysis.FileAnalyzer.Genre; +import org.opengrok.indexer.analysis.AbstractAnalyzer; import org.opengrok.indexer.analysis.FileAnalyzerFactory; public class TarAnalyzerFactory extends FileAnalyzerFactory { @@ -36,11 +35,11 @@ public class TarAnalyzerFactory extends FileAnalyzerFactory { }; public TarAnalyzerFactory() { - super(null, null, SUFFIXES, null, null, null, Genre.XREFABLE, name); + super(null, null, SUFFIXES, null, null, null, AbstractAnalyzer.Genre.XREFABLE, name); } @Override - protected FileAnalyzer newAnalyzer() { + protected AbstractAnalyzer newAnalyzer() { return new TarAnalyzer(this); } } diff --git a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/archive/ZipAnalyzer.java b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/archive/ZipAnalyzer.java index 8c640d205a5..ee9eb19ea5b 100644 --- a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/archive/ZipAnalyzer.java +++ b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/archive/ZipAnalyzer.java @@ -29,11 +29,11 @@ import java.util.zip.ZipEntry; import java.util.zip.ZipInputStream; import org.apache.lucene.document.Document; +import org.opengrok.indexer.analysis.AnalyzerFactory; import org.opengrok.indexer.analysis.FileAnalyzer; -import org.opengrok.indexer.analysis.FileAnalyzerFactory; import org.opengrok.indexer.analysis.IteratorReader; -import org.opengrok.indexer.analysis.StreamSource; import org.opengrok.indexer.analysis.OGKTextField; +import org.opengrok.indexer.analysis.StreamSource; import org.opengrok.indexer.search.QueryBuilder; import org.opengrok.indexer.web.Util; @@ -44,7 +44,7 @@ */ public class ZipAnalyzer extends FileAnalyzer { - protected ZipAnalyzer(FileAnalyzerFactory factory) { + protected ZipAnalyzer(AnalyzerFactory factory) { super(factory); } diff --git a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/archive/ZipAnalyzerFactory.java b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/archive/ZipAnalyzerFactory.java index a05b3b2e6ed..6fc3c54e072 100644 --- a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/archive/ZipAnalyzerFactory.java +++ b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/archive/ZipAnalyzerFactory.java @@ -24,8 +24,8 @@ package org.opengrok.indexer.analysis.archive; -import org.opengrok.indexer.analysis.FileAnalyzer; -import org.opengrok.indexer.analysis.FileAnalyzer.Genre; +import org.opengrok.indexer.analysis.AbstractAnalyzer; +import org.opengrok.indexer.analysis.AnalyzerFactory; import org.opengrok.indexer.analysis.FileAnalyzerFactory; public final class ZipAnalyzerFactory extends FileAnalyzerFactory { @@ -44,7 +44,7 @@ public String description() { } @Override - public FileAnalyzerFactory forFactory() { + public AnalyzerFactory forFactory() { return ZipAnalyzerFactory.DEFAULT_INSTANCE; } @@ -58,11 +58,11 @@ protected boolean doesCheckExtraFieldID() { new ZipAnalyzerFactory(); private ZipAnalyzerFactory() { - super(null, null, SUFFIXES, null, MATCHER, null, Genre.XREFABLE, name); + super(null, null, SUFFIXES, null, MATCHER, null, AbstractAnalyzer.Genre.XREFABLE, name); } @Override - protected FileAnalyzer newAnalyzer() { + protected AbstractAnalyzer newAnalyzer() { return new ZipAnalyzer(this); } } diff --git a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/archive/ZipMatcherBase.java b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/archive/ZipMatcherBase.java index 042e72c9a05..0143cd4d7aa 100644 --- a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/archive/ZipMatcherBase.java +++ b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/archive/ZipMatcherBase.java @@ -26,6 +26,7 @@ import java.io.IOException; import java.io.InputStream; +import org.opengrok.indexer.analysis.AnalyzerFactory; import org.opengrok.indexer.analysis.FileAnalyzerFactory; /** @@ -45,7 +46,7 @@ public abstract class ZipMatcherBase implements FileAnalyzerFactory.Matcher { public boolean getIsPreciseMagic() { return true; } @Override - public FileAnalyzerFactory isMagic(byte[] contents, InputStream in) + public AnalyzerFactory isMagic(byte[] contents, InputStream in) throws IOException { assert in.markSupported(); if (contents.length < MAGIC.length) { diff --git a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/c/CAnalyzer.java b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/c/CAnalyzer.java index 3d98c6d1b4a..7ca3113913c 100644 --- a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/c/CAnalyzer.java +++ b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/c/CAnalyzer.java @@ -24,8 +24,8 @@ package org.opengrok.indexer.analysis.c; import java.io.Reader; -import org.opengrok.indexer.analysis.FileAnalyzer; -import org.opengrok.indexer.analysis.FileAnalyzerFactory; +import org.opengrok.indexer.analysis.AbstractAnalyzer; +import org.opengrok.indexer.analysis.AnalyzerFactory; import org.opengrok.indexer.analysis.JFlexTokenizer; import org.opengrok.indexer.analysis.JFlexXref; import org.opengrok.indexer.analysis.plain.AbstractSourceCodeAnalyzer; @@ -43,9 +43,9 @@ public class CAnalyzer extends AbstractSourceCodeAnalyzer { * Creates a new instance of CAnalyzer * @param factory defined instance for the analyzer */ - protected CAnalyzer(FileAnalyzerFactory factory) { + protected CAnalyzer(AnalyzerFactory factory) { super(factory, new JFlexTokenizer(new CSymbolTokenizer( - FileAnalyzer.dummyReader))); + AbstractAnalyzer.DUMMY_READER))); } /** diff --git a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/c/CAnalyzerFactory.java b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/c/CAnalyzerFactory.java index 496c6a12237..be02371106a 100644 --- a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/c/CAnalyzerFactory.java +++ b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/c/CAnalyzerFactory.java @@ -23,8 +23,7 @@ package org.opengrok.indexer.analysis.c; -import org.opengrok.indexer.analysis.FileAnalyzer; -import org.opengrok.indexer.analysis.FileAnalyzer.Genre; +import org.opengrok.indexer.analysis.AbstractAnalyzer; import org.opengrok.indexer.analysis.FileAnalyzerFactory; public class CAnalyzerFactory extends FileAnalyzerFactory { @@ -46,11 +45,11 @@ public class CAnalyzerFactory extends FileAnalyzerFactory { }; public CAnalyzerFactory() { - super(null, null, SUFFIXES, null, null, "text/plain", Genre.PLAIN, name); + super(null, null, SUFFIXES, null, null, "text/plain", AbstractAnalyzer.Genre.PLAIN, name); } @Override - protected FileAnalyzer newAnalyzer() { + protected AbstractAnalyzer newAnalyzer() { return new CAnalyzer(this); } } diff --git a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/c/CxxAnalyzer.java b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/c/CxxAnalyzer.java index dd4888e471c..62f5dfe2d75 100644 --- a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/c/CxxAnalyzer.java +++ b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/c/CxxAnalyzer.java @@ -24,8 +24,8 @@ package org.opengrok.indexer.analysis.c; import java.io.Reader; -import org.opengrok.indexer.analysis.FileAnalyzer; -import org.opengrok.indexer.analysis.FileAnalyzerFactory; +import org.opengrok.indexer.analysis.AbstractAnalyzer; +import org.opengrok.indexer.analysis.AnalyzerFactory; import org.opengrok.indexer.analysis.JFlexTokenizer; import org.opengrok.indexer.analysis.JFlexXref; import org.opengrok.indexer.analysis.plain.AbstractSourceCodeAnalyzer; @@ -41,9 +41,9 @@ public class CxxAnalyzer extends AbstractSourceCodeAnalyzer { * Creates a new instance of {@link CxxAnalyzer}. * @param factory defined instance for the analyzer */ - protected CxxAnalyzer(FileAnalyzerFactory factory) { + protected CxxAnalyzer(AnalyzerFactory factory) { super(factory, new JFlexTokenizer(new CxxSymbolTokenizer( - FileAnalyzer.dummyReader))); + AbstractAnalyzer.DUMMY_READER))); } /** diff --git a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/c/CxxAnalyzerFactory.java b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/c/CxxAnalyzerFactory.java index 62ae98ed428..9b1b4ae5900 100644 --- a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/c/CxxAnalyzerFactory.java +++ b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/c/CxxAnalyzerFactory.java @@ -22,8 +22,7 @@ */ package org.opengrok.indexer.analysis.c; -import org.opengrok.indexer.analysis.FileAnalyzer; -import org.opengrok.indexer.analysis.FileAnalyzer.Genre; +import org.opengrok.indexer.analysis.AbstractAnalyzer; import org.opengrok.indexer.analysis.FileAnalyzerFactory; public class CxxAnalyzerFactory extends FileAnalyzerFactory { @@ -43,11 +42,11 @@ public class CxxAnalyzerFactory extends FileAnalyzerFactory { }; public CxxAnalyzerFactory() { - super(null, null, SUFFIXES, null, null, "text/plain", Genre.PLAIN, name); + super(null, null, SUFFIXES, null, null, "text/plain", AbstractAnalyzer.Genre.PLAIN, name); } @Override - protected FileAnalyzer newAnalyzer() { + protected AbstractAnalyzer newAnalyzer() { return new CxxAnalyzer(this); } } diff --git a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/clojure/ClojureAnalyzer.java b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/clojure/ClojureAnalyzer.java index b188f35c460..883e71f8962 100644 --- a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/clojure/ClojureAnalyzer.java +++ b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/clojure/ClojureAnalyzer.java @@ -24,17 +24,17 @@ package org.opengrok.indexer.analysis.clojure; import java.io.Reader; -import org.opengrok.indexer.analysis.FileAnalyzer; -import org.opengrok.indexer.analysis.FileAnalyzerFactory; +import org.opengrok.indexer.analysis.AbstractAnalyzer; +import org.opengrok.indexer.analysis.AnalyzerFactory; import org.opengrok.indexer.analysis.JFlexTokenizer; import org.opengrok.indexer.analysis.JFlexXref; import org.opengrok.indexer.analysis.plain.AbstractSourceCodeAnalyzer; public class ClojureAnalyzer extends AbstractSourceCodeAnalyzer { - protected ClojureAnalyzer(FileAnalyzerFactory factory) { + protected ClojureAnalyzer(AnalyzerFactory factory) { super(factory, new JFlexTokenizer(new ClojureSymbolTokenizer( - FileAnalyzer.dummyReader))); + AbstractAnalyzer.DUMMY_READER))); } /** diff --git a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/clojure/ClojureAnalyzerFactory.java b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/clojure/ClojureAnalyzerFactory.java index 0e45f10fe31..b19e798dec5 100644 --- a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/clojure/ClojureAnalyzerFactory.java +++ b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/clojure/ClojureAnalyzerFactory.java @@ -22,8 +22,7 @@ */ package org.opengrok.indexer.analysis.clojure; -import org.opengrok.indexer.analysis.FileAnalyzer; -import org.opengrok.indexer.analysis.FileAnalyzer.Genre; +import org.opengrok.indexer.analysis.AbstractAnalyzer; import org.opengrok.indexer.analysis.FileAnalyzerFactory; public class ClojureAnalyzerFactory extends FileAnalyzerFactory { @@ -37,11 +36,11 @@ public class ClojureAnalyzerFactory extends FileAnalyzerFactory { }; public ClojureAnalyzerFactory() { - super(null, null, SUFFIXES, null, null, "text/plain", Genre.PLAIN, name); + super(null, null, SUFFIXES, null, null, "text/plain", AbstractAnalyzer.Genre.PLAIN, name); } @Override - protected FileAnalyzer newAnalyzer() { + protected AbstractAnalyzer newAnalyzer() { return new ClojureAnalyzer(this); } } diff --git a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/csharp/CSharpAnalyzer.java b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/csharp/CSharpAnalyzer.java index 65e0aa6c415..00d1611bf59 100644 --- a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/csharp/CSharpAnalyzer.java +++ b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/csharp/CSharpAnalyzer.java @@ -24,8 +24,8 @@ package org.opengrok.indexer.analysis.csharp; import java.io.Reader; -import org.opengrok.indexer.analysis.FileAnalyzer; -import org.opengrok.indexer.analysis.FileAnalyzerFactory; +import org.opengrok.indexer.analysis.AbstractAnalyzer; +import org.opengrok.indexer.analysis.AnalyzerFactory; import org.opengrok.indexer.analysis.JFlexTokenizer; import org.opengrok.indexer.analysis.JFlexXref; import org.opengrok.indexer.analysis.plain.AbstractSourceCodeAnalyzer; @@ -36,9 +36,9 @@ */ public class CSharpAnalyzer extends AbstractSourceCodeAnalyzer { - protected CSharpAnalyzer(FileAnalyzerFactory factory) { + protected CSharpAnalyzer(AnalyzerFactory factory) { super(factory, new JFlexTokenizer(new CSharpSymbolTokenizer( - FileAnalyzer.dummyReader))); + AbstractAnalyzer.DUMMY_READER))); } /** diff --git a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/csharp/CSharpAnalyzerFactory.java b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/csharp/CSharpAnalyzerFactory.java index b5a0ff88bc4..39a68a5f0cd 100644 --- a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/csharp/CSharpAnalyzerFactory.java +++ b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/csharp/CSharpAnalyzerFactory.java @@ -24,8 +24,7 @@ package org.opengrok.indexer.analysis.csharp; -import org.opengrok.indexer.analysis.FileAnalyzer; -import org.opengrok.indexer.analysis.FileAnalyzer.Genre; +import org.opengrok.indexer.analysis.AbstractAnalyzer; import org.opengrok.indexer.analysis.FileAnalyzerFactory; public class CSharpAnalyzerFactory extends FileAnalyzerFactory { @@ -37,11 +36,11 @@ public class CSharpAnalyzerFactory extends FileAnalyzerFactory { }; public CSharpAnalyzerFactory() { - super(null, null, SUFFIXES, null, null, "text/plain", Genre.PLAIN, name); + super(null, null, SUFFIXES, null, null, "text/plain", AbstractAnalyzer.Genre.PLAIN, name); } @Override - protected FileAnalyzer newAnalyzer() { + protected AbstractAnalyzer newAnalyzer() { return new CSharpAnalyzer(this); } } diff --git a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/data/IgnorantAnalyzerFactory.java b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/data/IgnorantAnalyzerFactory.java index 37f5d4110b2..92216aad807 100644 --- a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/data/IgnorantAnalyzerFactory.java +++ b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/data/IgnorantAnalyzerFactory.java @@ -23,6 +23,7 @@ package org.opengrok.indexer.analysis.data; +import org.opengrok.indexer.analysis.AbstractAnalyzer; import org.opengrok.indexer.analysis.FileAnalyzer; import org.opengrok.indexer.analysis.FileAnalyzerFactory; @@ -49,7 +50,7 @@ public IgnorantAnalyzerFactory() { } @Override - protected FileAnalyzer newAnalyzer() { + protected AbstractAnalyzer newAnalyzer() { // just use a FileAnalyzer since it won't analyze or xref the file return new FileAnalyzer(this); } diff --git a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/data/ImageAnalyzerFactory.java b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/data/ImageAnalyzerFactory.java index abb27bbe2d2..e051cd2aba0 100644 --- a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/data/ImageAnalyzerFactory.java +++ b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/data/ImageAnalyzerFactory.java @@ -23,8 +23,8 @@ package org.opengrok.indexer.analysis.data; +import org.opengrok.indexer.analysis.AbstractAnalyzer; import org.opengrok.indexer.analysis.FileAnalyzer; -import org.opengrok.indexer.analysis.FileAnalyzer.Genre; import org.opengrok.indexer.analysis.FileAnalyzerFactory; /** @@ -39,11 +39,11 @@ public class ImageAnalyzerFactory extends FileAnalyzerFactory { }; public ImageAnalyzerFactory() { - super(null, null, SUFFIXES, null, null, null, Genre.IMAGE, name); + super(null, null, SUFFIXES, null, null, null, AbstractAnalyzer.Genre.IMAGE, name); } @Override - protected FileAnalyzer newAnalyzer() { + protected AbstractAnalyzer newAnalyzer() { // just use a FileAnalyzer since it won't analyze or xref the file return new FileAnalyzer(this); } diff --git a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/document/DocumentMatcher.java b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/document/DocumentMatcher.java index c36cba5917b..f4ab11f4ccd 100644 --- a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/document/DocumentMatcher.java +++ b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/document/DocumentMatcher.java @@ -27,7 +27,7 @@ import java.io.InputStream; import java.io.InputStreamReader; import java.util.Arrays; -import org.opengrok.indexer.analysis.FileAnalyzerFactory; +import org.opengrok.indexer.analysis.AnalyzerFactory; import org.opengrok.indexer.analysis.FileAnalyzerFactory.Matcher; import org.opengrok.indexer.util.IOUtils; @@ -50,7 +50,7 @@ public class DocumentMatcher implements Matcher { private static final int FIRST_LOOK_WIDTH = 300; - private final FileAnalyzerFactory factory; + private final AnalyzerFactory factory; private final String[] lineStarters; @@ -60,7 +60,7 @@ public class DocumentMatcher implements Matcher { * @param lineStarters required list of line starters that indicate a match * @throws IllegalArgumentException thrown if any parameter is null */ - public DocumentMatcher(FileAnalyzerFactory factory, String[] lineStarters) { + public DocumentMatcher(AnalyzerFactory factory, String[] lineStarters) { if (factory == null) { throw new IllegalArgumentException("`factory' is null"); } @@ -97,7 +97,7 @@ public DocumentMatcher(FileAnalyzerFactory factory, String[] lineStarters) { * @throws IOException in case of any read error */ @Override - public FileAnalyzerFactory isMagic(byte[] contents, InputStream in) + public AnalyzerFactory isMagic(byte[] contents, InputStream in) throws IOException { if (!in.markSupported()) { @@ -174,7 +174,7 @@ public FileAnalyzerFactory isMagic(byte[] contents, InputStream in) } @Override - public FileAnalyzerFactory forFactory() { + public AnalyzerFactory forFactory() { return factory; } diff --git a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/document/MandocAnalyzer.java b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/document/MandocAnalyzer.java index 0f11215dee2..db5ea25e017 100644 --- a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/document/MandocAnalyzer.java +++ b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/document/MandocAnalyzer.java @@ -27,12 +27,12 @@ import java.io.Reader; import java.io.Writer; import org.apache.lucene.document.Document; -import org.opengrok.indexer.analysis.FileAnalyzer; -import org.opengrok.indexer.analysis.FileAnalyzerFactory; +import org.opengrok.indexer.analysis.AbstractAnalyzer; +import org.opengrok.indexer.analysis.AnalyzerFactory; import org.opengrok.indexer.analysis.JFlexTokenizer; +import org.opengrok.indexer.analysis.OGKTextField; import org.opengrok.indexer.analysis.StreamSource; import org.opengrok.indexer.analysis.TextAnalyzer; -import org.opengrok.indexer.analysis.OGKTextField; import org.opengrok.indexer.analysis.WriteXrefArgs; import org.opengrok.indexer.analysis.Xrefer; import org.opengrok.indexer.search.QueryBuilder; @@ -46,9 +46,9 @@ public class MandocAnalyzer extends TextAnalyzer { * Creates a new instance of MandocAnalyzer * @param factory defined instance for the analyzer */ - protected MandocAnalyzer(FileAnalyzerFactory factory) { + protected MandocAnalyzer(AnalyzerFactory factory) { super(factory, new JFlexTokenizer(new TroffFullTokenizer( - FileAnalyzer.dummyReader))); + AbstractAnalyzer.DUMMY_READER))); } /** diff --git a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/document/MandocAnalyzerFactory.java b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/document/MandocAnalyzerFactory.java index 44dda308e91..d0807f185e9 100644 --- a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/document/MandocAnalyzerFactory.java +++ b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/document/MandocAnalyzerFactory.java @@ -26,8 +26,8 @@ import java.io.IOException; import java.io.InputStream; -import org.opengrok.indexer.analysis.FileAnalyzer; -import org.opengrok.indexer.analysis.FileAnalyzer.Genre; +import org.opengrok.indexer.analysis.AbstractAnalyzer; +import org.opengrok.indexer.analysis.AnalyzerFactory; import org.opengrok.indexer.analysis.FileAnalyzerFactory; import org.opengrok.indexer.configuration.RuntimeEnvironment; @@ -37,7 +37,7 @@ public class MandocAnalyzerFactory extends FileAnalyzerFactory { public static final Matcher MATCHER = new Matcher() { @Override - public FileAnalyzerFactory isMagic(byte[] contents, InputStream in) + public AnalyzerFactory isMagic(byte[] contents, InputStream in) throws IOException { return RuntimeEnvironment.getInstance().getMandoc() != null ? getTrueMenMatcher().isMagic(contents, in) : @@ -45,7 +45,7 @@ public FileAnalyzerFactory isMagic(byte[] contents, InputStream in) } @Override - public FileAnalyzerFactory forFactory() { + public AnalyzerFactory forFactory() { return getTrueMenMatcher().forFactory(); } }; @@ -54,11 +54,11 @@ public FileAnalyzerFactory forFactory() { new MandocAnalyzerFactory(); protected MandocAnalyzerFactory() { - super(null, null, null, null, MATCHER, "text/plain", Genre.PLAIN, NAME); + super(null, null, null, null, MATCHER, "text/plain", AbstractAnalyzer.Genre.PLAIN, NAME); } @Override - protected FileAnalyzer newAnalyzer() { + protected AbstractAnalyzer newAnalyzer() { return new MandocAnalyzer(this); } diff --git a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/document/TroffAnalyzer.java b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/document/TroffAnalyzer.java index 7bb9e3e03c9..d756cb855bb 100644 --- a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/document/TroffAnalyzer.java +++ b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/document/TroffAnalyzer.java @@ -27,12 +27,12 @@ import java.io.Reader; import java.io.Writer; import org.apache.lucene.document.Document; -import org.opengrok.indexer.analysis.FileAnalyzer; -import org.opengrok.indexer.analysis.FileAnalyzerFactory; +import org.opengrok.indexer.analysis.AbstractAnalyzer; +import org.opengrok.indexer.analysis.AnalyzerFactory; import org.opengrok.indexer.analysis.JFlexTokenizer; +import org.opengrok.indexer.analysis.OGKTextField; import org.opengrok.indexer.analysis.StreamSource; import org.opengrok.indexer.analysis.TextAnalyzer; -import org.opengrok.indexer.analysis.OGKTextField; import org.opengrok.indexer.analysis.WriteXrefArgs; import org.opengrok.indexer.analysis.Xrefer; import org.opengrok.indexer.search.QueryBuilder; @@ -48,9 +48,9 @@ public class TroffAnalyzer extends TextAnalyzer { * Creates a new instance of TroffAnalyzer * @param factory defined instance for the analyzer */ - protected TroffAnalyzer(FileAnalyzerFactory factory) { + protected TroffAnalyzer(AnalyzerFactory factory) { super(factory, new JFlexTokenizer(new TroffFullTokenizer( - FileAnalyzer.dummyReader))); + AbstractAnalyzer.DUMMY_READER))); } /** diff --git a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/document/TroffAnalyzerFactory.java b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/document/TroffAnalyzerFactory.java index c4903eb81a0..2b7531fad46 100644 --- a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/document/TroffAnalyzerFactory.java +++ b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/document/TroffAnalyzerFactory.java @@ -26,8 +26,8 @@ import java.io.IOException; import java.io.InputStream; -import org.opengrok.indexer.analysis.FileAnalyzer; -import org.opengrok.indexer.analysis.FileAnalyzer.Genre; +import org.opengrok.indexer.analysis.AbstractAnalyzer; +import org.opengrok.indexer.analysis.AnalyzerFactory; import org.opengrok.indexer.analysis.FileAnalyzerFactory; public class TroffAnalyzerFactory extends FileAnalyzerFactory { @@ -36,13 +36,13 @@ public class TroffAnalyzerFactory extends FileAnalyzerFactory { public static final Matcher MATCHER = new Matcher() { @Override - public FileAnalyzerFactory isMagic(byte[] contents, InputStream in) + public AnalyzerFactory isMagic(byte[] contents, InputStream in) throws IOException { return getTrueMatcher().isMagic(contents, in); } @Override - public FileAnalyzerFactory forFactory() { + public AnalyzerFactory forFactory() { return getTrueMatcher().forFactory(); } }; @@ -51,11 +51,11 @@ public FileAnalyzerFactory forFactory() { new TroffAnalyzerFactory(); protected TroffAnalyzerFactory() { - super(null, null, null, null, MATCHER, "text/plain", Genre.PLAIN, name); + super(null, null, null, null, MATCHER, "text/plain", AbstractAnalyzer.Genre.PLAIN, name); } @Override - protected FileAnalyzer newAnalyzer() { + protected AbstractAnalyzer newAnalyzer() { return new TroffAnalyzer(this); } diff --git a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/eiffel/EiffelAnalyzer.java b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/eiffel/EiffelAnalyzer.java index 934ee8a4f8c..7ea38a05ea8 100644 --- a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/eiffel/EiffelAnalyzer.java +++ b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/eiffel/EiffelAnalyzer.java @@ -24,8 +24,8 @@ package org.opengrok.indexer.analysis.eiffel; import java.io.Reader; -import org.opengrok.indexer.analysis.FileAnalyzer; -import org.opengrok.indexer.analysis.FileAnalyzerFactory; +import org.opengrok.indexer.analysis.AbstractAnalyzer; +import org.opengrok.indexer.analysis.AnalyzerFactory; import org.opengrok.indexer.analysis.JFlexTokenizer; import org.opengrok.indexer.analysis.JFlexXref; import org.opengrok.indexer.analysis.plain.AbstractSourceCodeAnalyzer; @@ -39,9 +39,9 @@ public class EiffelAnalyzer extends AbstractSourceCodeAnalyzer { * Creates a new instance of {@link EiffelAnalyzer}. * @param factory instance */ - protected EiffelAnalyzer(FileAnalyzerFactory factory) { + protected EiffelAnalyzer(AnalyzerFactory factory) { super(factory, new JFlexTokenizer(new EiffelSymbolTokenizer( - FileAnalyzer.dummyReader))); + AbstractAnalyzer.DUMMY_READER))); } /** diff --git a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/eiffel/EiffelAnalyzerFactory.java b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/eiffel/EiffelAnalyzerFactory.java index eb78bf4d0f0..c27f4b496ef 100644 --- a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/eiffel/EiffelAnalyzerFactory.java +++ b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/eiffel/EiffelAnalyzerFactory.java @@ -23,8 +23,7 @@ package org.opengrok.indexer.analysis.eiffel; -import org.opengrok.indexer.analysis.FileAnalyzer; -import org.opengrok.indexer.analysis.FileAnalyzer.Genre; +import org.opengrok.indexer.analysis.AbstractAnalyzer; import org.opengrok.indexer.analysis.FileAnalyzerFactory; /** @@ -41,7 +40,7 @@ public class EiffelAnalyzerFactory extends FileAnalyzerFactory { * {@link EiffelAnalyzer}. */ public EiffelAnalyzerFactory() { - super(null, null, SUFFIXES, null, null, "text/plain", Genre.PLAIN, + super(null, null, SUFFIXES, null, null, "text/plain", AbstractAnalyzer.Genre.PLAIN, NAME); } @@ -50,7 +49,7 @@ public EiffelAnalyzerFactory() { * @return a defined instance */ @Override - protected FileAnalyzer newAnalyzer() { + protected AbstractAnalyzer newAnalyzer() { return new EiffelAnalyzer(this); } } diff --git a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/eiffel/EiffelLexHelper.java b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/eiffel/EiffelLexHelper.java index f7f453774be..a68d981a380 100644 --- a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/eiffel/EiffelLexHelper.java +++ b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/eiffel/EiffelLexHelper.java @@ -24,8 +24,8 @@ package org.opengrok.indexer.analysis.eiffel; import java.io.IOException; -import org.opengrok.indexer.analysis.Resettable; import org.opengrok.indexer.analysis.JFlexJointLexer; +import org.opengrok.indexer.analysis.Resettable; import org.opengrok.indexer.web.HtmlConsts; /** diff --git a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/erlang/ErlangAnalyzer.java b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/erlang/ErlangAnalyzer.java index 81de5fa72a7..844655a40e2 100644 --- a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/erlang/ErlangAnalyzer.java +++ b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/erlang/ErlangAnalyzer.java @@ -25,8 +25,8 @@ package org.opengrok.indexer.analysis.erlang; import java.io.Reader; -import org.opengrok.indexer.analysis.FileAnalyzer; -import org.opengrok.indexer.analysis.FileAnalyzerFactory; +import org.opengrok.indexer.analysis.AbstractAnalyzer; +import org.opengrok.indexer.analysis.AnalyzerFactory; import org.opengrok.indexer.analysis.JFlexTokenizer; import org.opengrok.indexer.analysis.JFlexXref; import org.opengrok.indexer.analysis.plain.AbstractSourceCodeAnalyzer; @@ -37,9 +37,9 @@ public class ErlangAnalyzer extends AbstractSourceCodeAnalyzer { * Creates a new instance of ErlangAnalyzer * @param factory defined instance for the analyzer */ - protected ErlangAnalyzer(FileAnalyzerFactory factory) { + protected ErlangAnalyzer(AnalyzerFactory factory) { super(factory, new JFlexTokenizer(new ErlangSymbolTokenizer( - FileAnalyzer.dummyReader))); + AbstractAnalyzer.DUMMY_READER))); } /** diff --git a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/erlang/ErlangAnalyzerFactory.java b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/erlang/ErlangAnalyzerFactory.java index 23494d08887..cf8d0fab2bb 100644 --- a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/erlang/ErlangAnalyzerFactory.java +++ b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/erlang/ErlangAnalyzerFactory.java @@ -24,8 +24,7 @@ package org.opengrok.indexer.analysis.erlang; -import org.opengrok.indexer.analysis.FileAnalyzer; -import org.opengrok.indexer.analysis.FileAnalyzer.Genre; +import org.opengrok.indexer.analysis.AbstractAnalyzer; import org.opengrok.indexer.analysis.FileAnalyzerFactory; public class ErlangAnalyzerFactory extends FileAnalyzerFactory { @@ -41,11 +40,11 @@ public class ErlangAnalyzerFactory extends FileAnalyzerFactory { }; public ErlangAnalyzerFactory() { - super(null, null, SUFFIXES, MAGICS, null, "text/plain", Genre.PLAIN, name); + super(null, null, SUFFIXES, MAGICS, null, "text/plain", AbstractAnalyzer.Genre.PLAIN, name); } @Override - protected FileAnalyzer newAnalyzer() { + protected AbstractAnalyzer newAnalyzer() { return new ErlangAnalyzer(this); } } diff --git a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/executables/ELFAnalyzer.java b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/executables/ELFAnalyzer.java index d2880979e16..840dc07d650 100644 --- a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/executables/ELFAnalyzer.java +++ b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/executables/ELFAnalyzer.java @@ -34,13 +34,12 @@ import java.util.List; import java.util.logging.Level; import java.util.logging.Logger; - import org.apache.lucene.document.Document; import org.apache.lucene.document.Field.Store; +import org.opengrok.indexer.analysis.AnalyzerFactory; import org.opengrok.indexer.analysis.FileAnalyzer; -import org.opengrok.indexer.analysis.FileAnalyzerFactory; -import org.opengrok.indexer.analysis.StreamSource; import org.opengrok.indexer.analysis.OGKTextField; +import org.opengrok.indexer.analysis.StreamSource; import org.opengrok.indexer.logger.LoggerFactory; import org.opengrok.indexer.search.QueryBuilder; import org.opengrok.indexer.web.Util; @@ -71,7 +70,7 @@ public class ELFAnalyzer extends FileAnalyzer { * Creates a new instance of ELFAnalyzer * @param factory The factory that creates ELFAnalyzers */ - protected ELFAnalyzer(FileAnalyzerFactory factory) { + protected ELFAnalyzer(AnalyzerFactory factory) { super(factory); } diff --git a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/executables/ELFAnalyzerFactory.java b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/executables/ELFAnalyzerFactory.java index 489f53141a5..a21729ac9c1 100644 --- a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/executables/ELFAnalyzerFactory.java +++ b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/executables/ELFAnalyzerFactory.java @@ -23,8 +23,7 @@ package org.opengrok.indexer.analysis.executables; -import org.opengrok.indexer.analysis.FileAnalyzer; -import org.opengrok.indexer.analysis.FileAnalyzer.Genre; +import org.opengrok.indexer.analysis.AbstractAnalyzer; import org.opengrok.indexer.analysis.FileAnalyzerFactory; public class ELFAnalyzerFactory extends FileAnalyzerFactory { @@ -36,11 +35,11 @@ public class ELFAnalyzerFactory extends FileAnalyzerFactory { }; public ELFAnalyzerFactory() { - super(null, null, null, MAGICS, null, null, Genre.XREFABLE, name); + super(null, null, null, MAGICS, null, null, AbstractAnalyzer.Genre.XREFABLE, name); } @Override - protected FileAnalyzer newAnalyzer() { + protected AbstractAnalyzer newAnalyzer() { return new ELFAnalyzer(this); } } diff --git a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/executables/JarAnalyzer.java b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/executables/JarAnalyzer.java index b19059a3752..402ef3492cb 100644 --- a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/executables/JarAnalyzer.java +++ b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/executables/JarAnalyzer.java @@ -31,11 +31,11 @@ import java.util.zip.ZipInputStream; import org.apache.lucene.document.Document; import org.apache.lucene.document.Field.Store; +import org.opengrok.indexer.analysis.AnalyzerFactory; import org.opengrok.indexer.analysis.AnalyzerGuru; import org.opengrok.indexer.analysis.FileAnalyzer; -import org.opengrok.indexer.analysis.FileAnalyzerFactory; -import org.opengrok.indexer.analysis.StreamSource; import org.opengrok.indexer.analysis.OGKTextField; +import org.opengrok.indexer.analysis.StreamSource; import org.opengrok.indexer.search.QueryBuilder; import org.opengrok.indexer.web.Util; @@ -49,7 +49,7 @@ public class JarAnalyzer extends FileAnalyzer { private static final String[] FIELD_NAMES = new String[] {QueryBuilder.FULL, QueryBuilder.REFS, QueryBuilder.DEFS}; - protected JarAnalyzer(FileAnalyzerFactory factory) { + protected JarAnalyzer(AnalyzerFactory factory) { super(factory); } @@ -82,7 +82,7 @@ public void analyze(Document doc, StreamSource src, Writer xrefOut) throws IOExc fout.write(ename); fout.write("\n"); - FileAnalyzerFactory fac = AnalyzerGuru.find(ename); + AnalyzerFactory fac = AnalyzerGuru.find(ename); if (fac instanceof JavaClassAnalyzerFactory) { if (xrefOut != null) { xrefOut.append("
"); diff --git a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/executables/JarAnalyzerFactory.java b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/executables/JarAnalyzerFactory.java index 9548a127a24..70cb257b9bd 100644 --- a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/executables/JarAnalyzerFactory.java +++ b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/executables/JarAnalyzerFactory.java @@ -24,8 +24,8 @@ package org.opengrok.indexer.analysis.executables; -import org.opengrok.indexer.analysis.FileAnalyzer; -import org.opengrok.indexer.analysis.FileAnalyzer.Genre; +import org.opengrok.indexer.analysis.AbstractAnalyzer; +import org.opengrok.indexer.analysis.AnalyzerFactory; import org.opengrok.indexer.analysis.FileAnalyzerFactory; import org.opengrok.indexer.analysis.archive.ZipMatcherBase; @@ -45,7 +45,7 @@ public String description() { } @Override - public FileAnalyzerFactory forFactory() { + public AnalyzerFactory forFactory() { return JarAnalyzerFactory.DEFAULT_INSTANCE; } @@ -64,11 +64,11 @@ protected Integer strictExtraFieldID() { new JarAnalyzerFactory(); private JarAnalyzerFactory() { - super(null, null, SUFFIXES, null, MATCHER, null, Genre.XREFABLE, name); + super(null, null, SUFFIXES, null, MATCHER, null, AbstractAnalyzer.Genre.XREFABLE, name); } @Override - protected FileAnalyzer newAnalyzer() { + protected AbstractAnalyzer newAnalyzer() { return new JarAnalyzer(this); } } diff --git a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/executables/JavaClassAnalyzer.java b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/executables/JavaClassAnalyzer.java index 0808d0b90a8..251605ea88a 100644 --- a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/executables/JavaClassAnalyzer.java +++ b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/executables/JavaClassAnalyzer.java @@ -56,8 +56,8 @@ import org.apache.bcel.classfile.Utility; import org.apache.lucene.document.Document; import org.apache.lucene.document.Field.Store; +import org.opengrok.indexer.analysis.AnalyzerFactory; import org.opengrok.indexer.analysis.FileAnalyzer; -import org.opengrok.indexer.analysis.FileAnalyzerFactory; import org.opengrok.indexer.analysis.OGKTextField; import org.opengrok.indexer.analysis.StreamSource; import org.opengrok.indexer.configuration.RuntimeEnvironment; @@ -82,7 +82,7 @@ public class JavaClassAnalyzer extends FileAnalyzer { * * @param factory The factory that creates JavaClassAnalyzers */ - protected JavaClassAnalyzer(FileAnalyzerFactory factory) { + protected JavaClassAnalyzer(AnalyzerFactory factory) { super(factory); } diff --git a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/executables/JavaClassAnalyzerFactory.java b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/executables/JavaClassAnalyzerFactory.java index e4d16a8fb1f..d156621845d 100644 --- a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/executables/JavaClassAnalyzerFactory.java +++ b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/executables/JavaClassAnalyzerFactory.java @@ -25,8 +25,8 @@ package org.opengrok.indexer.analysis.executables; import java.io.InputStream; -import org.opengrok.indexer.analysis.FileAnalyzer; -import org.opengrok.indexer.analysis.FileAnalyzer.Genre; +import org.opengrok.indexer.analysis.AbstractAnalyzer; +import org.opengrok.indexer.analysis.AnalyzerFactory; import org.opengrok.indexer.analysis.FileAnalyzerFactory; /** @@ -60,7 +60,7 @@ public String description() { } @Override - public FileAnalyzerFactory isMagic(byte[] content, InputStream in) { + public AnalyzerFactory isMagic(byte[] content, InputStream in) { if (content.length < 8) { return null; } @@ -82,7 +82,7 @@ public FileAnalyzerFactory isMagic(byte[] content, InputStream in) { } @Override - public FileAnalyzerFactory forFactory() { + public AnalyzerFactory forFactory() { return JavaClassAnalyzerFactory.DEFAULT_INSTANCE; } }; @@ -91,7 +91,7 @@ public FileAnalyzerFactory forFactory() { new JavaClassAnalyzerFactory(); private JavaClassAnalyzerFactory() { - super(null, null, SUFFIXES, null, MATCHER, null, Genre.XREFABLE, name); + super(null, null, SUFFIXES, null, MATCHER, null, AbstractAnalyzer.Genre.XREFABLE, name); } /** @@ -99,7 +99,7 @@ private JavaClassAnalyzerFactory() { * @return a defined instance */ @Override - protected FileAnalyzer newAnalyzer() { + protected AbstractAnalyzer newAnalyzer() { return new JavaClassAnalyzer(this); } } diff --git a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/fortran/FortranAnalyzer.java b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/fortran/FortranAnalyzer.java index c21feddf186..debc2d4f409 100644 --- a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/fortran/FortranAnalyzer.java +++ b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/fortran/FortranAnalyzer.java @@ -24,7 +24,7 @@ package org.opengrok.indexer.analysis.fortran; import java.io.Reader; -import org.opengrok.indexer.analysis.FileAnalyzer; +import org.opengrok.indexer.analysis.AbstractAnalyzer; import org.opengrok.indexer.analysis.JFlexTokenizer; import org.opengrok.indexer.analysis.JFlexXref; import org.opengrok.indexer.analysis.plain.AbstractSourceCodeAnalyzer; @@ -38,7 +38,7 @@ public class FortranAnalyzer extends AbstractSourceCodeAnalyzer { FortranAnalyzer(FortranAnalyzerFactory factory) { super(factory, new JFlexTokenizer(new FortranSymbolTokenizer( - FileAnalyzer.dummyReader))); + AbstractAnalyzer.DUMMY_READER))); } /** diff --git a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/fortran/FortranAnalyzerFactory.java b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/fortran/FortranAnalyzerFactory.java index f53cc4a90a0..86a6db3a286 100644 --- a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/fortran/FortranAnalyzerFactory.java +++ b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/fortran/FortranAnalyzerFactory.java @@ -24,8 +24,7 @@ package org.opengrok.indexer.analysis.fortran; -import org.opengrok.indexer.analysis.FileAnalyzer; -import org.opengrok.indexer.analysis.FileAnalyzer.Genre; +import org.opengrok.indexer.analysis.AbstractAnalyzer; import org.opengrok.indexer.analysis.FileAnalyzerFactory; public class FortranAnalyzerFactory extends FileAnalyzerFactory { @@ -54,11 +53,11 @@ public class FortranAnalyzerFactory extends FileAnalyzerFactory { "F15"}; public FortranAnalyzerFactory() { - super(null, null, SUFFIXES, null, null, "text/plain", Genre.PLAIN, name); + super(null, null, SUFFIXES, null, null, "text/plain", AbstractAnalyzer.Genre.PLAIN, name); } @Override - protected FileAnalyzer newAnalyzer() { + protected AbstractAnalyzer newAnalyzer() { return new FortranAnalyzer(this); } } diff --git a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/golang/GolangAnalyzer.java b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/golang/GolangAnalyzer.java index cfd8de336be..ba72f2a23ee 100644 --- a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/golang/GolangAnalyzer.java +++ b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/golang/GolangAnalyzer.java @@ -25,8 +25,8 @@ package org.opengrok.indexer.analysis.golang; import java.io.Reader; -import org.opengrok.indexer.analysis.FileAnalyzer; -import org.opengrok.indexer.analysis.FileAnalyzerFactory; +import org.opengrok.indexer.analysis.AbstractAnalyzer; +import org.opengrok.indexer.analysis.AnalyzerFactory; import org.opengrok.indexer.analysis.JFlexTokenizer; import org.opengrok.indexer.analysis.JFlexXref; import org.opengrok.indexer.analysis.plain.AbstractSourceCodeAnalyzer; @@ -41,9 +41,9 @@ public class GolangAnalyzer extends AbstractSourceCodeAnalyzer { * Creates a new instance of GolangAnalyzer * @param factory defined instance for the analyzer */ - protected GolangAnalyzer(FileAnalyzerFactory factory) { + protected GolangAnalyzer(AnalyzerFactory factory) { super(factory, new JFlexTokenizer(new GolangSymbolTokenizer( - FileAnalyzer.dummyReader))); + AbstractAnalyzer.DUMMY_READER))); } /** diff --git a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/golang/GolangAnalyzerFactory.java b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/golang/GolangAnalyzerFactory.java index 60e507e0c3c..d92031bf182 100644 --- a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/golang/GolangAnalyzerFactory.java +++ b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/golang/GolangAnalyzerFactory.java @@ -23,8 +23,7 @@ package org.opengrok.indexer.analysis.golang; -import org.opengrok.indexer.analysis.FileAnalyzer; -import org.opengrok.indexer.analysis.FileAnalyzer.Genre; +import org.opengrok.indexer.analysis.AbstractAnalyzer; import org.opengrok.indexer.analysis.FileAnalyzerFactory; /** @@ -40,11 +39,11 @@ public class GolangAnalyzerFactory extends FileAnalyzerFactory { }; public GolangAnalyzerFactory() { - super(null, null, SUFFIXES, null, null, "text/plain", Genre.PLAIN, name); + super(null, null, SUFFIXES, null, null, "text/plain", AbstractAnalyzer.Genre.PLAIN, name); } @Override - protected FileAnalyzer newAnalyzer() { + protected AbstractAnalyzer newAnalyzer() { return new GolangAnalyzer(this); } } diff --git a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/haskell/HaskellAnalyzer.java b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/haskell/HaskellAnalyzer.java index 3aca5880351..9284eb2c4c0 100644 --- a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/haskell/HaskellAnalyzer.java +++ b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/haskell/HaskellAnalyzer.java @@ -25,8 +25,8 @@ package org.opengrok.indexer.analysis.haskell; import java.io.Reader; -import org.opengrok.indexer.analysis.FileAnalyzer; -import org.opengrok.indexer.analysis.FileAnalyzerFactory; +import org.opengrok.indexer.analysis.AbstractAnalyzer; +import org.opengrok.indexer.analysis.AnalyzerFactory; import org.opengrok.indexer.analysis.JFlexTokenizer; import org.opengrok.indexer.analysis.JFlexXref; import org.opengrok.indexer.analysis.plain.AbstractSourceCodeAnalyzer; @@ -41,9 +41,9 @@ public class HaskellAnalyzer extends AbstractSourceCodeAnalyzer { * Creates a new instance of HaskellAnalyzer * @param factory defined instance for the analyzer */ - protected HaskellAnalyzer(FileAnalyzerFactory factory) { + protected HaskellAnalyzer(AnalyzerFactory factory) { super(factory, new JFlexTokenizer(new HaskellSymbolTokenizer( - FileAnalyzer.dummyReader))); + AbstractAnalyzer.DUMMY_READER))); } /** diff --git a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/haskell/HaskellAnalyzerFactory.java b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/haskell/HaskellAnalyzerFactory.java index f406e473cfe..e3c2d5cb954 100644 --- a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/haskell/HaskellAnalyzerFactory.java +++ b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/haskell/HaskellAnalyzerFactory.java @@ -24,8 +24,7 @@ package org.opengrok.indexer.analysis.haskell; -import org.opengrok.indexer.analysis.FileAnalyzer; -import org.opengrok.indexer.analysis.FileAnalyzer.Genre; +import org.opengrok.indexer.analysis.AbstractAnalyzer; import org.opengrok.indexer.analysis.FileAnalyzerFactory; /** @@ -42,11 +41,11 @@ public class HaskellAnalyzerFactory extends FileAnalyzerFactory { }; public HaskellAnalyzerFactory() { - super(null, null, SUFFIXES, null, null, "text/plain", Genre.PLAIN, name); + super(null, null, SUFFIXES, null, null, "text/plain", AbstractAnalyzer.Genre.PLAIN, name); } @Override - protected FileAnalyzer newAnalyzer() { + protected AbstractAnalyzer newAnalyzer() { return new HaskellAnalyzer(this); } } diff --git a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/java/JavaAnalyzer.java b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/java/JavaAnalyzer.java index 785c8c6d644..448d6fc1989 100644 --- a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/java/JavaAnalyzer.java +++ b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/java/JavaAnalyzer.java @@ -24,8 +24,8 @@ package org.opengrok.indexer.analysis.java; import java.io.Reader; -import org.opengrok.indexer.analysis.FileAnalyzer; -import org.opengrok.indexer.analysis.FileAnalyzerFactory; +import org.opengrok.indexer.analysis.AbstractAnalyzer; +import org.opengrok.indexer.analysis.AnalyzerFactory; import org.opengrok.indexer.analysis.JFlexTokenizer; import org.opengrok.indexer.analysis.JFlexXref; import org.opengrok.indexer.analysis.plain.AbstractSourceCodeAnalyzer; @@ -40,9 +40,9 @@ public class JavaAnalyzer extends AbstractSourceCodeAnalyzer { * Creates a new instance of JavaAnalyzer * @param factory defined instance for the analyzer */ - protected JavaAnalyzer(FileAnalyzerFactory factory) { + protected JavaAnalyzer(AnalyzerFactory factory) { super(factory, new JFlexTokenizer(new JavaSymbolTokenizer( - FileAnalyzer.dummyReader))); + AbstractAnalyzer.DUMMY_READER))); } /** diff --git a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/java/JavaAnalyzerFactory.java b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/java/JavaAnalyzerFactory.java index 0c133e40ab8..3e8b55d90f0 100644 --- a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/java/JavaAnalyzerFactory.java +++ b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/java/JavaAnalyzerFactory.java @@ -23,8 +23,7 @@ package org.opengrok.indexer.analysis.java; -import org.opengrok.indexer.analysis.FileAnalyzer; -import org.opengrok.indexer.analysis.FileAnalyzer.Genre; +import org.opengrok.indexer.analysis.AbstractAnalyzer; import org.opengrok.indexer.analysis.FileAnalyzerFactory; public class JavaAnalyzerFactory extends FileAnalyzerFactory { @@ -38,11 +37,11 @@ public class JavaAnalyzerFactory extends FileAnalyzerFactory { }; public JavaAnalyzerFactory() { - super(null, null, SUFFIXES, null, null, "text/plain", Genre.PLAIN, name); + super(null, null, SUFFIXES, null, null, "text/plain", AbstractAnalyzer.Genre.PLAIN, name); } @Override - protected FileAnalyzer newAnalyzer() { + protected AbstractAnalyzer newAnalyzer() { return new JavaAnalyzer(this); } } diff --git a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/javascript/JavaScriptAnalyzer.java b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/javascript/JavaScriptAnalyzer.java index 3f41264797d..ed72055b763 100644 --- a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/javascript/JavaScriptAnalyzer.java +++ b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/javascript/JavaScriptAnalyzer.java @@ -24,8 +24,8 @@ package org.opengrok.indexer.analysis.javascript; import java.io.Reader; -import org.opengrok.indexer.analysis.FileAnalyzer; -import org.opengrok.indexer.analysis.FileAnalyzerFactory; +import org.opengrok.indexer.analysis.AbstractAnalyzer; +import org.opengrok.indexer.analysis.AnalyzerFactory; import org.opengrok.indexer.analysis.JFlexTokenizer; import org.opengrok.indexer.analysis.JFlexXref; import org.opengrok.indexer.analysis.plain.AbstractSourceCodeAnalyzer; @@ -41,9 +41,9 @@ public class JavaScriptAnalyzer extends AbstractSourceCodeAnalyzer { * Creates a new instance of {@link JavaScriptAnalyzer}. * @param factory defined instance for the analyzer */ - protected JavaScriptAnalyzer(FileAnalyzerFactory factory) { + protected JavaScriptAnalyzer(AnalyzerFactory factory) { super(factory, new JFlexTokenizer(new JavaScriptSymbolTokenizer( - FileAnalyzer.dummyReader))); + AbstractAnalyzer.DUMMY_READER))); } /** diff --git a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/javascript/JavaScriptAnalyzerFactory.java b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/javascript/JavaScriptAnalyzerFactory.java index 3d6075e59f6..e0f26b8ae4a 100644 --- a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/javascript/JavaScriptAnalyzerFactory.java +++ b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/javascript/JavaScriptAnalyzerFactory.java @@ -24,8 +24,7 @@ package org.opengrok.indexer.analysis.javascript; -import org.opengrok.indexer.analysis.FileAnalyzer; -import org.opengrok.indexer.analysis.FileAnalyzer.Genre; +import org.opengrok.indexer.analysis.AbstractAnalyzer; import org.opengrok.indexer.analysis.FileAnalyzerFactory; public class JavaScriptAnalyzerFactory extends FileAnalyzerFactory { @@ -38,11 +37,11 @@ public class JavaScriptAnalyzerFactory extends FileAnalyzerFactory { }; public JavaScriptAnalyzerFactory() { - super(null, null, SUFFIXES, null, null, "text/plain", Genre.PLAIN, name); + super(null, null, SUFFIXES, null, null, "text/plain", AbstractAnalyzer.Genre.PLAIN, name); } @Override - protected FileAnalyzer newAnalyzer() { + protected AbstractAnalyzer newAnalyzer() { return new JavaScriptAnalyzer(this); } } diff --git a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/json/JsonAnalyzer.java b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/json/JsonAnalyzer.java index cf961588210..e053bd09029 100644 --- a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/json/JsonAnalyzer.java +++ b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/json/JsonAnalyzer.java @@ -24,8 +24,8 @@ package org.opengrok.indexer.analysis.json; import java.io.Reader; -import org.opengrok.indexer.analysis.FileAnalyzer; -import org.opengrok.indexer.analysis.FileAnalyzerFactory; +import org.opengrok.indexer.analysis.AbstractAnalyzer; +import org.opengrok.indexer.analysis.AnalyzerFactory; import org.opengrok.indexer.analysis.JFlexTokenizer; import org.opengrok.indexer.analysis.JFlexXref; import org.opengrok.indexer.analysis.plain.AbstractSourceCodeAnalyzer; @@ -41,9 +41,9 @@ public class JsonAnalyzer extends AbstractSourceCodeAnalyzer { * Creates a new instance of {@link JsonAnalyzer}. * @param factory defined instance for the analyzer */ - protected JsonAnalyzer(FileAnalyzerFactory factory) { + protected JsonAnalyzer(AnalyzerFactory factory) { super(factory, new JFlexTokenizer(new JsonSymbolTokenizer( - FileAnalyzer.dummyReader))); + AbstractAnalyzer.DUMMY_READER))); } /** diff --git a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/json/JsonAnalyzerFactory.java b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/json/JsonAnalyzerFactory.java index b08b5f3db60..1074eae0288 100644 --- a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/json/JsonAnalyzerFactory.java +++ b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/json/JsonAnalyzerFactory.java @@ -24,8 +24,7 @@ package org.opengrok.indexer.analysis.json; -import org.opengrok.indexer.analysis.FileAnalyzer; -import org.opengrok.indexer.analysis.FileAnalyzer.Genre; +import org.opengrok.indexer.analysis.AbstractAnalyzer; import org.opengrok.indexer.analysis.FileAnalyzerFactory; public class JsonAnalyzerFactory extends FileAnalyzerFactory { @@ -37,11 +36,11 @@ public class JsonAnalyzerFactory extends FileAnalyzerFactory { }; public JsonAnalyzerFactory() { - super(null, null, SUFFIXES, null, null, "text/plain", Genre.PLAIN, name); + super(null, null, SUFFIXES, null, null, "text/plain", AbstractAnalyzer.Genre.PLAIN, name); } @Override - protected FileAnalyzer newAnalyzer() { + protected AbstractAnalyzer newAnalyzer() { return new JsonAnalyzer(this); } } diff --git a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/kotlin/KotlinAnalyzer.java b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/kotlin/KotlinAnalyzer.java index a8fc7dbbaf1..7c63e5a8890 100644 --- a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/kotlin/KotlinAnalyzer.java +++ b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/kotlin/KotlinAnalyzer.java @@ -24,8 +24,8 @@ package org.opengrok.indexer.analysis.kotlin; import java.io.Reader; -import org.opengrok.indexer.analysis.FileAnalyzer; -import org.opengrok.indexer.analysis.FileAnalyzerFactory; +import org.opengrok.indexer.analysis.AbstractAnalyzer; +import org.opengrok.indexer.analysis.AnalyzerFactory; import org.opengrok.indexer.analysis.JFlexTokenizer; import org.opengrok.indexer.analysis.JFlexXref; import org.opengrok.indexer.analysis.plain.AbstractSourceCodeAnalyzer; @@ -40,9 +40,9 @@ public class KotlinAnalyzer extends AbstractSourceCodeAnalyzer { * Creates a new instance of KotlinAnalyzer * @param factory defined instance for the analyzer */ - protected KotlinAnalyzer(FileAnalyzerFactory factory) { + protected KotlinAnalyzer(AnalyzerFactory factory) { super(factory, new JFlexTokenizer(new KotlinSymbolTokenizer( - FileAnalyzer.dummyReader))); + AbstractAnalyzer.DUMMY_READER))); } /** diff --git a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/kotlin/KotlinAnalyzerFactory.java b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/kotlin/KotlinAnalyzerFactory.java index 70f1cc18549..33e3d488724 100644 --- a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/kotlin/KotlinAnalyzerFactory.java +++ b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/kotlin/KotlinAnalyzerFactory.java @@ -23,8 +23,7 @@ package org.opengrok.indexer.analysis.kotlin; -import org.opengrok.indexer.analysis.FileAnalyzer; -import org.opengrok.indexer.analysis.FileAnalyzer.Genre; +import org.opengrok.indexer.analysis.AbstractAnalyzer; import org.opengrok.indexer.analysis.FileAnalyzerFactory; public class KotlinAnalyzerFactory extends FileAnalyzerFactory { @@ -37,11 +36,11 @@ public class KotlinAnalyzerFactory extends FileAnalyzerFactory { }; public KotlinAnalyzerFactory() { - super(null, null, SUFFIXES, null, null, "text/plain", Genre.PLAIN, name); + super(null, null, SUFFIXES, null, null, "text/plain", AbstractAnalyzer.Genre.PLAIN, name); } @Override - protected FileAnalyzer newAnalyzer() { + protected AbstractAnalyzer newAnalyzer() { return new KotlinAnalyzer(this); } } diff --git a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/lisp/LispAnalyzer.java b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/lisp/LispAnalyzer.java index 31118198418..a29f9602da2 100644 --- a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/lisp/LispAnalyzer.java +++ b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/lisp/LispAnalyzer.java @@ -24,8 +24,8 @@ package org.opengrok.indexer.analysis.lisp; import java.io.Reader; -import org.opengrok.indexer.analysis.FileAnalyzer; -import org.opengrok.indexer.analysis.FileAnalyzerFactory; +import org.opengrok.indexer.analysis.AbstractAnalyzer; +import org.opengrok.indexer.analysis.AnalyzerFactory; import org.opengrok.indexer.analysis.JFlexTokenizer; import org.opengrok.indexer.analysis.JFlexXref; import org.opengrok.indexer.analysis.plain.AbstractSourceCodeAnalyzer; @@ -36,9 +36,9 @@ */ public class LispAnalyzer extends AbstractSourceCodeAnalyzer { - protected LispAnalyzer(FileAnalyzerFactory factory) { + protected LispAnalyzer(AnalyzerFactory factory) { super(factory, new JFlexTokenizer(new LispSymbolTokenizer( - FileAnalyzer.dummyReader))); + AbstractAnalyzer.DUMMY_READER))); } /** diff --git a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/lisp/LispAnalyzerFactory.java b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/lisp/LispAnalyzerFactory.java index 6a2032065e1..1a47f78c50f 100644 --- a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/lisp/LispAnalyzerFactory.java +++ b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/lisp/LispAnalyzerFactory.java @@ -23,8 +23,7 @@ package org.opengrok.indexer.analysis.lisp; -import org.opengrok.indexer.analysis.FileAnalyzer; -import org.opengrok.indexer.analysis.FileAnalyzer.Genre; +import org.opengrok.indexer.analysis.AbstractAnalyzer; import org.opengrok.indexer.analysis.FileAnalyzerFactory; public class LispAnalyzerFactory extends FileAnalyzerFactory { @@ -39,11 +38,11 @@ public class LispAnalyzerFactory extends FileAnalyzerFactory { }; public LispAnalyzerFactory() { - super(null, null, SUFFIXES, null, null, "text/plain", Genre.PLAIN, name); + super(null, null, SUFFIXES, null, null, "text/plain", AbstractAnalyzer.Genre.PLAIN, name); } @Override - protected FileAnalyzer newAnalyzer() { + protected AbstractAnalyzer newAnalyzer() { return new LispAnalyzer(this); } } diff --git a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/lua/LuaAnalyzer.java b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/lua/LuaAnalyzer.java index 3e41a7bdfad..0b833346aa3 100644 --- a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/lua/LuaAnalyzer.java +++ b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/lua/LuaAnalyzer.java @@ -25,8 +25,8 @@ package org.opengrok.indexer.analysis.lua; import java.io.Reader; -import org.opengrok.indexer.analysis.FileAnalyzer; -import org.opengrok.indexer.analysis.FileAnalyzerFactory; +import org.opengrok.indexer.analysis.AbstractAnalyzer; +import org.opengrok.indexer.analysis.AnalyzerFactory; import org.opengrok.indexer.analysis.JFlexTokenizer; import org.opengrok.indexer.analysis.JFlexXref; import org.opengrok.indexer.analysis.plain.AbstractSourceCodeAnalyzer; @@ -41,9 +41,9 @@ public class LuaAnalyzer extends AbstractSourceCodeAnalyzer { * Creates a new instance of LuaAnalyzer * @param factory defined instance for the analyzer */ - protected LuaAnalyzer(FileAnalyzerFactory factory) { + protected LuaAnalyzer(AnalyzerFactory factory) { super(factory, new JFlexTokenizer(new LuaSymbolTokenizer( - FileAnalyzer.dummyReader))); + AbstractAnalyzer.DUMMY_READER))); } /** diff --git a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/lua/LuaAnalyzerFactory.java b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/lua/LuaAnalyzerFactory.java index a0284c4dbca..334a9cdfe89 100644 --- a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/lua/LuaAnalyzerFactory.java +++ b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/lua/LuaAnalyzerFactory.java @@ -23,8 +23,7 @@ package org.opengrok.indexer.analysis.lua; -import org.opengrok.indexer.analysis.FileAnalyzer; -import org.opengrok.indexer.analysis.FileAnalyzer.Genre; +import org.opengrok.indexer.analysis.AbstractAnalyzer; import org.opengrok.indexer.analysis.FileAnalyzerFactory; /** @@ -40,11 +39,11 @@ public class LuaAnalyzerFactory extends FileAnalyzerFactory { }; public LuaAnalyzerFactory() { - super(null, null, SUFFIXES, null, null, "text/plain", Genre.PLAIN, name); + super(null, null, SUFFIXES, null, null, "text/plain", AbstractAnalyzer.Genre.PLAIN, name); } @Override - protected FileAnalyzer newAnalyzer() { + protected AbstractAnalyzer newAnalyzer() { return new LuaAnalyzer(this); } } diff --git a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/pascal/PascalAnalyzer.java b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/pascal/PascalAnalyzer.java index 78adc859f65..3679891b7cf 100644 --- a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/pascal/PascalAnalyzer.java +++ b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/pascal/PascalAnalyzer.java @@ -24,8 +24,8 @@ package org.opengrok.indexer.analysis.pascal; import java.io.Reader; -import org.opengrok.indexer.analysis.FileAnalyzer; -import org.opengrok.indexer.analysis.FileAnalyzerFactory; +import org.opengrok.indexer.analysis.AbstractAnalyzer; +import org.opengrok.indexer.analysis.AnalyzerFactory; import org.opengrok.indexer.analysis.JFlexTokenizer; import org.opengrok.indexer.analysis.JFlexXref; import org.opengrok.indexer.analysis.plain.AbstractSourceCodeAnalyzer; @@ -40,9 +40,9 @@ public class PascalAnalyzer extends AbstractSourceCodeAnalyzer { * Creates a new instance of {@link PascalAnalyzer}. * @param factory defined instance for the analyzer */ - protected PascalAnalyzer(FileAnalyzerFactory factory) { + protected PascalAnalyzer(AnalyzerFactory factory) { super(factory, new JFlexTokenizer(new PascalSymbolTokenizer( - FileAnalyzer.dummyReader))); + AbstractAnalyzer.DUMMY_READER))); } /** diff --git a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/pascal/PascalAnalyzerFactory.java b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/pascal/PascalAnalyzerFactory.java index f355dd92e9f..37da9bb301a 100644 --- a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/pascal/PascalAnalyzerFactory.java +++ b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/pascal/PascalAnalyzerFactory.java @@ -23,8 +23,7 @@ package org.opengrok.indexer.analysis.pascal; -import org.opengrok.indexer.analysis.FileAnalyzer; -import org.opengrok.indexer.analysis.FileAnalyzer.Genre; +import org.opengrok.indexer.analysis.AbstractAnalyzer; import org.opengrok.indexer.analysis.FileAnalyzerFactory; /** @@ -41,11 +40,11 @@ public class PascalAnalyzerFactory extends FileAnalyzerFactory { }; public PascalAnalyzerFactory() { - super(null, null, SUFFIXES, null, null, "text/plain", Genre.PLAIN, name); + super(null, null, SUFFIXES, null, null, "text/plain", AbstractAnalyzer.Genre.PLAIN, name); } @Override - protected FileAnalyzer newAnalyzer() { + protected AbstractAnalyzer newAnalyzer() { return new PascalAnalyzer(this); } } diff --git a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/perl/PerlAnalyzer.java b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/perl/PerlAnalyzer.java index 77f43a859f5..11fc946c11f 100644 --- a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/perl/PerlAnalyzer.java +++ b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/perl/PerlAnalyzer.java @@ -24,8 +24,8 @@ package org.opengrok.indexer.analysis.perl; import java.io.Reader; -import org.opengrok.indexer.analysis.FileAnalyzer; -import org.opengrok.indexer.analysis.FileAnalyzerFactory; +import org.opengrok.indexer.analysis.AbstractAnalyzer; +import org.opengrok.indexer.analysis.AnalyzerFactory; import org.opengrok.indexer.analysis.JFlexTokenizer; import org.opengrok.indexer.analysis.JFlexXref; import org.opengrok.indexer.analysis.plain.AbstractSourceCodeAnalyzer; @@ -40,9 +40,9 @@ public class PerlAnalyzer extends AbstractSourceCodeAnalyzer { * Creates a new instance of PerlAnalyzer * @param factory defined instance for the analyzer */ - protected PerlAnalyzer(FileAnalyzerFactory factory) { + protected PerlAnalyzer(AnalyzerFactory factory) { super(factory, new JFlexTokenizer(new PerlSymbolTokenizer( - FileAnalyzer.dummyReader))); + AbstractAnalyzer.DUMMY_READER))); } /** diff --git a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/perl/PerlAnalyzerFactory.java b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/perl/PerlAnalyzerFactory.java index 55242fad7f3..3cdaacae726 100644 --- a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/perl/PerlAnalyzerFactory.java +++ b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/perl/PerlAnalyzerFactory.java @@ -24,8 +24,7 @@ package org.opengrok.indexer.analysis.perl; -import org.opengrok.indexer.analysis.FileAnalyzer; -import org.opengrok.indexer.analysis.FileAnalyzer.Genre; +import org.opengrok.indexer.analysis.AbstractAnalyzer; import org.opengrok.indexer.analysis.FileAnalyzerFactory; /** @@ -52,11 +51,11 @@ public class PerlAnalyzerFactory extends FileAnalyzerFactory { }; public PerlAnalyzerFactory() { - super(null, null, SUFFIXES, MAGICS, null, "text/plain", Genre.PLAIN, name); + super(null, null, SUFFIXES, MAGICS, null, "text/plain", AbstractAnalyzer.Genre.PLAIN, name); } @Override - protected FileAnalyzer newAnalyzer() { + protected AbstractAnalyzer newAnalyzer() { return new PerlAnalyzer(this); } } diff --git a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/perl/PerlLexHelper.java b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/perl/PerlLexHelper.java index d766fde8632..b747693f665 100644 --- a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/perl/PerlLexHelper.java +++ b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/perl/PerlLexHelper.java @@ -28,11 +28,11 @@ import java.util.Queue; import java.util.regex.Matcher; import java.util.regex.Pattern; +import org.opengrok.indexer.analysis.JFlexJointLexer; import org.opengrok.indexer.analysis.Resettable; +import org.opengrok.indexer.util.RegexUtils; import org.opengrok.indexer.util.StringUtils; import org.opengrok.indexer.web.HtmlConsts; -import org.opengrok.indexer.analysis.JFlexJointLexer; -import org.opengrok.indexer.util.RegexUtils; /** * Represents an API for object's using {@link PerlLexHelper} diff --git a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/php/PhpAnalyzer.java b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/php/PhpAnalyzer.java index 650b98c9561..1d591bb445d 100644 --- a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/php/PhpAnalyzer.java +++ b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/php/PhpAnalyzer.java @@ -24,8 +24,8 @@ package org.opengrok.indexer.analysis.php; import java.io.Reader; -import org.opengrok.indexer.analysis.FileAnalyzer; -import org.opengrok.indexer.analysis.FileAnalyzerFactory; +import org.opengrok.indexer.analysis.AbstractAnalyzer; +import org.opengrok.indexer.analysis.AnalyzerFactory; import org.opengrok.indexer.analysis.JFlexTokenizer; import org.opengrok.indexer.analysis.JFlexXref; import org.opengrok.indexer.analysis.plain.AbstractSourceCodeAnalyzer; @@ -40,9 +40,9 @@ public class PhpAnalyzer extends AbstractSourceCodeAnalyzer { * Creates a new instance of PhpAnalyzer * @param factory defined instance for the analyzer */ - protected PhpAnalyzer(FileAnalyzerFactory factory) { + protected PhpAnalyzer(AnalyzerFactory factory) { super(factory, new JFlexTokenizer(new PhpSymbolTokenizer( - FileAnalyzer.dummyReader))); + AbstractAnalyzer.DUMMY_READER))); } /** diff --git a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/php/PhpAnalyzerFactory.java b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/php/PhpAnalyzerFactory.java index 86b37ccb30c..2e24e3ef05d 100644 --- a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/php/PhpAnalyzerFactory.java +++ b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/php/PhpAnalyzerFactory.java @@ -24,8 +24,7 @@ package org.opengrok.indexer.analysis.php; -import org.opengrok.indexer.analysis.FileAnalyzer; -import org.opengrok.indexer.analysis.FileAnalyzer.Genre; +import org.opengrok.indexer.analysis.AbstractAnalyzer; import org.opengrok.indexer.analysis.FileAnalyzerFactory; public class PhpAnalyzerFactory extends FileAnalyzerFactory { @@ -47,11 +46,11 @@ public class PhpAnalyzerFactory extends FileAnalyzerFactory { }; public PhpAnalyzerFactory() { - super(null, null, SUFFIXES, MAGICS, null, "text/plain", Genre.PLAIN, name); + super(null, null, SUFFIXES, MAGICS, null, "text/plain", AbstractAnalyzer.Genre.PLAIN, name); } @Override - protected FileAnalyzer newAnalyzer() { + protected AbstractAnalyzer newAnalyzer() { return new PhpAnalyzer(this); } } diff --git a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/plain/AbstractSourceCodeAnalyzer.java b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/plain/AbstractSourceCodeAnalyzer.java index 89518b23673..40c797baf5b 100644 --- a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/plain/AbstractSourceCodeAnalyzer.java +++ b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/plain/AbstractSourceCodeAnalyzer.java @@ -24,7 +24,7 @@ package org.opengrok.indexer.analysis.plain; import java.io.Reader; -import org.opengrok.indexer.analysis.FileAnalyzerFactory; +import org.opengrok.indexer.analysis.AnalyzerFactory; import org.opengrok.indexer.analysis.JFlexTokenizer; import org.opengrok.indexer.analysis.JFlexXref; @@ -53,7 +53,7 @@ public abstract class AbstractSourceCodeAnalyzer extends PlainAnalyzer { * @param factory defined instance for the analyzer * @param symbolTokenizer defined instance for the analyzer */ - protected AbstractSourceCodeAnalyzer(FileAnalyzerFactory factory, + protected AbstractSourceCodeAnalyzer(AnalyzerFactory factory, JFlexTokenizer symbolTokenizer) { super(factory, symbolTokenizer); } diff --git a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/plain/PlainAnalyzer.java b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/plain/PlainAnalyzer.java index 7c6fc98babe..853f3b2af8c 100644 --- a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/plain/PlainAnalyzer.java +++ b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/plain/PlainAnalyzer.java @@ -29,9 +29,9 @@ import java.io.Writer; import org.apache.lucene.document.Document; import org.apache.lucene.document.StoredField; +import org.opengrok.indexer.analysis.AnalyzerFactory; import org.opengrok.indexer.analysis.Definitions; import org.opengrok.indexer.analysis.ExpandTabsReader; -import org.opengrok.indexer.analysis.FileAnalyzerFactory; import org.opengrok.indexer.analysis.JFlexTokenizer; import org.opengrok.indexer.analysis.JFlexXref; import org.opengrok.indexer.analysis.OGKTextField; @@ -55,7 +55,7 @@ public class PlainAnalyzer extends TextAnalyzer { * Creates a new instance of PlainAnalyzer * @param factory defined instance for the analyzer */ - protected PlainAnalyzer(FileAnalyzerFactory factory) { + protected PlainAnalyzer(AnalyzerFactory factory) { super(factory); } @@ -64,7 +64,7 @@ protected PlainAnalyzer(FileAnalyzerFactory factory) { * @param factory defined instance for the analyzer * @param symbolTokenizer defined instance for the analyzer */ - protected PlainAnalyzer(FileAnalyzerFactory factory, + protected PlainAnalyzer(AnalyzerFactory factory, JFlexTokenizer symbolTokenizer) { super(factory, symbolTokenizer); } diff --git a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/plain/PlainAnalyzerFactory.java b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/plain/PlainAnalyzerFactory.java index 4606a759024..13024fd6100 100644 --- a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/plain/PlainAnalyzerFactory.java +++ b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/plain/PlainAnalyzerFactory.java @@ -26,8 +26,8 @@ import java.io.IOException; import java.io.InputStream; -import org.opengrok.indexer.analysis.FileAnalyzer; -import org.opengrok.indexer.analysis.FileAnalyzer.Genre; +import org.opengrok.indexer.analysis.AbstractAnalyzer; +import org.opengrok.indexer.analysis.AnalyzerFactory; import org.opengrok.indexer.analysis.FileAnalyzerFactory; import org.opengrok.indexer.util.IOUtils; @@ -44,7 +44,7 @@ public String description() { } @Override - public FileAnalyzerFactory isMagic(byte[] content, InputStream in) + public AnalyzerFactory isMagic(byte[] content, InputStream in) throws IOException { if (isPlainText(content)) { return DEFAULT_INSTANCE; @@ -54,7 +54,7 @@ public FileAnalyzerFactory isMagic(byte[] content, InputStream in) } @Override - public FileAnalyzerFactory forFactory() { + public AnalyzerFactory forFactory() { return DEFAULT_INSTANCE; } @@ -98,11 +98,11 @@ private boolean isPlainText(String str) { new PlainAnalyzerFactory(); private PlainAnalyzerFactory() { - super(null, null, null, null, MATCHER, "text/plain", Genre.PLAIN, name); + super(null, null, null, null, MATCHER, "text/plain", AbstractAnalyzer.Genre.PLAIN, name); } @Override - protected FileAnalyzer newAnalyzer() { + protected AbstractAnalyzer newAnalyzer() { return new PlainAnalyzer(this); } } diff --git a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/plain/XMLAnalyzer.java b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/plain/XMLAnalyzer.java index bc64b1e184f..ae10848284b 100644 --- a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/plain/XMLAnalyzer.java +++ b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/plain/XMLAnalyzer.java @@ -27,11 +27,11 @@ import java.io.Reader; import java.io.Writer; import org.apache.lucene.document.Document; -import org.opengrok.indexer.analysis.FileAnalyzerFactory; +import org.opengrok.indexer.analysis.AnalyzerFactory; import org.opengrok.indexer.analysis.JFlexXref; +import org.opengrok.indexer.analysis.OGKTextField; import org.opengrok.indexer.analysis.StreamSource; import org.opengrok.indexer.analysis.TextAnalyzer; -import org.opengrok.indexer.analysis.OGKTextField; import org.opengrok.indexer.analysis.WriteXrefArgs; import org.opengrok.indexer.analysis.Xrefer; import org.opengrok.indexer.search.QueryBuilder; @@ -47,7 +47,7 @@ public class XMLAnalyzer extends TextAnalyzer { * Creates a new instance of XMLAnalyzer * @param factory factory to be used */ - protected XMLAnalyzer(FileAnalyzerFactory factory) { + protected XMLAnalyzer(AnalyzerFactory factory) { super(factory); } diff --git a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/plain/XMLAnalyzerFactory.java b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/plain/XMLAnalyzerFactory.java index 904c32c5ff9..a7e9deddb3c 100644 --- a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/plain/XMLAnalyzerFactory.java +++ b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/plain/XMLAnalyzerFactory.java @@ -23,8 +23,7 @@ package org.opengrok.indexer.analysis.plain; -import org.opengrok.indexer.analysis.FileAnalyzer; -import org.opengrok.indexer.analysis.FileAnalyzer.Genre; +import org.opengrok.indexer.analysis.AbstractAnalyzer; import org.opengrok.indexer.analysis.FileAnalyzerFactory; public class XMLAnalyzerFactory extends FileAnalyzerFactory { @@ -42,11 +41,11 @@ public class XMLAnalyzerFactory extends FileAnalyzerFactory { }; public XMLAnalyzerFactory() { - super(null, null, SUFFIXES, MAGICS, null, "text/html", Genre.PLAIN, name); + super(null, null, SUFFIXES, MAGICS, null, "text/html", AbstractAnalyzer.Genre.PLAIN, name); } @Override - protected FileAnalyzer newAnalyzer() { + protected AbstractAnalyzer newAnalyzer() { return new XMLAnalyzer(this); } } diff --git a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/powershell/PowershellAnalyzer.java b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/powershell/PowershellAnalyzer.java index 449d4885f36..009cf428ceb 100644 --- a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/powershell/PowershellAnalyzer.java +++ b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/powershell/PowershellAnalyzer.java @@ -24,8 +24,8 @@ package org.opengrok.indexer.analysis.powershell; import java.io.Reader; -import org.opengrok.indexer.analysis.FileAnalyzer; -import org.opengrok.indexer.analysis.FileAnalyzerFactory; +import org.opengrok.indexer.analysis.AbstractAnalyzer; +import org.opengrok.indexer.analysis.AnalyzerFactory; import org.opengrok.indexer.analysis.JFlexTokenizer; import org.opengrok.indexer.analysis.JFlexXref; import org.opengrok.indexer.analysis.plain.AbstractSourceCodeAnalyzer; @@ -41,9 +41,9 @@ public class PowershellAnalyzer extends AbstractSourceCodeAnalyzer { * Creates a new instance of {@link PowershellAnalyzer}. * @param factory defined instance for the analyzer */ - protected PowershellAnalyzer(FileAnalyzerFactory factory) { + protected PowershellAnalyzer(AnalyzerFactory factory) { super(factory, new JFlexTokenizer(new PoshSymbolTokenizer( - FileAnalyzer.dummyReader))); + AbstractAnalyzer.DUMMY_READER))); } /** diff --git a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/powershell/PowershellAnalyzerFactory.java b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/powershell/PowershellAnalyzerFactory.java index af82266876a..c3adfea1e69 100644 --- a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/powershell/PowershellAnalyzerFactory.java +++ b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/powershell/PowershellAnalyzerFactory.java @@ -22,8 +22,7 @@ */ package org.opengrok.indexer.analysis.powershell; -import org.opengrok.indexer.analysis.FileAnalyzer; -import org.opengrok.indexer.analysis.FileAnalyzer.Genre; +import org.opengrok.indexer.analysis.AbstractAnalyzer; import org.opengrok.indexer.analysis.FileAnalyzerFactory; public class PowershellAnalyzerFactory extends FileAnalyzerFactory { @@ -36,11 +35,11 @@ public class PowershellAnalyzerFactory extends FileAnalyzerFactory { }; public PowershellAnalyzerFactory() { - super(null, null, SUFFIXES, null, null, "text/plain", Genre.PLAIN, name); + super(null, null, SUFFIXES, null, null, "text/plain", AbstractAnalyzer.Genre.PLAIN, name); } @Override - protected FileAnalyzer newAnalyzer() { + protected AbstractAnalyzer newAnalyzer() { return new PowershellAnalyzer(this); } } diff --git a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/python/PythonAnalyzer.java b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/python/PythonAnalyzer.java index e9270e6d435..800a96e91e2 100644 --- a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/python/PythonAnalyzer.java +++ b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/python/PythonAnalyzer.java @@ -24,8 +24,8 @@ package org.opengrok.indexer.analysis.python; import java.io.Reader; -import org.opengrok.indexer.analysis.FileAnalyzer; -import org.opengrok.indexer.analysis.FileAnalyzerFactory; +import org.opengrok.indexer.analysis.AbstractAnalyzer; +import org.opengrok.indexer.analysis.AnalyzerFactory; import org.opengrok.indexer.analysis.JFlexTokenizer; import org.opengrok.indexer.analysis.JFlexXref; import org.opengrok.indexer.analysis.plain.AbstractSourceCodeAnalyzer; @@ -40,9 +40,9 @@ public class PythonAnalyzer extends AbstractSourceCodeAnalyzer { * Creates a new instance of PythonAnalyzer * @param factory defined instance for the analyzer */ - protected PythonAnalyzer(FileAnalyzerFactory factory) { + protected PythonAnalyzer(AnalyzerFactory factory) { super(factory, new JFlexTokenizer(new PythonSymbolTokenizer( - FileAnalyzer.dummyReader))); + AbstractAnalyzer.DUMMY_READER))); } /** diff --git a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/python/PythonAnalyzerFactory.java b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/python/PythonAnalyzerFactory.java index 5a634da78be..4c50894a3fd 100644 --- a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/python/PythonAnalyzerFactory.java +++ b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/python/PythonAnalyzerFactory.java @@ -24,8 +24,7 @@ package org.opengrok.indexer.analysis.python; -import org.opengrok.indexer.analysis.FileAnalyzer; -import org.opengrok.indexer.analysis.FileAnalyzer.Genre; +import org.opengrok.indexer.analysis.AbstractAnalyzer; import org.opengrok.indexer.analysis.FileAnalyzerFactory; /** @@ -34,9 +33,9 @@ */ public class PythonAnalyzerFactory extends FileAnalyzerFactory { - + private static final String name = "Python"; - + //TODO note that .PM below is kind of wrong, since perl already has this and is registered before python analyzer // unfortunately we miss code that would be able to share extensions between analyzers private static final String[] SUFFIXES = { @@ -51,11 +50,11 @@ public class PythonAnalyzerFactory extends FileAnalyzerFactory { }; public PythonAnalyzerFactory() { - super(null, null, SUFFIXES, MAGICS, null, "text/plain", Genre.PLAIN, name); + super(null, null, SUFFIXES, MAGICS, null, "text/plain", AbstractAnalyzer.Genre.PLAIN, name); } @Override - protected FileAnalyzer newAnalyzer() { + protected AbstractAnalyzer newAnalyzer() { return new PythonAnalyzer(this); } } diff --git a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/ruby/RubyAnalyzer.java b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/ruby/RubyAnalyzer.java index c12cefe6d37..cd2118d8623 100644 --- a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/ruby/RubyAnalyzer.java +++ b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/ruby/RubyAnalyzer.java @@ -25,8 +25,8 @@ package org.opengrok.indexer.analysis.ruby; import java.io.Reader; -import org.opengrok.indexer.analysis.FileAnalyzer; -import org.opengrok.indexer.analysis.FileAnalyzerFactory; +import org.opengrok.indexer.analysis.AbstractAnalyzer; +import org.opengrok.indexer.analysis.AnalyzerFactory; import org.opengrok.indexer.analysis.JFlexTokenizer; import org.opengrok.indexer.analysis.JFlexXref; import org.opengrok.indexer.analysis.plain.AbstractSourceCodeAnalyzer; @@ -41,9 +41,9 @@ public class RubyAnalyzer extends AbstractSourceCodeAnalyzer { * Creates a new instance of {@link RubyAnalyzer}. * @param factory defined instance for the analyzer */ - protected RubyAnalyzer(FileAnalyzerFactory factory) { + protected RubyAnalyzer(AnalyzerFactory factory) { super(factory, new JFlexTokenizer(new RubySymbolTokenizer( - FileAnalyzer.dummyReader))); + AbstractAnalyzer.DUMMY_READER))); } /** diff --git a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/ruby/RubyAnalyzerFactory.java b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/ruby/RubyAnalyzerFactory.java index 24512232b46..e4c2c9eaa6e 100644 --- a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/ruby/RubyAnalyzerFactory.java +++ b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/ruby/RubyAnalyzerFactory.java @@ -24,8 +24,7 @@ package org.opengrok.indexer.analysis.ruby; -import org.opengrok.indexer.analysis.FileAnalyzer; -import org.opengrok.indexer.analysis.FileAnalyzer.Genre; +import org.opengrok.indexer.analysis.AbstractAnalyzer; import org.opengrok.indexer.analysis.FileAnalyzerFactory; /** @@ -52,7 +51,7 @@ public class RubyAnalyzerFactory extends FileAnalyzerFactory { * Creates a new instance of {@link RubyAnalyzerFactory}. */ public RubyAnalyzerFactory() { - super(null, null, SUFFIXES, MAGICS, null, "text/plain", Genre.PLAIN, + super(null, null, SUFFIXES, MAGICS, null, "text/plain", AbstractAnalyzer.Genre.PLAIN, name); } @@ -61,7 +60,7 @@ public RubyAnalyzerFactory() { * @return the new instance */ @Override - protected FileAnalyzer newAnalyzer() { + protected AbstractAnalyzer newAnalyzer() { return new RubyAnalyzer(this); } } diff --git a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/ruby/RubyLexHelper.java b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/ruby/RubyLexHelper.java index 18eb45e4ba0..9c99c3fe199 100644 --- a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/ruby/RubyLexHelper.java +++ b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/ruby/RubyLexHelper.java @@ -28,11 +28,11 @@ import java.util.Queue; import java.util.regex.Matcher; import java.util.regex.Pattern; +import org.opengrok.indexer.analysis.JFlexJointLexer; import org.opengrok.indexer.analysis.Resettable; +import org.opengrok.indexer.util.RegexUtils; import org.opengrok.indexer.util.StringUtils; import org.opengrok.indexer.web.HtmlConsts; -import org.opengrok.indexer.analysis.JFlexJointLexer; -import org.opengrok.indexer.util.RegexUtils; /** * Represents an API for object's using {@link RubyLexHelper} diff --git a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/rust/RustAnalyzer.java b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/rust/RustAnalyzer.java index 661df1725cc..5bc996150fa 100644 --- a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/rust/RustAnalyzer.java +++ b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/rust/RustAnalyzer.java @@ -26,8 +26,8 @@ package org.opengrok.indexer.analysis.rust; import java.io.Reader; -import org.opengrok.indexer.analysis.FileAnalyzer; -import org.opengrok.indexer.analysis.FileAnalyzerFactory; +import org.opengrok.indexer.analysis.AbstractAnalyzer; +import org.opengrok.indexer.analysis.AnalyzerFactory; import org.opengrok.indexer.analysis.JFlexTokenizer; import org.opengrok.indexer.analysis.JFlexXref; import org.opengrok.indexer.analysis.plain.AbstractSourceCodeAnalyzer; @@ -43,9 +43,9 @@ public class RustAnalyzer extends AbstractSourceCodeAnalyzer { * Creates a new instance of RustAnalyzer * @param factory defined instance for the analyzer */ - protected RustAnalyzer(FileAnalyzerFactory factory) { + protected RustAnalyzer(AnalyzerFactory factory) { super(factory, new JFlexTokenizer(new RustSymbolTokenizer( - FileAnalyzer.dummyReader))); + AbstractAnalyzer.DUMMY_READER))); } /** diff --git a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/rust/RustAnalyzerFactory.java b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/rust/RustAnalyzerFactory.java index 688bfa1c513..4ed2faec343 100644 --- a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/rust/RustAnalyzerFactory.java +++ b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/rust/RustAnalyzerFactory.java @@ -24,8 +24,7 @@ package org.opengrok.indexer.analysis.rust; -import org.opengrok.indexer.analysis.FileAnalyzer; -import org.opengrok.indexer.analysis.FileAnalyzer.Genre; +import org.opengrok.indexer.analysis.AbstractAnalyzer; import org.opengrok.indexer.analysis.FileAnalyzerFactory; /** @@ -43,11 +42,11 @@ public class RustAnalyzerFactory extends FileAnalyzerFactory { }; public RustAnalyzerFactory() { - super(null, null, SUFFIXES, null, null, "text/plain", Genre.PLAIN, name); + super(null, null, SUFFIXES, null, null, "text/plain", AbstractAnalyzer.Genre.PLAIN, name); } @Override - protected FileAnalyzer newAnalyzer() { + protected AbstractAnalyzer newAnalyzer() { return new RustAnalyzer(this); } } diff --git a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/scala/ScalaAnalyzer.java b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/scala/ScalaAnalyzer.java index 2bcd4894b1d..20328114fb0 100644 --- a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/scala/ScalaAnalyzer.java +++ b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/scala/ScalaAnalyzer.java @@ -24,8 +24,8 @@ package org.opengrok.indexer.analysis.scala; import java.io.Reader; -import org.opengrok.indexer.analysis.FileAnalyzer; -import org.opengrok.indexer.analysis.FileAnalyzerFactory; +import org.opengrok.indexer.analysis.AbstractAnalyzer; +import org.opengrok.indexer.analysis.AnalyzerFactory; import org.opengrok.indexer.analysis.JFlexTokenizer; import org.opengrok.indexer.analysis.JFlexXref; import org.opengrok.indexer.analysis.plain.AbstractSourceCodeAnalyzer; @@ -40,9 +40,9 @@ public class ScalaAnalyzer extends AbstractSourceCodeAnalyzer { * Creates a new instance of ScalaAnalyzer * @param factory defined instance for the analyzer */ - protected ScalaAnalyzer(FileAnalyzerFactory factory) { + protected ScalaAnalyzer(AnalyzerFactory factory) { super(factory, new JFlexTokenizer(new ScalaSymbolTokenizer( - FileAnalyzer.dummyReader))); + AbstractAnalyzer.DUMMY_READER))); } /** diff --git a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/scala/ScalaAnalyzerFactory.java b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/scala/ScalaAnalyzerFactory.java index 0f4b740d5f6..ec89bbe1aa3 100644 --- a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/scala/ScalaAnalyzerFactory.java +++ b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/scala/ScalaAnalyzerFactory.java @@ -23,8 +23,7 @@ package org.opengrok.indexer.analysis.scala; -import org.opengrok.indexer.analysis.FileAnalyzer; -import org.opengrok.indexer.analysis.FileAnalyzer.Genre; +import org.opengrok.indexer.analysis.AbstractAnalyzer; import org.opengrok.indexer.analysis.FileAnalyzerFactory; /** @@ -41,11 +40,11 @@ public class ScalaAnalyzerFactory extends FileAnalyzerFactory { }; public ScalaAnalyzerFactory() { - super(null, null, SUFFIXES, null, null, "text/plain", Genre.PLAIN, name); + super(null, null, SUFFIXES, null, null, "text/plain", AbstractAnalyzer.Genre.PLAIN, name); } @Override - protected FileAnalyzer newAnalyzer() { + protected AbstractAnalyzer newAnalyzer() { return new ScalaAnalyzer(this); } } diff --git a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/sh/ShAnalyzer.java b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/sh/ShAnalyzer.java index 788c51a494f..59ecbdf0841 100644 --- a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/sh/ShAnalyzer.java +++ b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/sh/ShAnalyzer.java @@ -24,8 +24,8 @@ package org.opengrok.indexer.analysis.sh; import java.io.Reader; -import org.opengrok.indexer.analysis.FileAnalyzer; -import org.opengrok.indexer.analysis.FileAnalyzerFactory; +import org.opengrok.indexer.analysis.AbstractAnalyzer; +import org.opengrok.indexer.analysis.AnalyzerFactory; import org.opengrok.indexer.analysis.JFlexTokenizer; import org.opengrok.indexer.analysis.JFlexXref; import org.opengrok.indexer.analysis.plain.AbstractSourceCodeAnalyzer; @@ -41,9 +41,9 @@ public class ShAnalyzer extends AbstractSourceCodeAnalyzer { * Creates a new instance of ShAnalyzer * @param factory defined instance for the analyzer */ - protected ShAnalyzer(FileAnalyzerFactory factory) { + protected ShAnalyzer(AnalyzerFactory factory) { super(factory, new JFlexTokenizer(new ShSymbolTokenizer( - FileAnalyzer.dummyReader))); + AbstractAnalyzer.DUMMY_READER))); } /** diff --git a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/sh/ShAnalyzerFactory.java b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/sh/ShAnalyzerFactory.java index 6ddeaf67ce3..6dacd76e351 100644 --- a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/sh/ShAnalyzerFactory.java +++ b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/sh/ShAnalyzerFactory.java @@ -23,8 +23,7 @@ */ package org.opengrok.indexer.analysis.sh; -import org.opengrok.indexer.analysis.FileAnalyzer; -import org.opengrok.indexer.analysis.FileAnalyzer.Genre; +import org.opengrok.indexer.analysis.AbstractAnalyzer; import org.opengrok.indexer.analysis.FileAnalyzerFactory; public class ShAnalyzerFactory extends FileAnalyzerFactory { @@ -61,11 +60,11 @@ public class ShAnalyzerFactory extends FileAnalyzerFactory { }; public ShAnalyzerFactory() { - super(NAMES, PREFIXES, SUFFIXES, MAGICS, null, "text/plain", Genre.PLAIN, name); + super(NAMES, PREFIXES, SUFFIXES, MAGICS, null, "text/plain", AbstractAnalyzer.Genre.PLAIN, name); } @Override - protected FileAnalyzer newAnalyzer() { + protected AbstractAnalyzer newAnalyzer() { return new ShAnalyzer(this); } } diff --git a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/sql/PLSQLAnalyzer.java b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/sql/PLSQLAnalyzer.java index 6487bf80341..52c3a7064c4 100644 --- a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/sql/PLSQLAnalyzer.java +++ b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/sql/PLSQLAnalyzer.java @@ -24,13 +24,13 @@ package org.opengrok.indexer.analysis.sql; import java.io.Reader; -import org.opengrok.indexer.analysis.FileAnalyzerFactory; +import org.opengrok.indexer.analysis.AnalyzerFactory; import org.opengrok.indexer.analysis.JFlexXref; import org.opengrok.indexer.analysis.plain.PlainAnalyzer; public class PLSQLAnalyzer extends PlainAnalyzer { - public PLSQLAnalyzer(FileAnalyzerFactory factory) { + public PLSQLAnalyzer(AnalyzerFactory factory) { super(factory); } diff --git a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/sql/PLSQLAnalyzerFactory.java b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/sql/PLSQLAnalyzerFactory.java index 8440efb73a5..c16468d5bb5 100644 --- a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/sql/PLSQLAnalyzerFactory.java +++ b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/sql/PLSQLAnalyzerFactory.java @@ -23,8 +23,7 @@ package org.opengrok.indexer.analysis.sql; -import org.opengrok.indexer.analysis.FileAnalyzer; -import org.opengrok.indexer.analysis.FileAnalyzer.Genre; +import org.opengrok.indexer.analysis.AbstractAnalyzer; import org.opengrok.indexer.analysis.FileAnalyzerFactory; public class PLSQLAnalyzerFactory extends FileAnalyzerFactory { @@ -41,11 +40,11 @@ public class PLSQLAnalyzerFactory extends FileAnalyzerFactory { }; public PLSQLAnalyzerFactory() { - super(null, null, SUFFIXES, null, null, "text/plain", Genre.PLAIN, name); + super(null, null, SUFFIXES, null, null, "text/plain", AbstractAnalyzer.Genre.PLAIN, name); } @Override - protected FileAnalyzer newAnalyzer() { + protected AbstractAnalyzer newAnalyzer() { return new PLSQLAnalyzer(this); } } diff --git a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/sql/SQLAnalyzer.java b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/sql/SQLAnalyzer.java index 00bda524290..617bbfa7580 100644 --- a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/sql/SQLAnalyzer.java +++ b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/sql/SQLAnalyzer.java @@ -24,13 +24,13 @@ package org.opengrok.indexer.analysis.sql; import java.io.Reader; -import org.opengrok.indexer.analysis.FileAnalyzerFactory; +import org.opengrok.indexer.analysis.AnalyzerFactory; import org.opengrok.indexer.analysis.JFlexXref; import org.opengrok.indexer.analysis.plain.PlainAnalyzer; public class SQLAnalyzer extends PlainAnalyzer { - public SQLAnalyzer(FileAnalyzerFactory factory) { + public SQLAnalyzer(AnalyzerFactory factory) { super(factory); } diff --git a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/sql/SQLAnalyzerFactory.java b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/sql/SQLAnalyzerFactory.java index 2b2a5957904..9dc5f422325 100644 --- a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/sql/SQLAnalyzerFactory.java +++ b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/sql/SQLAnalyzerFactory.java @@ -23,8 +23,7 @@ package org.opengrok.indexer.analysis.sql; -import org.opengrok.indexer.analysis.FileAnalyzer; -import org.opengrok.indexer.analysis.FileAnalyzer.Genre; +import org.opengrok.indexer.analysis.AbstractAnalyzer; import org.opengrok.indexer.analysis.FileAnalyzerFactory; public class SQLAnalyzerFactory extends FileAnalyzerFactory { @@ -36,11 +35,11 @@ public class SQLAnalyzerFactory extends FileAnalyzerFactory { }; public SQLAnalyzerFactory() { - super(null, null, SUFFIXES, null, null, "text/plain", Genre.PLAIN, name); + super(null, null, SUFFIXES, null, null, "text/plain", AbstractAnalyzer.Genre.PLAIN, name); } @Override - protected FileAnalyzer newAnalyzer() { + protected AbstractAnalyzer newAnalyzer() { return new SQLAnalyzer(this); } } diff --git a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/swift/SwiftAnalyzer.java b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/swift/SwiftAnalyzer.java index 7c67c0920b5..5d306d5487a 100644 --- a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/swift/SwiftAnalyzer.java +++ b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/swift/SwiftAnalyzer.java @@ -24,8 +24,8 @@ package org.opengrok.indexer.analysis.swift; import java.io.Reader; -import org.opengrok.indexer.analysis.FileAnalyzer; -import org.opengrok.indexer.analysis.FileAnalyzerFactory; +import org.opengrok.indexer.analysis.AbstractAnalyzer; +import org.opengrok.indexer.analysis.AnalyzerFactory; import org.opengrok.indexer.analysis.JFlexTokenizer; import org.opengrok.indexer.analysis.JFlexXref; import org.opengrok.indexer.analysis.plain.AbstractSourceCodeAnalyzer; @@ -40,9 +40,9 @@ public class SwiftAnalyzer extends AbstractSourceCodeAnalyzer { * Creates a new instance of {@link SwiftAnalyzer}. * @param factory defined instance for the analyzer */ - protected SwiftAnalyzer(FileAnalyzerFactory factory) { + protected SwiftAnalyzer(AnalyzerFactory factory) { super(factory, new JFlexTokenizer(new SwiftSymbolTokenizer( - FileAnalyzer.dummyReader))); + AbstractAnalyzer.DUMMY_READER))); } /** diff --git a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/swift/SwiftAnalyzerFactory.java b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/swift/SwiftAnalyzerFactory.java index d0051c4c2cc..03f1f4049b1 100644 --- a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/swift/SwiftAnalyzerFactory.java +++ b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/swift/SwiftAnalyzerFactory.java @@ -23,8 +23,7 @@ package org.opengrok.indexer.analysis.swift; -import org.opengrok.indexer.analysis.FileAnalyzer; -import org.opengrok.indexer.analysis.FileAnalyzer.Genre; +import org.opengrok.indexer.analysis.AbstractAnalyzer; import org.opengrok.indexer.analysis.FileAnalyzerFactory; public class SwiftAnalyzerFactory extends FileAnalyzerFactory { @@ -36,11 +35,11 @@ public class SwiftAnalyzerFactory extends FileAnalyzerFactory { }; public SwiftAnalyzerFactory() { - super(null, null, SUFFIXES, null, null, "text/plain", Genre.PLAIN, name); + super(null, null, SUFFIXES, null, null, "text/plain", AbstractAnalyzer.Genre.PLAIN, name); } @Override - protected FileAnalyzer newAnalyzer() { + protected AbstractAnalyzer newAnalyzer() { return new SwiftAnalyzer(this); } } diff --git a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/tcl/TclAnalyzer.java b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/tcl/TclAnalyzer.java index 0269aee7f3f..4bc3aa94d55 100644 --- a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/tcl/TclAnalyzer.java +++ b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/tcl/TclAnalyzer.java @@ -24,8 +24,8 @@ package org.opengrok.indexer.analysis.tcl; import java.io.Reader; -import org.opengrok.indexer.analysis.FileAnalyzer; -import org.opengrok.indexer.analysis.FileAnalyzerFactory; +import org.opengrok.indexer.analysis.AbstractAnalyzer; +import org.opengrok.indexer.analysis.AnalyzerFactory; import org.opengrok.indexer.analysis.JFlexTokenizer; import org.opengrok.indexer.analysis.JFlexXref; import org.opengrok.indexer.analysis.plain.AbstractSourceCodeAnalyzer; @@ -36,9 +36,9 @@ */ public class TclAnalyzer extends AbstractSourceCodeAnalyzer { - protected TclAnalyzer(FileAnalyzerFactory factory) { + protected TclAnalyzer(AnalyzerFactory factory) { super(factory, new JFlexTokenizer(new TclSymbolTokenizer( - FileAnalyzer.dummyReader))); + AbstractAnalyzer.DUMMY_READER))); } /** diff --git a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/tcl/TclAnalyzerFactory.java b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/tcl/TclAnalyzerFactory.java index 171e905d3de..d93c0ee717b 100644 --- a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/tcl/TclAnalyzerFactory.java +++ b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/tcl/TclAnalyzerFactory.java @@ -23,8 +23,7 @@ package org.opengrok.indexer.analysis.tcl; -import org.opengrok.indexer.analysis.FileAnalyzer; -import org.opengrok.indexer.analysis.FileAnalyzer.Genre; +import org.opengrok.indexer.analysis.AbstractAnalyzer; import org.opengrok.indexer.analysis.FileAnalyzerFactory; public class TclAnalyzerFactory extends FileAnalyzerFactory { @@ -43,11 +42,11 @@ public class TclAnalyzerFactory extends FileAnalyzerFactory { }; public TclAnalyzerFactory() { - super(null, null, SUFFIXES, null, null, "text/plain", Genre.PLAIN, name); + super(null, null, SUFFIXES, null, null, "text/plain", AbstractAnalyzer.Genre.PLAIN, name); } @Override - protected FileAnalyzer newAnalyzer() { + protected AbstractAnalyzer newAnalyzer() { return new TclAnalyzer(this); } } diff --git a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/uue/UuencodeAnalyzer.java b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/uue/UuencodeAnalyzer.java index 9a01d7a5b80..bd4a756a237 100644 --- a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/uue/UuencodeAnalyzer.java +++ b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/uue/UuencodeAnalyzer.java @@ -27,13 +27,13 @@ import java.io.Reader; import java.io.Writer; import org.apache.lucene.document.Document; -import org.opengrok.indexer.analysis.FileAnalyzer; -import org.opengrok.indexer.analysis.FileAnalyzerFactory; +import org.opengrok.indexer.analysis.AbstractAnalyzer; +import org.opengrok.indexer.analysis.AnalyzerFactory; import org.opengrok.indexer.analysis.JFlexTokenizer; import org.opengrok.indexer.analysis.JFlexXref; +import org.opengrok.indexer.analysis.OGKTextField; import org.opengrok.indexer.analysis.StreamSource; import org.opengrok.indexer.analysis.TextAnalyzer; -import org.opengrok.indexer.analysis.OGKTextField; import org.opengrok.indexer.analysis.WriteXrefArgs; import org.opengrok.indexer.search.QueryBuilder; @@ -48,9 +48,9 @@ public class UuencodeAnalyzer extends TextAnalyzer { * Creates a new instance of UuencodeAnalyzer * @param factory defined instance for the analyzer */ - protected UuencodeAnalyzer(FileAnalyzerFactory factory) { + protected UuencodeAnalyzer(AnalyzerFactory factory) { super(factory, new JFlexTokenizer(new UuencodeFullTokenizer( - FileAnalyzer.dummyReader))); + AbstractAnalyzer.DUMMY_READER))); } /** diff --git a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/uue/UuencodeAnalyzerFactory.java b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/uue/UuencodeAnalyzerFactory.java index d5adc047837..56626598aca 100644 --- a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/uue/UuencodeAnalyzerFactory.java +++ b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/uue/UuencodeAnalyzerFactory.java @@ -24,8 +24,7 @@ package org.opengrok.indexer.analysis.uue; -import org.opengrok.indexer.analysis.FileAnalyzer; -import org.opengrok.indexer.analysis.FileAnalyzer.Genre; +import org.opengrok.indexer.analysis.AbstractAnalyzer; import org.opengrok.indexer.analysis.FileAnalyzerFactory; /** @@ -53,11 +52,11 @@ public class UuencodeAnalyzerFactory extends FileAnalyzerFactory { }; public UuencodeAnalyzerFactory() { - super(null, null, SUFFIXES, MAGICS, null, "text/plain", Genre.PLAIN, name); + super(null, null, SUFFIXES, MAGICS, null, "text/plain", AbstractAnalyzer.Genre.PLAIN, name); } @Override - protected FileAnalyzer newAnalyzer() { + protected AbstractAnalyzer newAnalyzer() { return new UuencodeAnalyzer(this); } } diff --git a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/vb/VBAnalyzer.java b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/vb/VBAnalyzer.java index 8a8e2bff8f1..5891cd5ad92 100644 --- a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/vb/VBAnalyzer.java +++ b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/vb/VBAnalyzer.java @@ -24,8 +24,8 @@ package org.opengrok.indexer.analysis.vb; import java.io.Reader; -import org.opengrok.indexer.analysis.FileAnalyzer; -import org.opengrok.indexer.analysis.FileAnalyzerFactory; +import org.opengrok.indexer.analysis.AbstractAnalyzer; +import org.opengrok.indexer.analysis.AnalyzerFactory; import org.opengrok.indexer.analysis.JFlexTokenizer; import org.opengrok.indexer.analysis.JFlexXref; import org.opengrok.indexer.analysis.plain.AbstractSourceCodeAnalyzer; @@ -40,9 +40,9 @@ public class VBAnalyzer extends AbstractSourceCodeAnalyzer { * Creates a new instance of VBAnalyzer * @param factory defined instance for the analyzer */ - protected VBAnalyzer(FileAnalyzerFactory factory) { + protected VBAnalyzer(AnalyzerFactory factory) { super(factory, new JFlexTokenizer(new VBSymbolTokenizer( - FileAnalyzer.dummyReader))); + AbstractAnalyzer.DUMMY_READER))); } /** diff --git a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/vb/VBAnalyzerFactory.java b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/vb/VBAnalyzerFactory.java index d148afb5797..f85072e5c23 100644 --- a/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/vb/VBAnalyzerFactory.java +++ b/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/vb/VBAnalyzerFactory.java @@ -22,8 +22,7 @@ */ package org.opengrok.indexer.analysis.vb; -import org.opengrok.indexer.analysis.FileAnalyzer; -import org.opengrok.indexer.analysis.FileAnalyzer.Genre; +import org.opengrok.indexer.analysis.AbstractAnalyzer; import org.opengrok.indexer.analysis.FileAnalyzerFactory; public class VBAnalyzerFactory extends FileAnalyzerFactory { @@ -40,11 +39,11 @@ public class VBAnalyzerFactory extends FileAnalyzerFactory { }; public VBAnalyzerFactory() { - super(null, null, SUFFIXES, null, null, "text/plain", Genre.PLAIN, name); + super(null, null, SUFFIXES, null, null, "text/plain", AbstractAnalyzer.Genre.PLAIN, name); } @Override - protected FileAnalyzer newAnalyzer() { + protected AbstractAnalyzer newAnalyzer() { return new VBAnalyzer(this); } } diff --git a/opengrok-indexer/src/main/java/org/opengrok/indexer/index/IndexDatabase.java b/opengrok-indexer/src/main/java/org/opengrok/indexer/index/IndexDatabase.java index 0e444b39d39..ea3a078e67e 100644 --- a/opengrok-indexer/src/main/java/org/opengrok/indexer/index/IndexDatabase.java +++ b/opengrok-indexer/src/main/java/org/opengrok/indexer/index/IndexDatabase.java @@ -51,6 +51,9 @@ import java.util.logging.Logger; import java.util.stream.Collectors; import java.util.zip.GZIPOutputStream; +import javax.ws.rs.client.ClientBuilder; +import javax.ws.rs.client.Entity; +import javax.ws.rs.core.Response; import org.apache.lucene.analysis.Analyzer; import org.apache.lucene.analysis.standard.StandardAnalyzer; import org.apache.lucene.codecs.lucene50.Lucene50StoredFieldsFormat; @@ -82,12 +85,11 @@ import org.apache.lucene.store.NoLockFactory; import org.apache.lucene.store.SimpleFSLockFactory; import org.apache.lucene.util.BytesRef; +import org.opengrok.indexer.analysis.AbstractAnalyzer; +import org.opengrok.indexer.analysis.AnalyzerFactory; import org.opengrok.indexer.analysis.AnalyzerGuru; import org.opengrok.indexer.analysis.Ctags; import org.opengrok.indexer.analysis.Definitions; -import org.opengrok.indexer.analysis.FileAnalyzer; -import org.opengrok.indexer.analysis.FileAnalyzer.Genre; -import org.opengrok.indexer.analysis.FileAnalyzerFactory; import org.opengrok.indexer.configuration.Project; import org.opengrok.indexer.configuration.RuntimeEnvironment; import org.opengrok.indexer.history.HistoryException; @@ -101,10 +103,6 @@ import org.opengrok.indexer.util.TandemPath; import org.opengrok.indexer.web.Util; -import javax.ws.rs.client.ClientBuilder; -import javax.ws.rs.client.Entity; -import javax.ws.rs.core.Response; - /** * This class is used to create / update the index databases. Currently we use * one index database per project. @@ -747,7 +745,7 @@ private void removeFile(boolean removeHistory) throws IOException { */ private void addFile(File file, String path, Ctags ctags) throws IOException, InterruptedException { - FileAnalyzer fa = getAnalyzerFor(file, path); + AbstractAnalyzer fa = getAnalyzerFor(file, path); for (IndexChangedListener listener : listeners) { listener.fileAdd(path, fa.getClass().getSimpleName()); @@ -801,9 +799,9 @@ private void addFile(File file, String path, Ctags ctags) } } - private FileAnalyzer getAnalyzerFor(File file, String path) + private AbstractAnalyzer getAnalyzerFor(File file, String path) throws IOException { - FileAnalyzer fa; + AbstractAnalyzer fa; try (InputStream in = new BufferedInputStream( new FileInputStream(file))) { return AnalyzerGuru.getAnalyzer(in, path); @@ -1590,16 +1588,16 @@ public int hashCode() { return hash; } - private boolean isXrefWriter(FileAnalyzer fa) { - Genre g = fa.getFactory().getGenre(); - return (g == Genre.PLAIN || g == Genre.XREFABLE); + private boolean isXrefWriter(AbstractAnalyzer fa) { + AbstractAnalyzer.Genre g = fa.getFactory().getGenre(); + return (g == AbstractAnalyzer.Genre.PLAIN || g == AbstractAnalyzer.Genre.XREFABLE); } /** * Get a writer to which the xref can be written, or null if no xref * should be produced for files of this type. */ - private Writer newXrefWriter(FileAnalyzer fa, String path) + private Writer newXrefWriter(AbstractAnalyzer fa, String path) throws IOException { RuntimeEnvironment env = RuntimeEnvironment.getInstance(); if (env.isGenerateHtml() && isXrefWriter(fa)) { @@ -1713,7 +1711,7 @@ private boolean checkSettings(File file, break; } - FileAnalyzer fa = null; + AbstractAnalyzer fa = null; String fileTypeName; if (actGuruVersion.equals(reqGuruVersion)) { fileTypeName = doc.get(QueryBuilder.TYPE); @@ -1723,7 +1721,7 @@ private boolean checkSettings(File file, break; } - FileAnalyzerFactory fac = + AnalyzerFactory fac = AnalyzerGuru.findByFileTypeName(fileTypeName); if (fac != null) { fa = fac.getAnalyzer(); diff --git a/opengrok-indexer/src/main/java/org/opengrok/indexer/search/Results.java b/opengrok-indexer/src/main/java/org/opengrok/indexer/search/Results.java index 2a0e1ee529a..332dd8dff3d 100644 --- a/opengrok-indexer/src/main/java/org/opengrok/indexer/search/Results.java +++ b/opengrok-indexer/src/main/java/org/opengrok/indexer/search/Results.java @@ -25,6 +25,8 @@ package org.opengrok.indexer.search; +import static org.opengrok.indexer.web.messages.MessagesContainer.MESSAGES_MAIN_PAGE_TAG; + import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; @@ -47,8 +49,8 @@ import org.apache.lucene.index.IndexableField; import org.apache.lucene.search.IndexSearcher; import org.apache.lucene.search.ScoreDoc; +import org.opengrok.indexer.analysis.AbstractAnalyzer; import org.opengrok.indexer.analysis.Definitions; -import org.opengrok.indexer.analysis.FileAnalyzer.Genre; import org.opengrok.indexer.analysis.Scopes; import org.opengrok.indexer.configuration.Project; import org.opengrok.indexer.configuration.RuntimeEnvironment; @@ -59,11 +61,8 @@ import org.opengrok.indexer.web.Prefix; import org.opengrok.indexer.web.SearchHelper; import org.opengrok.indexer.web.Util; - import org.opengrok.indexer.web.messages.MessagesUtils; -import static org.opengrok.indexer.web.messages.MessagesContainer.MESSAGES_MAIN_PAGE_TAG; - /** * @author Chandan slightly rewritten by Lubos Kosco */ @@ -229,17 +228,17 @@ public static void prettyPrint(Writer out, SearchHelper sh, int start, out.write(""); out.write(""); if (sh.sourceContext != null) { - Genre genre = Genre.get(doc.get("t")); - if (Genre.XREFABLE == genre && sh.summarizer != null) { + AbstractAnalyzer.Genre genre = AbstractAnalyzer.Genre.get(doc.get("t")); + if (AbstractAnalyzer.Genre.XREFABLE == genre && sh.summarizer != null) { String xtags = getTags(xrefDataDir, rpath, sh.compressed); // FIXME use Highlighter from lucene contrib here, // instead of summarizer, we'd also get rid of // apache lucene in whole source ... out.write(sh.summarizer.getSummary(xtags).toString()); - } else if (Genre.HTML == genre && sh.summarizer != null) { + } else if (AbstractAnalyzer.Genre.HTML == genre && sh.summarizer != null) { String htags = getTags(sh.sourceRoot, rpath, false); out.write(sh.summarizer.getSummary(htags).toString()); - } else if (genre == Genre.PLAIN) { + } else if (genre == AbstractAnalyzer.Genre.PLAIN) { printPlain(fargs, doc, docId, rpath); } } diff --git a/opengrok-indexer/src/main/java/org/opengrok/indexer/search/SearchEngine.java b/opengrok-indexer/src/main/java/org/opengrok/indexer/search/SearchEngine.java index ba395eec2c0..8ad336fd943 100644 --- a/opengrok-indexer/src/main/java/org/opengrok/indexer/search/SearchEngine.java +++ b/opengrok-indexer/src/main/java/org/opengrok/indexer/search/SearchEngine.java @@ -54,9 +54,9 @@ import org.apache.lucene.search.TopScoreDocCollector; import org.apache.lucene.store.FSDirectory; import org.apache.lucene.util.Version; +import org.opengrok.indexer.analysis.AbstractAnalyzer; import org.opengrok.indexer.analysis.CompatibleAnalyser; import org.opengrok.indexer.analysis.Definitions; -import org.opengrok.indexer.analysis.FileAnalyzer.Genre; import org.opengrok.indexer.analysis.Scopes; import org.opengrok.indexer.configuration.Project; import org.opengrok.indexer.configuration.RuntimeEnvironment; @@ -496,7 +496,7 @@ public void results(int start, int end, List ret) { Document doc = docs.get(ii); String filename = doc.get(QueryBuilder.PATH); - Genre genre = Genre.get(doc.get(QueryBuilder.T)); + AbstractAnalyzer.Genre genre = AbstractAnalyzer.Genre.get(doc.get(QueryBuilder.T)); Definitions tags = null; IndexableField tagsField = doc.getField(QueryBuilder.TAGS); if (tagsField != null) { @@ -512,14 +512,14 @@ public void results(int start, int end, List ret) { if (sourceContext != null) { sourceContext.toggleAlt(); try { - if (Genre.PLAIN == genre && (source != null)) { + if (AbstractAnalyzer.Genre.PLAIN == genre && (source != null)) { // SRCROOT is read with UTF-8 as a default. hasContext = sourceContext.getContext( new InputStreamReader(new FileInputStream( source + filename), StandardCharsets.UTF_8), null, null, null, filename, tags, nhits > 100, false, ret, scopes); - } else if (Genre.XREFABLE == genre && data != null && summarizer != null) { + } else if (AbstractAnalyzer.Genre.XREFABLE == genre && data != null && summarizer != null) { int l; /** * For backward compatibility, read the diff --git a/opengrok-indexer/src/main/java/org/opengrok/indexer/search/context/Context.java b/opengrok-indexer/src/main/java/org/opengrok/indexer/search/context/Context.java index 2c8932d32f7..af7914fccb7 100644 --- a/opengrok-indexer/src/main/java/org/opengrok/indexer/search/context/Context.java +++ b/opengrok-indexer/src/main/java/org/opengrok/indexer/search/context/Context.java @@ -43,8 +43,8 @@ import org.apache.lucene.index.IndexableField; import org.apache.lucene.search.IndexSearcher; import org.apache.lucene.search.Query; +import org.opengrok.indexer.analysis.AbstractAnalyzer; import org.opengrok.indexer.analysis.Definitions; -import org.opengrok.indexer.analysis.FileAnalyzer; import org.opengrok.indexer.analysis.Scopes; import org.opengrok.indexer.analysis.Scopes.Scope; import org.opengrok.indexer.analysis.plain.PlainAnalyzerFactory; @@ -179,7 +179,7 @@ public boolean getContext2(RuntimeEnvironment env, IndexSearcher searcher, * circumstances it isn't used"; here it is not meant to be used. */ PlainAnalyzerFactory fac = PlainAnalyzerFactory.DEFAULT_INSTANCE; - FileAnalyzer anz = fac.getAnalyzer(); + AbstractAnalyzer anz = fac.getAnalyzer(); String path = doc.get(QueryBuilder.PATH); String pathE = Util.URIEncodePath(path); diff --git a/opengrok-indexer/src/main/java/org/opengrok/indexer/web/DiffData.java b/opengrok-indexer/src/main/java/org/opengrok/indexer/web/DiffData.java index a5cd27a7069..86632bed271 100644 --- a/opengrok-indexer/src/main/java/org/opengrok/indexer/web/DiffData.java +++ b/opengrok-indexer/src/main/java/org/opengrok/indexer/web/DiffData.java @@ -23,8 +23,8 @@ */ package org.opengrok.indexer.web; +import org.opengrok.indexer.analysis.AbstractAnalyzer; import org.suigeneris.jrcs.diff.Revision; -import org.opengrok.indexer.analysis.FileAnalyzer.Genre; /** * A simple container to store the data required to generated a view of diffs @@ -41,7 +41,7 @@ public class DiffData { /** the HTML escaped filename used */ public String filename; /** the genre of the requested diff */ - public Genre genre; + public AbstractAnalyzer.Genre genre; /** the original and new revision container */ public Revision revision; /** the URI encoded parameter values of the request. {@code param[0]} diff --git a/opengrok-indexer/src/main/java/org/opengrok/indexer/web/PageConfig.java b/opengrok-indexer/src/main/java/org/opengrok/indexer/web/PageConfig.java index 9659207a3b0..e375f10fde7 100644 --- a/opengrok-indexer/src/main/java/org/opengrok/indexer/web/PageConfig.java +++ b/opengrok-indexer/src/main/java/org/opengrok/indexer/web/PageConfig.java @@ -58,9 +58,9 @@ import javax.servlet.http.HttpServletResponse; import javax.ws.rs.core.HttpHeaders; import org.opengrok.indexer.Info; +import org.opengrok.indexer.analysis.AbstractAnalyzer; import org.opengrok.indexer.analysis.AnalyzerGuru; import org.opengrok.indexer.analysis.ExpandTabsReader; -import org.opengrok.indexer.analysis.FileAnalyzer.Genre; import org.opengrok.indexer.authorization.AuthorizationFramework; import org.opengrok.indexer.configuration.Group; import org.opengrok.indexer.configuration.Project; @@ -129,8 +129,8 @@ public final class PageConfig { private Boolean annotate; private Annotation annotation; private Boolean hasHistory; - private static final EnumSet txtGenres - = EnumSet.of(Genre.DATA, Genre.PLAIN, Genre.HTML); + private static final EnumSet txtGenres + = EnumSet.of(AbstractAnalyzer.Genre.DATA, AbstractAnalyzer.Genre.PLAIN, AbstractAnalyzer.Genre.HTML); private SortedSet requestedProjects; private String requestedProjectsString; private List dirFileList; @@ -277,7 +277,7 @@ public DiffData getDiffData() { } } - if (data.genre != Genre.PLAIN && data.genre != Genre.HTML) { + if (data.genre != AbstractAnalyzer.Genre.PLAIN && data.genre != AbstractAnalyzer.Genre.HTML) { return data; } diff --git a/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/AnalyzerGuruTest.java b/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/AnalyzerGuruTest.java index af7aa369570..93cd8d3a807 100644 --- a/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/AnalyzerGuruTest.java +++ b/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/AnalyzerGuruTest.java @@ -30,7 +30,6 @@ import java.io.IOException; import java.io.InputStream; import java.nio.charset.Charset; -import java.util.Locale; import java.util.Map; import java.util.jar.JarEntry; import java.util.jar.JarOutputStream; @@ -71,7 +70,7 @@ public void testFileNameSameAsExtension() throws Exception { ByteArrayInputStream in = new ByteArrayInputStream( "#!/bin/sh\nexec /usr/bin/zip \"$@\"\n".getBytes("US-ASCII")); String file = "/dummy/path/to/source/zip"; - FileAnalyzer fa = AnalyzerGuru.getAnalyzer(in, file); + AbstractAnalyzer fa = AnalyzerGuru.getAnalyzer(in, file); assertSame(ShAnalyzer.class, fa.getClass()); } @@ -82,7 +81,7 @@ public void testUTF8ByteOrderMark() throws Exception { 'v', 'e', 'r', 's', 'i', 'o', 'n', '=', '"', '1', '.', '0', '"', '?', '>'}; ByteArrayInputStream in = new ByteArrayInputStream(xml); - FileAnalyzer fa = AnalyzerGuru.getAnalyzer(in, "/dummy/file"); + AbstractAnalyzer fa = AnalyzerGuru.getAnalyzer(in, "/dummy/file"); assertSame(XMLAnalyzer.class, fa.getClass()); } @@ -91,7 +90,7 @@ public void testUTF8ByteOrderMarkPlusCopyrightSymbol() throws Exception { byte[] doc = {(byte) 0xEF, (byte) 0xBB, (byte) 0xBF, // UTF-8 BOM '/', '/', ' ', (byte) 0xC2, (byte)0xA9}; ByteArrayInputStream in = new ByteArrayInputStream(doc); - FileAnalyzer fa = AnalyzerGuru.getAnalyzer(in, "/dummy/file"); + AbstractAnalyzer fa = AnalyzerGuru.getAnalyzer(in, "/dummy/file"); assertSame("despite BOM as precise match,", PlainAnalyzer.class, fa.getClass()); } @@ -103,7 +102,7 @@ public void testUTF8ByteOrderMarkPlainFile() throws Exception { 'w', 'o', 'r', 'l', 'd'}; ByteArrayInputStream in = new ByteArrayInputStream(bytes); - FileAnalyzer fa = AnalyzerGuru.getAnalyzer(in, "/dummy/file"); + AbstractAnalyzer fa = AnalyzerGuru.getAnalyzer(in, "/dummy/file"); assertSame(PlainAnalyzer.class, fa.getClass()); } @@ -112,7 +111,7 @@ public void testUTF16BigByteOrderMarkPlusCopyrightSymbol() throws Exception { byte[] doc = {(byte) 0xFE, (byte) 0xFF, // UTF-16BE BOM 0, '#', 0, ' ', (byte) 0xC2, (byte) 0xA9}; ByteArrayInputStream in = new ByteArrayInputStream(doc); - FileAnalyzer fa = AnalyzerGuru.getAnalyzer(in, "/dummy/file"); + AbstractAnalyzer fa = AnalyzerGuru.getAnalyzer(in, "/dummy/file"); assertSame("despite BOM as precise match,", PlainAnalyzer.class, fa.getClass()); } @@ -122,7 +121,7 @@ public void testUTF16LittleByteOrderMarkPlusCopyrightSymbol() throws Exception { byte[] doc = {(byte) 0xFF, (byte) 0xFE, // UTF-16BE BOM '#', 0, ' ', 0, (byte) 0xA9, (byte) 0xC2}; ByteArrayInputStream in = new ByteArrayInputStream(doc); - FileAnalyzer fa = AnalyzerGuru.getAnalyzer(in, "/dummy/file"); + AbstractAnalyzer fa = AnalyzerGuru.getAnalyzer(in, "/dummy/file"); assertSame("despite BOM as precise match,", PlainAnalyzer.class, fa.getClass()); } @@ -132,8 +131,8 @@ public void addExtension() throws Exception { // should not find analyzer for this unlikely extension assertNull(AnalyzerGuru.find("file.unlikely_extension")); - FileAnalyzerFactory - faf = AnalyzerGuru.findFactory(ShAnalyzerFactory.class.getName()); + AnalyzerFactory + faf = AnalyzerGuru.findFactory(ShAnalyzerFactory.class.getName()); // should be the same factory as the built-in analyzer for sh scripts assertSame(AnalyzerGuru.find("myscript.sh"), faf); @@ -152,8 +151,8 @@ public void addPrefix() throws Exception { // should not find analyzer for this unlikely extension assertNull(AnalyzerGuru.find("unlikely_prefix.foo")); - FileAnalyzerFactory - faf = AnalyzerGuru.findFactory(ShAnalyzerFactory.class.getName()); + AnalyzerFactory + faf = AnalyzerGuru.findFactory(ShAnalyzerFactory.class.getName()); // should be the same factory as the built-in analyzer for sh scripts assertSame(AnalyzerGuru.find("myscript.sh"), faf); @@ -175,7 +174,7 @@ public void testZip() throws IOException { zos.closeEntry(); zos.close(); InputStream in = new ByteArrayInputStream(baos.toByteArray()); - FileAnalyzer fa = AnalyzerGuru.getAnalyzer(in, "dummy"); + AbstractAnalyzer fa = AnalyzerGuru.getAnalyzer(in, "dummy"); assertSame(ZipAnalyzer.class, fa.getClass()); } @@ -187,7 +186,7 @@ public void testJar() throws IOException { jos.closeEntry(); jos.close(); InputStream in = new ByteArrayInputStream(baos.toByteArray()); - FileAnalyzer fa = AnalyzerGuru.getAnalyzer(in, "dummy"); + AbstractAnalyzer fa = AnalyzerGuru.getAnalyzer(in, "dummy"); assertSame(JarAnalyzer.class, fa.getClass()); } @@ -201,16 +200,16 @@ public void testPlainText() throws IOException { @Test public void rfe2969() { - FileAnalyzerFactory faf = AnalyzerGuru.find("foo.hxx"); + AnalyzerFactory faf = AnalyzerGuru.find("foo.hxx"); assertNotNull(faf); assertSame(CxxAnalyzerFactory.class, faf.getClass()); } @Test public void rfe3401() { - FileAnalyzerFactory f1 = AnalyzerGuru.find("main.c"); + AnalyzerFactory f1 = AnalyzerGuru.find("main.c"); assertNotNull(f1); - FileAnalyzerFactory f2 = AnalyzerGuru.find("main.cc"); + AnalyzerFactory f2 = AnalyzerGuru.find("main.cc"); assertNotNull(f2); assertNotSame(f1.getClass(), f2.getClass()); @@ -224,7 +223,7 @@ public void rfe3401() { public void matchesFullName() { String s = File.separator; // so test works on Unix and Windows String path = s+"path"+s+"to"+s+"Makefile"; - FileAnalyzerFactory faf = AnalyzerGuru.find(path); + AnalyzerFactory faf = AnalyzerGuru.find(path); Class c = faf.getClass(); assertSame(ShAnalyzerFactory.class, faf.getClass()); faf = AnalyzerGuru.find("GNUMakefile"); @@ -308,7 +307,7 @@ public void shouldMatchELFMagic() throws Exception { byte[] elfmt = {(byte)0x7F, 'E', 'L', 'F', (byte) 2, (byte) 2, (byte) 1, (byte) 0x06}; ByteArrayInputStream in = new ByteArrayInputStream(elfmt); - FileAnalyzer fa = AnalyzerGuru.getAnalyzer(in, "/dummy/file"); + AbstractAnalyzer fa = AnalyzerGuru.getAnalyzer(in, "/dummy/file"); assertSame("despite \\177ELF magic,", ELFAnalyzer.class, fa.getClass()); } @@ -324,7 +323,7 @@ public void shouldMatchJavaClassMagic() throws Exception { byte[] dotclass = {(byte) 0xCA, (byte) 0xFE, (byte) 0xBA, (byte) 0xBE, (byte) 0, (byte) 1, (byte) 0, (byte) 0x34}; ByteArrayInputStream in = new ByteArrayInputStream(dotclass); - FileAnalyzer fa = AnalyzerGuru.getAnalyzer(in, "/dummy/file"); + AbstractAnalyzer fa = AnalyzerGuru.getAnalyzer(in, "/dummy/file"); assertSame("despite 0xCAFEBABE magic,", JavaClassAnalyzer.class, fa.getClass()); } @@ -334,7 +333,7 @@ public void shouldMatchTroffMagic() throws Exception { byte[] mandoc = {' ', '\n', '.', '\"', '\n', '.', 'T', 'H', (byte) 0x20, '\n'}; ByteArrayInputStream in = new ByteArrayInputStream(mandoc); - FileAnalyzer fa = AnalyzerGuru.getAnalyzer(in, "/dummy/file"); + AbstractAnalyzer fa = AnalyzerGuru.getAnalyzer(in, "/dummy/file"); assertSame("despite .TH magic,", TroffAnalyzer.class, fa.getClass()); } @@ -344,7 +343,7 @@ public void shouldMatchMandocMagic() throws Exception { byte[] mandoc = {'\n', ' ', '.', '\"', '\n', '.', 'D', 'd', (byte) 0x20, '\n'}; ByteArrayInputStream in = new ByteArrayInputStream(mandoc); - FileAnalyzer fa = AnalyzerGuru.getAnalyzer(in, "/dummy/file"); + AbstractAnalyzer fa = AnalyzerGuru.getAnalyzer(in, "/dummy/file"); assertSame("despite .Dd magic,", MandocAnalyzer.class, fa.getClass()); } diff --git a/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/LuceneCompatibilityTest.java b/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/LuceneCompatibilityTest.java index 381a73d43d7..3f079d96399 100644 --- a/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/LuceneCompatibilityTest.java +++ b/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/LuceneCompatibilityTest.java @@ -96,7 +96,7 @@ protected void tearDown() throws Exception { @SuppressWarnings("rawtypes") public void testCompatibility() throws Exception, IOException, IllegalAccessException, IllegalArgumentException { for (Iterator it = guru.getAnalyzerFactories().iterator(); it.hasNext();) { - FileAnalyzerFactory fa = (FileAnalyzerFactory) it.next(); + AnalyzerFactory fa = (AnalyzerFactory) it.next(); String input = "Hello world"; String[] output = new String[]{"Hello", "world"}; testA = fa.getAnalyzer(); diff --git a/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/ada/AdaXrefTest.java b/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/ada/AdaXrefTest.java index 5dc29999155..6dc639e529b 100644 --- a/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/ada/AdaXrefTest.java +++ b/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/ada/AdaXrefTest.java @@ -35,7 +35,8 @@ import org.junit.Test; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; -import org.opengrok.indexer.analysis.FileAnalyzer; + +import org.opengrok.indexer.analysis.AbstractAnalyzer; import org.opengrok.indexer.analysis.WriteXrefArgs; import org.opengrok.indexer.analysis.Xrefer; import static org.opengrok.indexer.util.CustomAssertions.assertLinesEqual; @@ -75,7 +76,7 @@ private int writeAdaXref(InputStream iss, PrintStream oss) Writer sw = new StringWriter(); AdaAnalyzerFactory fac = new AdaAnalyzerFactory(); - FileAnalyzer analyzer = fac.getAnalyzer(); + AbstractAnalyzer analyzer = fac.getAnalyzer(); WriteXrefArgs wargs = new WriteXrefArgs( new InputStreamReader(iss, "UTF-8"), sw); Xrefer xref = analyzer.writeXref(wargs); diff --git a/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/archive/ZipAnalyzerFactoryTest.java b/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/archive/ZipAnalyzerFactoryTest.java index 68c7bb6daec..12d43697e17 100644 --- a/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/archive/ZipAnalyzerFactoryTest.java +++ b/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/archive/ZipAnalyzerFactoryTest.java @@ -28,8 +28,8 @@ import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertSame; import org.junit.Test; +import org.opengrok.indexer.analysis.AnalyzerFactory; import org.opengrok.indexer.analysis.AnalyzerGuru; -import org.opengrok.indexer.analysis.FileAnalyzerFactory; /** * Represents a container for tests of {@link ZipAnalyzerFactory}. @@ -47,7 +47,7 @@ public void testZipWrtAnalyzerGuru() throws IOException { assertNotNull("zip.bin should be available,", res); // assert that it is matched - FileAnalyzerFactory fac = AnalyzerGuru.find(res); + AnalyzerFactory fac = AnalyzerGuru.find(res); assertNotNull("zip.bin should have factory", fac); assertSame("should be ZipAnalyzerFactory", fac.getClass(), ZipAnalyzerFactory.class); diff --git a/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/c/CAnalyzerFactoryTest.java b/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/c/CAnalyzerFactoryTest.java index 233ba3e4419..c34f9a5ef65 100644 --- a/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/c/CAnalyzerFactoryTest.java +++ b/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/c/CAnalyzerFactoryTest.java @@ -42,8 +42,8 @@ import org.junit.BeforeClass; import org.junit.Rule; import org.junit.Test; +import org.opengrok.indexer.analysis.AbstractAnalyzer; import org.opengrok.indexer.analysis.Ctags; -import org.opengrok.indexer.analysis.FileAnalyzer; import org.opengrok.indexer.analysis.Scopes; import org.opengrok.indexer.analysis.Scopes.Scope; import org.opengrok.indexer.analysis.StreamSource; @@ -63,7 +63,7 @@ public class CAnalyzerFactoryTest { private static Ctags ctags; private static TestRepository repository; - private static FileAnalyzer analyzer; + private static AbstractAnalyzer analyzer; @Rule public ConditionalRunRule rule = new ConditionalRunRule(); diff --git a/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/c/CXrefTest.java b/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/c/CXrefTest.java index fff39476ba3..eeb4cbba416 100644 --- a/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/c/CXrefTest.java +++ b/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/c/CXrefTest.java @@ -36,9 +36,10 @@ import org.junit.Test; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; + +import org.opengrok.indexer.analysis.AbstractAnalyzer; import org.opengrok.indexer.analysis.CtagsReader; import org.opengrok.indexer.analysis.Definitions; -import org.opengrok.indexer.analysis.FileAnalyzer; import org.opengrok.indexer.analysis.WriteXrefArgs; import org.opengrok.indexer.analysis.Xrefer; import static org.opengrok.indexer.util.CustomAssertions.assertLinesEqual; @@ -79,7 +80,7 @@ private int writeCXref(InputStream iss, PrintStream oss) Writer sw = new StringWriter(); CAnalyzerFactory fac = new CAnalyzerFactory(); - FileAnalyzer analyzer = fac.getAnalyzer(); + AbstractAnalyzer analyzer = fac.getAnalyzer(); WriteXrefArgs wargs = new WriteXrefArgs( new InputStreamReader(iss, "UTF-8"), sw); wargs.setDefs(getTagsDefinitions()); diff --git a/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/c/CxxAnalyzerFactoryTest.java b/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/c/CxxAnalyzerFactoryTest.java index e860925ce19..dcc2080d3ad 100644 --- a/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/c/CxxAnalyzerFactoryTest.java +++ b/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/c/CxxAnalyzerFactoryTest.java @@ -42,8 +42,8 @@ import org.junit.BeforeClass; import org.junit.Rule; import org.junit.Test; +import org.opengrok.indexer.analysis.AbstractAnalyzer; import org.opengrok.indexer.analysis.Ctags; -import org.opengrok.indexer.analysis.FileAnalyzer; import org.opengrok.indexer.analysis.Scopes; import org.opengrok.indexer.analysis.Scopes.Scope; import org.opengrok.indexer.analysis.StreamSource; @@ -63,7 +63,7 @@ public class CxxAnalyzerFactoryTest { private static Ctags ctags; private static TestRepository repository; - private static FileAnalyzer analyzer; + private static AbstractAnalyzer analyzer; @Rule public ConditionalRunRule rule = new ConditionalRunRule(); diff --git a/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/c/CxxXrefTest.java b/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/c/CxxXrefTest.java index 2ddd10b7880..12389ae7ea7 100644 --- a/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/c/CxxXrefTest.java +++ b/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/c/CxxXrefTest.java @@ -35,9 +35,10 @@ import org.junit.Test; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; + +import org.opengrok.indexer.analysis.AbstractAnalyzer; import org.opengrok.indexer.analysis.CtagsReader; import org.opengrok.indexer.analysis.Definitions; -import org.opengrok.indexer.analysis.FileAnalyzer; import org.opengrok.indexer.analysis.WriteXrefArgs; import org.opengrok.indexer.analysis.Xrefer; import static org.opengrok.indexer.util.CustomAssertions.assertLinesEqual; @@ -78,7 +79,7 @@ private int writeCxxXref(InputStream iss, PrintStream oss) Writer sw = new StringWriter(); CxxAnalyzerFactory fac = new CxxAnalyzerFactory(); - FileAnalyzer analyzer = fac.getAnalyzer(); + AbstractAnalyzer analyzer = fac.getAnalyzer(); WriteXrefArgs wargs = new WriteXrefArgs( new InputStreamReader(iss, "UTF-8"), sw); wargs.setDefs(getTagsDefinitions()); diff --git a/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/clojure/ClojureAnalyzerFactoryTest.java b/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/clojure/ClojureAnalyzerFactoryTest.java index be829a59ba4..9b1db18a4ec 100644 --- a/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/clojure/ClojureAnalyzerFactoryTest.java +++ b/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/clojure/ClojureAnalyzerFactoryTest.java @@ -29,9 +29,9 @@ import org.junit.BeforeClass; import org.junit.Rule; import org.junit.Test; +import org.opengrok.indexer.analysis.AbstractAnalyzer; import org.opengrok.indexer.analysis.Ctags; import org.opengrok.indexer.analysis.Definitions; -import org.opengrok.indexer.analysis.FileAnalyzer; import org.opengrok.indexer.analysis.StreamSource; import org.opengrok.indexer.condition.ConditionalRun; import org.opengrok.indexer.condition.ConditionalRunRule; @@ -60,7 +60,7 @@ public class ClojureAnalyzerFactoryTest { private static Ctags ctags; private static TestRepository repository; - private static FileAnalyzer analyzer; + private static AbstractAnalyzer analyzer; @Rule public ConditionalRunRule rule = new ConditionalRunRule(); diff --git a/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/clojure/ClojureXrefTest.java b/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/clojure/ClojureXrefTest.java index 22484cd63ad..67c69b9dac2 100644 --- a/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/clojure/ClojureXrefTest.java +++ b/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/clojure/ClojureXrefTest.java @@ -33,9 +33,9 @@ import java.io.StringWriter; import java.io.Writer; +import org.opengrok.indexer.analysis.AbstractAnalyzer; import org.opengrok.indexer.analysis.CtagsReader; import org.opengrok.indexer.analysis.Definitions; -import org.opengrok.indexer.analysis.FileAnalyzer; import org.opengrok.indexer.analysis.WriteXrefArgs; import org.junit.Test; import static org.junit.Assert.assertEquals; @@ -98,7 +98,7 @@ private int writeClojureXref(PrintStream oss, InputStream iss, Writer sw = new StringWriter(); ClojureAnalyzerFactory fac = new ClojureAnalyzerFactory(); - FileAnalyzer analyzer = fac.getAnalyzer(); + AbstractAnalyzer analyzer = fac.getAnalyzer(); WriteXrefArgs wargs = new WriteXrefArgs( new InputStreamReader(iss, "UTF-8"), sw); wargs.setDefs(defs); diff --git a/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/csharp/CSharpAnalyzerFactoryTest.java b/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/csharp/CSharpAnalyzerFactoryTest.java index 78c7a41658a..cade0a9f90d 100644 --- a/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/csharp/CSharpAnalyzerFactoryTest.java +++ b/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/csharp/CSharpAnalyzerFactoryTest.java @@ -37,8 +37,9 @@ import org.junit.Test; import static org.junit.Assert.*; import static org.opengrok.indexer.analysis.AnalyzerGuru.string_ft_nstored_nanalyzed_norms; + +import org.opengrok.indexer.analysis.AbstractAnalyzer; import org.opengrok.indexer.analysis.Ctags; -import org.opengrok.indexer.analysis.FileAnalyzer; import org.opengrok.indexer.analysis.Scopes; import org.opengrok.indexer.analysis.Scopes.Scope; import org.opengrok.indexer.analysis.StreamSource; @@ -58,7 +59,7 @@ public class CSharpAnalyzerFactoryTest { private static Ctags ctags; private static TestRepository repository; - private static FileAnalyzer analyzer; + private static AbstractAnalyzer analyzer; @Rule public ConditionalRunRule rule = new ConditionalRunRule(); diff --git a/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/csharp/CSharpXrefTest.java b/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/csharp/CSharpXrefTest.java index 4b04cb9804d..62e6000281f 100644 --- a/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/csharp/CSharpXrefTest.java +++ b/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/csharp/CSharpXrefTest.java @@ -33,9 +33,9 @@ import java.io.StringWriter; import java.io.Writer; +import org.opengrok.indexer.analysis.AbstractAnalyzer; import org.opengrok.indexer.analysis.CtagsReader; import org.opengrok.indexer.analysis.Definitions; -import org.opengrok.indexer.analysis.FileAnalyzer; import org.opengrok.indexer.analysis.WriteXrefArgs; import org.junit.Test; import static org.junit.Assert.assertEquals; @@ -98,7 +98,7 @@ private int writeCsharpXref(PrintStream oss, InputStream iss, Writer sw = new StringWriter(); CSharpAnalyzerFactory fac = new CSharpAnalyzerFactory(); - FileAnalyzer analyzer = fac.getAnalyzer(); + AbstractAnalyzer analyzer = fac.getAnalyzer(); analyzer.setScopesEnabled(true); analyzer.setFoldingEnabled(true); WriteXrefArgs wargs = new WriteXrefArgs( diff --git a/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/document/DocumentMatcherTest.java b/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/document/DocumentMatcherTest.java index 5484492323e..844be246f0b 100644 --- a/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/document/DocumentMatcherTest.java +++ b/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/document/DocumentMatcherTest.java @@ -29,7 +29,7 @@ import static org.junit.Assert.assertNull; import static org.junit.Assert.assertSame; import org.junit.Test; -import org.opengrok.indexer.analysis.FileAnalyzerFactory; +import org.opengrok.indexer.analysis.AnalyzerFactory; /** * Represents a container for tests of {@link DocumentMatcher} subclasses @@ -48,7 +48,7 @@ public void testMdocDocument() throws IOException { byte[] buf = readSignature(res); - FileAnalyzerFactory fac; + AnalyzerFactory fac; // assert that it is troff-like fac = TroffAnalyzerFactory.MATCHER.isMagic(buf, res); @@ -73,7 +73,7 @@ public void testMandocDocument() throws IOException { byte[] buf = readSignature(res); - FileAnalyzerFactory fac; + AnalyzerFactory fac; // assert that it is mandoc-like fac = MandocAnalyzerFactory.MATCHER.isMagic(buf, res); @@ -102,7 +102,7 @@ public void testMandocBOMDocument() throws IOException { byte[] buf = readSignature(res); - FileAnalyzerFactory fac; + AnalyzerFactory fac; // assert that it is mandoc-like fac = MandocAnalyzerFactory.MATCHER.isMagic(buf, res); diff --git a/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/document/TroffXrefTest.java b/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/document/TroffXrefTest.java index ea2bdb09546..efc6a831609 100644 --- a/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/document/TroffXrefTest.java +++ b/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/document/TroffXrefTest.java @@ -32,8 +32,8 @@ import java.io.StringWriter; import java.io.Writer; +import org.opengrok.indexer.analysis.AbstractAnalyzer; import org.opengrok.indexer.analysis.Definitions; -import org.opengrok.indexer.analysis.FileAnalyzer; import org.opengrok.indexer.analysis.WriteXrefArgs; import org.junit.Test; import static org.junit.Assert.assertEquals; @@ -89,7 +89,7 @@ private int writeTroffXref(PrintStream oss, InputStream iss, Writer sw = new StringWriter(); TroffAnalyzerFactory fac = new TroffAnalyzerFactory(); - FileAnalyzer analyzer = fac.getAnalyzer(); + AbstractAnalyzer analyzer = fac.getAnalyzer(); analyzer.setScopesEnabled(true); analyzer.setFoldingEnabled(true); WriteXrefArgs wargs = new WriteXrefArgs( diff --git a/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/eiffel/EiffelXrefTest.java b/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/eiffel/EiffelXrefTest.java index 3c5e966aab9..bbbb6379bbc 100644 --- a/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/eiffel/EiffelXrefTest.java +++ b/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/eiffel/EiffelXrefTest.java @@ -33,9 +33,9 @@ import java.io.StringWriter; import java.io.Writer; +import org.opengrok.indexer.analysis.AbstractAnalyzer; import org.opengrok.indexer.analysis.CtagsReader; import org.opengrok.indexer.analysis.Definitions; -import org.opengrok.indexer.analysis.FileAnalyzer; import org.opengrok.indexer.analysis.WriteXrefArgs; import org.junit.Test; import static org.junit.Assert.assertEquals; @@ -98,7 +98,7 @@ private int writeEiffelXref(PrintStream oss, InputStream iss, Writer sw = new StringWriter(); EiffelAnalyzerFactory fac = new EiffelAnalyzerFactory(); - FileAnalyzer analyzer = fac.getAnalyzer(); + AbstractAnalyzer analyzer = fac.getAnalyzer(); analyzer.setScopesEnabled(true); analyzer.setFoldingEnabled(true); WriteXrefArgs wargs = new WriteXrefArgs( diff --git a/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/erlang/ErlangXrefTest.java b/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/erlang/ErlangXrefTest.java index b18a04c3879..346e6bbbfce 100644 --- a/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/erlang/ErlangXrefTest.java +++ b/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/erlang/ErlangXrefTest.java @@ -33,9 +33,9 @@ import java.io.StringWriter; import java.io.Writer; +import org.opengrok.indexer.analysis.AbstractAnalyzer; import org.opengrok.indexer.analysis.CtagsReader; import org.opengrok.indexer.analysis.Definitions; -import org.opengrok.indexer.analysis.FileAnalyzer; import org.opengrok.indexer.analysis.WriteXrefArgs; import org.junit.Test; import static org.junit.Assert.assertEquals; @@ -98,7 +98,7 @@ private int writeErlangXref(PrintStream oss, InputStream iss, Writer sw = new StringWriter(); ErlangAnalyzerFactory fac = new ErlangAnalyzerFactory(); - FileAnalyzer analyzer = fac.getAnalyzer(); + AbstractAnalyzer analyzer = fac.getAnalyzer(); WriteXrefArgs wargs = new WriteXrefArgs( new InputStreamReader(iss, "UTF-8"), sw); wargs.setDefs(defs); diff --git a/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/executables/JarAnalyzerFactoryTest.java b/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/executables/JarAnalyzerFactoryTest.java index 592eec7bba0..661cc9bd569 100644 --- a/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/executables/JarAnalyzerFactoryTest.java +++ b/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/executables/JarAnalyzerFactoryTest.java @@ -28,8 +28,8 @@ import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertSame; import org.junit.Test; +import org.opengrok.indexer.analysis.AnalyzerFactory; import org.opengrok.indexer.analysis.AnalyzerGuru; -import org.opengrok.indexer.analysis.FileAnalyzerFactory; /** * Represents a container for tests of {@link JarAnalyzerFactory}. @@ -47,7 +47,7 @@ public void testJarWrtAnalyzerGuru() throws IOException { assertNotNull("javajar.bin should be available,", res); // assert that it is matched - FileAnalyzerFactory fac = AnalyzerGuru.find(res); + AnalyzerFactory fac = AnalyzerGuru.find(res); assertNotNull("javajar.bin should have factory", fac); assertSame("should be JarAnalyzerFactory", fac.getClass(), JarAnalyzerFactory.class); diff --git a/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/executables/JavaClassAnalyzerFactoryTest.java b/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/executables/JavaClassAnalyzerFactoryTest.java index 72a42c807d1..a6123eec18d 100644 --- a/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/executables/JavaClassAnalyzerFactoryTest.java +++ b/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/executables/JavaClassAnalyzerFactoryTest.java @@ -29,8 +29,8 @@ import static org.junit.Assert.assertNotSame; import static org.junit.Assert.assertSame; import org.junit.Test; +import org.opengrok.indexer.analysis.AnalyzerFactory; import org.opengrok.indexer.analysis.AnalyzerGuru; -import org.opengrok.indexer.analysis.FileAnalyzerFactory; /** * Represents a container for tests of {@link JavaClassAnalyzerFactory}. @@ -48,7 +48,7 @@ public void testJavaClassWrtAnalyzerGuru() throws IOException { assertNotNull("despite inclusion locally,", res); // assert that it is matched - FileAnalyzerFactory fac = AnalyzerGuru.find(res); + AnalyzerFactory fac = AnalyzerGuru.find(res); assertNotNull("javaclass.bin should have factory", fac); assertSame("should be JavaClassAnalyzerFactory", fac.getClass(), JavaClassAnalyzerFactory.class); @@ -64,7 +64,7 @@ public void testDylibCafebabeWrtAnalyzerGuru() throws IOException { "analysis/executables/fat.dylib"); assertNotNull("despite inclusion locally,", res); - FileAnalyzerFactory fac = AnalyzerGuru.find(res); + AnalyzerFactory fac = AnalyzerGuru.find(res); if (fac != null) { assertNotSame("should not be JavaClassAnalyzerFactory", fac.getClass(), JavaClassAnalyzerFactory.class); diff --git a/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/fortran/FortranXrefTest.java b/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/fortran/FortranXrefTest.java index c89aa8a3816..f0be4ececd6 100644 --- a/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/fortran/FortranXrefTest.java +++ b/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/fortran/FortranXrefTest.java @@ -33,9 +33,9 @@ import java.io.StringWriter; import java.io.Writer; +import org.opengrok.indexer.analysis.AbstractAnalyzer; import org.opengrok.indexer.analysis.CtagsReader; import org.opengrok.indexer.analysis.Definitions; -import org.opengrok.indexer.analysis.FileAnalyzer; import org.opengrok.indexer.analysis.WriteXrefArgs; import org.junit.Test; import static org.junit.Assert.assertEquals; @@ -94,7 +94,7 @@ private int writeFortranXref(PrintStream oss, InputStream iss, Writer sw = new StringWriter(); FortranAnalyzerFactory fac = new FortranAnalyzerFactory(); - FileAnalyzer analyzer = fac.getAnalyzer(); + AbstractAnalyzer analyzer = fac.getAnalyzer(); analyzer.setScopesEnabled(true); analyzer.setFoldingEnabled(true); WriteXrefArgs wargs = new WriteXrefArgs( diff --git a/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/golang/GolangXrefTest.java b/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/golang/GolangXrefTest.java index d4b0935b540..9564476c863 100644 --- a/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/golang/GolangXrefTest.java +++ b/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/golang/GolangXrefTest.java @@ -33,9 +33,9 @@ import java.io.StringWriter; import java.io.Writer; +import org.opengrok.indexer.analysis.AbstractAnalyzer; import org.opengrok.indexer.analysis.CtagsReader; import org.opengrok.indexer.analysis.Definitions; -import org.opengrok.indexer.analysis.FileAnalyzer; import org.opengrok.indexer.analysis.WriteXrefArgs; import org.junit.Test; import static org.junit.Assert.assertEquals; @@ -98,7 +98,7 @@ private int writeGolangXref(PrintStream oss, InputStream iss, Writer sw = new StringWriter(); GolangAnalyzerFactory fac = new GolangAnalyzerFactory(); - FileAnalyzer analyzer = fac.getAnalyzer(); + AbstractAnalyzer analyzer = fac.getAnalyzer(); analyzer.setScopesEnabled(true); analyzer.setFoldingEnabled(true); WriteXrefArgs wargs = new WriteXrefArgs( diff --git a/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/haskell/HaskellSymbolTokenizerTest.java b/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/haskell/HaskellSymbolTokenizerTest.java index 20dd6a77727..29d30cf5174 100644 --- a/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/haskell/HaskellSymbolTokenizerTest.java +++ b/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/haskell/HaskellSymbolTokenizerTest.java @@ -37,7 +37,7 @@ import org.apache.lucene.analysis.tokenattributes.CharTermAttribute; import static org.junit.Assert.assertNotNull; import org.junit.Test; -import org.opengrok.indexer.analysis.FileAnalyzer; +import org.opengrok.indexer.analysis.AbstractAnalyzer; import org.opengrok.indexer.analysis.JFlexTokenizer; import static org.opengrok.indexer.util.CustomAssertions.assertSymbolStream; @@ -48,7 +48,7 @@ */ public class HaskellSymbolTokenizerTest { - private final FileAnalyzer analyzer; + private final AbstractAnalyzer analyzer; public HaskellSymbolTokenizerTest() { this.analyzer = new HaskellAnalyzerFactory().getAnalyzer(); diff --git a/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/haskell/HaskellXrefTest.java b/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/haskell/HaskellXrefTest.java index 0722ff0f308..90fe63f7ff5 100644 --- a/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/haskell/HaskellXrefTest.java +++ b/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/haskell/HaskellXrefTest.java @@ -35,9 +35,10 @@ import org.junit.Test; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; + +import org.opengrok.indexer.analysis.AbstractAnalyzer; import org.opengrok.indexer.analysis.CtagsReader; import org.opengrok.indexer.analysis.Definitions; -import org.opengrok.indexer.analysis.FileAnalyzer; import org.opengrok.indexer.analysis.WriteXrefArgs; import org.opengrok.indexer.analysis.Xrefer; import static org.opengrok.indexer.util.CustomAssertions.assertLinesEqual; @@ -55,7 +56,7 @@ public void basicTest() throws IOException { String s = "putStrLn \"Hello, world!\""; Writer w = new StringWriter(); HaskellAnalyzerFactory fac = new HaskellAnalyzerFactory(); - FileAnalyzer analyzer = fac.getAnalyzer(); + AbstractAnalyzer analyzer = fac.getAnalyzer(); WriteXrefArgs xargs = new WriteXrefArgs(new StringReader(s), w); Xrefer xref = analyzer.writeXref(xargs); assertLinesEqual("Haskell basicTest", @@ -75,7 +76,7 @@ private static int writeHaskellXref(InputStream is, PrintStream os, os.println("

");
         Writer w = new StringWriter();
         HaskellAnalyzerFactory fac = new HaskellAnalyzerFactory();
-        FileAnalyzer analyzer = fac.getAnalyzer();
+        AbstractAnalyzer analyzer = fac.getAnalyzer();
         WriteXrefArgs args = new WriteXrefArgs(
             new InputStreamReader(is, "UTF-8"), w);
         args.setDefs(defs);
diff --git a/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/java/JavaAnalyzerFactoryTest.java b/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/java/JavaAnalyzerFactoryTest.java
index 394802cba59..3bdc7959ee6 100644
--- a/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/java/JavaAnalyzerFactoryTest.java
+++ b/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/java/JavaAnalyzerFactoryTest.java
@@ -42,8 +42,8 @@
 import org.junit.BeforeClass;
 import org.junit.Rule;
 import org.junit.Test;
+import org.opengrok.indexer.analysis.AbstractAnalyzer;
 import org.opengrok.indexer.analysis.Ctags;
-import org.opengrok.indexer.analysis.FileAnalyzer;
 import org.opengrok.indexer.analysis.Scopes;
 import org.opengrok.indexer.analysis.Scopes.Scope;
 import org.opengrok.indexer.analysis.StreamSource;
@@ -63,7 +63,7 @@ public class JavaAnalyzerFactoryTest {
 
     private static Ctags ctags;
     private static TestRepository repository;
-    private static FileAnalyzer analyzer;
+    private static AbstractAnalyzer analyzer;
 
     @Rule
     public ConditionalRunRule rule = new ConditionalRunRule();
diff --git a/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/java/JavaSymbolTokenizerTest.java b/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/java/JavaSymbolTokenizerTest.java
index af836f0fa64..68be0edc928 100644
--- a/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/java/JavaSymbolTokenizerTest.java
+++ b/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/java/JavaSymbolTokenizerTest.java
@@ -36,7 +36,7 @@
 
 import org.apache.lucene.analysis.tokenattributes.CharTermAttribute;
 import org.junit.Test;
-import org.opengrok.indexer.analysis.FileAnalyzer;
+import org.opengrok.indexer.analysis.AbstractAnalyzer;
 import org.opengrok.indexer.analysis.JFlexTokenizer;
 import org.opengrok.indexer.logger.LoggerFactory;
 
@@ -49,7 +49,7 @@ public class JavaSymbolTokenizerTest {
 
     private static final Logger LOGGER = LoggerFactory.getLogger(JavaSymbolTokenizerTest.class);
 
-    private final FileAnalyzer analyzer;
+    private final AbstractAnalyzer analyzer;
 
     public JavaSymbolTokenizerTest() {
         this.analyzer = new JavaAnalyzerFactory().getAnalyzer();
diff --git a/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/java/JavaXrefTest.java b/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/java/JavaXrefTest.java
index 1aed6db0a30..ddd23cebfa0 100644
--- a/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/java/JavaXrefTest.java
+++ b/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/java/JavaXrefTest.java
@@ -33,9 +33,9 @@
 import java.io.StringWriter;
 import java.io.Writer;
 
+import org.opengrok.indexer.analysis.AbstractAnalyzer;
 import org.opengrok.indexer.analysis.CtagsReader;
 import org.opengrok.indexer.analysis.Definitions;
-import org.opengrok.indexer.analysis.FileAnalyzer;
 import org.opengrok.indexer.analysis.WriteXrefArgs;
 import org.junit.Test;
 import static org.junit.Assert.assertEquals;
@@ -98,7 +98,7 @@ private int writeJavaXref(PrintStream oss, InputStream iss,
 
         Writer sw = new StringWriter();
         JavaAnalyzerFactory fac = new JavaAnalyzerFactory();
-        FileAnalyzer analyzer = fac.getAnalyzer();
+        AbstractAnalyzer analyzer = fac.getAnalyzer();
         analyzer.setScopesEnabled(true);
         analyzer.setFoldingEnabled(true);
         WriteXrefArgs wargs = new WriteXrefArgs(
diff --git a/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/javascript/JavaScriptXrefTest.java b/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/javascript/JavaScriptXrefTest.java
index f90609ec35b..e68110b13e7 100644
--- a/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/javascript/JavaScriptXrefTest.java
+++ b/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/javascript/JavaScriptXrefTest.java
@@ -33,9 +33,9 @@
 import java.io.StringWriter;
 import java.io.Writer;
 
+import org.opengrok.indexer.analysis.AbstractAnalyzer;
 import org.opengrok.indexer.analysis.CtagsReader;
 import org.opengrok.indexer.analysis.Definitions;
-import org.opengrok.indexer.analysis.FileAnalyzer;
 import org.opengrok.indexer.analysis.WriteXrefArgs;
 import org.junit.Test;
 import static org.junit.Assert.assertEquals;
@@ -98,7 +98,7 @@ private int writeJavaScriptXref(PrintStream oss, InputStream iss,
 
         Writer sw = new StringWriter();
         JavaScriptAnalyzerFactory fac = new JavaScriptAnalyzerFactory();
-        FileAnalyzer analyzer = fac.getAnalyzer();
+        AbstractAnalyzer analyzer = fac.getAnalyzer();
         analyzer.setScopesEnabled(true);
         analyzer.setFoldingEnabled(true);
         WriteXrefArgs wargs = new WriteXrefArgs(
diff --git a/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/json/JsonXrefTest.java b/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/json/JsonXrefTest.java
index b7092462a65..c7bfa3b62d2 100644
--- a/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/json/JsonXrefTest.java
+++ b/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/json/JsonXrefTest.java
@@ -33,9 +33,9 @@
 import java.io.StringWriter;
 import java.io.Writer;
 
+import org.opengrok.indexer.analysis.AbstractAnalyzer;
 import org.opengrok.indexer.analysis.CtagsReader;
 import org.opengrok.indexer.analysis.Definitions;
-import org.opengrok.indexer.analysis.FileAnalyzer;
 import org.opengrok.indexer.analysis.WriteXrefArgs;
 import org.junit.Test;
 import static org.junit.Assert.assertEquals;
@@ -98,7 +98,7 @@ private int writeJsonXref(PrintStream oss, InputStream iss,
 
         Writer sw = new StringWriter();
         JsonAnalyzerFactory fac = new JsonAnalyzerFactory();
-        FileAnalyzer analyzer = fac.getAnalyzer();
+        AbstractAnalyzer analyzer = fac.getAnalyzer();
         analyzer.setScopesEnabled(true);
         analyzer.setFoldingEnabled(true);
         WriteXrefArgs wargs = new WriteXrefArgs(
diff --git a/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/kotlin/KotlinXrefTest.java b/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/kotlin/KotlinXrefTest.java
index 28642bb9872..5e3395ba875 100644
--- a/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/kotlin/KotlinXrefTest.java
+++ b/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/kotlin/KotlinXrefTest.java
@@ -33,9 +33,9 @@
 import java.io.StringWriter;
 import java.io.Writer;
 
+import org.opengrok.indexer.analysis.AbstractAnalyzer;
 import org.opengrok.indexer.analysis.CtagsReader;
 import org.opengrok.indexer.analysis.Definitions;
-import org.opengrok.indexer.analysis.FileAnalyzer;
 import org.opengrok.indexer.analysis.WriteXrefArgs;
 import org.junit.Test;
 import static org.junit.Assert.assertEquals;
@@ -98,7 +98,7 @@ private int writeKotlinXref(PrintStream oss, InputStream iss,
 
         Writer sw = new StringWriter();
         KotlinAnalyzerFactory fac = new KotlinAnalyzerFactory();
-        FileAnalyzer analyzer = fac.getAnalyzer();
+        AbstractAnalyzer analyzer = fac.getAnalyzer();
         analyzer.setScopesEnabled(true);
         analyzer.setFoldingEnabled(true);
         WriteXrefArgs wargs = new WriteXrefArgs(
diff --git a/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/lisp/LispXrefTest.java b/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/lisp/LispXrefTest.java
index f3816c8d9fe..247c65e26ba 100644
--- a/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/lisp/LispXrefTest.java
+++ b/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/lisp/LispXrefTest.java
@@ -33,9 +33,9 @@
 import java.io.StringWriter;
 import java.io.Writer;
 
+import org.opengrok.indexer.analysis.AbstractAnalyzer;
 import org.opengrok.indexer.analysis.CtagsReader;
 import org.opengrok.indexer.analysis.Definitions;
-import org.opengrok.indexer.analysis.FileAnalyzer;
 import org.opengrok.indexer.analysis.WriteXrefArgs;
 import org.junit.Test;
 import static org.junit.Assert.assertEquals;
@@ -98,7 +98,7 @@ private int writeLispXref(PrintStream oss, InputStream iss,
 
         Writer sw = new StringWriter();
         LispAnalyzerFactory fac = new LispAnalyzerFactory();
-        FileAnalyzer analyzer = fac.getAnalyzer();
+        AbstractAnalyzer analyzer = fac.getAnalyzer();
         analyzer.setScopesEnabled(true);
         analyzer.setFoldingEnabled(true);
         WriteXrefArgs wargs = new WriteXrefArgs(
diff --git a/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/lua/LuaXrefTest.java b/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/lua/LuaXrefTest.java
index df0495249c7..fe118a2a610 100644
--- a/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/lua/LuaXrefTest.java
+++ b/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/lua/LuaXrefTest.java
@@ -33,9 +33,9 @@
 import java.io.StringWriter;
 import java.io.Writer;
 
+import org.opengrok.indexer.analysis.AbstractAnalyzer;
 import org.opengrok.indexer.analysis.CtagsReader;
 import org.opengrok.indexer.analysis.Definitions;
-import org.opengrok.indexer.analysis.FileAnalyzer;
 import org.opengrok.indexer.analysis.WriteXrefArgs;
 import org.junit.Test;
 import static org.junit.Assert.assertEquals;
@@ -98,7 +98,7 @@ private int writeLuaXref(PrintStream oss, InputStream iss,
 
         Writer sw = new StringWriter();
         LuaAnalyzerFactory fac = new LuaAnalyzerFactory();
-        FileAnalyzer analyzer = fac.getAnalyzer();
+        AbstractAnalyzer analyzer = fac.getAnalyzer();
         analyzer.setScopesEnabled(true);
         analyzer.setFoldingEnabled(true);
         WriteXrefArgs wargs = new WriteXrefArgs(
diff --git a/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/pascal/PascalAnalyzerFactoryTest.java b/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/pascal/PascalAnalyzerFactoryTest.java
index b1fe8a109d6..f9f64446238 100644
--- a/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/pascal/PascalAnalyzerFactoryTest.java
+++ b/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/pascal/PascalAnalyzerFactoryTest.java
@@ -40,9 +40,10 @@
 import org.junit.Rule;
 import org.junit.Test;
 import static org.opengrok.indexer.analysis.AnalyzerGuru.string_ft_nstored_nanalyzed_norms;
+
+import org.opengrok.indexer.analysis.AbstractAnalyzer;
 import org.opengrok.indexer.analysis.Ctags;
 import org.opengrok.indexer.analysis.Definitions;
-import org.opengrok.indexer.analysis.FileAnalyzer;
 import org.opengrok.indexer.analysis.StreamSource;
 import org.opengrok.indexer.condition.ConditionalRun;
 import org.opengrok.indexer.condition.ConditionalRunRule;
@@ -60,7 +61,7 @@ public class PascalAnalyzerFactoryTest {
     
     private static Ctags ctags;
     private static TestRepository repository;
-    private static FileAnalyzer analyzer;
+    private static AbstractAnalyzer analyzer;
 
     @Rule
     public ConditionalRunRule rule = new ConditionalRunRule();
diff --git a/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/pascal/PascalXrefTest.java b/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/pascal/PascalXrefTest.java
index 201563fe6f3..842b5e03bb4 100644
--- a/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/pascal/PascalXrefTest.java
+++ b/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/pascal/PascalXrefTest.java
@@ -33,9 +33,9 @@
 import java.io.StringWriter;
 import java.io.Writer;
 
+import org.opengrok.indexer.analysis.AbstractAnalyzer;
 import org.opengrok.indexer.analysis.CtagsReader;
 import org.opengrok.indexer.analysis.Definitions;
-import org.opengrok.indexer.analysis.FileAnalyzer;
 import org.opengrok.indexer.analysis.WriteXrefArgs;
 import org.junit.Test;
 import static org.junit.Assert.assertEquals;
@@ -98,7 +98,7 @@ private int writePascalXref(PrintStream oss, InputStream iss,
 
         Writer sw = new StringWriter();
         PascalAnalyzerFactory fac = new PascalAnalyzerFactory();
-        FileAnalyzer analyzer = fac.getAnalyzer();
+        AbstractAnalyzer analyzer = fac.getAnalyzer();
         analyzer.setScopesEnabled(true);
         analyzer.setFoldingEnabled(true);
         WriteXrefArgs wargs = new WriteXrefArgs(
diff --git a/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/perl/PerlXrefTest.java b/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/perl/PerlXrefTest.java
index 9d9a0089a98..6cc86decb70 100644
--- a/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/perl/PerlXrefTest.java
+++ b/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/perl/PerlXrefTest.java
@@ -35,7 +35,8 @@
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
-import org.opengrok.indexer.analysis.FileAnalyzer;
+
+import org.opengrok.indexer.analysis.AbstractAnalyzer;
 import org.opengrok.indexer.analysis.WriteXrefArgs;
 import org.opengrok.indexer.analysis.Xrefer;
 import static org.opengrok.indexer.util.CustomAssertions.assertLinesEqual;
@@ -90,7 +91,7 @@ private int writePerlXref(InputStream iss, PrintStream oss)
 
         Writer sw = new StringWriter();
         PerlAnalyzerFactory fac = new PerlAnalyzerFactory();
-        FileAnalyzer analyzer = fac.getAnalyzer();
+        AbstractAnalyzer analyzer = fac.getAnalyzer();
         Xrefer xref = analyzer.writeXref(new WriteXrefArgs(
             new InputStreamReader(iss, "UTF-8"), sw));
         oss.print(sw.toString());
diff --git a/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/php/PhpSymbolTokenizerTest.java b/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/php/PhpSymbolTokenizerTest.java
index 524df8c1f83..8120adfa7c1 100644
--- a/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/php/PhpSymbolTokenizerTest.java
+++ b/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/php/PhpSymbolTokenizerTest.java
@@ -36,7 +36,7 @@
 
 import org.apache.lucene.analysis.tokenattributes.CharTermAttribute;
 import org.junit.Test;
-import org.opengrok.indexer.analysis.FileAnalyzer;
+import org.opengrok.indexer.analysis.AbstractAnalyzer;
 import org.opengrok.indexer.analysis.JFlexTokenizer;
 
 /**
@@ -46,7 +46,7 @@
  */
 public class PhpSymbolTokenizerTest {    
 
-    private final FileAnalyzer analyzer;
+    private final AbstractAnalyzer analyzer;
 
     public PhpSymbolTokenizerTest() {
         PhpAnalyzerFactory analFact = new PhpAnalyzerFactory();
diff --git a/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/php/PhpXrefTest.java b/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/php/PhpXrefTest.java
index 1e38d949810..f15f5be5025 100644
--- a/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/php/PhpXrefTest.java
+++ b/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/php/PhpXrefTest.java
@@ -38,9 +38,10 @@
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
+
+import org.opengrok.indexer.analysis.AbstractAnalyzer;
 import org.opengrok.indexer.analysis.CtagsReader;
 import org.opengrok.indexer.analysis.Definitions;
-import org.opengrok.indexer.analysis.FileAnalyzer;
 import org.opengrok.indexer.analysis.WriteXrefArgs;
 import org.opengrok.indexer.analysis.Xrefer;
 import static org.opengrok.indexer.util.CustomAssertions.assertLinesEqual;
@@ -58,7 +59,7 @@ public void basicTest() throws IOException {
         String s = "
");
         Writer w = new StringWriter();
         PhpAnalyzerFactory fac = new PhpAnalyzerFactory();
-        FileAnalyzer analyzer = fac.getAnalyzer();
+        AbstractAnalyzer analyzer = fac.getAnalyzer();
         WriteXrefArgs wargs = new WriteXrefArgs(
             new InputStreamReader(is, "UTF-8"), w);
         wargs.setDefs(getTagsDefinitions());
diff --git a/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/plain/XMLAnalyzerTest.java b/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/plain/XMLAnalyzerTest.java
index 406288d09ab..b9234e65de0 100644
--- a/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/plain/XMLAnalyzerTest.java
+++ b/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/plain/XMLAnalyzerTest.java
@@ -29,7 +29,8 @@
 import java.io.StringWriter;
 import org.junit.Test;
 import static org.junit.Assert.*;
-import org.opengrok.indexer.analysis.FileAnalyzer;
+
+import org.opengrok.indexer.analysis.AbstractAnalyzer;
 import org.opengrok.indexer.analysis.WriteXrefArgs;
 
 public class XMLAnalyzerTest {
@@ -44,7 +45,7 @@ public void bug2225() throws IOException {
         StringReader sr = new StringReader(xmlText);
         StringWriter sw = new StringWriter();
         XMLAnalyzerFactory fac = new XMLAnalyzerFactory();
-        FileAnalyzer analyzer = fac.getAnalyzer();
+        AbstractAnalyzer analyzer = fac.getAnalyzer();
         analyzer.writeXref(new WriteXrefArgs(sr, sw));
         String[] xref = sw.toString().split("\n");
         // Reference to a Java class should have / instead of . in the path
@@ -70,7 +71,7 @@ public void bug806() throws IOException {
         StringReader sr = new StringReader(xmlText);
         StringWriter sw = new StringWriter();
         XMLAnalyzerFactory fac = new XMLAnalyzerFactory();
-        FileAnalyzer analyzer = fac.getAnalyzer();
+        AbstractAnalyzer analyzer = fac.getAnalyzer();
         analyzer.writeXref(new WriteXrefArgs(sr, sw));
         String[] xref = sw.toString().split("\n");
         // don't remove ../
@@ -88,7 +89,7 @@ public void xrefWithSpecialCharsInStringLiterals() throws IOException {
                 new StringReader(" ");
         StringWriter output = new StringWriter();
         XMLAnalyzerFactory fac = new XMLAnalyzerFactory();
-        FileAnalyzer analyzer = fac.getAnalyzer();
+        AbstractAnalyzer analyzer = fac.getAnalyzer();
         analyzer.writeXref(new WriteXrefArgs(input, output));
         assertTrue(output.toString().contains("<betweensinglequotes>"));
 
diff --git a/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/powershell/PoshXrefTest.java b/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/powershell/PoshXrefTest.java
index 5eecae61c07..86beec16c81 100644
--- a/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/powershell/PoshXrefTest.java
+++ b/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/powershell/PoshXrefTest.java
@@ -33,9 +33,9 @@
 import java.io.StringWriter;
 import java.io.Writer;
 
+import org.opengrok.indexer.analysis.AbstractAnalyzer;
 import org.opengrok.indexer.analysis.CtagsReader;
 import org.opengrok.indexer.analysis.Definitions;
-import org.opengrok.indexer.analysis.FileAnalyzer;
 import org.opengrok.indexer.analysis.WriteXrefArgs;
 import org.junit.Test;
 import static org.junit.Assert.assertEquals;
@@ -98,7 +98,7 @@ private int writePowerShellXref(PrintStream oss, InputStream iss,
 
         Writer sw = new StringWriter();
         PowershellAnalyzerFactory fac = new PowershellAnalyzerFactory();
-        FileAnalyzer analyzer = fac.getAnalyzer();
+        AbstractAnalyzer analyzer = fac.getAnalyzer();
         analyzer.setScopesEnabled(true);
         analyzer.setFoldingEnabled(true);
         WriteXrefArgs wargs = new WriteXrefArgs(
diff --git a/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/python/PythonXrefTest.java b/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/python/PythonXrefTest.java
index 5a3750972ae..4d28dae7e73 100644
--- a/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/python/PythonXrefTest.java
+++ b/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/python/PythonXrefTest.java
@@ -33,9 +33,9 @@
 import java.io.StringWriter;
 import java.io.Writer;
 
+import org.opengrok.indexer.analysis.AbstractAnalyzer;
 import org.opengrok.indexer.analysis.CtagsReader;
 import org.opengrok.indexer.analysis.Definitions;
-import org.opengrok.indexer.analysis.FileAnalyzer;
 import org.opengrok.indexer.analysis.WriteXrefArgs;
 import org.junit.Test;
 import static org.junit.Assert.assertEquals;
@@ -98,7 +98,7 @@ private int writePythonXref(PrintStream oss, InputStream iss,
 
         Writer sw = new StringWriter();
         PythonAnalyzerFactory fac = new PythonAnalyzerFactory();
-        FileAnalyzer analyzer = fac.getAnalyzer();
+        AbstractAnalyzer analyzer = fac.getAnalyzer();
         analyzer.setScopesEnabled(true);
         analyzer.setFoldingEnabled(true);
         WriteXrefArgs wargs = new WriteXrefArgs(
diff --git a/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/ruby/RubyXrefTest.java b/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/ruby/RubyXrefTest.java
index c73f425d79b..031e249cf6e 100644
--- a/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/ruby/RubyXrefTest.java
+++ b/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/ruby/RubyXrefTest.java
@@ -37,9 +37,10 @@
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
+
+import org.opengrok.indexer.analysis.AbstractAnalyzer;
 import org.opengrok.indexer.analysis.CtagsReader;
 import org.opengrok.indexer.analysis.Definitions;
-import org.opengrok.indexer.analysis.FileAnalyzer;
 import org.opengrok.indexer.analysis.JFlexXref;
 import org.opengrok.indexer.analysis.WriteXrefArgs;
 import org.opengrok.indexer.analysis.Xrefer;
@@ -103,7 +104,7 @@ private int writeRubyXref(InputStream iss, PrintStream oss)
 
         Writer sw = new StringWriter();
         RubyAnalyzerFactory fac = new RubyAnalyzerFactory();
-        FileAnalyzer analyzer = fac.getAnalyzer();
+        AbstractAnalyzer analyzer = fac.getAnalyzer();
         WriteXrefArgs wargs = new WriteXrefArgs(
             new InputStreamReader(iss, "UTF-8"), sw);
         wargs.setDefs(getTagsDefinitions());
diff --git a/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/rust/RustXrefTest.java b/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/rust/RustXrefTest.java
index 7da7c319514..c9857fbcde7 100644
--- a/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/rust/RustXrefTest.java
+++ b/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/rust/RustXrefTest.java
@@ -33,9 +33,9 @@
 import java.io.StringWriter;
 import java.io.Writer;
 
+import org.opengrok.indexer.analysis.AbstractAnalyzer;
 import org.opengrok.indexer.analysis.CtagsReader;
 import org.opengrok.indexer.analysis.Definitions;
-import org.opengrok.indexer.analysis.FileAnalyzer;
 import org.opengrok.indexer.analysis.WriteXrefArgs;
 import org.junit.Test;
 import static org.junit.Assert.assertEquals;
@@ -98,7 +98,7 @@ private int writeRustXref(PrintStream oss, InputStream iss,
 
         Writer sw = new StringWriter();
         RustAnalyzerFactory fac = new RustAnalyzerFactory();
-        FileAnalyzer analyzer = fac.getAnalyzer();
+        AbstractAnalyzer analyzer = fac.getAnalyzer();
         analyzer.setScopesEnabled(true);
         analyzer.setFoldingEnabled(true);
         WriteXrefArgs wargs = new WriteXrefArgs(
diff --git a/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/scala/ScalaXrefTest.java b/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/scala/ScalaXrefTest.java
index 7461c7dd1db..ed0e6b17794 100644
--- a/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/scala/ScalaXrefTest.java
+++ b/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/scala/ScalaXrefTest.java
@@ -33,9 +33,9 @@
 import java.io.StringWriter;
 import java.io.Writer;
 
+import org.opengrok.indexer.analysis.AbstractAnalyzer;
 import org.opengrok.indexer.analysis.CtagsReader;
 import org.opengrok.indexer.analysis.Definitions;
-import org.opengrok.indexer.analysis.FileAnalyzer;
 import org.opengrok.indexer.analysis.WriteXrefArgs;
 import org.junit.Test;
 import static org.junit.Assert.assertEquals;
@@ -98,7 +98,7 @@ private int writeScalaXref(PrintStream oss, InputStream iss,
 
         Writer sw = new StringWriter();
         ScalaAnalyzerFactory fac = new ScalaAnalyzerFactory();
-        FileAnalyzer analyzer = fac.getAnalyzer();
+        AbstractAnalyzer analyzer = fac.getAnalyzer();
         analyzer.setScopesEnabled(true);
         analyzer.setFoldingEnabled(true);
         WriteXrefArgs wargs = new WriteXrefArgs(
diff --git a/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/sh/ShXrefTest.java b/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/sh/ShXrefTest.java
index 83e0d7051bb..db6cc0983ba 100644
--- a/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/sh/ShXrefTest.java
+++ b/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/sh/ShXrefTest.java
@@ -33,9 +33,9 @@
 import java.io.StringWriter;
 import java.io.Writer;
 
+import org.opengrok.indexer.analysis.AbstractAnalyzer;
 import org.opengrok.indexer.analysis.CtagsReader;
 import org.opengrok.indexer.analysis.Definitions;
-import org.opengrok.indexer.analysis.FileAnalyzer;
 import org.opengrok.indexer.analysis.WriteXrefArgs;
 import org.junit.Test;
 import static org.junit.Assert.assertEquals;
@@ -94,7 +94,7 @@ private int writeShXref(PrintStream oss, InputStream iss,
 
         Writer sw = new StringWriter();
         ShAnalyzerFactory fac = new ShAnalyzerFactory();
-        FileAnalyzer analyzer = fac.getAnalyzer();
+        AbstractAnalyzer analyzer = fac.getAnalyzer();
         analyzer.setScopesEnabled(true);
         analyzer.setFoldingEnabled(true);
         WriteXrefArgs wargs = new WriteXrefArgs(
diff --git a/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/sql/PLSQLXrefTest.java b/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/sql/PLSQLXrefTest.java
index 1eee69f4105..7b44f6a0013 100644
--- a/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/sql/PLSQLXrefTest.java
+++ b/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/sql/PLSQLXrefTest.java
@@ -33,9 +33,9 @@
 import java.io.StringWriter;
 import java.io.Writer;
 
+import org.opengrok.indexer.analysis.AbstractAnalyzer;
 import org.opengrok.indexer.analysis.CtagsReader;
 import org.opengrok.indexer.analysis.Definitions;
-import org.opengrok.indexer.analysis.FileAnalyzer;
 import org.opengrok.indexer.analysis.WriteXrefArgs;
 import org.junit.Test;
 import static org.junit.Assert.assertEquals;
@@ -98,7 +98,7 @@ private int writePLSQLXref(PrintStream oss, InputStream iss,
 
         Writer sw = new StringWriter();
         PLSQLAnalyzerFactory fac = new PLSQLAnalyzerFactory();
-        FileAnalyzer analyzer = fac.getAnalyzer();
+        AbstractAnalyzer analyzer = fac.getAnalyzer();
         analyzer.setScopesEnabled(true);
         analyzer.setFoldingEnabled(true);
         WriteXrefArgs wargs = new WriteXrefArgs(
diff --git a/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/sql/SQLXrefTest.java b/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/sql/SQLXrefTest.java
index 19a73f347b2..fbd11456e1a 100644
--- a/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/sql/SQLXrefTest.java
+++ b/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/sql/SQLXrefTest.java
@@ -33,9 +33,9 @@
 import java.io.StringWriter;
 import java.io.Writer;
 
+import org.opengrok.indexer.analysis.AbstractAnalyzer;
 import org.opengrok.indexer.analysis.CtagsReader;
 import org.opengrok.indexer.analysis.Definitions;
-import org.opengrok.indexer.analysis.FileAnalyzer;
 import org.opengrok.indexer.analysis.WriteXrefArgs;
 import org.junit.Test;
 import static org.junit.Assert.assertEquals;
@@ -98,7 +98,7 @@ private int writeSQLXref(PrintStream oss, InputStream iss,
 
         Writer sw = new StringWriter();
         SQLAnalyzerFactory fac = new SQLAnalyzerFactory();
-        FileAnalyzer analyzer = fac.getAnalyzer();
+        AbstractAnalyzer analyzer = fac.getAnalyzer();
         analyzer.setScopesEnabled(true);
         analyzer.setFoldingEnabled(true);
         WriteXrefArgs wargs = new WriteXrefArgs(
diff --git a/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/swift/SwiftXrefTest.java b/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/swift/SwiftXrefTest.java
index 2242f307d56..026c2ab3531 100644
--- a/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/swift/SwiftXrefTest.java
+++ b/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/swift/SwiftXrefTest.java
@@ -33,9 +33,9 @@
 import java.io.StringWriter;
 import java.io.Writer;
 
+import org.opengrok.indexer.analysis.AbstractAnalyzer;
 import org.opengrok.indexer.analysis.CtagsReader;
 import org.opengrok.indexer.analysis.Definitions;
-import org.opengrok.indexer.analysis.FileAnalyzer;
 import org.opengrok.indexer.analysis.WriteXrefArgs;
 import org.junit.Test;
 import static org.junit.Assert.assertEquals;
@@ -98,7 +98,7 @@ private int writeSwiftXref(PrintStream oss, InputStream iss,
 
         Writer sw = new StringWriter();
         SwiftAnalyzerFactory fac = new SwiftAnalyzerFactory();
-        FileAnalyzer analyzer = fac.getAnalyzer();
+        AbstractAnalyzer analyzer = fac.getAnalyzer();
         analyzer.setScopesEnabled(true);
         analyzer.setFoldingEnabled(true);
         WriteXrefArgs wargs = new WriteXrefArgs(
diff --git a/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/tcl/TclXrefTest.java b/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/tcl/TclXrefTest.java
index a9ae56306fb..08e0b8350a8 100644
--- a/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/tcl/TclXrefTest.java
+++ b/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/tcl/TclXrefTest.java
@@ -33,9 +33,9 @@
 import java.io.StringWriter;
 import java.io.Writer;
 
+import org.opengrok.indexer.analysis.AbstractAnalyzer;
 import org.opengrok.indexer.analysis.CtagsReader;
 import org.opengrok.indexer.analysis.Definitions;
-import org.opengrok.indexer.analysis.FileAnalyzer;
 import org.opengrok.indexer.analysis.WriteXrefArgs;
 import org.junit.Test;
 import static org.junit.Assert.assertEquals;
@@ -98,7 +98,7 @@ private int writeTclXref(PrintStream oss, InputStream iss,
 
         Writer sw = new StringWriter();
         TclAnalyzerFactory fac = new TclAnalyzerFactory();
-        FileAnalyzer analyzer = fac.getAnalyzer();
+        AbstractAnalyzer analyzer = fac.getAnalyzer();
         analyzer.setScopesEnabled(true);
         analyzer.setFoldingEnabled(true);
         WriteXrefArgs wargs = new WriteXrefArgs(
diff --git a/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/vb/VBXrefTest.java b/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/vb/VBXrefTest.java
index 649730b3889..e6ec86d887a 100644
--- a/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/vb/VBXrefTest.java
+++ b/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/vb/VBXrefTest.java
@@ -33,9 +33,9 @@
 import java.io.StringWriter;
 import java.io.Writer;
 
+import org.opengrok.indexer.analysis.AbstractAnalyzer;
 import org.opengrok.indexer.analysis.CtagsReader;
 import org.opengrok.indexer.analysis.Definitions;
-import org.opengrok.indexer.analysis.FileAnalyzer;
 import org.opengrok.indexer.analysis.WriteXrefArgs;
 import org.junit.Test;
 import static org.junit.Assert.assertEquals;
@@ -98,7 +98,7 @@ private int writeVBXref(PrintStream oss, InputStream iss,
 
         Writer sw = new StringWriter();
         VBAnalyzerFactory fac = new VBAnalyzerFactory();
-        FileAnalyzer analyzer = fac.getAnalyzer();
+        AbstractAnalyzer analyzer = fac.getAnalyzer();
         analyzer.setScopesEnabled(true);
         analyzer.setFoldingEnabled(true);
         WriteXrefArgs wargs = new WriteXrefArgs(
diff --git a/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/xml/XMLXrefTest.java b/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/xml/XMLXrefTest.java
index 5317b4b9630..ed150d6afaa 100644
--- a/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/xml/XMLXrefTest.java
+++ b/opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/xml/XMLXrefTest.java
@@ -32,7 +32,7 @@
 import java.io.StringWriter;
 import java.io.Writer;
 
-import org.opengrok.indexer.analysis.FileAnalyzer;
+import org.opengrok.indexer.analysis.AbstractAnalyzer;
 import org.opengrok.indexer.analysis.WriteXrefArgs;
 import org.junit.Test;
 import static org.junit.Assert.assertEquals;
@@ -94,7 +94,7 @@ private int writeXMLXref(PrintStream oss, InputStream iss)
 
         Writer sw = new StringWriter();
         XMLAnalyzerFactory fac = new XMLAnalyzerFactory();
-        FileAnalyzer analyzer = fac.getAnalyzer();
+        AbstractAnalyzer analyzer = fac.getAnalyzer();
         analyzer.setScopesEnabled(true);
         analyzer.setFoldingEnabled(true);
         WriteXrefArgs wargs = new WriteXrefArgs(
diff --git a/opengrok-indexer/src/test/java/org/opengrok/indexer/index/IndexerTest.java b/opengrok-indexer/src/test/java/org/opengrok/indexer/index/IndexerTest.java
index cc25f310574..221cc9b06b3 100644
--- a/opengrok-indexer/src/test/java/org/opengrok/indexer/index/IndexerTest.java
+++ b/opengrok-indexer/src/test/java/org/opengrok/indexer/index/IndexerTest.java
@@ -52,8 +52,8 @@
 import org.junit.BeforeClass;
 import org.junit.Rule;
 import org.junit.Test;
+import org.opengrok.indexer.analysis.AnalyzerFactory;
 import org.opengrok.indexer.analysis.AnalyzerGuru;
-import org.opengrok.indexer.analysis.FileAnalyzerFactory;
 import org.opengrok.indexer.condition.ConditionalRun;
 import org.opengrok.indexer.condition.ConditionalRunRule;
 import org.opengrok.indexer.condition.CtagsInstalled;
@@ -373,7 +373,7 @@ public void testXref() throws IOException {
         List files = new ArrayList<>();
         FileUtilities.getAllFiles(new File(repository.getSourceRoot()), files, false);
         for (File f : files) {
-            FileAnalyzerFactory factory = AnalyzerGuru.find(f.getAbsolutePath());
+            AnalyzerFactory factory = AnalyzerGuru.find(f.getAbsolutePath());
             if (factory == null) {
                 continue;
             }
diff --git a/opengrok-indexer/src/test/java/org/opengrok/indexer/search/context/SearchAndContextFormatterTest.java b/opengrok-indexer/src/test/java/org/opengrok/indexer/search/context/SearchAndContextFormatterTest.java
index 6cc0050d10c..b04910f928e 100644
--- a/opengrok-indexer/src/test/java/org/opengrok/indexer/search/context/SearchAndContextFormatterTest.java
+++ b/opengrok-indexer/src/test/java/org/opengrok/indexer/search/context/SearchAndContextFormatterTest.java
@@ -41,7 +41,7 @@
 import org.junit.BeforeClass;
 import org.junit.ClassRule;
 import org.junit.Test;
-import org.opengrok.indexer.analysis.FileAnalyzer;
+import org.opengrok.indexer.analysis.AbstractAnalyzer;
 import org.opengrok.indexer.analysis.plain.PlainAnalyzerFactory;
 import org.opengrok.indexer.condition.ConditionalRun;
 import org.opengrok.indexer.condition.ConditionalRunRule;
@@ -141,7 +141,7 @@ private String[] getFirstFragments(SearchEngine instance)
          * an analyzer "even if in some circumstances it isn't used."
          */
         PlainAnalyzerFactory fac = PlainAnalyzerFactory.DEFAULT_INSTANCE;
-        FileAnalyzer anz = fac.getAnalyzer();
+        AbstractAnalyzer anz = fac.getAnalyzer();
 
         ContextFormatter formatter = new ContextFormatter(args);
         OGKUnifiedHighlighter uhi = new OGKUnifiedHighlighter(env,
diff --git a/opengrok-indexer/src/test/java/org/opengrok/indexer/search/context/SearchAndContextFormatterTest2.java b/opengrok-indexer/src/test/java/org/opengrok/indexer/search/context/SearchAndContextFormatterTest2.java
index 999245edbb8..14d3b08d8c3 100644
--- a/opengrok-indexer/src/test/java/org/opengrok/indexer/search/context/SearchAndContextFormatterTest2.java
+++ b/opengrok-indexer/src/test/java/org/opengrok/indexer/search/context/SearchAndContextFormatterTest2.java
@@ -43,7 +43,7 @@
 import org.junit.BeforeClass;
 import org.junit.Rule;
 import org.junit.Test;
-import org.opengrok.indexer.analysis.FileAnalyzer;
+import org.opengrok.indexer.analysis.AbstractAnalyzer;
 import org.opengrok.indexer.analysis.plain.PlainAnalyzerFactory;
 import org.opengrok.indexer.condition.ConditionalRun;
 import org.opengrok.indexer.condition.ConditionalRunRule;
@@ -200,7 +200,7 @@ private String[] getFirstFragments(SearchEngine instance)
          * an analyzer "even if in some circumstances it isn't used."
          */
         PlainAnalyzerFactory fac = PlainAnalyzerFactory.DEFAULT_INSTANCE;
-        FileAnalyzer anz = fac.getAnalyzer();
+        AbstractAnalyzer anz = fac.getAnalyzer();
 
         ContextFormatter formatter = new ContextFormatter(args);
         OGKUnifiedHighlighter uhi = new OGKUnifiedHighlighter(env,
diff --git a/opengrok-indexer/src/test/java/org/opengrok/indexer/web/XrefSourceTransformerTest.java b/opengrok-indexer/src/test/java/org/opengrok/indexer/web/XrefSourceTransformerTest.java
index bb647cd3452..c546020eec4 100644
--- a/opengrok-indexer/src/test/java/org/opengrok/indexer/web/XrefSourceTransformerTest.java
+++ b/opengrok-indexer/src/test/java/org/opengrok/indexer/web/XrefSourceTransformerTest.java
@@ -29,7 +29,7 @@
 import static org.junit.Assert.assertEquals;
 import org.junit.Before;
 import org.junit.Test;
-import org.opengrok.indexer.analysis.FileAnalyzer;
+import org.opengrok.indexer.analysis.AbstractAnalyzer;
 
 /**
  * Represents a container for tests of {@link XrefSourceTransformer}.
@@ -58,7 +58,7 @@ public class XrefSourceTransformerTest {
     public void setUp() {
         StringReader rdr = new StringReader(XREF_FRAG_DFLT);
         // Test the normal path of dummy-first then actual data.
-        xform = new XrefSourceTransformer(FileAnalyzer.dummyReader);
+        xform = new XrefSourceTransformer(AbstractAnalyzer.DUMMY_READER);
         xform.yyreset(rdr);
 
         out = new StringWriter();
diff --git a/opengrok-web/src/main/webapp/diff.jsp b/opengrok-web/src/main/webapp/diff.jsp
index 1af6edb0ad1..83cf31b30e0 100644
--- a/opengrok-web/src/main/webapp/diff.jsp
+++ b/opengrok-web/src/main/webapp/diff.jsp
@@ -37,10 +37,11 @@ org.suigeneris.jrcs.diff.delta.Delta,
 org.suigeneris.jrcs.diff.Diff,
 org.suigeneris.jrcs.diff.Revision,
 org.opengrok.indexer.analysis.AnalyzerGuru,
-org.opengrok.indexer.analysis.FileAnalyzer.Genre,
 org.opengrok.indexer.web.DiffData,
 org.opengrok.indexer.web.DiffType"
-%><%!
+%>
+<%@ page import="org.opengrok.indexer.analysis.AbstractAnalyzer" %>
+<%!
 private String getAnnotateRevision(DiffData data) {
     if (data.type == DiffType.OLD || data.type == DiffType.NEW) {
         String rev = data.rev[data.type == DiffType.NEW ? 1 : 0];
@@ -108,7 +109,7 @@ include file="mast.jsp"
     

Error:

<%= data.errorMsg %>

<% - } else if (data.genre == Genre.IMAGE) { + } else if (data.genre == AbstractAnalyzer.Genre.IMAGE) { String link = request.getContextPath() + Prefix.DOWNLOAD_P + Util.htmlize(cfg.getPath()); @@ -128,7 +129,7 @@ include file="mast.jsp"
<% - } else if (data.genre != Genre.PLAIN && data.genre != Genre.HTML) { + } else if (data.genre != AbstractAnalyzer.Genre.PLAIN && data.genre != AbstractAnalyzer.Genre.HTML) { String link = request.getContextPath() + Prefix.DOWNLOAD_P + Util.htmlize(cfg.getPath()); @@ -534,4 +535,4 @@ include file="mast.jsp" include file="foot.jspf" -%> \ No newline at end of file +%> diff --git a/opengrok-web/src/main/webapp/list.jsp b/opengrok-web/src/main/webapp/list.jsp index 7fd8b20a4fc..07ff6c452ec 100644 --- a/opengrok-web/src/main/webapp/list.jsp +++ b/opengrok-web/src/main/webapp/list.jsp @@ -36,8 +36,6 @@ java.util.Locale, java.util.Set, org.opengrok.indexer.analysis.AnalyzerGuru, org.opengrok.indexer.analysis.Definitions, -org.opengrok.indexer.analysis.FileAnalyzer.Genre, -org.opengrok.indexer.analysis.FileAnalyzerFactory, org.opengrok.indexer.history.Annotation, org.opengrok.indexer.index.IndexDatabase, org.opengrok.indexer.search.DirectoryEntry, @@ -47,7 +45,10 @@ org.opengrok.indexer.util.FileExtraZipper, org.opengrok.indexer.util.IOUtils, org.opengrok.web.DirectoryListing, org.opengrok.indexer.web.SearchHelper" -%><% +%> +<%@ page import="org.opengrok.indexer.analysis.AnalyzerFactory" %> +<%@ page import="org.opengrok.indexer.analysis.AbstractAnalyzer" %> +<% { // need to set it here since requesting parameters if (request.getCharacterEncoding() == null) { @@ -177,18 +178,18 @@ document.pageReady.push(function() { pageReadyList();}); BufferedInputStream bin = new BufferedInputStream(new FileInputStream(resourceFile)); try { - FileAnalyzerFactory a = AnalyzerGuru.find(basename); - Genre g = AnalyzerGuru.getGenre(a); + AnalyzerFactory a = AnalyzerGuru.find(basename); + AbstractAnalyzer.Genre g = AnalyzerGuru.getGenre(a); if (g == null) { a = AnalyzerGuru.find(bin); g = AnalyzerGuru.getGenre(a); } - if (g == Genre.IMAGE) { + if (g == AbstractAnalyzer.Genre.IMAGE) { %>
<% - } else if ( g == Genre.HTML) { + } else if ( g == AbstractAnalyzer.Genre.HTML) { /** * For backward compatibility, read the OpenGrok-produced * document using the system default charset. @@ -196,7 +197,7 @@ document.pageReady.push(function() { pageReadyList();}); r = new InputStreamReader(bin); // dumpXref() is also useful here for translating links. Util.dumpXref(out, r, request.getContextPath()); - } else if (g == Genre.PLAIN) { + } else if (g == AbstractAnalyzer.Genre.PLAIN) { %>
<%
@@ -238,10 +239,10 @@ Click download <%= basename %><%
             }
         } else {
             // requesting a previous revision or needed to generate xref on the fly (economy mode).
-            FileAnalyzerFactory a = AnalyzerGuru.find(basename);
-            Genre g = AnalyzerGuru.getGenre(a);
+            AnalyzerFactory a = AnalyzerGuru.find(basename);
+            AbstractAnalyzer.Genre g = AnalyzerGuru.getGenre(a);
             String error = null;
-            if (g == Genre.PLAIN || g == Genre.HTML || g == null) {
+            if (g == AbstractAnalyzer.Genre.PLAIN || g == AbstractAnalyzer.Genre.HTML || g == null) {
                 InputStream in = null;
                 try {
                     if (rev.equals(DUMMY_REVISION)) {
@@ -260,7 +261,7 @@ Click download <%= basename %><%
                             a = AnalyzerGuru.find(in);
                             g = AnalyzerGuru.getGenre(a);
                         }
-                        if (g == Genre.DATA || g == Genre.XREFABLE || g == null) {
+                        if (g == AbstractAnalyzer.Genre.DATA || g == AbstractAnalyzer.Genre.XREFABLE || g == null) {
     %>
     
Binary file [Click here to download] @@ -269,7 +270,7 @@ Click download <%= basename %><% %>
<%
-                            if (g == Genre.PLAIN) {
+                            if (g == AbstractAnalyzer.Genre.PLAIN) {
                                 // We don't have any way to get definitions
                                 // for old revisions currently.
                                 Definitions defs = null;
@@ -283,11 +284,11 @@ Click download <%= basename %><%
                                         request.getContextPath(),
                                         a, r, out,
                                         defs, annotation, project);
-                            } else if (g == Genre.IMAGE) {
+                            } else if (g == AbstractAnalyzer.Genre.IMAGE) {
         %>
<%
-                            } else if (g == Genre.HTML) {
+                            } else if (g == AbstractAnalyzer.Genre.HTML) {
                                 /**
                                  * For backward compatibility, read the
                                  * OpenGrok-produced document using the system
@@ -325,7 +326,7 @@ Click download <%= basename %><%
     

<%= error %>

<% } } - } else if (g == Genre.IMAGE) { + } else if (g == AbstractAnalyzer.Genre.IMAGE) { %>