hypercast.DT
Class GNP_Landmark

java.lang.Object
  |
  +--hypercast.DT.GNP_Landmark
All Implemented Interfaces:
I_AdapterCallback, I_Node, I_Stats

public class GNP_Landmark
extends java.lang.Object
implements I_AdapterCallback, I_Node


Field Summary
 
Fields inherited from interface hypercast.I_Node
DEFAULT_CONFIG_FILE, PROTOSUB_BUDDYLIST, PROTOSUB_MULTICAST, PROTOSUB_NOSPEC, PROTOSUB_SERVER
 
Constructor Summary
GNP_Landmark(hypercast.HyperCastConfig config, hypercast.I_UnicastAdapter adapter, java.lang.String prefix)
           
GNP_Landmark(java.lang.String cf, java.lang.String addrStr, java.lang.String prefix)
          Constructor.
 
Method Summary
 hypercast.I_LogicalAddress createLogicalAddress(byte[] laddr, int offset)
          Creates a logical address object from a byte array.
 hypercast.I_LogicalAddress createLogicalAddress(java.lang.String laStr)
          Creates a logical address object from a String.
 hypercast.I_AddressPair getAddressPair()
          Returns this logical and physical addresses of this node.
 hypercast.I_AddressPair[] getAllNeighbors()
          Returns the node's neighbors' physical/logical address pairs.
 hypercast.I_AddressPair[] getChildren(hypercast.I_LogicalAddress root)
          Returns the node's children's physical/logical address pairs, with respect to the spanning tree rooted at root.
 hypercast.I_AddressPair[] getParent(hypercast.I_LogicalAddress root)
          Returns the addresspair of the next hop for a message routed by this node towards the root.
 org.w3c.dom.Element[] getReadSchema(org.w3c.dom.Document doc, org.apache.xpath.XPath xpath)
          Return the schema element which represents the root of the sub-tree, specified by the given xpath, in read schema tree.
 org.w3c.dom.Element[] getStats(org.w3c.dom.Document doc, org.apache.xpath.XPath xpath)
          Return the result of query for the statistics specified by the given xpath.
 java.lang.String getStatsName()
          Gets the element name of this I_Stats instance.
 org.w3c.dom.Element[] getWriteSchema(org.w3c.dom.Document doc, org.apache.xpath.XPath xpath)
          Return the schema element which represents the root of the sub-tree, specified by the given xpath, in write schema tree.
 void joinOverlay()
          Joins the overlay.
 void leaveOverlay()
          Leaves the overlay.
static void main(java.lang.String[] args)
           
 void messageArrivedFromAdapter(hypercast.I_Message msg)
          Process received message based on their types.
 boolean previousHopCheck(hypercast.I_LogicalAddress src, hypercast.I_LogicalAddress dst, hypercast.I_LogicalAddress prehop)
          Verify the previous hop of the message.
 hypercast.I_Message restoreMessage(byte[] receiveBuffer, int[] validBytesStart, int validBytesEnd)
          Reconstruct GNP message from byte array.
 void setLogicalAddress(hypercast.I_LogicalAddress la)
          Sets the logical address to specified one.
 void setNotificationHandler(hypercast.NotificationHandler nh)
          Set notification handler.
 org.w3c.dom.Element[] setStats(org.w3c.dom.Document doc, org.apache.xpath.XPath xpath, org.w3c.dom.Element newValue)
          Set the statistics specified by the given xpath.
 void setStatsName(java.lang.String name)
          Assigns a name to this I_Stats instance.
 void startProbe()
          Probe management: 1.
 void timerExpired(java.lang.Object Timer_ID)
          Handle timer-related tasks.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GNP_Landmark

public GNP_Landmark(hypercast.HyperCastConfig config,
                    hypercast.I_UnicastAdapter adapter,
                    java.lang.String prefix)

GNP_Landmark

public GNP_Landmark(java.lang.String cf,
                    java.lang.String addrStr,
                    java.lang.String prefix)
Constructor.

Parameters:
cf - Name of configuration file.
addrStr - String used to create address. It is not used in current version.
prefix - Property prefix.
Method Detail

startProbe

public void startProbe()
Probe management: 1. StartProbe sends out the trigger messages 2. Two timers for each landmark, a. is used for creating the randomness between packets(even one) b. is used for safeguard the probe, i.e. timeout (old one) 3. A third timer is used to guard the total time used for probe process


messageArrivedFromAdapter

public void messageArrivedFromAdapter(hypercast.I_Message msg)
Process received message based on their types.

Specified by:
messageArrivedFromAdapter in interface I_AdapterCallback

timerExpired

public void timerExpired(java.lang.Object Timer_ID)
Handle timer-related tasks.

Specified by:
timerExpired in interface I_AdapterCallback

restoreMessage

public hypercast.I_Message restoreMessage(byte[] receiveBuffer,
                                          int[] validBytesStart,
                                          int validBytesEnd)
Reconstruct GNP message from byte array.

Specified by:
restoreMessage in interface I_AdapterCallback
Parameters:
receiveBuffer - the byte array buffer of a incoming stream
validBytesStart - the start index to create a message from
validBytesEnd - the total length of bytes in this buffer
Returns:
null if buffer does not contain a complete message.

joinOverlay

public void joinOverlay()
Joins the overlay. Do nothing

Specified by:
joinOverlay in interface I_Node

leaveOverlay

public void leaveOverlay()
Leaves the overlay. Do nothing.

Specified by:
leaveOverlay in interface I_Node

getParent

public hypercast.I_AddressPair[] getParent(hypercast.I_LogicalAddress root)
Returns the addresspair of the next hop for a message routed by this node towards the root. Return null;

Specified by:
getParent in interface I_Node

getChildren

public hypercast.I_AddressPair[] getChildren(hypercast.I_LogicalAddress root)
Returns the node's children's physical/logical address pairs, with respect to the spanning tree rooted at root. Return null;

Specified by:
getChildren in interface I_Node

getAllNeighbors

public hypercast.I_AddressPair[] getAllNeighbors()
Returns the node's neighbors' physical/logical address pairs. Return null;

Specified by:
getAllNeighbors in interface I_Node

getAddressPair

public hypercast.I_AddressPair getAddressPair()
Returns this logical and physical addresses of this node.

Specified by:
getAddressPair in interface I_Node

createLogicalAddress

public hypercast.I_LogicalAddress createLogicalAddress(byte[] laddr,
                                                       int offset)
Creates a logical address object from a byte array. Return null.

Specified by:
createLogicalAddress in interface I_Node

createLogicalAddress

public hypercast.I_LogicalAddress createLogicalAddress(java.lang.String laStr)
Creates a logical address object from a String. Return null.

Specified by:
createLogicalAddress in interface I_Node

setLogicalAddress

public void setLogicalAddress(hypercast.I_LogicalAddress la)
Sets the logical address to specified one. Do nothing.

Specified by:
setLogicalAddress in interface I_Node

previousHopCheck

public boolean previousHopCheck(hypercast.I_LogicalAddress src,
                                hypercast.I_LogicalAddress dst,
                                hypercast.I_LogicalAddress prehop)
Verify the previous hop of the message. If checkmode is set to "neighborCheck", this method checks if the previous hop is a neighbor; otherwise this method checks if the previous hop is a valid sender of OL messages. It does nothing in DT_server.

Specified by:
previousHopCheck in interface I_Node

setNotificationHandler

public void setNotificationHandler(hypercast.NotificationHandler nh)
Set notification handler. Do noting.

Specified by:
setNotificationHandler in interface I_Node

getStats

public org.w3c.dom.Element[] getStats(org.w3c.dom.Document doc,
                                      org.apache.xpath.XPath xpath)
                               throws HyperCastStatsException
Return the result of query for the statistics specified by the given xpath.

Specified by:
getStats in interface I_Stats
Parameters:
doc - Document used for create new elements or nodes.
xpath - XPath instance represents the statistics to be queried.
Throws:
HyperCastStatsException - If the xpath does not specify a valid subtree.
See Also:
I_Stats.getStats(org.w3c.dom.Document, org.apache.xpath.XPath)

setStats

public org.w3c.dom.Element[] setStats(org.w3c.dom.Document doc,
                                      org.apache.xpath.XPath xpath,
                                      org.w3c.dom.Element newValue)
                               throws HyperCastStatsException
Set the statistics specified by the given xpath. The value actually set is returned.

Specified by:
setStats in interface I_Stats
Parameters:
doc - Document used for create new elements or nodes.
xpath - XPath instance represents the statistics to be queried.
newValue - Element representing the value or sub-tree to be set.
Throws:
HyperCastStatsException - If the xpath does not specify a valid subtree or if any part of the the subtree is read-only, or if the newValue does not conform with the expected format.
See Also:
I_Stats.setStats(org.w3c.dom.Document, org.apache.xpath.XPath, org.w3c.dom.Element)

getReadSchema

public org.w3c.dom.Element[] getReadSchema(org.w3c.dom.Document doc,
                                           org.apache.xpath.XPath xpath)
                                    throws HyperCastStatsException
Return the schema element which represents the root of the sub-tree, specified by the given xpath, in read schema tree.

Specified by:
getReadSchema in interface I_Stats
Parameters:
doc - Document used for create new elements or nodes.
xpath - XPath instance representing the statistics which is the root of the sub-tree to be queried.
Throws:
HyperCastStatsException - If some part of the specified subtree does not correctly implement this interface method.
See Also:
I_Stats.getReadSchema(Document, XPath)

getWriteSchema

public org.w3c.dom.Element[] getWriteSchema(org.w3c.dom.Document doc,
                                            org.apache.xpath.XPath xpath)
                                     throws HyperCastStatsException
Return the schema element which represents the root of the sub-tree, specified by the given xpath, in write schema tree.

Specified by:
getWriteSchema in interface I_Stats
Parameters:
doc - Document used for create new elements or nodes.
xpath - XPath instance representing the statistics which is the root of the sub-tree to be queried.
Throws:
HyperCastStatsException - If some part of the specified subtree does not correctly implement this interface method.
See Also:
I_Stats.getWriteSchema(Document, XPath)

getStatsName

public java.lang.String getStatsName()
Description copied from interface: I_Stats
Gets the element name of this I_Stats instance. The element name is originally assigned from the attribute StstsName in the configuration file, and can be changed by this method.

Specified by:
getStatsName in interface I_Stats
See Also:
I_Stats.getStatsName()

setStatsName

public void setStatsName(java.lang.String name)
Description copied from interface: I_Stats
Assigns a name to this I_Stats instance. The assigned name becomes the tag of the element associated to this I_Stats instance on the statistics tree.

Specified by:
setStatsName in interface I_Stats
Parameters:
name - the name assigned to the I_Stats instance.
See Also:
I_Stats.setStatsName(String)

main

public static void main(java.lang.String[] args)