public abstract class ProcessBuilderClientDelegate extends AbstractExecutableClientDelegate
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.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 and Description |
|---|
ProcessBuilderClientDelegate() |
| Modifier and Type | Method and Description |
|---|---|
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.
|
getProperty, setPropertygetContext, messageReceived, postStop, preStart, sendStarted, sendStopped, sendUserMessagepublic void initialize(IClientContext context) throws DelegateInitializeException
ProcessBuilderClientDelegate.setProgramPath(File)), and optionally the working
directory (ProcessBuilderClientDelegate.setWorkingDirectory(File) and the environment
(ProcessBuilderClientDelegate.setEnvironment(Map)). Implementations should call the super implementation
first.initialize in interface IClientDelegateinitialize in class BaseClientDelegatecontext - 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.CoreExceptionDelegateInitializeException - If the delegate cannot be initialized or will not be able
to run properly.public final void start()
IClientDelegateIClientContext.clientStarted().public final void stop()
IClientDelegateIClientDelegate.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().public final void kill()
IClientDelegateIClientDelegate.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().protected void processTerminated(boolean failed)
failed - protected void processAboutToStart()
throws Exception
Exceptionprotected void setProgramPath(String path)
protected void setArguments(String compactArguments)
protected void setWorkingDirectory(String dir)
protected void setEnvironment(String environment)
protected void setProgramPath(File path)
setProgramPath in class AbstractExecutableClientDelegateprotected void setArguments(List<String> args)
setArguments in class AbstractExecutableClientDelegateprotected void setEnvironment(Map<String,String> environment)
setEnvironment in class AbstractExecutableClientDelegateprotected void setWorkingDirectory(File dir)
setWorkingDirectory in class AbstractExecutableClientDelegateprotected void setShowOutConsole(boolean show)
setShowOutConsole in class AbstractExecutableClientDelegateprotected void setShowErrConsole(boolean show)
setShowErrConsole in class AbstractExecutableClientDelegateprotected void setShowInConsole(boolean show)
setShowInConsole in class AbstractExecutableClientDelegateprotected final void setWaitForProcessTreeTermination(boolean wait)
setWaitForProcessTreeTermination in class AbstractExecutableClientDelegateprotected File getProgramPath()
getProgramPath in class AbstractExecutableClientDelegateprotected List<String> getArguments()
getArguments in class AbstractExecutableClientDelegateprotected File getWorkingDirectory()
getWorkingDirectory in class AbstractExecutableClientDelegateprotected Map<String,String> getEnvironment()
getEnvironment in class AbstractExecutableClientDelegateprotected boolean isShowOutConsole()
isShowOutConsole in class AbstractExecutableClientDelegateprotected boolean isShowErrConsole()
isShowErrConsole in class AbstractExecutableClientDelegateprotected boolean isShowInConsole()
isShowInConsole in class AbstractExecutableClientDelegateprotected boolean isWaitForProcessTreeTermination()
isWaitForProcessTreeTermination in class AbstractExecutableClientDelegate© Copyright IBM Corp. 2013. All rights reserved.