com.sun.faban.harness.tools
Class ToolWrapper

java.lang.Object
  extended by com.sun.faban.harness.tools.ToolWrapper

public class ToolWrapper
extends Object

This class is a wrapper for tool.

Author:
Sheetal Patil

Field Summary
protected  Timer timer
          The timer used for scheduling the tools.
 
Constructor Summary
ToolWrapper(Class toolClass, MasterToolContext ctx)
          Constructor.
 
Method Summary
 void configure(String toolName, String path, String outDir, String host, CmdAgentImpl cmdAgent, CountDownLatch latch)
          This method is responsible for configuring a tool.
protected  void finish()
          Finishes up the tool and notifies the infrastructure of the tool finishing up.
 void kill()
          This method is responsible for killing the tool utility.
 void postprocess()
          This method is responsible for post-processing.
 boolean start(int delay)
          This method is responsible for starting a tool with given delay.
 boolean start(int delay, int duration)
          This method is responsible for starting a tool with given delay and duration.
 void stop()
          This method is responsible for stopping the tool utility.
protected  void stop(boolean warn)
          This method is responsible for stopping the tool utility.
protected  void xferLog()
          Transfers the tool output file 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
The timer used for scheduling the tools.

Constructor Detail

ToolWrapper

public ToolWrapper(Class toolClass,
                   MasterToolContext ctx)
            throws Exception
Constructor.

Parameters:
toolClass - The tool class
ctx - The master tool context
Throws:
Exception - Error creating the tool
Method Detail

postprocess

public void postprocess()
                 throws Exception
This method is responsible for post-processing.

Throws:
Exception - Any exception thrown by the wrapped method

configure

public void configure(String toolName,
                      String path,
                      String outDir,
                      String host,
                      CmdAgentImpl cmdAgent,
                      CountDownLatch latch)
               throws Exception
This method is responsible for configuring a tool.

Parameters:
toolName - The name of the tool.
path - The path to start the command
outDir - The tool output directory
host - The host the tool should run
cmdAgent - The local command agent
latch - The latch used for identifying tool completion
Throws:
Exception - If there is any error

start

public boolean start(int delay)
This method is responsible for starting a tool with given delay.

Parameters:
delay - The lapse time after which the tool will start
Returns:
always return true

start

public boolean start(int delay,
                     int duration)
This method is responsible for starting a tool with given delay and duration.

Parameters:
delay - The lapse time after which the tool will start
duration - The duration the tool is to run
Returns:
always return true

stop

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

Throws:
Exception - Any exception thrown by the wrapped method

stop

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

Parameters:
warn - Whether to warn if the tool already ended.
Throws:
Exception - Any exception thrown by the wrapped method

xferLog

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


finish

protected void finish()
Finishes up the tool and notifies the infrastructure of the tool finishing up.


kill

public void kill()
          throws Exception
This method is responsible for killing the tool utility.

Throws:
Exception - Any exception thrown by the wrapped method