org.rhq.enterprise.communications.command.impl.start
Class StartCommandResponse

java.lang.Object
  extended by org.rhq.enterprise.communications.command.AbstractCommandResponse
      extended by org.rhq.enterprise.communications.command.impl.start.StartCommandResponse
All Implemented Interfaces:
Serializable, CommandResponse

public class StartCommandResponse
extends AbstractCommandResponse

The response of a start command that will indicate if the remote process instance was successfully started or not.

The results object (if command was successful) will be the exit code (as an Integer) of the process (if the command has its StartCommand#isWaitForExit() set to true). The results object will be null if that wait flag is false.

Author:
John Mazzitelli
See Also:
Serialized Form

Constructor Summary
StartCommandResponse(Command command)
          Creates a response, however, there is no associated exit code (due to the fact that the original command did not request that the command service wait for the process to exit).
StartCommandResponse(Command command, Integer exitCode)
          Creates a response that considers the command a success, with the exitCode passed as the result object.
StartCommandResponse(CommandResponse responseToTransform)
          Constructor for StartCommandResponse ;
StartCommandResponse(Command command, Throwable exception)
          Creates a response that considers the command a failure with the given exception stored in the response.
 
Method Summary
 Integer getExitCode()
          Convienence method that provides a strongly-typed return value of the exit code.
 
Methods inherited from class org.rhq.enterprise.communications.command.AbstractCommandResponse
getCommand, getException, getResults, isSuccessful, setCommand, setException, setResults, setSuccessful, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

StartCommandResponse

public StartCommandResponse(Command command)
Creates a response, however, there is no associated exit code (due to the fact that the original command did not request that the command service wait for the process to exit).

See Also:
AbstractCommandResponse.AbstractCommandResponse(Command)

StartCommandResponse

public StartCommandResponse(Command command,
                            Integer exitCode)
Creates a response that considers the command a success, with the exitCode passed as the result object. The exit code is the process's exit code that it returned when it stopped.

Parameters:
command - the command that succeeded
exitCode - the exit code

StartCommandResponse

public StartCommandResponse(Command command,
                            Throwable exception)
Creates a response that considers the command a failure with the given exception stored in the response.

Parameters:
command - the command that failed
exception - that caused the failure

StartCommandResponse

public StartCommandResponse(CommandResponse responseToTransform)
Constructor for StartCommandResponse ;

See Also:
AbstractCommandResponse.AbstractCommandResponse(CommandResponse)
Method Detail

getExitCode

public Integer getExitCode()
Convienence method that provides a strongly-typed return value of the exit code. Note that if the command did not tell the command service to wait for the process to exit, the returned value will be null. The returned value will also be null if the process failed to start; in which case, get the AbstractCommandResponse.getException() that caused the failure.

Returns:
the exit code of the process; null if the process failed to start or the command service didn't wait for it to exit


Copyright © 2008-2012 Red Hat, Inc.. All Rights Reserved.