mail.node
Class LocalNode
java.lang.Object
mail.node.Node
mail.node.LocalNode
public class LocalNode
- extends Node
- Author:
- Arne Müller
Fields inherited from class mail.node.Node |
crypt |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
BOOTSTRAP
public static final int BOOTSTRAP
- See Also:
- Constant Field Values
THINK_OFFLINE
public static final int THINK_OFFLINE
- if a node was not reachable THINK_OFFLINE times in a row, it is though to have went offline
- See Also:
- Constant Field Values
neighbors
private java.util.Set<Node> neighbors
reachability
private java.util.Map<Node,java.lang.Integer> reachability
mails
private MailStore mails
names
private java.util.Map<NameID,ID> names
LocalNode
public LocalNode(MailStore mailStore,
java.util.Map<NameID,ID> nameStore,
EncSupply enc)
throws EncSupplyException
- Throws:
EncSupplyException
getClosest
public java.util.ArrayList<Node> getClosest(ID nodeid)
- 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
getNeighbors
public java.util.Collection<Node> getNeighbors()
- Description copied from class:
Node
- returns all the neighbors of this Node
- Specified by:
getNeighbors
in class Node
- Returns:
addNeighbor
public void addNeighbor(Node n)
- add's another neighbor to the node's list of neighbors
- Specified by:
addNeighbor
in class Node
- Parameters:
n
-
getName
public ID getName(NameID nameid)
- Description copied from class:
Node
- fetches the ID that registered the name with the given ID
- Specified by:
getName
in class Node
- Returns:
storeName
public void storeName(NameID nameid,
ID user)
- Specified by:
storeName
in class Node
getMail
public java.util.Collection<Mail> getMail(ID receiver)
- Specified by:
getMail
in class Node
getMailStore
public MailStore getMailStore()
store
public void store(Mail m)
- Specified by:
store
in class Node
getNode
public Node getNode(ID id)
- Specified by:
getNode
in class Node
toString
public java.lang.String toString()
- Overrides:
toString
in class Node
refresh
public void refresh()
refreshNames
public void refreshNames()
sendMail
public void sendMail(Mail m)
setName
public void setName(java.lang.String name)
bootstrap
public void bootstrap(Address a,
Communicator c)
throws BootstrapException
- Throws:
BootstrapException
fetchMail
public java.util.Collection<Mail> fetchMail()
markReachable
protected void markReachable(Node n)
- Overrides:
markReachable
in class Node
markUnreachable
private void markUnreachable(Node n)