|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
This interface abstacts any ring or network of Nodes. It pretends contain all Nodes in the Network and allow to operate with the Nodes with transparent manner.
Any future implementation must contain the no argument constructor.
Method Summary | |
boolean |
existNode(NodeHandle node)
Inform if exist on the network one node with NodeHandle node. |
void |
failNodes(NodeHandle[] nodes)
nodes shows all nodes NodeHandle that have failed. |
int |
getProximity(NodeHandle nodeA,
NodeHandle nodeB)
Evaluates the proximity between the two nodes. |
Application |
getRandomApplication(java.lang.String appId)
Gets a reference of some application on any node of the network. |
Node |
getRandomNode(java.util.Random r)
Returns a randomly selected node of actual network. |
int |
getSimulatedSteps()
Gets the actual number of simulated steps. |
java.lang.String |
getTopology()
Returns the topology of the actual network. |
java.util.Iterator |
iterator()
Gets an Iterator to get all nodes. |
void |
joinNode(Node node)
Joins the node to the ring. |
void |
joinNode(Node node,
NodeHandle bootstrap)
Network joins a node with specified bootstrap. |
int |
joinNodes(int size)
Generates size Nodes and joins them to the ring. |
int |
joinNodes(int size,
NodeHandle[] bootstrap)
Generates size new Nodes joins them by any of the bootstraps. |
void |
leaveNodes(NodeHandle[] nodes)
Leave the ring the nodes which his NodeHandle appears in the array nodes. |
void |
prettyPrintNodes()
Shows for each node, its Id, predecessor and successor. |
void |
printNodes()
Shows for System.out all information of all nodes, including its finger table. |
int |
registerApplication(NodeHandle[] nodes)
Register to all Nodes whose NodeHandle appears in array Ids of nodes the Application specified at properties file. |
void |
registerApplicationAll()
Register to all Nodes in this network the Applicaton specified at properties file. |
void |
registerApplicationRandom(int nodes)
Register the Application specified at properties file radomly to a maximum number of Nodes specified by nodes. |
int |
run(int steps)
Runs the process to simulate a total number of steps. |
Network |
setValues(java.lang.String topology,
NodeFactory nodeFactory)
Sets the initial values for the new Network instance. |
boolean |
simulate()
Runs the process to simulate one time step. |
int |
size()
Returns the number of Nodes that contains the actual network. |
int |
stabilize()
Runs the process of stabilization while the network not has been stabilized. |
Method Detail |
public Network setValues(java.lang.String topology, NodeFactory nodeFactory) throws InitializationException
topology
- Desired network topology.nodeFactory
- NodeFactory implementation to be used to build
the network.
InitializationException
- if any error occurs during
the initialization process.public void joinNode(Node node) throws InitializationException
node
- Node to join to the ring.
InitializationException
public void joinNode(Node node, NodeHandle bootstrap) throws InitializationException
node
- Node to join to the network.bootstrap
- Node that joins the node.
InitializationException
- if occurs any problem during the join.public int joinNodes(int size) throws InitializationException
size
- Number of Nodes to join to the ring.
InitializationException
public int joinNodes(int size, NodeHandle[] bootstrap) throws InitializationException
size
- Number of nodes to joins to the network.bootstrap
- Array of NodeHandles to use as bootstrap. The implementation only
must ensure the use of them, or the maximum of them if the number of nodes
to join is smaller than bootstrap.length.
InitializationException
- if any error has ocurred during the operation.public void leaveNodes(NodeHandle[] nodes) throws InitializationException
nodes
- Node's NodeHandles that must leave the network.
InitializationException
public void failNodes(NodeHandle[] nodes) throws InitializationException
nodes
- Node's NodeHandles that must fail.
InitializationException
public void registerApplicationAll() throws InitializationException
InitializationException
Application
,
Node
public int registerApplication(NodeHandle[] nodes) throws InitializationException
nodes
- NodeHandles of Nodes that must be registered the Application.
InitializationException
Node
,
Id
public void registerApplicationRandom(int nodes) throws InitializationException
nodes
- Number of Nodes to be register the Application.
InitializationException
Node
,
Id
public java.lang.String getTopology()
public int size()
public void printNodes()
public void prettyPrintNodes()
public int stabilize()
public boolean simulate()
public int run(int steps)
for (int i=0; i < steps; i++) { simulate(); }
steps
- Number of steps to simulate.
public Node getRandomNode(java.util.Random r)
r
- Generator of random numbers.
public boolean existNode(NodeHandle node)
node
- NodeHandle of the node to be search.
public Application getRandomApplication(java.lang.String appId)
appId
- Application identification for searching it.
public java.util.Iterator iterator()
public int getSimulatedSteps()
public int getProximity(NodeHandle nodeA, NodeHandle nodeB)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |