All Packages Class Hierarchy This Package Previous Next Index
java.lang.Object | +----simu.sned.sned
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:
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.
public sned()
Preconditions: None.
Postconditions: The empty SNED Hashtable exists.
public synchronized boolean CreateSNEentry(String SNEid, String simIp, int simPort, String realIP, int realPort)
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.
public synchronized void DeleteSNEentry(String fromSNEid)
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.
public synchronized Object GetSNEData(String SNEid, String attribute)
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.
public synchronized void SetSNEData(String SNEid, String attribute, Object value)
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.
public synchronized void CreateLink(String fromSNEid, String toSNEid, String linkStatus)
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.
public synchronized String GetLinkStatus(String fromSNEid, String toSNEid)
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.
public synchronized Hashtable GetLinks(String SNEid)
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.
public synchronized boolean SetLinkStatus(String fromSNEid, String toSNEid, String linkStatus)
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.
public synchronized void DeleteLink(String fromSNEid, String toSNEid)
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.
All Packages Class Hierarchy This Package Previous Next Index