|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectplanet.generic.commonapi.NodeImpl
planet.trivialp2p.TrivialNode
It is a trivial implementation of a P2P overlay network. Each node only has two links: the predecessor and successor in a ring topology. This overlay not contains stabilization protocol and is assigned under network building.
Field Summary | |
static int |
DATA
Type value: It identifies that this message contains an application level Message. |
static java.lang.String[] |
MODES
This String contains a string representation of each mode value of the RouteMessage. |
static int |
NumberOfModes
|
static int |
NumberOfTypes
|
static int |
REFRESH
Mode value: Defines a message's mode to be delivered directly in a oneway communication. |
static int |
REQUEST
Mode value: Defines a message's mode that requires a routing task in a oneway communication. |
static java.lang.String[] |
TYPES
This String contains a string representation of each type value of the RouteMessage. |
Fields inherited from class planet.generic.commonapi.NodeImpl |
endpoints, id, listeners, nodeHandle, role |
Constructor Summary | |
TrivialNode()
Initialize the internal structure. |
Method Summary | |
void |
broadcast(java.lang.String appId,
NodeHandle to,
NodeHandle nextHop,
Message msg)
This routing method is not implemented and always throws a NoSuchMethodError. |
void |
buildEdges(java.lang.String resultName,
java.util.Collection edgeCollection,
ResultsConstraint constraint)
Build the edges for its sucessor and predecessor links. |
void |
fail()
Do nothing. |
java.util.Set |
getAllLinks()
Gets all node connections to other nodes as its NodeHandles. |
NodeHandle |
getClosestNodeHandle(Id id)
Returns the own nodehandle or its successor nodehandle, in a clockwise proximity. |
java.util.Hashtable |
getInfo()
Gets the internal routing information in a hashtable. |
NodeHandle |
getPred()
Gets the predecessor nodehandle. |
NodeHandle |
getSucc()
Gets the successor nodehandle. |
java.util.Vector |
getSuccList(int max)
Gets the successor list. |
boolean |
isAlive()
Shows whenever this method is alive. |
void |
join(NodeHandle bootstrap)
Nothing does. |
void |
leave()
Nothing does. |
java.util.Vector |
localLookup(Id key,
int max,
boolean safe)
Always return null. |
java.util.Vector |
neighborSet(int max)
Always return null. |
void |
prettyPrintNode()
Prints out the local node information. |
void |
printNode()
Prints out the routing information of this node. |
boolean |
process(int actualStep)
Process the local incoming messages. |
boolean |
range(NodeHandle node,
Id rank,
Id leftKey,
Id rightKey)
This methods ALWAYS return false. |
java.util.Vector |
replicaSet(Id key,
int maxRank)
Always return null. |
void |
routeData(java.lang.String appId,
NodeHandle to,
NodeHandle nextHop,
Message msg)
Routes an application level message to the destination node. |
void |
setPredecessor(NodeHandle pred)
Updates the node predecessor. |
void |
setSuccessor(NodeHandle succ)
Updates the node successor. |
java.lang.String |
toString()
|
Methods inherited from class planet.generic.commonapi.NodeImpl |
addEdges, addMessageListener, buildMessage, buildMessage, buildNewEdge, dispatchDataMessage, getId, getLocalHandle, getRegisteredApplication, getRegisteredApplications, hasMoreMessages, inMessages, invokeByStepToAllApplications, isLocalMessage, nextMessage, outMessages, playsGoodRole, receive, registerApplication, removeMessageListener, send, sendMessage, sendMessage, sendMessage, sendMessage, setGoodRole, setTimer, setTimer, setValues |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final int REQUEST
public static final int REFRESH
public static final int DATA
public static final int NumberOfTypes
public static final int NumberOfModes
public static final java.lang.String[] TYPES
public static final java.lang.String[] MODES
Constructor Detail |
public TrivialNode() throws InitializationException
Method Detail |
public void join(NodeHandle bootstrap)
join
in interface Node
join
in class NodeImpl
bootstrap
- Bootstrap node.Node.join(planet.commonapi.NodeHandle)
public void leave()
leave
in interface Node
leave
in class NodeImpl
Node.leave()
public java.util.Hashtable getInfo()
getInfo
in class NodeImpl
NodeImpl.getInfo()
public NodeHandle getClosestNodeHandle(Id id)
getClosestNodeHandle
in interface Node
getClosestNodeHandle
in class NodeImpl
id
- The id to be find.
Node.getClosestNodeHandle(planet.commonapi.Id)
public void routeData(java.lang.String appId, NodeHandle to, NodeHandle nextHop, Message msg)
appId
- Application name.to
- Destination node (or key).nextHop
- May be null. The next hop into the route.msg
- Application level message to be sent.Node.routeData(java.lang.String, planet.commonapi.NodeHandle, planet.commonapi.NodeHandle, planet.commonapi.Message)
public void fail()
Node.fail()
public void printNode()
Node.printNode()
public void prettyPrintNode()
Node.prettyPrintNode()
public void broadcast(java.lang.String appId, NodeHandle to, NodeHandle nextHop, Message msg)
appId
- Application id that requires to send a broadcast message.to
- Source node.nextHop
- Next hop in the route.msg
- Application level message to be delivered in the broadcast.
java.lang.NoSuchMethodError
- always this method is invoked.Node.broadcast(java.lang.String, planet.commonapi.NodeHandle, planet.commonapi.NodeHandle, planet.commonapi.Message)
public NodeHandle getPred()
Node.getPred()
public NodeHandle getSucc()
Node.getSucc()
public boolean isAlive()
Node.isAlive()
public java.util.Vector getSuccList(int max)
max
- Maximum number of successor to be returned.
Node.getSuccList(int)
public java.util.Vector localLookup(Id key, int max, boolean safe)
key
- Key to be foundmax
- Maximum number of nodehandles to be returned.safe
- Shows if the connections have to be safe.
Node.localLookup(planet.commonapi.Id, int, boolean)
public java.util.Vector neighborSet(int max)
max
- Maximum number of neighbors to be returned.
Node.neighborSet(int)
public java.util.Vector replicaSet(Id key, int maxRank)
key
- Key to be replicated.maxRank
- Maximum number of nodes where to save the replicas.
Node.replicaSet(planet.commonapi.Id, int)
public boolean range(NodeHandle node, Id rank, Id leftKey, Id rightKey)
node
- Node that is currently a root of some range of keys.rank
- Number of keys that is root the node (rank=rightKey-leftKey).leftKey
- The value that appears in the invokation is the candidate left
key of the range. It may be modified to reflect the correct left margin
once invokation has finished.rightKey
- Shows once the invokation has finished the left margin of
the range.
Node.range(planet.commonapi.NodeHandle,
planet.commonapi.Id, planet.commonapi.Id, planet.commonapi.Id)
public void buildEdges(java.lang.String resultName, java.util.Collection edgeCollection, ResultsConstraint constraint)
resultName
- Result name to be used.edgeCollection
- Edge collection where to add all the new ones.constraint
- Constraint to verify the addition of the edges.Node.buildEdges(java.lang.String, java.util.Collection, planet.commonapi.results.ResultsConstraint)
public java.util.Set getAllLinks()
Node
Node.getAllLinks()
public boolean process(int actualStep)
process
in interface Node
process
in class NodeImpl
actualStep
- Actual step in the simulation process.
Node.process(int)
public void setPredecessor(NodeHandle pred)
pred
- The new node predecessor.public void setSuccessor(NodeHandle succ)
succ
- The new node successor.public java.lang.String toString()
Object.toString()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |