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