Indexer.java revision 1470
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 0N/A * fields enclosed by brackets "[]" replaced with your own identifying 0N/A * information: Portions Copyright [yyyy] [name of copyright owner] 1054N/A * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved. 0N/A * Portions Copyright 2011 Jens Elkner. 886N/A * Creates and updates an inverted source index 886N/A * as well as generates Xref, file stats etc., if specified 65N/A "org.apache.derby.jdbc.EmbeddedDriver";
0N/A "org.apache.derby.jdbc.ClientDriver";
312N/A * Get the indexer instance. 0N/A * Program entry point 240N/A * @param argv argument vector 111N/A // Parse command line options: 77N/A // We need to read the configuration file first, since we 77N/A // will try to overwrite options.. 491N/A // Now we can handle all the other options.. 491N/A // Should be a full class name, but we also accept 491N/A // the shorthands "client" and "embedded". Expand 491N/A // the shorthands here. 491N/A // The default database driver is Derby's client driver. 491N/A // The default URL depends on the database driver. 491N/A // automatically allow symlinks that are directly in source root 312N/A //Set updated configuration in RuntimeEnvironment 1062N/A // PMD wants us to use length() > 0 && charAt(0) instead of startsWith() 491N/A // for performance. We prefer clarity over performance here, so silence it. 491N/A * Prepare the environment to execute indexing. Basically it does some 1062N/A * consistency checks wrt. commadline options sets and executes simple tasks 491N/A * like zapping or refreshing the history cache, list available projects 1062N/A * including their path, create spelling index for related projects, 491N/A * writing the config file. 491N/A * @param searchRepositories If {@code true} scan for new repositories in 491N/A * the source root directory. 491N/A * @param addProjects If {@code true} add automatically projects found 491N/A * @param defaultProject The name of the project to use as default. Might 491N/A * @param configFilename The pathname of the configuration file to write. 491N/A * If {@code null} writing the config file gets skipped. 491N/A * for the given or all projects. 491N/A * @param listFiles If {@code true}, print a list of all files of 491N/A * the index database for given projects to stdout. 491N/A * @param listTokens If {@code true}, print a list of frequent 491N/A * tokens for related projects to stdout. 491N/A * @param subFiles Determine target projects by the given repo 1062N/A * files when <var>listFiles</var> or <var>createDict</var> is set to 491N/A * {@code true}. {@code null} implies "all projects". 491N/A * @param repositories Target repositories.{@code null} implies 491N/A * @param zapCache List of project names, whose history cache should 491N/A * be zapped. An Asterisk ('*') implies zap all. Ignored if empty. 491N/A * @param listRepoPathes If {@code true}, just list available projects 491N/A * incl. their path, zap projects (if set) and return. 491N/A * @throws IndexerException 491N/A * @throws NullPointerException if <var>env</var> or <var>zapCache</var> is 260N/A // Keep a copy of the old project list so that we can preserve 260N/A // the customization of existing projects. // Add a project for each top-level directory in source root. // This is an existing object. Reuse the old project, // possibly with customizations, instead of creating a // new with default values. // Found a new directory with no matching project, so // create a new project with default properties. // The projects should be sorted... log.
log(
Level.
INFO,
"Generating history cache for specified repositories ...");
* Index and optionally optimize related databases. Obtains an * {@link RuntimeEnvironment} instance and registers with it, so that * required infos are obtained from there. * @param update If {@code true} update the index for related projects. * @param noThreads Number of threads to use for indexing. * @param subFiles Use the giben repo files to determine the projects, * which should be indexed or index db optimized. * @param progress If {@code true} show progress when indexing. Wrt. * to logging and terminal flooding a really bad idea. * @see IndexDatabase#update(ExecutorService, IndexChangedListener, List) + (
update ?
"updating " :
"optimizing ")
log.
warning(
"Received interrupt while waiting for executor to finish: " * Send the configuration of the current thread's runtime environment to * @param configHost where to send the configuration. Format: host:port . +
" (is web application server running with opengrok deployed?): "