ostore.dtree
Class DTreeResp

java.lang.Object
  |
  +--ostore.dtree.DTreeResp
All Implemented Interfaces:
QueueElementIF, QuickSerializable
Direct Known Subclasses:
CreateTreeResp, DTreeServiceResp, JoinTreeResp, LeaveTreeResp

public abstract class DTreeResp
extends Object
implements QueueElementIF, QuickSerializable

A superclass of all responses sent by the DTreeNode.

Version:
$Id: DTreeResp.java,v 1.15 2002/07/29 18:48:53 geels Exp $
Author:
Dennis Geels

Field Summary
static int DENIED
          An error code that indicates the sender was unable or unwilling to perform the request.
protected  SecureHash digest
          The digest of this DTreeResp.
protected  int error_code
          One of the error codes above (or NO_ERROR).
static int NO_ERROR
          An error code that indicates no error occurred.
static int NOT_OPEN
          An error code that indicates the requestor had attempted to close a replica that was not open.
protected  SecureHash req_digest
          A digest of the corresponding DTreeReq.
protected  SecureHash tree_id
          The name of the dissemination tree from the original request.
static int UNKNOWN_TREE
          An error code that indicates this node is not a member of the specified dissemination tree.
static int UNREACHABLE
          An error code that indicates the dissemination tree was unreachable.
 
Constructor Summary
protected DTreeResp(DTreeReq req, int error_code)
          Constructs a DTreeResp for the specified DTreeReq.
protected DTreeResp(InputBuffer buffer)
          Constructs a DTreeResp from its QuickSerializable form.
protected DTreeResp(SecureHash req_digest, SecureHash tree_id, int error_code)
          Constructs a new DTreeResp.
 
Method Summary
 SecureHash get_digest()
          Returns the digest of this DTreeResp.
 int get_error_code()
          Returns the error code.
 SecureHash get_req_digest()
          Returns the digest of the corresponding DTreeReq.
 SecureHash get_tree_id()
          Returns the name of the dissemination tree from the original request.
 int hashCode()
          Returns the hash of the digest of this DTreeResp.
 void serialize(OutputBuffer buffer)
          Add the object to the buffer.
 boolean successful()
          Returns true iff error_code() == NO_ERROR.
 String toString()
          Returns a human-readable representation of this DTreeResp.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

NO_ERROR

public static final int NO_ERROR
An error code that indicates no error occurred.

See Also:
Constant Field Values

UNREACHABLE

public static final int UNREACHABLE
An error code that indicates the dissemination tree was unreachable.

See Also:
Constant Field Values

UNKNOWN_TREE

public static final int UNKNOWN_TREE
An error code that indicates this node is not a member of the specified dissemination tree.

See Also:
Constant Field Values

DENIED

public static final int DENIED
An error code that indicates the sender was unable or unwilling to perform the request.

See Also:
Constant Field Values

NOT_OPEN

public static final int NOT_OPEN
An error code that indicates the requestor had attempted to close a replica that was not open.

See Also:
Constant Field Values

req_digest

protected SecureHash req_digest
A digest of the corresponding DTreeReq.


tree_id

protected SecureHash tree_id
The name of the dissemination tree from the original request.


error_code

protected int error_code
One of the error codes above (or NO_ERROR).


digest

protected transient SecureHash digest
The digest of this DTreeResp. Do NOT include this field in to_bytes.

Constructor Detail

DTreeResp

protected DTreeResp(SecureHash req_digest,
                    SecureHash tree_id,
                    int error_code)
Constructs a new DTreeResp.


DTreeResp

protected DTreeResp(DTreeReq req,
                    int error_code)
Constructs a DTreeResp for the specified DTreeReq.


DTreeResp

protected DTreeResp(InputBuffer buffer)
             throws QSException
Constructs a DTreeResp from its QuickSerializable form.

Method Detail

successful

public boolean successful()
Returns true iff error_code() == NO_ERROR.


get_error_code

public int get_error_code()
Returns the error code.


get_req_digest

public SecureHash get_req_digest()
Returns the digest of the corresponding DTreeReq.

See Also:
get_digest()

get_tree_id

public SecureHash get_tree_id()
Returns the name of the dissemination tree from the original request.


get_digest

public SecureHash get_digest()
Returns the digest of this DTreeResp.

WARNING: the first invocation of this method may be expensive, because it requires serializing the entire object.

See Also:
get_req_digest()

serialize

public void serialize(OutputBuffer buffer)
Description copied from interface: QuickSerializable
Add the object to the buffer.

Specified by:
serialize in interface QuickSerializable
Parameters:
buffer - the output buffer to add the object to

hashCode

public int hashCode()
Returns the hash of the digest of this DTreeResp.

WARNING: the first invocation of this method may be expensive, because it requires serializing the entire object.

Overrides:
hashCode in class Object

toString

public String toString()
Returns a human-readable representation of this DTreeResp.

Overrides:
toString in class Object