IndexDatabase.java revision 694
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] 1229N/A * Copyright 2008 Sun Microsystems, Inc. All rights reserved. 1185N/A * Use is subject to license terms. 1185N/A * This class is used to create / update the index databases. Currently we use 1185N/A * one index database per project. 92N/A * @author Trond Norbye 1185N/A * Create a new instance of the Index Database. Use this constructor if 1185N/A * you don't use any projects 1185N/A * @throws java.io.IOException if an error occurs while creating directories 1185N/A * Create a new instance of an Index Database for a given project 1205N/A * @param project the project to create the database for 1185N/A * @throws java.io.IOException if an errror occurs while creating directories 92N/A * Update the index database for all of the projects. Print progress to 1185N/A * @param executor An executor to run the job 1190N/A * @throws IOException if an error occurs 1185N/A * Update the index database for all of the projects 1185N/A * @param executor An executor to run the job 1185N/A * @param listener where to signal the changes to the database 1185N/A * @throws IOException if an error occurs 1185N/A * Update the index database for a number of sub-directories 1185N/A * @param executor An executor to run the job 0N/A * @param listener where to signal the changes to the database 583N/A * @throws IOException if an error occurs 1185N/A // to avoid race conditions, just recheck.. 1185N/A * By default the indexer will traverse all directories in the project. 1185N/A * If you add directories with this function update will just process 1185N/A * the specified directories. 1185N/A * @param dir The directory to scan 1205N/A * @return <code>true</code> if the file is added, false oth 1190N/A * Update the content of this index database 1190N/A * @throws IOException if an error occurs 1190N/A * @throws HistoryException if an error occurs when accessing the history 1185N/A log.
severe(
"Unable to run ctags! searching definitions will not work!");
154N/A * Optimize all index databases 1185N/A * @param executor An executor to run the job 0N/A * @throws IOException if an error occurs 972N/A * Optimize the index database 972N/A log.
warning(
"Optimize terminated... Someone else is updating / optimizing it!");
847N/A * Generate a spelling suggestion for the definitions stored in defs 0N/A * Remove a stale file (uidIter.term().text()) from the index database 1190N/A * @throws java.io.IOException if an error occurs 0N/A log.
info(
"Failed to remove obsolete xref-file: " +
849N/A // Remove the parent directory if it's empty 1185N/A * Add a file to the Lucene index (and generate a xref file) 159N/A * @param file The file to add 830N/A * @param path The path to the file (from source root) 1219N/A * @throws java.io.IOException if an error occurs 1190N/A // If mkdirs() returns false, the failure is most likely 1185N/A // because the file already exists. But to check for the 1185N/A // file first and only add it if it doesn't exists would 1185N/A // only increase the file IO... 1185N/A * Check if I should accept this file into the index database 158N/A * @param file the file to check 1185N/A * @return true if the file should be included, false otherwise 0N/A // Lets support symlinks within the same directory, this 1185N/A // should probably be extended to within the same repository 1185N/A // always accept directories so that their files can be examined 1185N/A // versioned files should always be accepted 1185N/A // this is an unversioned file, check if it should be indexed 1185N/A * Generate indexes recursively 1185N/A * @param dir the root indexDirectory to generate indexes for 1185N/A * Interrupt the index generation (and the index generation will stop as 1124N/A * Register an object to receive events when modifications is done to the 1185N/A * @param listener the object to receive the events 1190N/A * Remove an object from the lists of objects to receive events when 1185N/A * modifications is done to the index database 1185N/A * @param listener the object to remove 1185N/A * List all files in all of the index databases 1185N/A * @throws IOException if an error occurs 1190N/A * List all files in some of the index databases 1185N/A * @param subFiles Subdirectories for the various projects to list the files 1190N/A * for (or null or an empty list to dump all projects) 1185N/A * @throws IOException if an error occurs 1185N/A * List all of the files in this index database 1185N/A * @throws IOException If an IO error occurs while reading from the database 1145N/A * Get an indexReader for the Index database where a given file 1145N/A * @param path the file to get the database for 1145N/A * @return The index database where the file should be located or null if