mail.node
Class RemoteNode

java.lang.Object
  extended by mail.node.Node
      extended by mail.node.RemoteNode

public class RemoteNode
extends Node

Author:
Arne Müller

Nested Class Summary
 
Nested classes/interfaces inherited from class mail.node.Node
Node.IDComparator, Node.InvertedIDComparator
 
Field Summary
private  java.util.Collection<Address> address
           
private  Communicator comm
           
 
Fields inherited from class mail.node.Node
crypt
 
Constructor Summary
RemoteNode(Communicator c, java.util.Collection<Address> addr, java.lang.String key)
           
RemoteNode(Communicator c, Node local)
           
 
Method Summary
 void addAddress(java.util.Collection<Address> a)
           
 void addNeighbor(Node n)
          add's another neighbor to the node's list of neighbors
private  void debug_print(java.lang.Exception ex)
           
private  void debug_print(java.lang.String s)
           
 boolean equals(java.lang.Object o)
           
 java.util.Collection<Address> getAddress()
           
 java.util.ArrayList<Node> getClosest(ID nodeid)
          returns the neighbors of this node sorted by distance.
 java.util.Collection<Mail> getMail(ID receiver)
           
 ID getName(NameID nameid)
          fetches the ID that registered the name with the given ID
 java.util.Collection<Node> getNeighbors()
          returns all the neighbors of this Node
 Node getNode(ID id)
           
private static java.lang.String makeRequestID()
           
 void store(Mail m)
           
 void storeName(NameID nameid, ID user)
           
 java.lang.String toString()
           
 
Methods inherited from class mail.node.Node
distance, distance, getCryptEngine, getID, getKey, hashCode, markReachable, searchClosest, searchName, searchNode
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

comm

private Communicator comm

address

private java.util.Collection<Address> address
Constructor Detail

RemoteNode

public RemoteNode(Communicator c,
                  java.util.Collection<Address> addr,
                  java.lang.String key)
           throws CryptCreationException
Throws:
CryptCreationException

RemoteNode

public RemoteNode(Communicator c,
                  Node local)
Method Detail

debug_print

private void debug_print(java.lang.Exception ex)

debug_print

private void debug_print(java.lang.String s)

addNeighbor

public void addNeighbor(Node n)
Description copied from class: Node
add's another neighbor to the node's list of neighbors

Specified by:
addNeighbor in class Node

makeRequestID

private static java.lang.String makeRequestID()

getClosest

public java.util.ArrayList<Node> getClosest(ID nodeid)
                                     throws RequestFailedException
Description copied from class: Node
returns the neighbors of this node sorted by distance. the closest node will be first

Specified by:
getClosest in class Node
Parameters:
nodeid - the id of the node to which distance should be measured to
Returns:
neighbors sorted by distance
Throws:
RequestFailedException

getNode

public Node getNode(ID id)
             throws RequestFailedException
Specified by:
getNode in class Node
Throws:
RequestFailedException

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class Node

getName

public ID getName(NameID nameid)
           throws RequestFailedException
Description copied from class: Node
fetches the ID that registered the name with the given ID

Specified by:
getName in class Node
Returns:
Throws:
RequestFailedException

storeName

public void storeName(NameID nameid,
                      ID user)
               throws RequestFailedException
Specified by:
storeName in class Node
Throws:
RequestFailedException

getNeighbors

public java.util.Collection<Node> getNeighbors()
                                        throws RequestFailedException
Description copied from class: Node
returns all the neighbors of this Node

Specified by:
getNeighbors in class Node
Returns:
Throws:
RequestFailedException

getMail

public java.util.Collection<Mail> getMail(ID receiver)
                                   throws RequestFailedException
Specified by:
getMail in class Node
Throws:
RequestFailedException

store

public void store(Mail m)
           throws RequestFailedException
Specified by:
store in class Node
Throws:
RequestFailedException

getAddress

public java.util.Collection<Address> getAddress()

addAddress

public void addAddress(java.util.Collection<Address> a)

toString

public java.lang.String toString()
Overrides:
toString in class Node