com.esf.util.proc.service
Interface IProcessUtilityService


public interface IProcessUtilityService

Provides utilities for dealing with starting and stopping system processes.


Field Summary
static java.lang.String SERVICE_NAME
          service name of this interface for the bundle activator (com.esf.util.proc.service)
 
Method Summary
 int getPid(java.lang.String command)
          gets the PID of a process running in the process list
 boolean kill(int pid)
          kills a process running in the process list based on its PID
 boolean killAll(java.lang.String command)
          kills all processes with the name specified by the String command
 int start(java.lang.String command)
          starts a process using the Runtime and Process classes
 ProcessStats startWithStats(java.lang.String command)
          starts a process using the Runtime and Process classes and returns a ProcessStats object that contains the return code, and input/output streams.
 

Field Detail

SERVICE_NAME

static final java.lang.String SERVICE_NAME
service name of this interface for the bundle activator (com.esf.util.proc.service)

Method Detail

start

int start(java.lang.String command)
          throws java.lang.Exception
starts a process using the Runtime and Process classes

Parameters:
command - the command to execute
Returns:
the return code of the process that is executed
Throws:
java.lang.Exception - if the execution fails

startWithStats

ProcessStats startWithStats(java.lang.String command)
                            throws java.lang.Exception
starts a process using the Runtime and Process classes and returns a ProcessStats object that contains the return code, and input/output streams.

Parameters:
command - the command to execute
Returns:
a ProcessStats object.
Throws:
java.lang.Exception - if the execution fails

getPid

int getPid(java.lang.String command)
           throws java.lang.Exception
gets the PID of a process running in the process list

Parameters:
command - the command to get the PID of
Returns:
the PID of the first instance of the command, -1 if the PID is not found
Throws:
java.lang.Exception - if the pid search fails

kill

boolean kill(int pid)
kills a process running in the process list based on its PID

Parameters:
pid - the PID of the process to kill
Returns:
true if the kill succeeded, otherwise false

killAll

boolean killAll(java.lang.String command)
kills all processes with the name specified by the String command

Parameters:
command - the command to kill from the process list
Returns:
true if the command is successfully killed, otherwise false