Class NetData

java.lang.Object
   |
   +----java.awt.Component
           |
           +----java.awt.Container
                   |
                   +----java.awt.Panel
                           |
                           +----java.applet.Applet
                                   |
                                   +----user.plot.PlotApplet
                                           |
                                           +----NetData

public class NetData
extends PlotApplet
implements Runnable, ExternPlotControls, BlinkChecker
This class is used to read the file data/net_data which contains the net traffic data from the local file system or from the Web server. This class main function is to store the net data and to make the data available for JavaScript code.

To show the user the availability of the data at the Web server or file system a signal light is used. This light is:

The data are read in a separate thread. A special class instance is used for the synchronisation with the main thread. The usage of the data read thread is required, because is is a security violation at some browsers (a.o. Netscape 6) to call the Applet data read method from JavaScript.

It is also possible to show the data in a plot window Frame. There are several methods available to plot the corresponding net data. The frame is plotted as an instance of the DataPlotFrame class which on its turn is managed by an instance of the DataPlotWindow class. Only methods of this class should be used handle the plot window frame.

All function arguments and return values from the functions to be called from JavaScript are instances of the String class. This is done to be compatible with older browsers.

The function which are intended to be called from JavaScript are explicitly marked "To be called from JavaScript".


Variable Index

 o is_started
This class instance variable displays the state when the applet has been started for the first time.

Constructor Index

 o NetData()

Method Index

 o adjustPlotControls()
Adjust the plot controls before the plot frame is shown.
 o destroy()
Overload the destroy() method of the PlotApplet class.
 o doReadData()
Return if at the moment the net data thread is reading data.
 o getDataTypeIndex()
Get the current data type index as a string.
 o getDataTypeSelectID()
Get the selected file ID of the current data type as a string.
 o getDate(String)
Return the (day part of the) date at the specified index in the date array.
 o getDateDay(String, String)
Return the date of the day, representing the date interval, with the specified index from the data type with the specified index.
 o getDateID(String, String)
Return the date ID of the date interval with the specified index from the data type with the specified index.
 o getHost(String)
Return the host at the specified index in the host array.
 o getHostTitle(String)
Return of the host title sepcified with its index.
 o getInetTitle()
Get the title of the network performance tests along the "usual" Internet route.
 o getLoadValue(String, String)
Return the load value for the host and date (plus time) at the specified indices.
 o getNrDates()
Return the # dates which are found in all net data.
 o getNrHosts()
Return the # hosts which are read from the data file.
 o getNrSelectDates(String)
Return the # dates for which select date data files are available.
 o getOneDirect()
Return if one-directional or two-directional connections are used.
 o getParameterInfo()
Return the Applet parameter information.
 o getPeriod()
Get the period [m] between two dates.
 o getPingValue(String, String, String, String)
Return the ping value with the specified type from the connection between the specified hosts and at the specified date (plus time).
 o getPingValue(String, String, String, String, String)
Return the ping value with the specified type from the connection between the specified hosts, at the specified date (plus time) and with the specified net type.
 o getPlotControls()
Return the private plot controls as a component array.
 o getPlotHeight()
Return the height of the plot canvas parsed as a string.
 o getPlotWidth()
Return the width of the plot canvas parsed as a string.
 o getQoSAndInet()
Return if besides tests over the "usual" Internet connction also tests over Quality-of-Service connections should be performed.
 o getQoSTitle()
Get the title of the Quality-of-Service network performance tests.
 o getSetTitle()
Get the title of the hosts set.
 o getThroughputValue(String, String, String)
Return the throughput value from the connection between the specified hosts and at the specified date (plus time).
 o getThroughputValue(String, String, String, String)
Return the throughput value from the connection between the specified hosts, at the specified date (plus time) and with the specified net type.
 o getTimeOrDateID(String)
Return the time or week/day ID at the specified index in the time array.
 o getUDPBWValue(String, String, String, String)
Return the UDP bandwidth value with the specified type from the connection between the specified hosts and at the specified date (plus time).
 o getUDPBWValue(String, String, String, String, String)
Return the UDP bandwidth value with the specified type from the connection between the specified hosts, at the specified date (plus time) and with the specified net type.
 o getUseUDPBW()
Return if UDP bandwidth measurements should be performed.
 o hasSkippedConnections()
This function returns if there are skipped connections.
 o init()
Initialise the NetData Applet.
 o isFulfilled()
This function implements the isFulfilled() method from the BlinkChecker interface.
 o isSkippedConnection(String, String, String)
Return if the connection, specified by the host indices and the network type, is skipped.
 o plotControlAction(Event, Object)
Handle an action event at one of the private plot controls.
 o plotLoadData(String)
Plot the load data in a window frame.
 o plotPingData(String, String, String)
Plot the ping data with the specified type in a window frame.
 o plotShowed()
Returns the string "true" when a plot frame is showed; the string "false" is returned when no plot is displayed.
 o plotThroughputData(String, String)
Plot the throughput data in a window frame.
 o plotUDPBWData(String, String, String)
Plot the UDP bandwidth data with the specified type in a window frame.
 o run()
Implements the run method of the thread for the functions that could not run (for some browsers) under JavaScript.
 o setNetData(String)
Set the net data, but only when curently no data are being read.
 o setNewPlotSize(String, String)
Set the sizes of the plot canvas which are used when a new plot window is showed.
 o start()
Overload the start() method of the PlotApplet class to:
  1. Call super.start().
  2. Call the start() method of the Signal class instance which is used to handle the signal blink thread.
  3. Call the start() method of the thread which is used for functions that could not be called from JavaScript for some browsers when this thread is not running.
     o stop()
    Overload the stop() method of the PlotApplet class.

Variables

 o is_started
 public String is_started
This class instance variable displays the state when the applet has been started for the first time. It is intended to be used from JavaScript.

Constructors

 o NetData
 public NetData()

Methods

 o init
 public void init()
Initialise the NetData Applet. The init() method of the PlotApplet class is overloaded.

Overrides:
init in class Applet
 o start
 public void start()
Overload the start() method of the PlotApplet class to:
  1. Call super.start().
  2. Call the start() method of the Signal class instance which is used to handle the signal blink thread.
  3. Call the start() method of the thread which is used for functions that could not be called from JavaScript for some browsers when this thread is not running. Otherwise the resume() will be called, because it has been suspended by another stop() call of this Applet.
  4. Mark that this Applet has been started for the first time.

Overrides:
start in class PlotApplet
See Also:
start, stop, destroy
 o stop
 public void stop()
Overload the stop() method of the PlotApplet class. This is done to:
  1. Call the stop() method of the Signal class instance which is used to handle the signal blink thread.
  2. Call the suspend() method of the thread which is used to run commands that could not be run (for some browsers) from JavaScript. The thread may be resumed by another call of the start() method.
  3. Dispose an existing plot frame.

Overrides:
stop in class PlotApplet
See Also:
stop, start, destroy
 o destroy
 public void destroy()
Overload the destroy() method of the PlotApplet class. This is done to:
  1. Call the destroy() method of the Signal class instance which is used to handle the signal blink thread.
  2. Quit the thread which is used for commands that could not be run (for all browsers) from JavaScript.
    1. Overrides:
      destroy in class PlotApplet
      See Also:
      destroy, start, stop
 o getSetTitle
 public String getSetTitle()
Get the title of the hosts set. A new String object is returned.

To be called from JavaScript.

Returns:
The title of the hosts set.
 o getPeriod
 public String getPeriod()
Get the period [m] between two dates. it is returned as a new String object.

To be called from JavaScript.

Returns:
The period between two dates. It is returned as string.
 o getOneDirect
 public String getOneDirect()
Return if one-directional or two-directional connections are used. The Boolean flag is returned as a new String object.

To be called from JavaScript.

Returns:
When one-directional connections are used true is returned; false otherwise. Both values will be returned as string.
 o getQoSAndInet
 public String getQoSAndInet()
Return if besides tests over the "usual" Internet connction also tests over Quality-of-Service connections should be performed. The Boolean flag is returned as a new String object.

To be called from JavaScript.

Returns:
When also Quality-of-Service tests should be performed true is returned; false otherwise. Both values will be returned as string.
 o getQoSTitle
 public String getQoSTitle()
Get the title of the Quality-of-Service network performance tests. It is returned as a new String object.

To be called from JavaScript.

Returns:
The title of the Quality-of-Service tests.
 o getInetTitle
 public String getInetTitle()
Get the title of the network performance tests along the "usual" Internet route. It is returned as a new String object.

To be called from JavaScript.

Returns:
The title of the tests along the Internet route.
 o getUseUDPBW
 public String getUseUDPBW()
Return if UDP bandwidth measurements should be performed. The Boolean flag is returned as a new String object.

To be called from JavaScript.

Returns:
When also UDP bandwidth tests should be performed true is returned; false otherwise. Both values will be returned as string.
 o getNrSelectDates
 public String getNrSelectDates(String type_index_str)
Return the # dates for which select date data files are available. When no dates are available the string value of zero is returned. It is returned as a new String object.

To be called from JavaScript.

Parameters:
type_index_str - The index of the date type to obtain the # selected dates from, specified as string.
Returns:
The # select dates.
 o getDateDay
 public String getDateDay(String type_index_str,
                          String index_str)
Return the date of the day, representing the date interval, with the specified index from the data type with the specified index. It is returned as a new String object.

To be called from JavaScript.

Parameters:
type_index_str - The index of the data type to use.
index_str - The index of the date day to get, specified as string.
Returns:
The date of the day at the specified index.
 o getDateID
 public String getDateID(String type_index_str,
                         String index_str)
Return the date ID of the date interval with the specified index from the data type with the specified index. It is returned as a new String object.

To be called from JavaScript.

Parameters:
type_index_str - The index of the data type to use.
index_str - The index of the date ID to get, specified as string.
Returns:
The date ID at the specified index.
 o setNetData
 public void setNetData(String data_file)
Set the net data, but only when curently no data are being read. First the net data storage is cleared. After the clearing of the memory the net data read thread is requested to read the net data file. This method will wait until the net data are read which is also the only functionality when net data are being read at the moment.

The reading of the net data is a.o. stopped when an URL I/O Exception occurs. The exception message is displayed in the browser bar and in the JAVA Console.

To be called from JavaScript.

Parameters:
data_file - The data file to read the data from.
 o doReadData
 public String doReadData()
Return if at the moment the net data thread is reading data. This Boolean flag will be returned as a new String object.

To be called from JavaScript.

Returns:
When net data are being read at the moment true is returned; false otherwise. Both values will be returned as a string.
 o run
 public void run()
Implements the run method of the thread for the functions that could not run (for some browsers) under JavaScript. This implies the following functionality: Jump from this method when a QuitException has been thrown.

 o isFulfilled
 public boolean isFulfilled()
This function implements the isFulfilled() method from the BlinkChecker interface. It checks if the signal indeed should be switched off when blinking is enabled. This is the case when:
  1. The first time the half of the required # lines are read.
  2. At the later times the full required # lines are read.

Please note that this method will be called from within the run() method of the blinking thread in the Signal class instance.

 o getDataTypeIndex
 public String getDataTypeIndex()
Get the current data type index as a string. It is returned as a new String object.

To be called from JavaScript.

Returns:
The current data type index.
 o getDataTypeSelectID
 public String getDataTypeSelectID()
Get the selected file ID of the current data type as a string. It is returned as a new String object.

To be called from JavaScript.

Returns:
The selected file ID of the current type.
 o getNrHosts
 public String getNrHosts()
Return the # hosts which are read from the data file. It is returned as a new String object.

To be called from JavaScript.

Returns:
The # hosts.
 o getHost
 public String getHost(String index_str)
Return the host at the specified index in the host array. It is returned as a new String object.

To be called from JavaScript.

Parameters:
index_str - The index of the host in the array.
Returns:
The host at the given index.
 o getHostTitle
 public String getHostTitle(String index_str)
Return of the host title sepcified with its index. When no host title is defined the hostname is returned. It is returned as a new String object.

To be called from JavaScript.

Parameters:
index_str - The index of the host in the array.
Returns:
The host title at the given index.
 o isSkippedConnection
 public String isSkippedConnection(String host_1_index_str,
                                   String host_2_index_str,
                                   String net_type)
Return if the connection, specified by the host indices and the network type, is skipped. The boolean value is returned as a new String object.

To be called from JavaScript.

Parameters:
host_1_index_str - The index of the first host.
host_2_index_str - The index of the second host.
net_type - The network type.
Returns:
True when the conenction is skipped; false otherwise.
 o getNrDates
 public String getNrDates()
Return the # dates which are found in all net data. It is returned as new String object.

To be called from JavaScript.

Returns:
The # dates.
 o getDate
 public String getDate(String index_str)
Return the (day part of the) date at the specified index in the date array. Note that the array is sorted to increasingly recent date (and time). It is returned as a new String object.

To be called from JavaScript.

Parameters:
index_str - The index of the date (day) in the array.
Returns:
The date at the given index.
 o getTimeOrDateID
 public String getTimeOrDateID(String index_str)
Return the time or week/day ID at the specified index in the time array. Note that the array is sorted to increasinly recent (date and) time. It is returned as a new String object.

To be called from JavaScript.

Parameters:
index_str - The index of the time in the array.
Returns:
The time at the given index.
 o setNewPlotSize
 public void setNewPlotSize(String new_plot_width,
                            String new_plot_height)
Set the sizes of the plot canvas which are used when a new plot window is showed.

To be called from JavaScript.

Parameters:
new_plot_width - The new width of the plot canvas.
new_plot_height - The new height of the plot canvas.
 o getPlotWidth
 public String getPlotWidth()
Return the width of the plot canvas parsed as a string. Return zero when the width of the plot canvas appears to be larger than the screen.

To be called from JavaScript.

Returns:
The width of the plot canvas.
 o getPlotHeight
 public String getPlotHeight()
Return the height of the plot canvas parsed as a string. Return zero when the height of the plot canvas appears to be larger than the screen.

To be called from JavaScript.

Returns:
The height of the plot canvas.
 o plotShowed
 public String plotShowed()
Returns the string "true" when a plot frame is showed; the string "false" is returned when no plot is displayed. The string are returned as a new String object.

To be called from JavaScript.

Returns:
A boolean string to inquire if a plot frame is showed.
 o plotLoadData
 public void plotLoadData(String max_date_index_str)
Plot the load data in a window frame.

To be called from JavaScript.

Parameters:
max_date_index_str - The index of the most recent date.
 o plotPingData
 public void plotPingData(String max_date_index_str,
                          String ping_host_index_str,
                          String ping_type_str)
Plot the ping data with the specified type in a window frame. When all ping values are selected also error-bars in the interval
[avg-min, max-avg]
are plotted.

To be called from JavaScript.

Parameters:
max_date_index_str - The index of the most recent date.
ping_host_index_str - The index of the host from where the ping measurements with all other hosts was done. If the index is less than zero the ping measurements between all possible host combinations are shown.
ping_type_str - The ping type.
 o plotThroughputData
 public void plotThroughputData(String max_date_index_str,
                                String tput_host_index_str)
Plot the throughput data in a window frame.

To be called from JavaScript.

Parameters:
max_date_index_str - The index of the most recent date.
tput_host_index_str - The index of the host from where the throughput measurements with all other hosts was done. If the index is less than zero the ping measurements between all possible host combinattios are shown.
 o plotUDPBWData
 public void plotUDPBWData(String max_date_index_str,
                           String udp_bw_host_index_str,
                           String udp_bw_type_str)
Plot the UDP bandwidth data with the specified type in a window frame.

To be called from JavaScript.

Parameters:
max_date_index_str - The index of the most recent data.
udp_bw_host_index_str - The index of the host from where the UDP bandwidth measurements with all other hosts was done. If the index is less than zero the UDP bandwidth measurements between all possible host combinations are shown.
udp_bw_type_str - The UDP bandwidth type.
 o getPlotControls
 public Component[] getPlotControls()
Return the private plot controls as a component array. This function is part of the ExternPlotControls interface. It is called from the DataPlotWindow class instance.

Note that there are different control for the load data plot and for the net data (ping and throughput) plots. The reason is that at the load data always all plot traces can be plotted.

Returns:
The plot control component array.
 o plotControlAction
 public boolean plotControlAction(Event event,
                                  Object object)
Handle an action event at one of the private plot controls. Return if the action event indeed did occur at one of the plot controls. This function is part of the ExternPlotControls interface. It is called from the DataPlotWindow class instance.

Parameters:
event - The action event to handle.
object - The target object of the action event.
Returns:
True when the event did occur at one of the plot controls. False when this was not the case.
 o adjustPlotControls
 public void adjustPlotControls()
Adjust the plot controls before the plot frame is shown. This function is part of the ExternPlotControls interface. It is called from the DataPlotWindow class instance.

 o getLoadValue
 public String getLoadValue(String host_index_str,
                            String date_index_str)
Return the load value for the host and date (plus time) at the specified indices. If no value could be found the string "-1" is returned. The value is returned with a new String object.

To be called from JavaScript.

Parameters:
host_index_str - The index of the host.
date_index_str - The index of the date (and time).
Returns:
The load value.
 o getPingValue
 public String getPingValue(String host_1_index_str,
                            String host_2_index_str,
                            String date_index_str,
                            String ping_type_str)
Return the ping value with the specified type from the connection between the specified hosts and at the specified date (plus time). All variables are referenced by their indices. The ping value is returned with a new String object. When no value could be found:

To be called from JavaScript.

Parameters:
host_1_index_str - The index of the first host. This host should be lexically smaller than the second host.
host_2_index_str - The index of the second host.
date_index_str - The index of the date (and time).
ping_type_str - The ping type: min, avg, max, all.
Returns:
The ping value from the specified type.
 o getPingValue
 public String getPingValue(String host_1_index_str,
                            String host_2_index_str,
                            String date_index_str,
                            String ping_type_str,
                            String net_type)
Return the ping value with the specified type from the connection between the specified hosts, at the specified date (plus time) and with the specified net type. The ping value is returned with a new String object. All variables are referenced by their indices. When no value could be found:

To be called from JavaScript.

Parameters:
host_1_index_str - The index of the first host. This host should be lexically smaller than the second host.
host_2_index_str - The index of the second host.
date_index_str - The index of the date (and time).
ping_type_str - The ping type: min, avg, max, all.
net_type - The net type.
Returns:
The ping value from the specified type.
 o getThroughputValue
 public String getThroughputValue(String host_1_index_str,
                                  String host_2_index_str,
                                  String date_index_str)
Return the throughput value from the connection between the specified hosts and at the specified date (plus time). All variables are referenced by their indices. The throughput value is returned with a new String object. When no value could be found:

To be called from JavaScript.

Parameters:
host_1_index_str - The index of the first host. This host should be lexically smaller than the second host.
host_2_index_str - The index of the second host.
date_index_str - The index of the date (and time).
Returns:
The throughput value.
 o getThroughputValue
 public String getThroughputValue(String host_1_index_str,
                                  String host_2_index_str,
                                  String date_index_str,
                                  String net_type)
Return the throughput value from the connection between the specified hosts, at the specified date (plus time) and with the specified net type. All variables are referenced by their indices. The empty string is returned when no value could be found. The value is returned with a new String object.

To be called from JavaScript.

Parameters:
host_1_index_str - The index of the first host. This host should be lexically smaller than the second host.
host_2_index_str - The index of the second host.
date_index_str - The index of the date (and time).
net_type - The net type.
Returns:
The throughput value.
 o getUDPBWValue
 public String getUDPBWValue(String host_1_index_str,
                             String host_2_index_str,
                             String date_index_str,
                             String udp_bw_type_str)
Return the UDP bandwidth value with the specified type from the connection between the specified hosts and at the specified date (plus time). All variables are referenced by their indices. The UDP bandwidth value is returned with a new String object. When no value could be found:

To be called from JavaScript.

Parameters:
host_1_index_str - The index of the first host. This should be lexically smaller than the second host.
host_2_index_str - The index of the second host.
date_index_str - The index of the date (and time).
udp_bw_type_str - The UDP bandwidth type: receive date rate, percentage frames lost.
Returns:
The UDP bandwidth value from the specified type.
 o getUDPBWValue
 public String getUDPBWValue(String host_1_index_str,
                             String host_2_index_str,
                             String date_index_str,
                             String udp_bw_type_str,
                             String net_type)
Return the UDP bandwidth value with the specified type from the connection between the specified hosts, at the specified date (plus time) and with the specified net type. The UDP bandwidth value is returned with a new String object. All variables are referenced by their indices. When no value could be found:

To be called from JavaScript.

Parameters:
host_1_index_str - The index of the first host. This host should be lexically smaller than the second host.
host_2_index_str - The index of the second host.
date_index_str - The index of the date and time.
udp_bw_type_str - The UDP bandwidth type: receive date rate, percentage frames lost.
net_type - The net type.
Returns:
The UDP bandwidth value from the specified type.
 o hasSkippedConnections
 public String hasSkippedConnections()
This function returns if there are skipped connections. It is returned with a new String object.

To be called from JavaScript.

Returns:
The boolean string "true" when there are skipped connections; "false" otherwise.
 o getParameterInfo
 public String[][] getParameterInfo()
Return the Applet parameter information. The super class parameter information is returned to which the parameter information of this class is added.

Returns:
The parameter information.
Overrides:
getParameterInfo in class PlotApplet