com.esf.util.proc
Class Process

java.lang.Object
  extended bycom.esf.util.proc.Process
All Implemented Interfaces:
IProcessUtilityService

public class Process
extends java.lang.Object
implements IProcessUtilityService


Field Summary
 
Fields inherited from interface com.esf.util.proc.service.IProcessUtilityService
SERVICE_NAME
 
Constructor Summary
Process()
           
 
Method Summary
 void bind(IEsfLoggerService logger, IBootstrapService bootstrap)
           
 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
 void unbind()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Process

public Process()
Method Detail

bind

public void bind(IEsfLoggerService logger,
                 IBootstrapService bootstrap)

unbind

public void unbind()

start

public int start(java.lang.String command)
          throws java.lang.Exception
Description copied from interface: IProcessUtilityService
starts a process using the Runtime and Process classes

Specified by:
start in interface IProcessUtilityService
Parameters:
command - the command to execute
Returns:
the return code of the process that is executed
Throws:
java.lang.Exception - if the execution fails

getPid

public int getPid(java.lang.String command)
           throws java.lang.Exception
Description copied from interface: IProcessUtilityService
gets the PID of a process running in the process list

Specified by:
getPid in interface IProcessUtilityService
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

public boolean kill(int pid)
Description copied from interface: IProcessUtilityService
kills a process running in the process list based on its PID

Specified by:
kill in interface IProcessUtilityService
Parameters:
pid - the PID of the process to kill
Returns:
true if the kill succeeded, otherwise false

killAll

public boolean killAll(java.lang.String command)
Description copied from interface: IProcessUtilityService
kills all processes with the name specified by the String command

Specified by:
killAll in interface IProcessUtilityService
Parameters:
command - the command to kill from the process list
Returns:
true if the command is successfully killed, otherwise false


Copyright © 2009 Eurotech Inc. All rights reserved.