org.tranche.server
Class PropagationReturnWrapper

java.lang.Object
  extended by org.tranche.server.PropagationReturnWrapper
All Implemented Interfaces:
java.io.Serializable

public class PropagationReturnWrapper
extends java.lang.Object
implements java.io.Serializable

Since propagation must return information about which servers fail, we need to wrap return types and exceptions together.

Author:
Bryan Smith - bryanesmith@gmail.com
See Also:
Serialized Form

Field Summary
static byte FLAG_BOOLEAN
           
static byte FLAG_BYTE_1D
           
static byte FLAG_BYTE_2D
           
static byte FLAG_BYTE_3D
           
static byte FLAG_VOID
           
static int VERSION_LATEST
           
static int VERSION_ONE
           
 
Constructor Summary
PropagationReturnWrapper(java.io.InputStream in)
           
PropagationReturnWrapper(java.util.Set<PropagationExceptionWrapper> set)
          Since propagation must return information about which servers fail, we need to wrap return types and exceptions together.
PropagationReturnWrapper(java.util.Set<PropagationExceptionWrapper> set, java.lang.Object returnObj)
          Since propagation must return information about which servers fail, we need to wrap return types and exceptions together.
 
Method Summary
static PropagationReturnWrapper createFromBytes(byte[] bytes)
           
 java.util.Set<PropagationExceptionWrapper> getErrors()
          Returns collection of errors that occurred while propogating request.
 java.lang.Object getReturnValueObject()
          Returns the returned value from method.
 boolean isAnyErrors()
          Returns true if there were any errors while propogating request.
 boolean isBoolean()
          Returns true if and only if method return boolean value.
 boolean isByteArrayDoubleDimension()
          Returns true if and only if return type of byte[][]
 boolean isByteArraySingleDimension()
          Returns true if and only if return type of byte[]
 boolean isByteArrayTripleDimension()
          Returns true if and only if return type of byte[][][]
 boolean isVoid()
          Returns true if and only if method is void.
 void serialize(java.io.OutputStream out)
           
 void serializeVersionOne(java.io.OutputStream out)
           
 byte[] toByteArray()
           
 java.lang.String toString()
          Useful for troubleshooting.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

VERSION_ONE

public static final int VERSION_ONE
See Also:
Constant Field Values

VERSION_LATEST

public static final int VERSION_LATEST
See Also:
Constant Field Values

FLAG_VOID

public static final byte FLAG_VOID
See Also:
Constant Field Values

FLAG_BOOLEAN

public static final byte FLAG_BOOLEAN
See Also:
Constant Field Values

FLAG_BYTE_1D

public static final byte FLAG_BYTE_1D
See Also:
Constant Field Values

FLAG_BYTE_2D

public static final byte FLAG_BYTE_2D
See Also:
Constant Field Values

FLAG_BYTE_3D

public static final byte FLAG_BYTE_3D
See Also:
Constant Field Values
Constructor Detail

PropagationReturnWrapper

public PropagationReturnWrapper(java.util.Set<PropagationExceptionWrapper> set)

Since propagation must return information about which servers fail, we need to wrap return types and exceptions together.

Use this constructor when method is void return type.

Parameters:
set - Set of exceptions. Is usually empty.

PropagationReturnWrapper

public PropagationReturnWrapper(java.util.Set<PropagationExceptionWrapper> set,
                                java.lang.Object returnObj)

Since propagation must return information about which servers fail, we need to wrap return types and exceptions together.

Use this constructor when method returns a value. (Use other constructor if void).

Do not set a null value if there is a return type. If method returns a null value, create an empty array or throw a NullPointerException.

Parameters:
set - Set of exceptions. Is usually empty.
returnObj - If null, then treated as void; otherwise, this is the return object of type Boolean, byte[], byte[][], or byte[][][]

PropagationReturnWrapper

public PropagationReturnWrapper(java.io.InputStream in)
                         throws java.io.IOException
Parameters:
in -
Throws:
java.io.IOException
Method Detail

isAnyErrors

public boolean isAnyErrors()

Returns true if there were any errors while propogating request.

Returns:

getErrors

public java.util.Set<PropagationExceptionWrapper> getErrors()

Returns collection of errors that occurred while propogating request.

Returns:
See Also:
isAnyErrors()

isVoid

public boolean isVoid()

Returns true if and only if method is void.

Returns:

isBoolean

public boolean isBoolean()

Returns true if and only if method return boolean value.

Returns:

isByteArraySingleDimension

public boolean isByteArraySingleDimension()

Returns true if and only if return type of byte[]

Returns:

isByteArrayDoubleDimension

public boolean isByteArrayDoubleDimension()

Returns true if and only if return type of byte[][]

Returns:

isByteArrayTripleDimension

public boolean isByteArrayTripleDimension()

Returns true if and only if return type of byte[][][]

Returns:

getReturnValueObject

public java.lang.Object getReturnValueObject()

Returns the returned value from method. Note you will have to type case this value.

Returns:

serialize

public void serialize(java.io.OutputStream out)
               throws java.io.IOException
Throws:
java.io.IOException

serializeVersionOne

public void serializeVersionOne(java.io.OutputStream out)
                         throws java.io.IOException
Throws:
java.io.IOException

toString

public java.lang.String toString()

Useful for troubleshooting.

Overrides:
toString in class java.lang.Object
Returns:

toByteArray

public byte[] toByteArray()
                   throws java.io.IOException
Returns:
Throws:
java.io.IOException

createFromBytes

public static PropagationReturnWrapper createFromBytes(byte[] bytes)
                                                throws java.io.IOException
Parameters:
bytes -
Returns:
Throws:
java.io.IOException


This code is free for use both commercially and non-commercially as stated in the project's license