org.apache.qpid.management.domain.handler.impl
Class InvocationResult

java.lang.Object
  extended by org.apache.qpid.management.domain.handler.impl.InvocationResult
All Implemented Interfaces:
Serializable

public class InvocationResult
extends Object
implements Serializable

Value object used for storing an invocation method result. This is done in order to accomplish multiple return value requirement. As we know, it's not possible to do that only with method signature and therefore this value object / struct is used.

See Also:
Serialized Form

Constructor Summary
InvocationResult(long statusCode, String statusText, byte[] outputAndBidirectionalArgumentValues)
          Builds an invocation result with the given status code and status text.
 
Method Summary
 void createAndThrowException()
          Simply throws a new MethodInvocationException.
 byte[] getOutputAndBidirectionalArgumentValues()
          Returns the output and bidirectional argument values in raw format (byte [])
 Map<String,Object> getOutputSection()
          Returns the output section of this invocation result.
 long getReturnCode()
          Returns the return code of this invocation result.
 String getStatusText()
          Contains the status text of this invocation result.
 boolean isException()
          Checks if this result contains an error return code.
 void setOutputSection(Map<String,Object> outputSection)
          Sets the output section (decoded) of this invocation result.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

InvocationResult

InvocationResult(long statusCode,
                 String statusText,
                 byte[] outputAndBidirectionalArgumentValues)
Builds an invocation result with the given status code and status text.

Parameters:
statusCode - the status code.
statusText - the status text.
Method Detail

isException

public boolean isException()
Checks if this result contains an error return code.

Returns:
true if this result object contains an error return code.

createAndThrowException

public void createAndThrowException()
                             throws MethodInvocationException
Simply throws a new MethodInvocationException. Usually this method is called in conjunction with the isException() method in order to raise an exception if the wrapped return code means that there was an error.

Throws:
MethodInvocationException - always.

toString

public String toString()
Overrides:
toString in class Object

getReturnCode

public long getReturnCode()
Returns the return code of this invocation result.

Returns:
the return code of this invocation result.

getStatusText

public String getStatusText()
Contains the status text of this invocation result.

Returns:
the status text of this invocation result.

getOutputAndBidirectionalArgumentValues

public byte[] getOutputAndBidirectionalArgumentValues()
Returns the output and bidirectional argument values in raw format (byte [])

Returns:
the output and bidirectional argument values in raw format (byte [])

setOutputSection

public void setOutputSection(Map<String,Object> outputSection)
Sets the output section (decoded) of this invocation result. When an incoming message arrives, the output section (output and bidirectional argument values) are initially stored in raw format. After that, their values need to be converted. The final result is a map containing (for each Output or Input/Output parameter) the name of the argument as key and its value as value.

Parameters:
output - a map containing outptu and bidirectional values (not in schema order).

getOutputSection

public Map<String,Object> getOutputSection()
Returns the output section of this invocation result. The output section consists in output and bidirectional argument values. Note that the order of the arguments is not guaranteed.

Parameters:
outputSection - the output section of this invocation result;


Licensed to the Apache Software Foundation