IBM Rational Performance Tester SDK

com.ibm.rational.test.lt.recorder.core.clients
Class ProcessBuilderClientDelegate

java.lang.Object
  extended by com.ibm.rational.test.lt.recorder.core.extensibility.BaseClientDelegate
      extended by com.ibm.rational.test.lt.recorder.core.clients.AbstractExecutableClientDelegate
          extended by com.ibm.rational.test.lt.recorder.core.clients.ProcessBuilderClientDelegate
All Implemented Interfaces:
IClientDelegate, IRecordingComponentDelegate

public abstract class ProcessBuilderClientDelegate
extends AbstractExecutableClientDelegate

An implementation of AbstractExecutableClientDelegate, using a Java ProcessBuilder to launch the executable. This class must be sub-classed to initialize the required properties in ProcessBuilderClientDelegate.initialize(IClientContext). A concrete implementation of this client is accessible using the client ID com.ibm.rational.test.lt.recorder.core.application.


Field Summary
 
Fields inherited from class com.ibm.rational.test.lt.recorder.core.clients.AbstractExecutableClientDelegate
ARGUMENTS_PROPERTY, CONSOLE_ERR_PROPERTY, CONSOLE_IN_PROPERTY, CONSOLE_OUT_PROPERTY, ENVIRONMENT_PROPERTY, PROGRAM_PATH_PROPERTY, WAIT_FOR_PROCESS_TREE_TERMINATION_PROPERTY, WORKKING_DIRECTORY_PROPERTY
 
Constructor Summary
ProcessBuilderClientDelegate()
           
 
Method Summary
protected static String compactCommand(List<String> command)
           
protected static String compactEnvironment(Map<String,String> env)
           
protected static List<String> explodeCommand(String command)
           
protected static Map<String,String> explodeEnvironment(String env)
           
protected  List<String> getArguments()
           
protected  Map<String,String> getEnvironment()
           
protected  File getProgramPath()
           
protected  File getWorkingDirectory()
           
 void initialize(IClientContext context)
          This method should be overloaded by implementations to set (at least) the program path property (ProcessBuilderClientDelegate.setProgramPath(File)), and optionally the working directory (ProcessBuilderClientDelegate.setWorkingDirectory(File) and the environment (ProcessBuilderClientDelegate.setEnvironment(Map)).
protected  boolean isShowErrConsole()
           
protected  boolean isShowInConsole()
           
protected  boolean isShowOutConsole()
           
protected  boolean isWaitForProcessTreeTermination()
           
 void kill()
          Asks the client delegate to stop the client immediately and lose data if necessary.
protected  void processAboutToStart()
          Override this method to perform actions just before the process starts
protected  void processTerminated(boolean failed)
          Override this method to perform actions when the process terminates.
protected  void setArguments(List<String> args)
           
protected  void setArguments(String compactArguments)
           
protected  void setEnvironment(Map<String,String> environment)
           
protected  void setEnvironment(String environment)
           
protected  void setProgramPath(File path)
           
protected  void setProgramPath(String path)
           
protected  void setShowErrConsole(boolean show)
           
protected  void setShowInConsole(boolean show)
           
protected  void setShowOutConsole(boolean show)
           
protected  void setWaitForProcessTreeTermination(boolean wait)
           
protected  void setWorkingDirectory(File dir)
           
protected  void setWorkingDirectory(String dir)
           
 void start()
          Asks the client delegate to start the client.
 void stop()
          Asks the client delegate to stop the client.
 
Methods inherited from class com.ibm.rational.test.lt.recorder.core.clients.AbstractExecutableClientDelegate
getProperty, setProperty
 
Methods inherited from class com.ibm.rational.test.lt.recorder.core.extensibility.BaseClientDelegate
getContext, messageReceived, postStop, preStart, sendStarted, sendStopped, sendUserMessage
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ProcessBuilderClientDelegate

public ProcessBuilderClientDelegate()
Method Detail

initialize

public void initialize(IClientContext context)
                throws DelegateInitializeException
This method should be overloaded by implementations to set (at least) the program path property (ProcessBuilderClientDelegate.setProgramPath(File)), and optionally the working directory (ProcessBuilderClientDelegate.setWorkingDirectory(File) and the environment (ProcessBuilderClientDelegate.setEnvironment(Map)). Implementations should call the super implementation first.

Specified by:
initialize in interface IClientDelegate
Overrides:
initialize in class BaseClientDelegate
Parameters:
context - The client context, that provides the client configuration that this instance should conform to, and a mechanism for the delegate to send events to other involved components.
Throws:
CoreException
DelegateInitializeException - If the delegate cannot be initialized or will not be able to run properly.

start

public final void start()
Description copied from interface: IClientDelegate
Asks the client delegate to start the client. No other command can occur before this command. This command can be issued only once. This method should return without waiting for the start process to be completed. The delegate is required to notify its context when the start is complete by invoking IClientContext.clientStarted().


stop

public final void stop()
Description copied from interface: IClientDelegate
Asks the client delegate to stop the client. This command can occur only once, and only after IClientDelegate.start() has been invoked. This method should return without waiting for the stop process to be completed. The delegate is required to notify its context when the stop is complete by invoking IClientContext#clientStopped().


kill

public final void kill()
Description copied from interface: IClientDelegate
Asks the client delegate to stop the client immediately and lose data if necessary. This command can occur only once, and only after IClientDelegate.start() has been invoked. This method should return without waiting for the stop process to be completed. The delegate is required to notify its context when the stop is complete by invoking IClientContext#clientStopped().


processTerminated

protected void processTerminated(boolean failed)
Override this method to perform actions when the process terminates.

Parameters:
failed -

processAboutToStart

protected void processAboutToStart()
                            throws Exception
Override this method to perform actions just before the process starts

Throws:
Exception

setProgramPath

protected void setProgramPath(String path)

setArguments

protected void setArguments(String compactArguments)

setWorkingDirectory

protected void setWorkingDirectory(String dir)

setEnvironment

protected void setEnvironment(String environment)

setProgramPath

protected void setProgramPath(File path)
Specified by:
setProgramPath in class AbstractExecutableClientDelegate

setArguments

protected void setArguments(List<String> args)
Specified by:
setArguments in class AbstractExecutableClientDelegate

setEnvironment

protected void setEnvironment(Map<String,String> environment)
Specified by:
setEnvironment in class AbstractExecutableClientDelegate

setWorkingDirectory

protected void setWorkingDirectory(File dir)
Specified by:
setWorkingDirectory in class AbstractExecutableClientDelegate

setShowOutConsole

protected void setShowOutConsole(boolean show)
Specified by:
setShowOutConsole in class AbstractExecutableClientDelegate

setShowErrConsole

protected void setShowErrConsole(boolean show)
Specified by:
setShowErrConsole in class AbstractExecutableClientDelegate

setShowInConsole

protected void setShowInConsole(boolean show)
Specified by:
setShowInConsole in class AbstractExecutableClientDelegate

setWaitForProcessTreeTermination

protected void setWaitForProcessTreeTermination(boolean wait)
Specified by:
setWaitForProcessTreeTermination in class AbstractExecutableClientDelegate

getProgramPath

protected File getProgramPath()
Specified by:
getProgramPath in class AbstractExecutableClientDelegate

getArguments

protected List<String> getArguments()
Specified by:
getArguments in class AbstractExecutableClientDelegate

getWorkingDirectory

protected File getWorkingDirectory()
Specified by:
getWorkingDirectory in class AbstractExecutableClientDelegate

getEnvironment

protected Map<String,String> getEnvironment()
Specified by:
getEnvironment in class AbstractExecutableClientDelegate

isShowOutConsole

protected boolean isShowOutConsole()
Specified by:
isShowOutConsole in class AbstractExecutableClientDelegate

isShowErrConsole

protected boolean isShowErrConsole()
Specified by:
isShowErrConsole in class AbstractExecutableClientDelegate

isShowInConsole

protected boolean isShowInConsole()
Specified by:
isShowInConsole in class AbstractExecutableClientDelegate

isWaitForProcessTreeTermination

protected boolean isWaitForProcessTreeTermination()
Specified by:
isWaitForProcessTreeTermination in class AbstractExecutableClientDelegate

explodeCommand

protected static List<String> explodeCommand(String command)

compactCommand

protected static String compactCommand(List<String> command)

explodeEnvironment

protected static Map<String,String> explodeEnvironment(String env)

compactEnvironment

protected static String compactEnvironment(Map<String,String> env)

IBM Rational Performance Tester SDK

© Copyright IBM Corp. 2012. All rights reserved.