Class simu.scp.SCP
All Packages Class Hierarchy This Package Previous Next Index
Class simu.scp.SCP
java.lang.Object
|
+----java.awt.Component
|
+----java.awt.Container
|
+----java.awt.Panel
|
+----java.applet.Applet
|
+----simu.scp.SCP
- public class SCP
- extends Applet
- Version:
- 1.0 1-Mar-97
- Author:
- Andre Campeau
The SCP (Simulator Control Program) class is used to control the
simulated network environment. The simulated network environment
is composed of a number of simulated network elements (SNEs),
which simulate the behaviour of real hardware devices such as
printers, routers or networked workstations, and house the mobile
code infrastructure. Mobile code will migrate to and perform
tasks in SNEs just as they would on a real network.
The SCP is a basic extension of the java.applet.Applet class.
The SCP is responsible for creating, linking, destroying,
shipping code to and modifying data within these SNEs.
Multiple SNEs can be created on a single workstation, or on
many workstations. Currently a user must run the SNE manually
on a workstation and then manually register it with the SCP.
In the future, an anchor daemon could be responsible for creating
the SNE at a request from the SCP, after which the SCP would
manage the SNE directly. The anchor daemon would be a Java
program running on another computer which would respond to
create and destroy requests from the SCP.
SNEs can be linked together, thus simulating real network connections.
The SCP is responsible for managing the links between SNEs.
The SCP contains an interface component, which accepts input from
a user and displays simulation data. It also contains data elements,
such as global simulator data.
The user interface functions that are required for the SCP are:
- create SNEs
- manage SNE links
- destroy SNEs
- modify SNE data
The SCP uses something called a SNED, which stands for Simulated
Network Element Database, to store global non-remote data, which
consists of SNE registration information (IP, port, etc.) and simulated
link information. For more information about the SNED, refer to the
file sned.java, which contains the sned class used to implement the SNED.
-
SCP()
-
-
buttonCreate_Clicked(Event)
- The buttonCreate_Clicked method is called when the
Create button is clicked, checks that the SNEID,
RealIP and RealPort fields contain data, then
proceeds to enter the data into the SNE Database.
-
buttonDelete_Clicked(Event)
- The buttonDelete_Clicked method is called when
the Delete button has been clicked.
-
buttonDestroy_Clicked(Event)
- The buttonDestroy_Clicked method is called when
the Destroy button has been clicked.
-
buttonGetAttributes_Clicked(Event, String)
- The buttonGetAttributes_Clicked method is called when
the GetAttributes button has been clicked, or another
method calls it explicitly.
-
buttonLink_Clicked(Event)
- The buttonLink_Clicked method is called when the
Link button has been clicked.
-
buttonSetLocal_Clicked(Event)
- The buttonSetLocal_Clicked method is called when
the Set Local button has been clicked.
-
buttonSetRemote_Clicked(Event)
- The buttonSetRemote_Clicked method is called when
the Set Remote button has been clicked.
-
DeleteRemoteSNEAttributes(String, int, String)
- The DeleteRemoteSNEAttributes method deletes remote attributes
from a remote object.
-
displayError(String)
- The displayError method displays an error message in the
Status Messages text area.
-
displayStatusMessage(String)
- This displayStatusMessage method displays a message in the
Status Messages text area, followed by a linefeed.
-
displayStatusMessage(String, String)
- This displayStatusMessage method displays a message in the
Status Messages text area, followed by a special string.
-
GetRemoteSNEAttributes(String, int)
- The GetRemoteSNEAttributes method gets remote attributes
from a remote object.
-
GetSNEidFromSNEAttrList()
- The GetSNEidFromSNEAttrList method gets the SNEid from
the first entry in the list_SNEAttributes list.
-
handleEvent(Event)
- The handleEvent method handles events.
-
init()
- The init method initializes and draws all applet controls in the
applet window.
-
listSNE_Clicked(Event)
- The listSNE_Clicked method responds to a double-
click ACTION_EVENT by de-selecting all of the
items in the list except the item that was
double-clicked, then displaying the attributes
for that item.
-
listSNEAttributes_ListSelect(Event)
- The listSNEAttributes_ListSelect method is called when
the list_SNEAttributes list has been selected.
-
SetRemoteSNEAttributes(String, int, String, String)
- The SetRemoteSNEAttributes method sets remote attributes
on a remote object.
SCP
public SCP()
displayStatusMessage
public synchronized void displayStatusMessage(String Message)
- This displayStatusMessage method displays a message in the
Status Messages text area, followed by a linefeed.
- Parameters:
- message - The message to be displayed in the Status
Messages text area.
displayStatusMessage
public synchronized void displayStatusMessage(String Message,
String Special)
- This displayStatusMessage method displays a message in the
Status Messages text area, followed by a special string.
- Parameters:
- message - The message to be displayed in the Status
Messages text area.
- special - The special string to be output to the Status
Messages text area. For example, if no
linefeed is desired after message, special
would be null.
displayError
public synchronized void displayError(String ErrorMsg)
- The displayError method displays an error message in the
Status Messages text area. The Bell sound is played
to indicate an error has occurred.
- Parameters:
- ErrorMsg - The error message to be displayed in the
Status Messages text area.
GetSNEidFromSNEAttrList
public String GetSNEidFromSNEAttrList()
- The GetSNEidFromSNEAttrList method gets the SNEid from
the first entry in the list_SNEAttributes list. If the
text on the first line that is printed to the list by
the buttonGetAttributes_Clicked method is changed, this
method will have to be updated. If the list is empty,
null is returned, otherwise the SNEid string is returned.
GetRemoteSNEAttributes
public void GetRemoteSNEAttributes(String realIP,
int realPort)
- The GetRemoteSNEAttributes method gets remote attributes
from a remote object. In the context of the simulated
environment, this remote object will usually be a SNE,
although it could be another object that supports the
SNE communication protocol.
- Parameters:
- realIP - The IP address of the remote object.
- realPort - The port that the remote object is listening on.
SetRemoteSNEAttributes
public boolean SetRemoteSNEAttributes(String realIP,
int realPort,
String key,
String value)
- The SetRemoteSNEAttributes method sets remote attributes
on a remote object. In the context of the simulated
environment, this remote object will usually be a SNE,
although it could be another object that supports the
SNE communication protocol.
- Parameters:
- realIP - The IP address of the remote object.
- realPort - The port that the remote object is listening on.
- key - The key to set in the remote object's table.
- value - The value corresponding to the key.
DeleteRemoteSNEAttributes
public boolean DeleteRemoteSNEAttributes(String realIP,
int realPort,
String key)
- The DeleteRemoteSNEAttributes method deletes remote attributes
from a remote object. In the context of the simulated
environment, this remote object will usually be a SNE,
although it could be another object that supports the
SNE communication protocol.
- Parameters:
- realIP - The IP address of the remote object.
- realPort - The port that the remote object is listening on.
- key - The key to delete in the remote object's table.
buttonCreate_Clicked
public void buttonCreate_Clicked(Event event)
- The buttonCreate_Clicked method is called when the
Create button is clicked, checks that the SNEID,
RealIP and RealPort fields contain data, then
proceeds to enter the data into the SNE Database.
(SNED)
Note that the contents of the fields are not checked,
so no error is indicated for invalid IP addresses or
port numbers below 1024. Also, no error is indicated
when real IP + port duplicates exist in the SNED. An
error is indicated when the SNE already exists in the
SNED.
- Parameters:
- event - The Event object containing information
about the event that has occurred.
buttonLink_Clicked
public void buttonLink_Clicked(Event event)
- The buttonLink_Clicked method is called when the
Link button has been clicked. It gets the
SNEid's from the list_SNE list, and calls the
CreateLink method in the sned class to create the
link in the SNED. Note that this is all that has
to be done to set up a link; remote objects like
the SNE may periodically "call-in" to query the
link status from the SNED. By default, the initial
link status is "UP".
If two items in the SNE List are not selected, an
error message is printed.
- Parameters:
- event - The Event object containing information
about the event that has occurred.
buttonDestroy_Clicked
public void buttonDestroy_Clicked(Event event)
- The buttonDestroy_Clicked method is called when
the Destroy button has been clicked. It deletes
all of the corresponding SNE's from the SNED and
removes their list entries from the list_SNE list.
If no items are selected, an error message is printed.
- Parameters:
- event - The Event object containing information
about the event that has occurred.
buttonGetAttributes_Clicked
public void buttonGetAttributes_Clicked(Event event,
String SNEid)
- The buttonGetAttributes_Clicked method is called when
the GetAttributes button has been clicked, or another
method calls it explicitly. It gets both the local
attributes from the SNED and the remote attributes
from the SNE in another JVM, and displays these
attributes in the Attributes list.
Note that this method performs two functions, depending
upon parameters that are supplied to it by callers.
- Obtain all attributes, including both local and
remote attributes, and display them in the
Attributes list (list_SNEAttributes).
- Obtain only local attributes, use the remote
attributes from a previous call, and display
them in the Attributes list (list_SNEAttributes).
Function (1) is selected when the user explicitly hits
the Get Attributes button or double-clicks on an entry
in the list_SNE list. Function (2) is selected when a
method has changed attributes only in the local SNED,
and wishes to show the user these attributes immediately
after the change (i.e. when a link is deleted). The
reason for function (2) is that local updates may happen
often, and to have the entire attribute list sent from
a remote object each time would be costly in terms of
network bandwidth.
If no items are selected, an error message is printed.
- Parameters:
- event - The Event object containing information
about the event that has occurred.
- SNEid - The SNEid which is not null if function (2)
is required.
listSNE_Clicked
public void listSNE_Clicked(Event event)
- The listSNE_Clicked method responds to a double-
click ACTION_EVENT by de-selecting all of the
items in the list except the item that was
double-clicked, then displaying the attributes
for that item.
- Parameters:
- event - The Event object containing information
about the event that has occurred.
buttonSetRemote_Clicked
public void buttonSetRemote_Clicked(Event event)
- The buttonSetRemote_Clicked method is called when
the Set Remote button has been clicked. It gets
the text from the Key and Value text fields, and
updates a remote database with these new values by
calling the SetRemoteSNEAttributes method. Note
that the Attributes list is cleared immediately
after this method executes, which will force the
user to manually re-display the remote attributes.
This is an extra confirmation step that will ensure
that the attribute was successfully transported to
its remote destination.
If the Key text field is empty, an error message is
displayed.
- Parameters:
- event - The Event object containing information
about the event that has occurred.
buttonSetLocal_Clicked
public void buttonSetLocal_Clicked(Event event)
- The buttonSetLocal_Clicked method is called when
the Set Local button has been clicked. It gets
the text from the Key and Value text fields, and
updates the SNED with these new values by calling
the appropriate method. Note that the Attributes
list is updated immediately after this command
executes.
There are two areas in the Attributes list that are
affected by a Set Local button click: the Local
and Links areas. Some calculations are done to
determine which area the selection falls under,
then appropriate action is taken.
- Parameters:
- event - The Event object containing information
about the event that has occurred.
buttonDelete_Clicked
public void buttonDelete_Clicked(Event event)
- The buttonDelete_Clicked method is called when
the Delete button has been clicked. It gets
the SNEid from the Attributes list, gets the key
from the Key text field, and calls the appropriate
method to delete the item from the database.
There are two areas in the Attributes list that are
affected by a Delete button click: the Links
and Remote areas. Some calculations are done to
determine which area the selection falls under,
then appropriate action is taken.
- Parameters:
- event - The Event object containing information
about the event that has occurred.
listSNEAttributes_ListSelect
public void listSNEAttributes_ListSelect(Event event)
- The listSNEAttributes_ListSelect method is called when
the list_SNEAttributes list has been selected. This
means that the user has clicked on an item in the
Attributes list. There are many possible actions for
this event.
The sole purpose of this method is to enable and/or
disable one or more of the Set Remote, Set Local,
and Delete buttons, and the Key and Value text fields.
Also, the Key and Value text fields are set to the key
and value as selected from the list, as appropriate.
An important point to note is that if no item in the
Attribute list is selected, all of the aforementioned
objects are disabled. In order to enable selected
objects, the user must click on an attribute in one
of the three areas (Local, Links and Remote). In the
case where there are no entries in the Remote area,
the user should click on the area title in order to
enable Key & Value text fields (as well as the Set
Remote and Delete buttons). This will allow the user
to set new attributes on remote objects.
- Parameters:
- event - The Event object containing information
about the event that has occurred.
init
public void init()
- The init method initializes and draws all applet controls in the
applet window.
This method is automatically created and updated by Visual Cafe.
- Overrides:
- init in class Applet
handleEvent
public boolean handleEvent(Event event)
- The handleEvent method handles events. When an event occurs, the
handleEvent method is called, and depending upon the object and
type of event, a specific event handler method is then called.
This method is automatically created and updated by Visual Cafe.
- Parameters:
- event - The Event object containing information
about the event that has occurred.
- Overrides:
- handleEvent in class Component
All Packages Class Hierarchy This Package Previous Next Index