org.rhq.enterprise.communications.command
Interface CommandResponse

All Superinterfaces:
Serializable
All Known Implementing Classes:
AbstractCommandResponse, EchoCommandResponse, GenericCommandResponse, IdentifyCommandResponse, RemoteInputStreamCommandResponse, RemoteOutputStreamCommandResponse, RemotePojoInvocationCommandResponse, StartCommandResponse

public interface CommandResponse
extends Serializable

The interface to all command responses.

Author:
John Mazzitelli

Method Summary
 Command getCommand()
          If the command was issued with Command.isCommandInResponse() set to true, this will return a copy of the Command object that was executed.
 Throwable getException()
          If a command fails to execute, this may provide the exception (more specifically, a java.lang.Throwable) that caused the failure.
 Object getResults()
          Provides the command's results.
 boolean isSuccessful()
          Returns true if the command was executed successfully, false if any error occurred that caused the command to fail.
 

Method Detail

isSuccessful

boolean isSuccessful()
Returns true if the command was executed successfully, false if any error occurred that caused the command to fail.

Returns:
true if the command was successful, false otherwise
See Also:
getResults()

getCommand

Command getCommand()
If the command was issued with Command.isCommandInResponse() set to true, this will return a copy of the Command object that was executed. This is helpful in allowing for the client processing the response to know what command was executed.

To determine the actual results of the executed command, see getResults().

Returns:
the command that was executed or null if not available

getResults

Object getResults()
Provides the command's results. This may or may not be null, irregardless of whether the command was successful or not. The return value of this method may or may not be valid if isSuccessful() returns false. It is up to each implementor of this interface to determine the semantics of these conditions.

Returns:
the command execution results

getException

Throwable getException()
If a command fails to execute, this may provide the exception (more specifically, a java.lang.Throwable) that caused the failure. Typically, the returned value will be null if isSuccessful() returns true and will be non-null if isSuccessful() returns false. However, it is up to the implementor of this interface to determine whether or not to follow these guidelines. Implementors of this interface will determine when or if it will supply an exception. Note that it might be valid to have both a non-null exception and a non-nullresult.

Note that the exception may or may not have occurred on the server that executed the command.

Returns:
an exception that caused the command to fail, or null


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