com.sun.faban.harness.tools
Class GenericTool

java.lang.Object
  extended by com.sun.faban.harness.tools.GenericTool
All Implemented Interfaces:
Tool
Direct Known Subclasses:
Lockstat, Statit

Deprecated. The GenericTool has been replaced by the CommandLineTool.

@Deprecated
public class GenericTool
extends Object
implements Tool

GenericTool is an abstract class that all tools should extend. It provides the basic functionality for most tools. The tools modelled in GenericTool are the common system tools like vmstat, mpstat etc where the user arguments are directly passed to the tool and the tool is stopped by simply killing the corresponding process. When tools differ in functionality (for example statit), they should override the abstract class methods, configure, start, stop kill. Note that they can still use the abstract class methods to transfer the stdout, stderr from the tool to the master machine (not to mention cut and paste a large chunk of the remaining code).

Author:
Ramesh Ramachandran
See Also:
Tool

Field Summary
protected  Timer timer
          Deprecated. The timer used for scheduling the start of the tool.
 
Constructor Summary
GenericTool()
          Deprecated. Constructs the GenericTool.
 
Method Summary
protected  void buildCmd(List<String> argList)
          Deprecated. Builds the command from the path, tool name, and argument list.
 void configure(String tool, List<String> argList, String path, String outDir, String host, String masterhost, CmdAgentImpl cmdAgent, CountDownLatch latch)
          Deprecated. This is the method that should get the arguments to call the tool with.
protected  void finish()
          Deprecated. Finish up the tool.
 void kill()
          Deprecated. This method is required by the Tool API.
protected  void start()
          Deprecated. Starts the tool.
 boolean start(int delay)
          Deprecated. This method is responsible for starting up the tool utility.
 boolean start(int delay, int duration)
          Deprecated. This method is responsible for starting up the tool and stopping it after the duration specified.
 void stop()
          Deprecated. This method is responsible for stopping the tool utility.
protected  void stop(boolean warn)
          Deprecated. This method is responsible for stopping the tool utility.
protected  void xferLog()
          Deprecated. Transfers the tool output back to the master.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

timer

protected Timer timer
Deprecated. 
The timer used for scheduling the start of the tool.

Constructor Detail

GenericTool

public GenericTool()
Deprecated. 
Constructs the GenericTool.

Method Detail

configure

public void configure(String tool,
                      List<String> argList,
                      String path,
                      String outDir,
                      String host,
                      String masterhost,
                      CmdAgentImpl cmdAgent,
                      CountDownLatch latch)
Deprecated. 
This is the method that should get the arguments to call the tool with.

Specified by:
configure in interface Tool
Parameters:
tool - The tool to start
argList - The tool arguments
path - The path, if any, to find the tool
outDir - The output directory
host - The host to run the tool
masterhost - The Faban master
cmdAgent - The command agent for running commands
latch - Latch set when tool is done

buildCmd

protected void buildCmd(List<String> argList)
Deprecated. 
Builds the command from the path, tool name, and argument list.

Parameters:
argList - The argument list

kill

public void kill()
Deprecated. 
This method is required by the Tool API. It is called to abort the currently running tool if any.

Specified by:
kill in interface Tool

start

public boolean start(int delay,
                     int duration)
Deprecated. 
This method is responsible for starting up the tool and stopping it after the duration specified. It uses a thread to sleep for the delay + duration and then calls the stop().

Specified by:
start in interface Tool
Parameters:
delay - int delay (sec) after which start should be called
duration - int duration for which the tool needs to be run
Returns:
true if the tool is scheduled successfully

start

public boolean start(int delay)
Deprecated. 
This method is responsible for starting up the tool utility.

Specified by:
start in interface Tool
Parameters:
delay - int delay (sec) after which start should be called
Returns:
true if the tool is scheduled successfully

start

protected void start()
Deprecated. 
Starts the tool.


stop

public void stop()
Deprecated. 
This method is responsible for stopping the tool utility.

Specified by:
stop in interface Tool

stop

protected void stop(boolean warn)
Deprecated. 
This method is responsible for stopping the tool utility.

Parameters:
warn - Whether to warn if the tool already ended.

xferLog

protected void xferLog()
Deprecated. 
Transfers the tool output back to the master.


finish

protected void finish()
Deprecated. 
Finish up the tool.