IndexDatabase.java revision 504
0N/A * The contents of this file are subject to the terms of the 0N/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 405N/A * fields enclosed by brackets "[]" replaced with your own identifying 0N/A * information: Portions Copyright [yyyy] [name of copyright owner] 928N/A * Copyright 2008 Sun Microsystems, Inc. All rights reserved. 0N/A * Use is subject to license terms. 615N/A * This class is used to create / update the index databases. Currently we use 0N/A * one index database per project. 0N/A * @author Trond Norbye 0N/A * Create a new instance of the Index Database. Use this constructor if 0N/A * you don't use any projects 0N/A * @throws java.io.IOException if an error occurs while creating directories 0N/A * Create a new instance of an Index Database for a given project 0N/A * @param project the project to create the database for 0N/A * @throws java.io.IOException if an errror occurs while creating directories 0N/A * Update the index database for all of the projects. Print progress to 0N/A * @param executor An executor to run the job 0N/A * @throws IOException if an error occurs 0N/A * Update the index database for all of the projects 0N/A * @param executor An executor to run the job 816N/A * @param listener where to signal the changes to the database 816N/A * @throws IOException if an error occurs 816N/A // to avoid race conditions, just recheck.. 1318N/A * By default the indexer will traverse all directories in the project. 1318N/A * If you add directories with this function update will just process 816N/A * the specified directories. 816N/A * @param dir The directory to scan 928N/A * @return <code>true</code> if the file is added, false oth 816N/A * Update the content of this index database 816N/A * @throws IOException if an error occurs 1327N/A * Optimize all index databases 0N/A * @param executor An executor to run the job 0N/A * @throws IOException if an error occurs 816N/A * Optimize the index database 1185N/A log.
warning(
"Optimize terminated... Someone else is updating / optimizing it!");
1190N/A * Generate a spelling suggestion for the definitions stored in defs 0N/A log.
info(
"Generating spelling suggestion index ... ");
0N/A * Remove a stale file (uidIter.term().text()) from the index database 0N/A * (and the xref file) 0N/A * @throws java.io.IOException if an error occurs 0N/A log.
info(
"Failed to remove obsolete xref-file: " +
0N/A // Ignore. The directory is most likely not empty, but to check 1190N/A // would just increase the disk IO even more.. 0N/A * Add a file to the Lucene index (and generate a xref file) 0N/A * @param file The file to add 1190N/A * @param path The path to the file (from source root) 0N/A * @throws java.io.IOException if an error occurs 0N/A // The failure was most likely because the file already 1190N/A // existed. But to check for the file first and only 0N/A // add it if it doesn't exists would only increase the 0N/A * Check if I should accept this file into the index database 0N/A * @param file the file to check 0N/A * @return true if the file should be included, false otherwise // Lets support symlinks within the same directory, this // should probably be extended to within the same repository // always accept directories so that their files can be examined // versioned files should always be accepted // this is an unversioned file, check if it should be indexed * Generate indexes recursively * @param dir the root indexDirectory to generate indexes for * Interrupt the index generation (and the index generation will stop as * Register an object to receive events when modifications is done to the * @param listener the object to receive the events * Remove an object from the lists of objects to receive events when * modifications is done to the index database * @param listener the object to remove * List all files in all of the index databases * @throws IOException if an error occurs * List all files in some of the index databases * @param subFiles Subdirectories for the various projects to list the files * for (or null or an empty list to dump all projects) * @throws IOException if an error occurs log.
warning(
"Warning: Could not find a project for \"" +
path +
"\"");
* List all of the files in this index database * @throws IOException If an IO error occurs while reading from the database log.
warning(
"Warning: Could not find a project for \"" +
path +
"\"");
* Get an indexReader for the Index database where a given file * @param path the file to get the database for * @return The index database where the file should be located or null if