oogp2p.chord
Class ChordAdministrator

java.lang.Object
  extended byoogp2p.chord.ChordAdministrator

public class ChordAdministrator
extends java.lang.Object

Author:
dtg Administrator for Chord. Performs various logic on chord node to ensure proper topology and functionality of Chord.

Field Summary
static java.lang.String DEFAULT_FILE_DIR
           
private  java.io.File myFiles
           
private  FixFingers myFixFingers
           
private  FixKeys myFixKeys
           
private  boolean myJoined
           
(package private)  ChordNode myNode
           
private  Stabilize myStabilizer
           
private  boolean myValidFlag
           
 
Constructor Summary
ChordAdministrator()
           
 
Method Summary
 void addFiles()
          Adds the files from the users's shared directory to the chord ring
 void addKey(byte[] key, java.net.InetAddress nodeIP)
           
 void buildFingers()
           
 void buildFingers(ChordLocation n)
          Update finger table via searches by passed in node
 void createChordRing()
          creates a chordRing
 void fixKeys()
           
 java.util.Iterator getMapping(byte[] key)
           
 ChordNode getNode()
           
 ChordLocation getPredecessor()
           
 java.net.InetAddress getSuccessorIP()
          returns IP address of node's successor
 boolean isJoined()
           
 boolean isValid()
          whether or not the chord thing is valid
 void join(ChordLocation connectorLoc)
           
 ChordLocation nodeLocation()
          returns chord node location of self
 void notify(ChordLocation possibleNewPred)
           
 void printFingers()
           
 void printKeys()
           
 void refreshFingers()
          Refreshes the Fingers
 void setFinger(ChordLocation updatedLoc, int fingerPos)
           
 void setToInvalid()
           
 void setToValid()
           
 void stabilize(ChordLocation pofs)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

myNode

ChordNode myNode

myJoined

private boolean myJoined

myValidFlag

private boolean myValidFlag

myStabilizer

private Stabilize myStabilizer

myFixFingers

private FixFingers myFixFingers

myFixKeys

private FixKeys myFixKeys

DEFAULT_FILE_DIR

public static java.lang.String DEFAULT_FILE_DIR

myFiles

private java.io.File myFiles
Constructor Detail

ChordAdministrator

public ChordAdministrator()
Method Detail

join

public void join(ChordLocation connectorLoc)

addFiles

public void addFiles()
Adds the files from the users's shared directory to the chord ring


setToInvalid

public void setToInvalid()

setToValid

public void setToValid()

isValid

public boolean isValid()
whether or not the chord thing is valid


createChordRing

public void createChordRing()
creates a chordRing


nodeLocation

public ChordLocation nodeLocation()
returns chord node location of self


getNode

public ChordNode getNode()

getSuccessorIP

public java.net.InetAddress getSuccessorIP()
returns IP address of node's successor


getPredecessor

public ChordLocation getPredecessor()

stabilize

public void stabilize(ChordLocation pofs)
Parameters:
pofs - -- my Successors' Predecessor Stabilizes myNode with respect to pofs

notify

public void notify(ChordLocation possibleNewPred)

buildFingers

public void buildFingers(ChordLocation n)
Update finger table via searches by passed in node


buildFingers

public void buildFingers()

isJoined

public boolean isJoined()
Returns:

setFinger

public void setFinger(ChordLocation updatedLoc,
                      int fingerPos)
Parameters:
fingerPos - finger position Updates the node in the Fingers at position fingerPos. (First makes sure that the node at fingerPos in Fingers has the same nodeID as the updatedNode

refreshFingers

public void refreshFingers()
Refreshes the Fingers


printFingers

public void printFingers()

addKey

public void addKey(byte[] key,
                   java.net.InetAddress nodeIP)

printKeys

public void printKeys()

getMapping

public java.util.Iterator getMapping(byte[] key)
Parameters:
key - returns the InetAddress what key maps to

fixKeys

public void fixKeys()