com.friendshipsystems.fsshresourcemanager
Class FJobCancelerWin

java.lang.Object
  extended by com.friendshipsystems.fsshresourcemanager.FJobCancelerWin
All Implemented Interfaces:
FIJobCanceler

public class FJobCancelerWin
extends java.lang.Object
implements FIJobCanceler

The concrete FJobCanceler implementation to cancel processes on a Windows host. Since wmic is used this only works for Windows versions XP Pro and up

Author:
FRIENDSHIP SYSTEMS

Constructor Summary
FJobCancelerWin()
           
 
Method Summary
 boolean confirmKill(java.lang.String response)
          After a kill command was issued FIJobCanceler.confirmKill(String) tries to find out whether the remote process was successfully killed.
 java.lang.String getConfirmKillCommand(int pid)
          Method that returns command to issue to find out whether killing of a process succeeded.
 java.lang.String getKillCommand(int pid)
          Method to determine the command to send to the remote host in order to kill the process with the previously determined PID.
 java.lang.String getPIDCommand(java.lang.String exe, java.lang.String user)
          Method that returns the command to issue in order to determine a program's PID.
 int getPIDFromResponse(java.lang.String response)
          Method that parses the remote hosts's response to the PID request
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FJobCancelerWin

public FJobCancelerWin()
Method Detail

getPIDCommand

public java.lang.String getPIDCommand(java.lang.String exe,
                                      java.lang.String user)
Description copied from interface: FIJobCanceler
Method that returns the command to issue in order to determine a program's PID.

Specified by:
getPIDCommand in interface FIJobCanceler
Parameters:
exe - The program to determine the PID for
user - The user that submitted the program
Returns:
The command to issue

getKillCommand

public java.lang.String getKillCommand(int pid)
Description copied from interface: FIJobCanceler
Method to determine the command to send to the remote host in order to kill the process with the previously determined PID.

Specified by:
getKillCommand in interface FIJobCanceler
Parameters:
pid - The process id of the process to kill
Returns:
the command to be issued on the remote machine in order to kill the remote process

getConfirmKillCommand

public java.lang.String getConfirmKillCommand(int pid)
Description copied from interface: FIJobCanceler
Method that returns command to issue to find out whether killing of a process succeeded.

Specified by:
getConfirmKillCommand in interface FIJobCanceler
Parameters:
pid - The process id of the process that should be searched
Returns:
The command

confirmKill

public boolean confirmKill(java.lang.String response)
Description copied from interface: FIJobCanceler
After a kill command was issued FIJobCanceler.confirmKill(String) tries to find out whether the remote process was successfully killed. This method is used to parse the answer received after the command returned from FIJobCanceler.getConfirmKillCommand(int) was executed on the remote host.

Specified by:
confirmKill in interface FIJobCanceler
Parameters:
response - The response received from the remote host after FIJobCanceler.getConfirmKillCommand(int) was executed.
Returns:
true if the response confirms the command to be succesful, false otherwise

getPIDFromResponse

public int getPIDFromResponse(java.lang.String response)
Description copied from interface: FIJobCanceler
Method that parses the remote hosts's response to the PID request

Specified by:
getPIDFromResponse in interface FIJobCanceler
Parameters:
response - The response read after issuing the command returned from FIJobCanceler.getPIDCommand(String, String).
Returns:
The PID, 0 if not successful