org.rhq.enterprise.communications.command.impl.echo
Class EchoCommandResponse

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

public class EchoCommandResponse
extends AbstractCommandResponse

Encapsulates the results of an echo.

Author:
John Mazzitelli
See Also:
Serialized Form

Constructor Summary
EchoCommandResponse(CommandResponse responseToTransform)
          Constructor for EchoCommandResponse.
EchoCommandResponse(Command cmd, String echoMessage)
          Constructor for EchoCommandResponse that defines a successfully executed echo command.
EchoCommandResponse(Command cmd, Throwable exception)
          Constructor for EchoCommandResponse that defines a failed echo command.
 
Method Summary
 String getEchoMessage()
          Provides a strong-typed method that clients can call to obtain the echo message.
 
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

EchoCommandResponse

public EchoCommandResponse(Command cmd,
                           String echoMessage)
Constructor for EchoCommandResponse that defines a successfully executed echo command.

Parameters:
cmd - the echo command that was executed (may be null)
echoMessage - the message being echoed back to the client

EchoCommandResponse

public EchoCommandResponse(Command cmd,
                           Throwable exception)
Constructor for EchoCommandResponse that defines a failed echo command.

Parameters:
cmd - the echo command that was executed (may be null)
exception - the exception that caused the failure, if available (may be null)

EchoCommandResponse

public EchoCommandResponse(CommandResponse responseToTransform)
Constructor for EchoCommandResponse.

See Also:
AbstractCommandResponse.AbstractCommandResponse(CommandResponse)
Method Detail

getEchoMessage

public String getEchoMessage()
Provides a strong-typed method that clients can call to obtain the echo message. Clients are free to call AbstractCommandResponse.getResults() and cast the return value to a String. This method simply provides a way to help clients avoid that cast and to know exactly what type to expect.

Returns:
the echoed message with any prefix that was requested in the command


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