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