RuntimeEnvironment.java revision 65
/*
* 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 class RuntimeEnvironment {
private boolean threadLocalConfig;
private Configuration configuration;
public static RuntimeEnvironment getInstance() {
return instance;
}
/**
* Creates a new instance of RuntimeEnvironment
*/
private RuntimeEnvironment() {
threadLocalConfig = false;
configuration = new Configuration();
}
private Configuration getConfiguration() {
if (threadLocalConfig) {
}
}
return ret;
}
public String getDataRootPath() {
return getConfiguration().getDataRoot();
}
public String getSourceRootPath() {
return getConfiguration().getSourceRoot();
}
public File getDataRootFile() {
}
return ret;
}
public File getSourceRootFile() {
}
return ret;
}
}
}
}
}
public boolean hasProjects() {
}
return getConfiguration().getProjects();
}
}
public void register() {
}
public String getUrlPrefix() {
return getConfiguration().getUrlPrefix();
}
}
return getConfiguration().getCtags();
}
}
public int getHistoryReaderTimeLimit() {
return getConfiguration().getHistoryCacheTime();
}
public void setHistoryReaderTimeLimit(int historyReaderTimeLimit) {
}
public boolean useHistoryCache() {
return getConfiguration().isHistoryCache();
}
public void setUseHistoryCache(boolean useHistoryCache) {
}
public boolean isGenerateHtml() {
return getConfiguration().isGenerateHtml();
}
public void setGenerateHtml(boolean generateHtml) {
}
public void setThreadLocalConfiguration(boolean tls) {
}
return getConfiguration().getRepositories();
}
}
return threadmap;
}
XMLDecoder d = new XMLDecoder(
d.close();
if (obj instanceof Configuration) {
} else {
throw new IOException("Not a valid config file");
}
}
XMLEncoder e = new XMLEncoder(
e.writeObject(getConfiguration());
e.close();
}
e.writeObject(getConfiguration());
e.close();
try {
;
}
}
private Thread configurationListenerThread;
private ServerSocket configServerSocket;
public void stopConfigurationListenerThread() {
try {
} catch (Exception e) {}
}
boolean ret = false;
try {
configServerSocket = new ServerSocket();
ret = true;
threadLocalConfig = true;
public void run() {
try {
System.out.println((new Date()).toString() + " OpenGrok: Got request from " + s.getInetAddress().getHostAddress());
d.close();
if (obj instanceof Configuration) {
}
} catch (IOException e) {
e.printStackTrace();
} finally {
}
}
}
});
t.start();
} catch (UnknownHostException ex) {
} catch (IOException ex) {
}
try {
} catch (IOException ex) {
;
}
}
return ret;
}
}