org.rhq.core.pluginapi.util
Class ProcessExecutionUtility

java.lang.Object
  extended by org.rhq.core.pluginapi.util.ProcessExecutionUtility

public class ProcessExecutionUtility
extends Object


Method Summary
static ProcessExecution createProcessExecution(File file)
          Creates a ProcessExecution for the specified file for the current platform.
static ProcessExecution createProcessExecution(String prefix, File file)
          Creates a ProcessExecution for the specified file for the current platform.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

createProcessExecution

public static ProcessExecution createProcessExecution(File file)
Creates a ProcessExecution for the specified file for the current platform. If the current platform is Windows and the file name ends with ".bat" or ".cmd", the file will be assumed to be a Windows batch file, and the process execution will be initialized accordingly. Note, if the file is a UNIX script, its first line must be a valid #! reference to a script interpreter (e.g. #!/bin/sh), otherwise it will fail to execute. The returned ProcessExecution will have a non-null arguments list, an environment map that is a copy of the current process's environment, and a working directory set to its executable's parent directory.

Parameters:
file - an executable or a batch file
Returns:
a process execution

createProcessExecution

public static ProcessExecution createProcessExecution(String prefix,
                                                      File file)
Creates a ProcessExecution for the specified file for the current platform. If the current platform is Windows and the file name ends with ".bat" or ".cmd", the file will be assumed to be a Windows batch file, and the process execution will be initialized accordingly. Note, if the file is a UNIX script, its first line must be a valid #! reference to a script interpreter (e.g. #!/bin/sh), otherwise it will fail to execute. The returned ProcessExecution will have a non-null arguments list, an environment map that is a copy of the current process's environment, and a working directory set to its executable's parent directory.

Parameters:
prefix - a command prefix applied prior to file execution. Typically a sudo command. Ignored if null.
file - an executable or a batch file
Returns:
a process execution


Copyright © 2008-2009 RHQ Project Advisory Board (Red Hat, Inc.). All Rights Reserved.