public BasicServerInfo(String defaultBaseDirectory,
boolean useSystemProperties) throws Exception {
// Before we try the persistent value, we always check the
// system properties first. This lets an admin override this
// on the command line.
this.baseDirectory = useSystemProperties? System.getProperty(HOME_DIR_SYS_PROP, defaultBaseDirectory): defaultBaseDirectory;
// force load of server constants
ServerConstants.getVersion();
if (baseDirectory == null || baseDirectory.length() == 0) {
base = DirectoryUtils.getGeronimoInstallDirectory();
if (base == null) {
throw new IllegalArgumentException("Could not determine geronimo installation directory");
}
} else {
base = new File(baseDirectory);
}
if (!base.isDirectory()) {
throw new IllegalArgumentException("Base directory is not a directory: " + baseDirectory);
}
baseURI = base.toURI();
baseServer = deriveBaseServer(useSystemProperties);
baseServerURI = baseServer.toURI();
if (useSystemProperties) {
System.setProperty(HOME_DIR_SYS_PROP, base.getAbsolutePath());
System.setProperty(SERVER_DIR_SYS_PROP, baseServer.getAbsolutePath());
}
String tmpDir = resolveServerPath(System.getProperty("java.io.tmpdir"));
System.setProperty("java.io.tmpdir", tmpDir);
}
|