protected File getHomeDir(ProcessInfo processInfo, JavaCommandLine javaCommandLine) { String home = javaCommandLine.getSystemProperties().get(HOME_DIR_SYSPROP); File homeDir = new File(home); if (!homeDir.isAbsolute()) { if (processInfo.priorSnaphot().getExecutable() == null) { throw new RuntimeException(HOME_DIR_SYSPROP + " for AS7 process " + processInfo + " is a relative path, and the RHQ Agent process does not have permission to resolve it."); } String cwd = processInfo.priorSnaphot().getExecutable().getCwd(); homeDir = new File(cwd, home); } return new File(FileUtils.getCanonicalPath(homeDir.getPath())); }
protected File getBaseDir(ProcessInfo process, JavaCommandLine javaCommandLine, File homeDir) { String baseDirString = javaCommandLine.getSystemProperties().get(getBaseDirSystemPropertyName()); File baseDir; if (baseDirString != null) { baseDir = new File(baseDirString); if (!baseDir.isAbsolute()) { if (process.priorSnaphot().getExecutable() == null) { baseDir = new File(homeDir, baseDirString); if (!baseDir.exists()) { throw new RuntimeException(getBaseDirSystemPropertyName() + " for AS7 process " + process + " is a relative path, and the RHQ Agent process does not have permission to resolve it."); } } else { String cwd = process.priorSnaphot().getExecutable().getCwd(); baseDir = new File(cwd, baseDirString); if (!baseDir.exists()) { baseDir = new File(homeDir, baseDirString); } } } baseDir = new File(FileUtils.getCanonicalPath(baseDir.getPath())); } else { baseDir = new File(homeDir, getDefaultBaseDirName()); } return baseDir; }
protected File getLogDir(ProcessInfo process, AS7CommandLine commandLine, File baseDir) { String logDirString = commandLine.getSystemProperties().get(getLogDirSystemPropertyName()); File logDir; if (logDirString != null) { logDir = new File(logDirString); if (!logDir.isAbsolute()) { if (process.priorSnaphot().getExecutable() == null) { throw new RuntimeException(getLogDirSystemPropertyName() + " for AS7 process " + process + " is a relative path, and the RHQ Agent process does not have permission to resolve it."); } String cwd = process.priorSnaphot().getExecutable().getCwd(); logDir = new File(cwd, logDirString); } logDir = new File(FileUtils.getCanonicalPath(logDir.getPath())); } else { logDir = new File(baseDir, getDefaultLogDirName()); } return logDir; }
protected File getConfigDir(ProcessInfo process, JavaCommandLine javaCommandLine, File baseDir) { String configDirString = javaCommandLine.getSystemProperties().get(getConfigDirSystemPropertyName()); File configDir; if (configDirString != null) { configDir = new File(configDirString); if (!configDir.isAbsolute()) { if (process.priorSnaphot().getExecutable() == null) { throw new RuntimeException(getConfigDirSystemPropertyName() + " for AS7 process " + process + " is a relative path, and the RHQ Agent process does not have permission to resolve it."); } String cwd = process.priorSnaphot().getExecutable().getCwd(); configDir = new File(cwd, configDirString); } configDir = new File(FileUtils.getCanonicalPath(configDir.getPath())); } else { configDir = new File(baseDir, getDefaultConfigDirName()); } return configDir; }
/** * @deprecated as of 4.6. For similar purpose, call {@link #priorSnaphot()} and then corresponding method * from the returned {@link ProcessInfoSnapshot}. */ @Deprecated public ProcExe getExecutable() throws SystemInfoException { return priorSnaphot().getExecutable(); }
/** * @deprecated as of 4.6. For similar purpose, call {@link #priorSnaphot()} and then corresponding method * from the returned {@link ProcessInfoSnapshot}. */ @Deprecated public ProcExe getExecutable() throws SystemInfoException { return priorSnaphot().getExecutable(); }