Methods Summary |
---|
private static java.lang.String | getCatalinaBase()Get the value of the catalina.base environment variable.
return System.getProperty("catalina.base", getCatalinaHome());
|
private static java.lang.String | getCatalinaHome()Get the value of the catalina.home environment variable.
return System.getProperty("catalina.home",
System.getProperty("user.dir"));
|
private static java.lang.String | getConfigUrl()Get the value of the configuration URL.
return System.getProperty("catalina.config");
|
public static java.lang.String | getProperty(java.lang.String name)Return specified property value.
loadProperties();
return properties.getProperty(name);
|
public static java.lang.String | getProperty(java.lang.String name, java.lang.String defaultValue)Return specified property value.
return properties.getProperty(name, defaultValue);
|
private static void | loadProperties()Load properties.
InputStream is = null;
Throwable error = null;
try {
String configUrl = getConfigUrl();
if (configUrl != null) {
is = (new URL(configUrl)).openStream();
}
} catch (Throwable t) {
// Ignore
}
if (is == null) {
try {
File home = new File(getCatalinaBase());
File conf = new File(home, "conf");
File properties = new File(conf, "catalina.properties");
is = new FileInputStream(properties);
} catch (Throwable t) {
// Ignore
}
}
if (is == null) {
try {
is = CatalinaProperties.class.getResourceAsStream
("/org/apache/catalina/startup/catalina.properties");
} catch (Throwable t) {
// Ignore
}
}
if (is != null) {
try {
properties = new Properties();
properties.load(is);
is.close();
} catch (Throwable t) {
error = t;
}
}
if ((is == null) || (error != null)) {
// Do something
log.warn("Failed to load catalina.properties", error);
// That's fine - we have reasonable defaults.
properties=new Properties();
}
// Register the properties as system properties
Enumeration enumeration = properties.propertyNames();
while (enumeration.hasMoreElements()) {
String name = (String) enumeration.nextElement();
String value = properties.getProperty(name);
if (value != null) {
System.setProperty(name, value);
}
}
|