|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--hypercast.HC.HC_Node
HC_Node is a full implementation of the Hypercube protocol. 1. One new constructor is added which contain a string "prefix" in their parameters. The prefix is used for getting attributes. 3. A new method createDTMessage is added which is the constructor of HC_Message and is called by all sending methods. It can be overrided by the extended security node classes. 4. For all timer related methods, such as setTimer, getTimer, cleanTimer and timerExpired, the "timer type" parameter is redifined as a general "Object" instead of a int variable. 5. The Timer in the node adapter is started/stopped explicitly.
Field Summary | |
static byte |
Dead
The state of this node, dead |
static byte |
HRoot
The state of this node, hroot |
static byte |
HRootMissingNeighbor
The state of this node, hroot missing neighbor |
static byte |
HRootMissingNeighborAction
The state of this node, hroot missing neighbor action |
static byte |
Joining
The state of this node, joinng |
static byte |
JoiningWait
The state of this node, wait for joining |
static byte |
Leaving
The state of this node, leaving |
static byte |
MissingNeighbor
The state of this node, missing neighbor |
static byte |
MissingNeighborAction
The state of this node, missing neighbor action |
static byte |
Stable
The state of this node, stable |
static byte |
StartHypercube
The state of this node, start a hypercube |
Fields inherited from interface hypercast.I_Node |
DEFAULT_CONFIG_FILE, PROTOSUB_BUDDYLIST, PROTOSUB_MULTICAST, PROTOSUB_NOSPEC, PROTOSUB_SERVER |
Constructor Summary | |
HC_Node(hypercast.HyperCastConfig c,
hypercast.I_MulticastAdapter madapter)
Constructs a HC_Node object with an infrustructure I_UnicastAdapter |
|
HC_Node(hypercast.HyperCastConfig c,
hypercast.I_MulticastAdapter madapter,
java.lang.String prefix)
Constructs a HC_Node object with an infrustructure I_UnicastAdapter and attribute prefix |
Method Summary | |
hypercast.HC.HC_Message |
createHCMessage(byte type,
hypercast.I_PhysicalAddress paddr,
hypercast.HC.HC_LogicalAddress laddr,
hypercast.HC.HC_LogicalAddress root,
int seq,
byte[] data)
This method creates a new DT_Message based on parameters. |
hypercast.I_LogicalAddress |
createLogicalAddress(byte[] laddr,
int offset)
Creates an I_LogicalAddress object from an bytes array. |
hypercast.I_LogicalAddress |
createLogicalAddress(java.lang.String laStr)
Creates a logical address object from a String. |
hypercast.I_AddressPair |
getAddressPair()
Gets the AddressPair of this node |
hypercast.I_AddressPair[] |
getAllNeighbors()
Gets the AddressPair[] of this node's all neighbors |
hypercast.I_AddressPair[] |
getChildren(hypercast.I_LogicalAddress root)
Gets the AddressPair[] of this node's Children with reference to a given Root |
hypercast.HC.HC_AddressPair |
getHRoot()
Gets the AddressPair of the HRoot |
java.lang.String |
getLAAddress(java.lang.String NodePALAPair)
Gets logical address from a node's AddressPair |
java.lang.String |
getNeighborAttribute(int index,
java.lang.String attribute)
Gets neighbor's physical address or logical address |
java.lang.String |
getPAAddress(java.lang.String NodePALAPair)
Gets physical address from a node's AddressPair. |
hypercast.I_AddressPair[] |
getParent(hypercast.I_LogicalAddress root)
Gets the AddressPair[] of this node's Children with reference to a given Root. |
hypercast.HC.HC_AddressPair |
getPred()
Gets the AddressPair of the Predecessesor of this node in the Hypercube |
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. |
byte |
getState()
Gets the node's current state |
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. |
hypercast.HC.HC_AddressPair |
getSucc()
Gets the AddressPair of the Sueecssor of this node in the Hypercube |
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 a multicast group |
void |
leaveOverlay()
Leaves a multicast group |
static int |
MaxAddress()
Gets the maximum logical address number of this hypercube. |
void |
messageArrivedFromAdapter(hypercast.I_Message msg)
Processes the message received from an I_UnicastAdapter. |
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[] recvbuff,
int[] validBytesStart,
int validBytesEnd)
Creates an HC_Message if there are enough valid bytes in the buffer. |
void |
setLogicalAddress(hypercast.I_LogicalAddress la)
Sets the logical address of this node to the 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 |
timerExpired(java.lang.Object Timer_ID)
This function processes a timer event |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final byte Joining
public static final byte Stable
public static final byte MissingNeighbor
public static final byte MissingNeighborAction
public static final byte HRoot
public static final byte HRootMissingNeighbor
public static final byte HRootMissingNeighborAction
public static final byte Leaving
public static final byte StartHypercube
public static final byte JoiningWait
public static final byte Dead
Constructor Detail |
public HC_Node(hypercast.HyperCastConfig c, hypercast.I_MulticastAdapter madapter)
c
- an HyperCastConfig objectmadapter
- an object of I_MulticastAdapter.public HC_Node(hypercast.HyperCastConfig c, hypercast.I_MulticastAdapter madapter, java.lang.String prefix)
c
- an HyperCastConfig objectmadapter
- an object of I_MulticastAdapter.prefix
- property prefixMethod Detail |
public void joinOverlay()
joinOverlay
in interface I_Node
public void leaveOverlay()
leaveOverlay
in interface I_Node
public static int MaxAddress()
public hypercast.I_Message restoreMessage(byte[] recvbuff, int[] validBytesStart, int validBytesEnd)
restoreMessage
in interface I_AdapterCallback
recvbuff
- the byte array buffer of a incoming streamvalidBytesStart
- the start index to create a message fromvalidBytesEnd
- the total length of bytes in this buffer
I_AdapterCallback.restoreMessage(byte[], int[], int)
public hypercast.I_LogicalAddress createLogicalAddress(byte[] laddr, int offset)
createLogicalAddress
in interface I_Node
laddr
- bytes array
public hypercast.I_LogicalAddress createLogicalAddress(java.lang.String laStr)
createLogicalAddress
in interface I_Node
public void setLogicalAddress(hypercast.I_LogicalAddress la)
setLogicalAddress
in interface I_Node
public boolean previousHopCheck(hypercast.I_LogicalAddress src, hypercast.I_LogicalAddress dst, hypercast.I_LogicalAddress prehop)
previousHopCheck
in interface I_Node
public void setNotificationHandler(hypercast.NotificationHandler nh)
setNotificationHandler
in interface I_Node
public void messageArrivedFromAdapter(hypercast.I_Message msg)
messageArrivedFromAdapter
in interface I_AdapterCallback
msg
- I_Messagepublic void timerExpired(java.lang.Object Timer_ID)
This is also the kernel part of the Hypercast protocol. The HC_Node changes it's state, pings it's neighborhod everytime there is a timer event comes in.
timerExpired
in interface I_AdapterCallback
Timer_ID
- time event IDpublic hypercast.HC.HC_Message createHCMessage(byte type, hypercast.I_PhysicalAddress paddr, hypercast.HC.HC_LogicalAddress laddr, hypercast.HC.HC_LogicalAddress root, int seq, byte[] data)
public hypercast.I_AddressPair getAddressPair()
getAddressPair
in interface I_Node
public hypercast.HC.HC_AddressPair getHRoot()
public hypercast.HC.HC_AddressPair getSucc()
public hypercast.HC.HC_AddressPair getPred()
public hypercast.I_AddressPair[] getParent(hypercast.I_LogicalAddress root)
getParent
in interface I_Node
root
- HC_LogicalAddress object of a Root
public hypercast.I_AddressPair[] getChildren(hypercast.I_LogicalAddress root)
getChildren
in interface I_Node
root
- HC_LogicalAddress object of a Root
public hypercast.I_AddressPair[] getAllNeighbors()
getAllNeighbors
in interface I_Node
public byte getState()
public java.lang.String getStatsName()
I_Stats
getStatsName
in interface I_Stats
I_Stats.getStatsName()
public void setStatsName(java.lang.String name)
I_Stats
setStatsName
in interface I_Stats
name
- the name assigned to the I_Stats instance.I_Stats.setStatsName(String)
public org.w3c.dom.Element[] getStats(org.w3c.dom.Document doc, org.apache.xpath.XPath xpath) throws HyperCastStatsException
getStats
in interface I_Stats
doc
- Document used for create new elements or nodes.xpath
- XPath instance represents the statistics to be queried.
HyperCastStatsException
- If the xpath does not specify a valid subtree.I_Stats.getStats(org.w3c.dom.Document, org.apache.xpath.XPath)
public org.w3c.dom.Element[] setStats(org.w3c.dom.Document doc, org.apache.xpath.XPath xpath, org.w3c.dom.Element newValue) throws HyperCastStatsException
setStats
in interface I_Stats
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.
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.I_Stats.setStats(org.w3c.dom.Document, org.apache.xpath.XPath, org.w3c.dom.Element)
public org.w3c.dom.Element[] getReadSchema(org.w3c.dom.Document doc, org.apache.xpath.XPath xpath) throws HyperCastStatsException
getReadSchema
in interface I_Stats
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.
HyperCastStatsException
- If some part of the specified
subtree does not correctly implement this interface method.I_Stats.getReadSchema(Document, XPath)
public org.w3c.dom.Element[] getWriteSchema(org.w3c.dom.Document doc, org.apache.xpath.XPath xpath) throws HyperCastStatsException
getWriteSchema
in interface I_Stats
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.
HyperCastStatsException
- If some part of the specified
subtree does not correctly implement this interface method.I_Stats.getWriteSchema(Document, XPath)
public java.lang.String getNeighborAttribute(int index, java.lang.String attribute)
attribute
- PA or LA
public java.lang.String getPAAddress(java.lang.String NodePALAPair)
public java.lang.String getLAAddress(java.lang.String NodePALAPair)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |