All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class vnet.NetLayout

java.lang.Object
   |
   +----java.util.Observable
           |
           +----vnet.NetLayout

public class NetLayout
extends Observable
implements Observer
Class to represent the virtual net layout It is a representation of nodes (machines) and links (communication channels) where any node or link can fail. This net layout only simulates only the physical layout, that is, it manages the adding or removing of nodes and links in the net, but not the binding, unbinding or lookup of servers in the net. It implements the Observable function of the observer pattern.

Version:
0.1, august-1997
Author:
LuisM Pena

Constructor Index

 o NetLayout()
Default constructor
 o NetLayout(long)
This constructor allows to specify the default delay that will apply for the nodes and links in the net.

Method Index

 o addLink(LinkId, NodeId, NodeId)
Inserts a new link in the net, with the default delay The observers of the netlayout will receive a VirtualNetEvent notification, with the new link inside
 o addLink(LinkId, NodeId, NodeId, long)
Inserts a new link in the net, with the specified delay The observers of the netlayout will receive a VirtualNetEvent notification, with the new link inside
 o addNode(NodeId)
Inserts a new node in the net, with the default delay The observers of the netlayout will receive a VirtualNetEvent notification, with the new node inside
 o addNode(NodeId, long)
Inserts a new node in the net, with the specified delay The observers of the netlayout will receive a VirtualNetEvent notification, with the new node inside
 o destroy()
This is the destructor: destroy the nodes of the net, who destroy themselves the links, notifying all this events to the observes.
 o getLinks()
Gets the links included in the net
 o getNode(NodeId)
Gets the NetNode of the net with the specified id
 o getNodes()
Gets the nodes included in the net
 o removeLink(LinkId)
Removes a Link out of the net.
 o removeNode(NodeId)
Removes a Node out of the net.
 o setNetDelay(long)
Sets an additional delay that applies to every message operation between nodes (and links)
 o update(Observable, Object)
Observable method

Constructors

 o NetLayout
 public NetLayout()
Default constructor

 o NetLayout
 public NetLayout(long delay)
This constructor allows to specify the default delay that will apply for the nodes and links in the net.

Parameters:
delay - the delay that will apply by default to the nodes and links

Methods

 o destroy
 public void destroy() throws VNException
This is the destructor: destroy the nodes of the net, who destroy themselves the links, notifying all this events to the observes.

Throws: VNException
if any NetNode.destroy() fails
See Also:
destroy
 o addNode
 public void addNode(NodeId id) throws VNException
Inserts a new node in the net, with the default delay The observers of the netlayout will receive a VirtualNetEvent notification, with the new node inside

Parameters:
id - the Node identity
Throws: VNException
if the NodeId has already been added to the net
See Also:
NetLayout
 o addNode
 public synchronized void addNode(NodeId id,
                                  long delay) throws VNException
Inserts a new node in the net, with the specified delay The observers of the netlayout will receive a VirtualNetEvent notification, with the new node inside

Parameters:
id - the Node identity
delay - the expected delay
Throws: VNException
if the NodeId has already been added to the net
 o removeNode
 public synchronized void removeNode(NodeId id) throws VNException
Removes a Node out of the net.

Parameters:
id - the Node identity
Throws: VNException
if the NodeId doesn't allow to the net
 o addLink
 public void addLink(LinkId id,
                     NodeId idA,
                     NodeId idB) throws VNException
Inserts a new link in the net, with the default delay The observers of the netlayout will receive a VirtualNetEvent notification, with the new link inside

Parameters:
id - the Link identity
idA - any of the two nodes associated to this link
idB - the another node
Throws: VNException
if the LinkId has already been added to the net, or if the nodes don't allow to the net.
See Also:
NetLayout
 o addLink
 public synchronized void addLink(LinkId id,
                                  NodeId idA,
                                  NodeId idB,
                                  long delay) throws VNException
Inserts a new link in the net, with the specified delay The observers of the netlayout will receive a VirtualNetEvent notification, with the new link inside

Parameters:
id - the Link identity
idA - any of the two nodes associated to this link
idB - the another node
delay - the expected delay
Throws: VNException
if the LinkId has already been added to the net, or if the nodes don't allow to the net.
 o removeLink
 public synchronized void removeLink(LinkId id) throws VNException
Removes a Link out of the net.

Parameters:
id - the Link identity
Throws: VNException
if the LinkId doesn't allow to the net or the destroy() NetLink method fails
See Also:
destroy
 o setNetDelay
 public static void setNetDelay(long delay)
Sets an additional delay that applies to every message operation between nodes (and links)

Parameters:
delay - the delay in milliseconds
 o getNodes
 public synchronized Enumeration getNodes()
Gets the nodes included in the net

Returns:
the nodes in the net
 o getLinks
 public synchronized Enumeration getLinks()
Gets the links included in the net

Returns:
the links in the net
 o update
 public synchronized void update(Observable o,
                                 Object arg)
Observable method

 o getNode
 public synchronized NetNode getNode(NodeId id) throws VNException
Gets the NetNode of the net with the specified id

Parameters:
id - the NodId to look for
Returns:
the NetNode with the specified id
Throws: VNException
if there is no NetNode with such NodeId

All Packages  Class Hierarchy  This Package  Previous  Next  Index