FileAnalyzer.java revision 1462
0N/A * The contents of this file are subject to the terms of the 407N/A * Common Development and Distribution License (the "License"). 0N/A * You may not use this file except in compliance with the License. 0N/A * language governing permissions and limitations under the License. 0N/A * When distributing Covered Code, include this CDDL HEADER in each 0N/A * If applicable, add the following below this CDDL HEADER, with the 0N/A * fields enclosed by brackets "[]" replaced with your own identifying 0N/A * information: Portions Copyright [yyyy] [name of copyright owner] 1380N/A * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved. 0N/A * Use is subject to license terms. 0N/A * Base class for all different File Analyzers 0N/A * An Analyzer for a filetype provides 0N/A * <li>the file extentions and magic numbers it analyzes</li> 0N/A * <li>a lucene document listing the fields it can support</li> 0N/A * <li>TokenStreams for each of the field it said requires tokenizing in 2</li> 0N/A * <li>cross reference in HTML format</li> 0N/A * <li>The type of file data, plain text etc</li> 0N/A * Created on September 21, 2005 1462N/A /** the project to which this analyzer is related to */ 0N/A * What kind of file is this? 1185N/A /** xrefed - line numbered context */ 1185N/A /** xrefed - summarizer context */ 1185N/A /** not xrefed - no context */ 1185N/A /** not xrefed - summarizer context from original file */ 1185N/A * Get the type name value used to tag lucence documents. 1185N/A * @return a none-null string. 1185N/A * Get the Genre for the given type name. 1185N/A * @param typeName name to check 1185N/A * @return {@code null} if it doesn't match any genre, the genre otherwise. 1462N/A * Ctags instance to use for tagging. 1462N/A * Set the ctag instance to use for tagging this repo's files. 1462N/A * @param ctags instance to set. 1462N/A *Set the project, to which this instance is related to. 1462N/A * @param project project to set. 202N/A * Get the factory which created this analyzer. 202N/A * @return the {@code FileAnalyzerFactory} which created this analyzer 1462N/A * Get the genre, which this analyzer usually handles. 1462N/A * @return the genre this analyzer handles. 1462N/A * @see FileAnalyzerFactory#getGenre() 1462N/A /** Creates a new instance of FileAnalyzer 1462N/A * @param factory the factory to use to obtain default settings */ 1462N/A * Read the given input, analyze it and store the result into the given 1462N/A * document. NOTE: This method does not close given input stream on return! 1462N/A * @param doc where to store results. 1462N/A * @param in source to read. 1462N/A * Get the TokenStream for the given fieldname. 1462N/A * @param fieldName filed name in question {@code path | project | hist} 1462N/A * @param reader reader to use. 1462N/A * @return {@code null} for unknown field names, a new corresponding 1380N/A //TODO needs refactoring to get more speed and less ram usage for indexer 1462N/A * Write out current results html formatted to the given writer. 0N/A * @param out to writer HTML cross-reference 271N/A * @throws java.io.IOException if an error occurs 1462N/A * Write out current results html formatted to the given destination. 1462N/A * @param xrefDir the parent directory of the file to write. 1462N/A * @param path the relative path wrt. <var>xrefDir</var> of the file to write.