com.resilientedge.jockey.appcomm
Class Response
java.lang.Object
|
+--com.resilientedge.jockey.appcomm.AbstractMarshallable
|
+--com.resilientedge.jockey.appcomm.Response
- All Implemented Interfaces:
- Marshallable, java.io.Serializable
- public class Response
- extends AbstractMarshallable
- implements java.io.Serializable
A response object returned from the jockey engine.
- Version:
- $Revision: 1.1.1.1 $
- Author:
- John Gardner
- See Also:
- Serialized Form
Constructor Summary |
Response(java.lang.Exception exception)
'Failure' response constructor. |
Response(java.lang.Object returnValue)
'Successful' response constructor. |
Method Summary |
int |
fromBytes(byte[] buffer,
int offset)
Reinitialize this object from the contents of an array of bytes. |
java.lang.Exception |
getException()
Return the exception that resulted from the remote call. |
java.lang.String |
getMarshalName()
Return an identifier for this object. |
int |
getMarshalSize()
Return the number of bytes that this object would require to marshal
itself. |
java.lang.Object |
getReturnValue()
Return the result of the remote call, as an object. |
int |
getState()
Return the state of the response, success or failure. |
void |
mergeWith(Response response)
Combine the contents of this response with another. |
int |
toBytes(byte[] buffer,
int offset)
Marshal this object to a language independent array of bytes. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
SUCCESS
public static final int SUCCESS
FAILED
public static final int FAILED
FAILED_RESPONSE
public static final Response FAILED_RESPONSE
Response
public Response(java.lang.Object returnValue)
- 'Successful' response constructor.
- Parameters:
returnValue
- object to serve as return value from request
Response
public Response(java.lang.Exception exception)
- 'Failure' response constructor.
- Parameters:
exception
- exception to be returned.
mergeWith
public void mergeWith(Response response)
throws java.lang.UnsupportedOperationException,
java.lang.IllegalArgumentException,
java.lang.ClassCastException
- Combine the contents of this response with another. Assumes the response
payload of both responses is some object which makes sense to combine; a
compatable collection, for example.
This implementation ignores failures; if combining A and B, and one of
those has failed, this object will contain the successful one.
- Parameters:
response
- the response to combine
getState
public int getState()
- Return the state of the response, success or failure.
- Returns:
- one of the SUCCESS or FAILURE constants
getReturnValue
public java.lang.Object getReturnValue()
throws java.lang.Exception
- Return the result of the remote call, as an object.
If the call resulted in an exception, that exception will be thrown here.
- Returns:
- the return value
getException
public java.lang.Exception getException()
- Return the exception that resulted from the remote call.
- Returns:
- the exception
getMarshalName
public java.lang.String getMarshalName()
- Return an identifier for this object. This has to be unique among
marshallable objects.
Currently, format is "PI" | "SI" "class-stem-name".
- Returns:
- name for this object.
toBytes
public int toBytes(byte[] buffer,
int offset)
- Marshal this object to a language independent array of bytes.
- Overrides:
toBytes
in class AbstractMarshallable
- Parameters:
buffer
- a destination buffer to receive this object.offset
- begin marshalling at this offset from buffer start- Returns:
- the number of bytes of the input buffer consumed.
fromBytes
public int fromBytes(byte[] buffer,
int offset)
- Reinitialize this object from the contents of an array of bytes.
- Overrides:
fromBytes
in class AbstractMarshallable
- Parameters:
buffer
- a buffer containing the marshalled object.offset
- begin unmarshalling at this offset from buffer start- Returns:
- the number of bytes of the input buffer consumed.
getMarshalSize
public int getMarshalSize()
- Return the number of bytes that this object would require to marshal
itself.
- Overrides:
getMarshalSize
in class AbstractMarshallable
- Returns:
- the number of bytes that this object would consume.
Copyright © 2001 Resilient Edge, Inc. All Rights Reserved.