RuntimeEnvironment.java revision 665
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* See LICENSE.txt included in this distribution for the specific
* language governing permissions and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at LICENSE.txt.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/**
* The RuntimeEnvironment class is used as a placeholder for the current
* configuration this execution context (classloader) is using.
*/
public final class RuntimeEnvironment {
private Configuration configuration;
/**
* Get the one and only instance of the RuntimeEnvironment
* @return the one and only instance of the RuntimeEnvironment
*/
public static RuntimeEnvironment getInstance() {
return instance;
}
/**
* Creates a new instance of RuntimeEnvironment. Private to ensure a
* singleton pattern.
*/
private RuntimeEnvironment() {
configuration = new Configuration();
return configuration;
}
};
}
try {
return s;
}
return file.getCanonicalPath();
} catch (IOException ex) {
return s;
}
}
/**
* Get the path to the where the index database is stored
* @return the path to the index database
*/
public String getDataRootPath() {
}
/**
* Get a file representing the index database
* @return the index database
*/
public File getDataRootFile() {
}
return ret;
}
/**
* 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
*/
public String getSourceRootPath() {
}
/**
* Get a file representing the directory where the sources are located
* @return A file representing the directory where the sources are located
*/
public File getSourceRootFile() {
}
return ret;
}
/**
* Specify the source root
* @param sourceRoot the location of the sources
*/
}
/**
* Do we have projects?
* @return true if we have projects
*/
public boolean hasProjects() {
}
/**
* 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
*/
}
/**
* Register this thread in the thread/configuration map (so that all
* subsequent calls to the RuntimeEnvironment from this thread will use
* the same configuration
*/
public void register() {
}
/**
* Get the context name of the web application
* @return the web applications context name
*/
public String getUrlPrefix() {
}
/**
* 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
*/
}
/**
* Validate that I have a Exuberant ctags program I may use
* @return true if success, false otherwise
*/
public boolean validateExuberantCtags() {
boolean ret = true;
"Please use option -c to specify path to a good Exuberant Ctags program");
ret = false;
}
return ret;
}
/**
* Get the max time a SMC operation may use to avoid beeing cached
* @return the max time
*/
public int getHistoryReaderTimeLimit() {
}
/**
* Specify the maximum time a SCM operation should take before it will
* be cached (in ms)
* @param historyReaderTimeLimit the max time in ms before it is cached
*/
public void setHistoryReaderTimeLimit(int historyReaderTimeLimit) {
}
/**
* Is history cache currently enabled?
* @return true if history cache is enabled
*/
public boolean useHistoryCache() {
}
/**
* Specify if we should use history cache or not
* @param useHistoryCache set false if you do not want to use history cache
*/
public void setUseHistoryCache(boolean useHistoryCache) {
}
/**
* Should we generate HTML or not during the indexing phase
* @return true if HTML should be generated during the indexing phase
*/
public boolean isGenerateHtml() {
}
/**
* Specify if we should generate HTML or not during the indexing phase
* @param generateHtml set this to true to pregenerate HTML
*/
public void setGenerateHtml(boolean generateHtml) {
}
/**
* Set if we should compress the xref files or not
* @param compressXref set to true if the generated html files should be
* compressed
*/
public void setCompressXref(boolean compressXref) {
}
/**
* Are we using copressed HTML files?
* @return true if the html-files should be compressed. false otherwise
*/
public boolean isCompressXref() {
}
public boolean isQuickContextScan() {
}
public void setQuickContextScan(boolean quickContextScan) {
}
}
/**
* 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)
*/
public Project getDefaultProject() {
}
/**
* 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
*/
public int getIndexWordLimit() {
}
/**
* 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
*/
public void setIndexWordLimit(int indexWordLimit) {
}
/**
* Is the verbosity flag turned on?
* @return true if we can print extra information
*/
public boolean isVerbose() {
}
/**
* Set the verbosity flag (to add extra debug information in output)
* @param verbose new value
*/
public void setVerbose(boolean verbose) {
}
/**
* Specify if a search may start with a wildcard. Note that queries
* that start with a wildcard will give a significant impact on the
* search performace.
* @param allowLeadingWildcard set to true to activate (disabled by default)
*/
public void setAllowLeadingWildcard(boolean allowLeadingWildcard) {
}
/**
* Is leading wildcards allowed?
* @return true if a search may start with a wildcard
*/
public boolean isAllowLeadingWildcard() {
}
public IgnoredNames getIgnoredNames() {
}
}
/**
* Returns the user page for the history listing
* @return the URL string fragment preceeding the username
*/
public String getUserPage() {
}
/**
* Sets the user page for the history listing
* @param userPage the URL fragment preceeding the username from history
*/
}
/**
* Returns the bug page for the history listing
* @return the URL string fragment preceeding the bug ID
*/
public String getBugPage() {
}
/**
* 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
*/
public String getBugPattern() {
}
/**
* 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
*/
public String getReviewPage() {
}
/**
* 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
*/
public String getReviewPattern() {
}
/**
* Sets the review(ARC) regex for the history listing
* @param reviewPattern the regex to search history comments
*/
}
public String getWebappLAF() {
}
}
public boolean isRemoteScmSupported() {
}
public void setRemoteScmSupported(boolean supported) {
}
public boolean isOptimizeDatabase() {
}
public void setOptimizeDatabase(boolean optimizeDatabase) {
}
public boolean isUsingLuceneLocking() {
}
public void setUsingLuceneLocking(boolean useLuceneLocking) {
}
public boolean isIndexVersionedFilesOnly() {
}
public void setIndexVersionedFilesOnly(boolean indexVersionedFilesOnly) {
}
/**
* 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
*/
e.close();
try {
}
}
protected void writeConfiguration() throws IOException {
}
this.configuration = configuration;
register();
}
public Configuration getConfiguration() {
return this.threadConfig.get();
}
private ServerSocket configServerSocket;
/**
* Try to stop the configuration listener thread
*/
public void stopConfigurationListenerThread() {
try {
}
/**
* Start a thread to listen on a socket to receive new configurations
* to use.
* @param endpoint The socket address to listen on
* @return true if the endpoint was available (and the thread was started)
*/
boolean ret = false;
try {
configServerSocket = new ServerSocket();
ret = true;
public void run() {
try {
d.close();
if (obj instanceof Configuration) {
}
} catch (IOException e) {
} finally {
if (s != null) {
try {
s.close();
} catch (IOException ex) {
}
}
}
}
}
});
t.start();
} catch (UnknownHostException ex) {
} catch (IOException ex) {
}
try {
} catch (IOException ex) {
}
}
return ret;
}
}