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:
- Red when no data are loaded yet, or the data could not be
loaded.
- Yellow when the net data are being loaded. The light is:
- Blinking when the loading is continuing.
- Stationary when we have to wait for the Web server or
when the loading is very slow.
- Green when the net data are loaded.
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".
-
is_started
- This class instance variable displays the state when the applet
has been started for the first time.
-
NetData()
-
-
adjustPlotControls()
- Adjust the plot controls before the plot frame is shown.
-
destroy()
- Overload the
destroy()
method of the
PlotApplet
class.
-
doReadData()
- Return if at the moment the net data thread is reading data.
-
getDataTypeIndex()
- Get the current data type index as a string.
-
getDataTypeSelectID()
- Get the selected file ID of the current data type as a string.
-
getDate(String)
- Return the (day part of the) date at the specified index in the
date array.
-
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.
-
getDateID(String, String)
- Return the date ID of the date interval with the specified index
from the data type with the specified index.
-
getHost(String)
- Return the host at the specified index in the host array.
-
getHostTitle(String)
- Return of the host title sepcified with its index.
-
getInetTitle()
- Get the title of the network performance tests along the
"usual" Internet route.
-
getLoadValue(String, String)
- Return the load value for the host and date (plus time) at the
specified indices.
-
getNrDates()
- Return the # dates which are found in all net data.
-
getNrHosts()
- Return the # hosts which are read from the data file.
-
getNrSelectDates(String)
- Return the # dates for which select date data files are
available.
-
getOneDirect()
- Return if one-directional or two-directional connections are
used.
-
getParameterInfo()
- Return the Applet parameter information.
-
getPeriod()
- Get the period [m] between two dates.
-
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).
-
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.
-
getPlotControls()
- Return the private plot controls as a component array.
-
getPlotHeight()
- Return the height of the plot canvas parsed as a string.
-
getPlotWidth()
- Return the width of the plot canvas parsed as a string.
-
getQoSAndInet()
- Return if besides tests over the "usual" Internet
connction also tests over Quality-of-Service connections should
be performed.
-
getQoSTitle()
- Get the title of the Quality-of-Service network performance
tests.
-
getSetTitle()
- Get the title of the hosts set.
-
getThroughputValue(String, String, String)
- Return the throughput value from the connection between the
specified hosts and at the specified date (plus time).
-
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.
-
getTimeOrDateID(String)
- Return the time or week/day ID at the specified index in the
time array.
-
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).
-
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.
-
getUseUDPBW()
- Return if UDP bandwidth measurements should be performed.
-
hasSkippedConnections()
- This function returns if there are skipped connections.
-
init()
- Initialise the
NetData
Applet.
-
isFulfilled()
- This function implements the
isFulfilled()
method
from the BlinkChecker
interface.
-
isSkippedConnection(String, String, String)
- Return if the connection, specified by the host indices and the
network type, is skipped.
-
plotControlAction(Event, Object)
- Handle an action event at one of the private plot controls.
-
plotLoadData(String)
- Plot the load data in a window frame.
-
plotPingData(String, String, String)
- Plot the ping data with the specified type in a window frame.
-
plotShowed()
- Returns the string "true" when a plot frame is showed;
the string "false" is returned when no plot is
displayed.
-
plotThroughputData(String, String)
- Plot the throughput data in a window frame.
-
plotUDPBWData(String, String, String)
- Plot the UDP bandwidth data with the specified type in a window
frame.
-
run()
- Implements the run method of the thread for the functions that
could not run (for some browsers) under JavaScript.
-
setNetData(String)
- Set the net data, but only when curently no data are being read.
-
setNewPlotSize(String, String)
- Set the sizes of the plot canvas which are used when a new plot
window is showed.
-
start()
- Overload the
start()
method of the
PlotApplet
class to:
- Call
super.start()
.
- Call the
start()
method of the
Signal
class instance which is used to handle
the signal blink thread.
- 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.
-
stop()
- Overload the
stop()
method of the
PlotApplet
class.
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.
NetData
public NetData()
init
public void init()
- Initialise the
NetData
Applet. The
init()
method of the PlotApplet
class
is overloaded.
- Overrides:
- init in class Applet
start
public void start()
- Overload the
start()
method of the
PlotApplet
class to:
- Call
super.start()
.
- Call the
start()
method of the
Signal
class instance which is used to handle
the signal blink thread.
- 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.
- Mark that this Applet has been started for the first
time.
- Overrides:
- start in class PlotApplet
- See Also:
- start, stop, destroy
stop
public void stop()
- Overload the
stop()
method of the
PlotApplet
class. This is done to:
- Call the
stop()
method of the
Signal
class instance which is used to handle
the signal blink thread.
- 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.
- Dispose an existing plot frame.
- Overrides:
- stop in class PlotApplet
- See Also:
- stop, start, destroy
destroy
public void destroy()
- Overload the
destroy()
method of the
PlotApplet
class. This is done to:
- Call the
destroy()
method of the
Signal
class instance which is used to handle
the signal blink thread.
- Quit the thread which is used for commands that could not be
run (for all browsers) from JavaScript.
- Overrides:
- destroy in class PlotApplet
- See Also:
- destroy, start, stop
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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:
- Reading the net data from the corresponding data file, when
needed. When the data where read, or an execption did occur
which stopped the data reading the state flag is marked
corresposingly.
- Show the plot window.
Jump from this method when a QuitException
has been
thrown.
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:
- The first time the half of the required # lines are
read.
- 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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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:
- The string "-10" is returned when the connection is
skipped.
- The string "-1" is returned when the connection is
not skipped.
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.
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:
- The string "-10" is returned when the connection is
skipped.
- The string "-1" is returned when the connection is
not skipped.
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.
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:
- The string "-10" is returned when the connection is
skipped.
- The string "-1" is returned when the connection is
not skipped.
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.
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.
- The string "-10" is returned when the connection is
skipped.
- The string "-1" is returned when the connection is
not skipped.
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.
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:
- The string "-10" is returned when the connection is
skipped.
- The string "-1" is returned when the connection is
not skipped.
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.
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:
- The string "-10" is returned when the connection is
skipped.
- The string "-1" is returned when the connection is
not skipped.
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.
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.
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