RuntimeEnvironment.java revision 1467
70N/A * CDDL HEADER START 70N/A * The contents of this file are subject to the terms of the 851N/A * Common Development and Distribution License (the "License"). 851N/A * You may not use this file except in compliance with the License. 70N/A * language governing permissions and limitations under the License. 70N/A * When distributing Covered Code, include this CDDL HEADER in each 70N/A * If applicable, add the following below this CDDL HEADER, with the 70N/A * fields enclosed by brackets "[]" replaced with your own identifying 70N/A * information: Portions Copyright [yyyy] [name of copyright owner] 70N/A * Copyright (c) 2006, 2012, Oracle and/or its affiliates. All rights reserved. * The RuntimeEnvironment class is used as a placeholder for the current * configuration this execution context (classloader) is using. * Get the one and only instance of the RuntimeEnvironment * @return the one and only instance of the RuntimeEnvironment * Creates a new instance of RuntimeEnvironment. Private to ensure a * Makes testing easier by being able to drop the current env and replace it * Check, whether the running JVM is older than version 1.7 . * @return {@code true} if older than 1.7 public static final boolean isOldJVM() {
log.
warning(
"Failed to get canonical path for '" + s +
"': " * @see Configuration#getScanningDepth() * @return the current scan depth * @see Configuration#setScanningDepth(int) * @param scanningDepth the scan depth to use. * Get the path to the where the index database is stored * @return the path to the index database * Get a file representing the index database * @return the index database * Set the path to where the index database is stored * @param dataRoot the index database * Get the path to where the sources are located * @return path to where the sources are located * Get a file representing the directory where the sources are located * @return A file representing the directory where the sources are located * Specify the source root * @param sourceRoot the location of the sources * Returns a path relative to source root. This would just be a simple * substring operation, except we need to support symlinks outside the * @param file A file to resolve * @param stripCount Number of characters past source root to strip * @throws IOException If an IO error occurs * @throws FileNotFoundException If the file is not relative to source root * @return Path relative to source root +
"' relative to source root '" +
sourceRoot +
"'");
* @return true if we have projects * Get all of the projects * @return a list containing all of the projects (may be null) * Set the list of the projects * @param projects the list of projects to use * subsequent calls to the RuntimeEnvironment from this thread will use * Get the context name of the web application. * @return the web applications context name. * Set the web context name * @param urlPrefix the web applications context name * Get the name of the ctags program in use * @return the name of the ctags program in use * Specify the CTags program to use * @param ctags the ctags program to use * Get the number of search result pages, which should be cached in * @return the number of result pages to cache. * Set the number of search result pages, which should be cached in * @param cachePages the number of result pages to cache. * Get the number of hits to display on one search result page. * @return number of hits per page. * Set the number of hits to display on one search result page. * @param hitsPerPage number of hits per page to set. * Validate that I have a Exuberant ctags program I may use * @return true if success, false otherwise log.
warning(
"No Exuberant Ctags found in PATH!\n" +
"(tried running '" +
getCtags() +
"')\n" +
"Please use option -c to specify path to a good Exuberant Ctags program\n"+
"Or set it in java system property " * Get the max time a SMC operation may use to avoid beeing cached * Specify the maximum time a SCM operation should take before it will * @param historyReaderTimeLimit the max time in ms before it is cached * Is history cache currently enabled? * @return true if history cache is enabled * Specify if we should use history cache or not * @param useHistoryCache set false if you do not want to use history cache * Should the history cache be stored in a database instead of in XML * @return {@code true} if the cache should be stored in a database * Set whether the history cache should be stored in a database. * @param store {@code true} if the cache should be stored in a database * Should we generate HTML or not during the indexing phase * @return true if HTML should be generated during the indexing phase * Specify if we should generate HTML or not during the indexing phase * @param generateHtml set this to true to pregenerate HTML * Set if we should compress the xref files or not. Applies to newly * application automatically detects, whether an xref file is compressed * and processes it properly. * @param compressXref set to {@code true} if generated xref html files * Set if we should compress generated xref html files? * @return {@code true} if the xref html files should be compressed. * Check whether a quick context scan should be done. * @return {@code true} if quick scan should be made. * @see #setQuickContextScan(boolean) * If set to {@code true}, at most 1 MiB of a file gets read into a buffer * at once and than tokenized. Otherwise the whole file gets processed as * usual, i.e. the file content gets read on demand when tokenizing and the * whole file gets processed (no matter of its size). * @param quickContextScan if {@code true} enable quick scanning * Get the map of known repositories. * @return a possible empty list including {@code null}. * Set the map of external SCM repositories * @param repositories the repositories to use * Set the project that is specified to be the default project to use. The * default project is the project you will search (from the web application) * if the page request didn't contain the cookie. * @param defaultProject The default project to use * Get the project that is specified to be the default project to use. The * default project is the project you will search (from the web application) * if the page request didn't contain the cookie.. * @return the default project (may be null if not specified) * Chandan wrote the following answer on the opengrok-discuss list: * "Traditionally search engines (specially spiders) think that large files * are junk. Large files tend to be multimedia files etc., which text * search spiders do not want to chew. So they ignore the contents of * the file after a cutoff length. Lucene does this by number of words, * which is by default is 10,000." * By default OpenGrok will increase this limit to 60000, but it may be * overridden in the configuration file * @return The maximum words to index * Set the number of words in a file Lucene will index. * See getIndexWordLimit for a better description. * @param indexWordLimit the number of words to index in a single file * Is the verbosity flag turned on? * @return true if we can print extra information * Set the verbosity flag (to add extra debug information in output) * @param verbose new value * Is the progress print flag turned on? * @return {@code true} if we can print per project progress % * Set the printing of progress % flag (user convenience). * @param enable {@code true} to enable progress printing. * Specify if a search may start with a wildcard. Note that queries * that start with a wildcard will give a significant impact on the * @param allowLeadingWildcard set to true to activate (disabled by default) * Is leading wildcards allowed? * @return true if a search may start with a wildcard * Get the list of names/patterns to determine file, which should be * Takes precedence over {@link #getIncludedNames()}. * @return stuff to ignore, which might be {@code null}. * Set the list of names/patterns to determine file, which should be * Takes precedence over {@link #getIncludedNames()}. * @param ignoredNames stuff to ignore. * Get the list of names/patterns to determine, which are allowed to * @return stuff to index. {@code null} means everything. * @see #getIgnoredNames() * Set the list of names/patterns to determine, which are allowed to * @param includedNames stuff to index. {@code null} means everything. * @see #setIgnoredNames(IgnoredNames) * Returns the user page for the history listing * @return the URL string fragment preceeding the username * Get the client command to use to access the repository for the given * fully quallified classname. * @param clazzName name of the targeting class * @return {@code null} if not yet set, the client command otherwise. * Set the client command to use to access the repository for the given * fully quallified classname. * @param clazzName name of the targeting class. If {@code null} this method * @param cmd the client command to use. If {@code null} the corresponding * entry for the given clazzName get removed. * @return the client command previously set, which might be {@code null}. * Sets the user page for the history listing * @param userPage the URL fragment preceeding the username from history * Returns the user page suffix for the history listing * @return the URL string fragment following the username * Sets the user page suffix for the history listing * @param userPageSuffix the URL fragment following the username from history * Returns the bug page for the history listing * @return the URL string fragment preceeding the bug ID * Sets the bug page for the history listing * @param bugPage the URL fragment preceeding the bug ID * Returns the bug regex for the history listing * @return the regex that is looked for in history comments * Sets the bug regex for the history listing * @param bugPattern the regex to search history comments * Returns the review(ARC) page for the history listing * @return the URL string fragment preceeding the review page ID * Sets the review(ARC) page for the history listing * @param reviewPage the URL fragment preceeding the review page ID * Returns the review(ARC) regex for the history listing * @return the regex that is looked for in history comments * Sets the review(ARC) regex for the history listing * @param reviewPattern the regex to search history comments * Get the name of the web app Look And Feel (LAF) theme to use. It gets * used to construct the stylesheet and image include links in web pages * and names a directory, which contains all this stuff. * @return the name of the web app LAF * Set the name of the web app Look And Feel (LAF) theme to use. It gets * used to construct the stylesheet and image include links in web pages * and names a directory, which contains all this stuff. * @param laf the name of the web app LAF * Check whether file histories should be retrieved from the related remote * repositories when needed. * @return {@code true} if fetch on demand is enabled. * Set whether file histories should be retrieved from the related remote * repositories when needed. * @param supported {@code true} if fetch on demand is enabled. * Check, whether the lucene index database should be optimized (compact * segments etc.) after indexing has been run. * @return {@code true} if optimization is enabled. * Set, whether the lucene index database should be optimized (compact * segments etc.) after indexing has been run. * @param optimizeDatabase {@code true} if optimization should be done. * Check, wheter lucene should lock index files when indexing to avoid * concurrent access, reading invalid data. * @return {@code true} if locking should be used. * Set wheter lucene should lock index files when indexing to avoid * concurrent access, reading invalid data. * @param useLuceneLocking {@code true} if locking should be used. * Check, whether unversioned files should not be indexed. * If {@code true}, it takes precedence over {@link #getIncludedNames()}, * i.e. files are not indexed when unversioned, even if they match an * @return {@code true} if indexing of unversioned files is disabled. * Set, whether unversioned files should not be indexed. * If set to {@code true}, it takes precedence over {@link #getIncludedNames()}, * i.e. files are not indexed when unversioned, even if they match an * @param indexVersionedFilesOnly {@code true} to disable indexing of * Get the date of the last index update. * @return the time of the last index update. * Get the fully quallified class name of the history database driver to use. * @return the database driver class name. * Set the fully quallified class name of the history database driver to use. * @param databaseDriver the database driver class name to set. * Get the JDBC connection URL to use to connect to the history database. * @return the JDBC connection URL to use. * Set the JDBC connection URL to use to connect to the history database. * @param databaseUrl the JDBC connection URL to set. * Get the optional file to be used to handover additional options to the * @return {@code null} if not set, the options filename otherwise. * Set the file to be used to handover additional options to the ctags * @param filename the options filename to use. Might be {@code null}. * Get the pathnames of symlinks, which are allowed to be processed (e.g. * indexed, tokenized, etc.). * @return a possible empty set. * Set the pathnames of symlinks, which are allowed to be processed (e.g. * indexed, tokenized, etc.). * @param allowedSymlinks symlinks to allow. {@code null} means none. * Check whether e-mail addresses should be obfuscated in the xref. * @return {@code true} if obfuscation is needed. * Set whether e-mail addresses should be obfuscated in the xref. * @param obfuscate {@code true} if obfuscation is needed. * Should status.jsp print internal settings, like paths and database * @return {@code true} if status.jsp should show the configuration. * Set whether status.jsp should print internal settings. * @param chatty {@code true} if internal settings should be printed. * Read an configuration file and set it as the current configuration. * @param file the file to read * @throws IOException if an error occurs * Write the current configuration to a file * @param file the file to write the configuration into * @throws IOException if an error occurs * Write the current configuration to a socket * @param host the host address to receive the configuration * @param port the port to use on the host * @throws IOException if an error occurs * Send the current configuration to the web application [server]. * Set the current configuration for this instance to the given parameter. * Involves invalidating known repositories of the {@link HistoryGuru}. * @param configuration configuration to set. * Get the current configuration for this instance. * @return the current configuration. * Try to stop the configuration listener thread * Start a thread to listen on a socket to receive new configurations * @param endpoint The socket address to listen on * @return true if the endpoint was available (and the thread was started) log.
info(
"Re-configure request from " +
byte[]
buf =
new byte[
1024];