Class simu.sned.sned
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class simu.sned.sned

java.lang.Object
   |
   +----simu.sned.sned

public class sned
extends Object
Version:
1.0 27-Feb-97
Author:
Andre Campeau

The sned class is a database class for SNE's. It is an abbreviation for Simulated Network Element Database (SNED). It contains a Hashtable which is the root of the database (snedRoot) and many methods to access and mutate data in the database.

All of the methods are synchronized, which will offer mutual exclusion protection on the database. This means that only one thread can be accessing or mutating data in the SNED at a time. The methods are as follows:

For more information, see the method descriptions included with the methods.

Simulated Network Elements (SNE's) can be defined and are the basic records for the database. Each SNE entry has a unique SNEid and associated pointer to a SNE object. The SNE object is another Hashtable (see sne.java) and it contains several pre-defined data elements which are associated with SNE's. For example, the SNE object contains addressing and link information about the SNE.


Constructor Index

 o sned()
The sned constructor creates an empty SNED Hashtable object on the heap.

Method Index

 o CreateLink(String, String, String)
The CreateLink method creates a simulated network link by adding the appropriate data to the SNED.
 o CreateSNEentry(String, String, int, String, int)
The CreateSNEentry method creates a SNE entry in the SNED.
 o DeleteLink(String, String)
The DeleteLink method deletes the link from the SNED.
 o DeleteSNEentry(String)
The DeleteSNEentry method deletes a SNE entry from the SNED.
 o GetLinks(String)
The GetLinks method retrieves a list of links for a SNE.
 o GetLinkStatus(String, String)
The GetLinkStatus method retrieves the Link Status from the SNED.
 o GetSNEData(String, String)
The GetSNEData method gets SNE data from the SNE Data Object.
 o SetLinkStatus(String, String, String)
The SetLinkStatus method sets the Link Status in the SNED.
 o SetSNEData(String, String, Object)
The SetSNEData method creates and/or sets SNE data in the SNE Data Object.

Constructors

 o sned
  public sned()
The sned constructor creates an empty SNED Hashtable object on the heap.

Preconditions: None.

Postconditions: The empty SNED Hashtable exists.

Methods

 o CreateSNEentry
  public synchronized boolean CreateSNEentry(String SNEid,
                                             String simIp,
                                             int simPort,
                                             String realIP,
                                             int realPort)
The CreateSNEentry method creates a SNE entry in the SNED.

Preconditions: None.

Postconditions: The SNEid is created as an attribute in the SNED Hashtable. A SNE Data object is created and a pointer to it is inserted as the SNEid’s value in the SNED Hashtable. An empty Link Hashtable object is created and a pointer to it is inserted into the Links field of the SNE Data object. The SNE Data object is populated with mandatory data: simIp, simPort, realIP and realPort. If the SNE id is already in the SNED, false is returned and nothing is done, otherwise the data is added to the SNED and true is returned.

Parameters:
SNEid - The SNE identifier.
simIP - The Simulated IP Address.
simPort - The Simulated port.
realIP - The Real IP Address.
realPort - The Real port.
 o DeleteSNEentry
  public synchronized void DeleteSNEentry(String fromSNEid)
The DeleteSNEentry method deletes a SNE entry from the SNED.

Preconditions: The SNEid exists in the SNED Hashtable.

Postconditions: If the SNEid exists, its Link Hashtable is scanned and the DeleteLink method is invoked for all links in the Hashtable. The SNEid is removed from the SNED, which leaves the SNE Data Object unreferenced. Automatic garbage collection will automatically deallocate space used by the SNE Data object and Link Hashtable. If the SNEid does not exist in the SNED Hashtable, nothing is done.

Parameters:
SNEid - The SNE identifier.
 o GetSNEData
  public synchronized Object GetSNEData(String SNEid,
                                        String attribute)
The GetSNEData method gets SNE data from the SNE Data Object.

Preconditions: The SNEid exists in the SNED Hashtable.

Postconditions: If the SNEid exists, a lookup is done in its SNE Data Object using the attribute parameter and the resulting value is returned as a String. If SNEid does not exist in the SNED Hashtable, or the attribute does not exist in the SNE Data Object, or the value for the attribute is set to the null string, a null string is returned.

Parameters:
SNEid - The SNE identifier.
attribute - The attribute (key) to be obtained.
 o SetSNEData
  public synchronized void SetSNEData(String SNEid,
                                      String attribute,
                                      Object value)
The SetSNEData method creates and/or sets SNE data in the SNE Data Object.

Preconditions: The SNEid exists in the SNED Hashtable.

Postconditions: If the attribute exists in the SNE Data Object, its value is changed to the new value. If the attribute does not exist, nothing is done. If the SNEid does not exist in the SNED Hashtable, nothing is done.

Parameters:
SNEid - The SNE identifier; a string.
attribute - The attribute (key) to be inserted; a string.
value - The data to be inserted; an object.
 o CreateLink
  public synchronized void CreateLink(String fromSNEid,
                                      String toSNEid,
                                      String linkStatus)
The CreateLink method creates a simulated network link by adding the appropriate data to the SNED.

Preconditions: Both fromSNEid and toSNEid exist in the SNED Hashtable.

Postconditions: The link is created in the SNED. A Link Hashtable object is populated with the link data. Note that both the fromSNEid and toSNEid Link Hashtables are updated. If the link already existed, the Link Status is replaced by the contents of the linkStatus parameter. If one or both of the SNEid’s do not exist in the SNED Hashtable, nothing is done.

Parameters:
fromSNEid - The first SNE identifier.
toSNEid - The second SNE identifier.
linkStatus - The link status.
 o GetLinkStatus
  public synchronized String GetLinkStatus(String fromSNEid,
                                           String toSNEid)
The GetLinkStatus method retrieves the Link Status from the SNED.

Preconditions: Both fromSNEid and toSNEid exist in the SNED Hashtable.

Postconditions: The link status is looked up in the Link Hashtable and returned as a string. If the SNEid's do not exist in the SNED Hashtable, a null string is returned. If the link does not exist, a null string is returned.

Parameters:
fromSNEid - The first SNE identifier.
toSNEid - The second SNE identifier.
 o GetLinks
  public synchronized Hashtable GetLinks(String SNEid)
The GetLinks method retrieves a list of links for a SNE.

Preconditions: None.

Postconditions: A list of links and the corresponding link status is returned in a Hashtable. If there are no links for the SNE, or the SNEid does not exist in the SNED, null is returned.

Parameters:
fromSNEid - The first SNE identifier.
toSNEid - The second SNE identifier.
 o SetLinkStatus
  public synchronized boolean SetLinkStatus(String fromSNEid,
                                            String toSNEid,
                                            String linkStatus)
The SetLinkStatus method sets the Link Status in the SNED.

Preconditions: Both fromSNEid and toSNEid exist in the SNED Hashtable.

Postconditions: If the link exists, the Link Status is replaced by the contents of the linkStatus parameter. If one or both of the SNEs do not exist in the SNED Hashtable, or the link does not exist, false is returned, otherwise true is returned.

Parameters:
fromSNEid - The first SNE identifier.
toSNEid - The second SNE identifier.
linkStatus - The link status.
 o DeleteLink
  public synchronized void DeleteLink(String fromSNEid,
                                      String toSNEid)
The DeleteLink method deletes the link from the SNED.

Preconditions: Both fromSNEid and toSNEid exist in the SNED Hashtable.

Postconditions: The link is removed from the Link Hashtable for both fromSNEid and toSNEid. If one or both of the SNEs do not exist in the SNED Hashtable, or the link does not exist, nothing is done.

Parameters:
fromSNEid - The first SNE identifier.
toSNEid - The second SNE identifier.

All Packages  Class Hierarchy  This Package  Previous  Next  Index