Skip to Content.
Sympa Menu

perfsonar-dev - perfsonar: r5390 - in branches/perfsonarui/src/org/perfsonar/perfsonarui/bwctl: . data ui

Subject: perfsonar development work

List archive

perfsonar: r5390 - in branches/perfsonarui/src/org/perfsonar/perfsonarui/bwctl: . data ui


Chronological Thread 
  • From:
  • To:
  • Subject: perfsonar: r5390 - in branches/perfsonarui/src/org/perfsonar/perfsonarui/bwctl: . data ui
  • Date: Wed, 9 Dec 2009 05:38:46 -0500

Author: nemanja.zutic
Date: 2009-12-09 05:38:46 -0500 (Wed, 09 Dec 2009)
New Revision: 5390

Added:

branches/perfsonarui/src/org/perfsonar/perfsonarui/bwctl/BWCTLHistoryData.java

branches/perfsonarui/src/org/perfsonar/perfsonarui/bwctl/BWCTLHistoryMetaRequest.java

branches/perfsonarui/src/org/perfsonar/perfsonarui/bwctl/BWCTLHistoryRequest.java
branches/perfsonarui/src/org/perfsonar/perfsonarui/bwctl/data/

branches/perfsonarui/src/org/perfsonar/perfsonarui/bwctl/data/HistoricalData.java

branches/perfsonarui/src/org/perfsonar/perfsonarui/bwctl/data/HistoricalInterval.java

branches/perfsonarui/src/org/perfsonar/perfsonarui/bwctl/data/HistoricalMeasurement.java

branches/perfsonarui/src/org/perfsonar/perfsonarui/bwctl/data/HistoricalMetadata.java

branches/perfsonarui/src/org/perfsonar/perfsonarui/bwctl/data/HistoricalSample.java

branches/perfsonarui/src/org/perfsonar/perfsonarui/bwctl/data/MeasurementData.java

branches/perfsonarui/src/org/perfsonar/perfsonarui/bwctl/data/MeasurementSample.java

branches/perfsonarui/src/org/perfsonar/perfsonarui/bwctl/data/MetadataPair.java

branches/perfsonarui/src/org/perfsonar/perfsonarui/bwctl/data/RTTDelays.java
branches/perfsonarui/src/org/perfsonar/perfsonarui/bwctl/ui/

branches/perfsonarui/src/org/perfsonar/perfsonarui/bwctl/ui/BWCTLGraphPanel.java

branches/perfsonarui/src/org/perfsonar/perfsonarui/bwctl/ui/BWCTLHistoryGraphPanel.java

branches/perfsonarui/src/org/perfsonar/perfsonarui/bwctl/ui/BWCTLHistoryMetadataPanel.java

branches/perfsonarui/src/org/perfsonar/perfsonarui/bwctl/ui/BWCTLHistoryMetadataPanelLooker.java

branches/perfsonarui/src/org/perfsonar/perfsonarui/bwctl/ui/BWCTLHistoryTimeControlPanel.java
Removed:

branches/perfsonarui/src/org/perfsonar/perfsonarui/bwctl/BWCTLGraphPanel.java
branches/perfsonarui/src/org/perfsonar/perfsonarui/bwctl/RTTDelays.java
Modified:

branches/perfsonarui/src/org/perfsonar/perfsonarui/bwctl/BWCTLMainComponent.java

branches/perfsonarui/src/org/perfsonar/perfsonarui/bwctl/BWCTLPerfsonarTab.java
branches/perfsonarui/src/org/perfsonar/perfsonarui/bwctl/BWCTLRequest.java
branches/perfsonarui/src/org/perfsonar/perfsonarui/bwctl/RTTRequest.java
Log:
Changes to the psUI BWCTL tab. Added functionality to work with BWCTL MA.

Deleted:
branches/perfsonarui/src/org/perfsonar/perfsonarui/bwctl/BWCTLGraphPanel.java

Added:
branches/perfsonarui/src/org/perfsonar/perfsonarui/bwctl/BWCTLHistoryData.java

Added:
branches/perfsonarui/src/org/perfsonar/perfsonarui/bwctl/BWCTLHistoryMetaRequest.java

Added:
branches/perfsonarui/src/org/perfsonar/perfsonarui/bwctl/BWCTLHistoryRequest.java

Modified:
branches/perfsonarui/src/org/perfsonar/perfsonarui/bwctl/BWCTLMainComponent.java
===================================================================
---
branches/perfsonarui/src/org/perfsonar/perfsonarui/bwctl/BWCTLMainComponent.java
2009-12-09 10:29:43 UTC (rev 5389)
+++
branches/perfsonarui/src/org/perfsonar/perfsonarui/bwctl/BWCTLMainComponent.java
2009-12-09 10:38:46 UTC (rev 5390)
@@ -1,601 +1,671 @@
-package org.perfsonar.perfsonarui.bwctl;
-
-import java.awt.Component;
-import java.awt.Dimension;
-import java.awt.GridBagConstraints;
-import java.awt.GridBagLayout;
-import java.awt.GridLayout;
-import java.awt.Insets;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.net.URL;
-import java.text.NumberFormat;
-import java.util.Hashtable;
-
-import javax.swing.BorderFactory;
-import javax.swing.ButtonGroup;
-import javax.swing.ButtonModel;
-import javax.swing.JFormattedTextField;
-import javax.swing.JLabel;
-import javax.swing.JOptionPane;
-import javax.swing.JPanel;
-import javax.swing.JPasswordField;
-import javax.swing.JRadioButton;
-import javax.swing.JScrollPane;
-import javax.swing.JSeparator;
-import javax.swing.JTextArea;
-import javax.swing.JTextField;
-import javax.swing.SwingConstants;
-
-import org.perfsonar.perfsonarui.plugins.IPerfsonarTab;
-import org.perfsonar.perfsonarui.plugins.MAEndpoint;
-import org.perfsonar.perfsonarui.plugins.MAEndpointList;
-import org.perfsonar.perfsonarui.ui.PluginMainPanel;
-
-/**
- * BWCTL visualization for perfSonarUI
- * @author Roland Karch

- */
-
-public class BWCTLMainComponent extends PluginMainPanel
- implements ActionListener
-{
- private static final long serialVersionUID = 1016070292100053577L;
-
- protected Hashtable<String,String> namePairs = new
Hashtable<String,String>();
-
- protected String sourceName;
-
- protected String destinationName;
-
- protected JTextField sourceAddress;
- protected JLabel sourceAddressLabel;
-
- protected JTextField destinationAddress;
- protected JLabel destinationAddressLabel;
-
- protected JSeparator leftRightDivider;
-
- protected JRadioButton addressTypeIPV4;
- protected JRadioButton addressTypeIPV6;
- protected ButtonGroup addressType;
- protected JLabel addressTypeLabel;
-
- protected JSeparator addressSeparator;
-
- protected JRadioButton protocolTCP;
- protected JRadioButton protocolUDP;
- protected ButtonGroup protocol;
- protected JLabel protocolLabel;
-
- protected JTextField windowSize;
- protected JLabel windowSizeLabel;
-
- protected JFormattedTextField userRTT;
- protected JLabel userRTTLabel;
-
- protected JTextField bufferSize;
- protected JLabel bufferSizeLabel;
-
- protected JTextField bandwidth;
- protected JLabel bandwidthLabel;
-
- protected JSeparator transportSeparator;
-
- protected JTextField interval;
- protected JLabel intervalLabel;
-
- protected JTextField duration;
- protected JLabel durationLabel;
-
- protected JTextField tos;
- protected JLabel tosLabel;
-
- protected JSeparator loginSeparator;
-
- protected JTextField login;
- protected JLabel loginLabel;
-
- protected JPasswordField password;
- protected JLabel passwordLabel;
-
- protected JSeparator infoLabelSeparator;
-
- protected JLabel infoLabelLine1;
- protected JLabel infoLabelLine2;
-
- protected JSeparator resultSeparator;
-
- protected JTextArea result;
-
- protected BWCTLGraphPanel graph;
-
- protected boolean secondRTTrequest = false;
-
- public BWCTLMainComponent(Component parentComponent, IPerfsonarTab
psModel) {
- super(parentComponent, psModel, new GridLayout());
- namePairs.put("ARNES_Ljubljana_JRA1", "Ljubljana_ARNES");
- namePairs.put("BELNET_Gent_JRA1","Gent_BELNET");
- namePairs.put("CARNET_Zagreb_JRA1", "Zagreb_CARNET");
- namePairs.put("CESNET_Prague_JRA1", "Prague_CESNET");
- namePairs.put("FCCN_Lisbon_JRA1", "Lisbon_FCCN");
- namePairs.put("GARR_Bologna_JRA1", "Bologna_GARR");
- namePairs.put("GARR_Rome_JRA1", "none");
- namePairs.put("GRNET_Athens_JRA1", "Athens_GRNET");
- namePairs.put("GRNET_Thessaloniki_JRA1",
"Thessaloniki_GRNET");
- namePairs.put("Hungarnet_Budapest_JRA1",
"Budapest_HUNGARNET");
- namePairs.put("ISTF_Sofia_JRA1", "Sofia_ISTF");
- namePairs.put("RENATER_Paris_JRA1", "none");
- namePairs.put("SURFNet_Amsterdam_JRA1", "Amsterdam_SURFnet");
- namePairs.put("PSNC_Poznan_JRA1", "Poznan_PSNC");
- namePairs.put("UNINet_Tromsoe_JRA1", "Tromso_UNINet");
- }
-
-
- public void addWidgets() {
- JPanel panel = new JPanel();
- GridBagConstraints constraints;
- this.setLayout(new GridLayout());
- panel.setLayout(new GridBagLayout());
- constraints = new GridBagConstraints();
- constraints.fill = GridBagConstraints.BOTH;
- constraints.insets = new Insets(2,2,2,2);
-
- leftRightDivider = new JSeparator(SwingConstants.VERTICAL);
- constraints.gridx = 2;
- constraints.gridy = 0;
- constraints.gridheight = 8;
- panel.add(leftRightDivider, constraints);
- constraints.gridheight = 1;
- sourceAddress = new JTextField(getEndpointHost(
- model.getEndpointList()));
-
- constraints.gridx = 4;
- constraints.gridy = 0;
- panel.add(sourceAddress, constraints);
-
- sourceAddressLabel = new JLabel("Source Address");
- sourceAddressLabel.setLabelFor(sourceAddress);
- constraints.gridx -= 1;
- panel.add(sourceAddressLabel, constraints);
-
- destinationAddress = new JTextField("");
-
- constraints.gridx = 4;
- constraints.gridy = 1;
- panel.add(destinationAddress, constraints);
-
- destinationAddressLabel = new JLabel("Destination Address");
- destinationAddressLabel.setLabelFor(destinationAddress);
- constraints.gridx -= 1;
- panel.add(destinationAddressLabel, constraints);
-
- addressTypeIPV4 = new JRadioButton("IPv4");
- addressTypeIPV4.setSelected(true);
- addressTypeIPV4.setActionCommand("ipv4");
-
- addressTypeIPV6 = new JRadioButton("IPv6");
- addressTypeIPV6.setActionCommand("ipv6");
-
- addressType = new ButtonGroup();
- addressType.add(addressTypeIPV4);
- addressType.add(addressTypeIPV6);
-
- constraints.gridx = 1;
- constraints.gridy = 0;
- panel.add(addressTypeIPV4, constraints);
- constraints.gridy = 1;
- panel.add(addressTypeIPV6, constraints);
-
- addressTypeLabel = new JLabel("Address type");
- addressTypeLabel.setLabelFor(addressTypeIPV4);
- constraints.gridx = 0;
- constraints.gridy = 0;
- panel.add(addressTypeLabel, constraints);
-
- addressSeparator = new JSeparator();
- constraints.gridx = 0;
- constraints.gridy = 2;
- constraints.gridwidth = 5;
- panel.add(addressSeparator, constraints);
- constraints.gridwidth = 1;
-
- protocolTCP = new JRadioButton("TCP");
- protocolTCP.setSelected(true);
- protocolTCP.setActionCommand("TCP");
- protocolTCP.addActionListener(this);
-
- protocolUDP = new JRadioButton("UDP");
- protocolUDP.setActionCommand("UDP");
- protocolUDP.addActionListener(this);
-
- protocol = new ButtonGroup();
- protocol.add(protocolTCP);
- protocol.add(protocolUDP);
-
- constraints.gridx = 1;
- constraints.gridy = 3;
- panel.add(protocolTCP, constraints);
- constraints.gridy = 4;
- panel.add(protocolUDP, constraints);
-
- protocolLabel = new JLabel("Transport layer");
- addressTypeLabel.setLabelFor(protocolTCP);
- constraints.gridx = 0;
- constraints.gridy = 3;
- panel.add(protocolLabel, constraints);
-
- windowSize = new JTextField("");
- constraints.gridx = 4;
- constraints.gridy = 3;
- panel.add(windowSize, constraints);
-
- windowSizeLabel = new JLabel("TCP Window Size (bytes)");
- constraints.gridx -= 1;
- windowSizeLabel.setLabelFor(windowSize);
- panel.add(windowSizeLabel, constraints);
-
- userRTT = new
JFormattedTextField(NumberFormat.getNumberInstance());
- constraints.gridx = 4;
- constraints.gridy = 4;
- userRTT.setToolTipText("Note: Either enter RTT manually " +
- "or retrieve it using IPPM OneWayDelay
requsets "+
- "by clicking 'Estimate RTT' command");
- panel.add(userRTT, constraints);
-
- userRTTLabel = new JLabel("RTT (ms)");
- constraints.gridx -= 1;
- userRTTLabel.setLabelFor(userRTT);
- panel.add(userRTTLabel, constraints);
-
-
- bufferSize = new JTextField("");
- constraints.gridx = 4;
- constraints.gridy = 3;
- bufferSize.setVisible(false);
- panel.add(bufferSize, constraints);
-
- bufferSizeLabel = new JLabel("UDP Buffer Size (bytes)");
- constraints.gridx -= 1;
- bufferSizeLabel.setLabelFor(bufferSize);
- bufferSizeLabel.setVisible(false);
- panel.add(bufferSizeLabel, constraints);
-
- bandwidth = new JTextField("");
- constraints.gridx = 4;
- constraints.gridy = 4;
- bandwidth.setVisible(false);
- panel.add(bandwidth, constraints);
-
- bandwidthLabel = new JLabel("Maximum Bandwidth (bps)");
- constraints.gridx -= 1;
- bandwidthLabel.setLabelFor(bandwidth);
- bandwidthLabel.setVisible(false);
- panel.add(bandwidthLabel, constraints);
-
- transportSeparator = new JSeparator();
- constraints.gridx = 0;
- constraints.gridy = 5;
- constraints.gridwidth = 5;
- panel.add(transportSeparator, constraints);
- constraints.gridwidth = 1;
-
- duration = new JTextField("");
- duration.setToolTipText("Warning: Measurement requests will "
+
- "need AT LEAST as long as specified here to return " +
- "results!");
- constraints.gridx = 1;
- constraints.gridy = 6;
- panel.add(duration, constraints);
-
- durationLabel = new JLabel("Test Duration (s)");
- constraints.gridx -= 1;
- windowSizeLabel.setLabelFor(duration);
- panel.add(durationLabel, constraints);
-
- interval = new JTextField("");
- constraints.gridx = 4;
- constraints.gridy = 6;
- panel.add(interval, constraints);
-
- intervalLabel = new JLabel("Reporting Interval (s)");
- constraints.gridx -= 1;
- intervalLabel.setLabelFor(interval);
- panel.add(intervalLabel, constraints);
-
- tos = new JTextField("");
- constraints.gridx = 1;
- constraints.gridy = 7;
- panel.add(tos, constraints);
-
- tosLabel = new JLabel("Type of Service bits");
- constraints.gridx -= 1;
- tosLabel.setLabelFor(tos);
- panel.add(tosLabel, constraints);
-
- loginSeparator = new JSeparator();
- constraints.gridx = 0;
- constraints.gridy = 8;
- constraints.gridwidth = 5;
- panel.add(loginSeparator, constraints);
- constraints.gridwidth = 1;
-
- login = new JTextField("");
- constraints.gridx = 1;
- constraints.gridy = 9;
- panel.add(login, constraints);
-
- loginLabel = new JLabel("BWCTL Login");
- constraints.gridx -= 1;
- loginLabel.setLabelFor(login);
- panel.add(loginLabel, constraints);
-
- password = new JPasswordField();
- constraints.gridx = 4;
- panel.add(password, constraints);
-
- passwordLabel = new JLabel("Password");
- constraints.gridx -= 1;
- passwordLabel.setLabelFor(password);
- panel.add(passwordLabel, constraints);
-
- resultSeparator = new JSeparator();
- constraints.gridx = 0;
- constraints.gridy = 10;
- constraints.gridwidth = 5;
- panel.add(resultSeparator, constraints);
- //constraints.gridwidth = 1;
-
- infoLabelLine1 = new JLabel("Click 'Estimate RTT' to get the
estimated RTT between two points (based on IPPM OWD)");
- constraints.gridx = 0;
- constraints.gridy = 11;
- constraints.gridwidth = 5;
- constraints.fill = GridBagConstraints.HORIZONTAL;
- panel.add(infoLabelLine1, constraints);
-
- infoLabelLine2 = new JLabel(" ");
- constraints.gridx = 0;
- constraints.gridy = 12;
- constraints.gridwidth = 5;
- constraints.fill = GridBagConstraints.HORIZONTAL;
- panel.add(infoLabelLine2, constraints);
-
- infoLabelSeparator = new JSeparator();
- constraints.gridx = 0;
- constraints.gridy = 13;
- constraints.gridwidth = 5;
- panel.add(infoLabelSeparator, constraints);
-
- result = new JTextArea("Result");
- result.setBorder(BorderFactory.createEtchedBorder());
- constraints.gridx = 0;
- constraints.gridy = 14;
- constraints.gridwidth = 5;
- constraints.fill = GridBagConstraints.BOTH;
- //result.setAutoscrolls(true);
-
- JScrollPane sp = new JScrollPane(result);
- sp.setBorder(BorderFactory.createTitledBorder("Result"));
- result.setWrapStyleWord(true);
-// sp.setPreferredSize(new Dimension(200,200));
- panel.add(sp, constraints);
-
- graph = new BWCTLGraphPanel(this);
- constraints.gridx = 0;
- constraints.gridy = 15;
- constraints.gridwidth = 5;
- constraints.fill = GridBagConstraints.BOTH;
-// graph.setPreferredSize(new Dimension(200,300));
- panel.add(graph,constraints);
-
- Dimension d = new Dimension(128,20);
-// sourceAddress.setMinimumSize(d);
-// sourceAddress.setPreferredSize(d);
-// destinationAddress.setMinimumSize(d);
-// destinationAddress.setPreferredSize(d);
- duration.setMinimumSize(d);
- duration.setPreferredSize(d);
- interval.setMinimumSize(d);
- interval.setPreferredSize(d);
-
-// d = new Dimension(600,600);
-// setPreferredSize(d);
- JScrollPane mainSrcPane = new JScrollPane(panel);
- add(mainSrcPane);
- }
-
- public String getAddressType()
- {
- ButtonModel selected;
-
- selected = addressType.getSelection();
- return selected.getActionCommand();
- }
-
- public String getProtocol()
- {
- ButtonModel selected;
-
- selected = protocol.getSelection();
- return selected.getActionCommand();
- }
-
- public void updateSource()
- {
- MAEndpointList endpoints;
- MAEndpoint endpoint;
-
- endpoints = model.getEndpointList();
- sourceAddress.setText(getEndpointHost(endpoints));
- sourceName = getEndpointName(endpoints);
- ((BWCTLPerfsonarTab)model).endpointSrcIndex = -1;
- for (int i = 0; i < endpoints.size(); i++)
- {
- endpoint = endpoints.get(i);
- if (endpoint.isEnabled())
- {
- model.getUserData().setEndpoint(endpoint);
- ((BWCTLPerfsonarTab)model).endpointSrcIndex =
i;
- break;
- }
- }
- resetRTTData();
- }
-
- public void updateDestination()
- {
- MAEndpointList endpoints;
-
- endpoints = model.getEndpointList();
- destinationAddress.setText(getEndpointHost(endpoints));
- destinationName = getEndpointName(endpoints);
- ((BWCTLPerfsonarTab)model).endpointDstIndex = -1;
- for(int i = 0; i < endpoints.size(); i++){
- if(endpoints.get(i).isEnabled()){
- ((BWCTLPerfsonarTab)model).endpointDstIndex =
i;
- break;
- }
- }
- resetRTTData();
- }
-
- public String getSourceName() {
- return namePairs.get(sourceName);
- }
-
- public String getDestinationName() {
- return namePairs.get(destinationName);
- }
-
- public String getEndpointHost(MAEndpointList endpoints)
- {
- if (endpoints == null)
- {
- return null;
- }
-
- for (int i = 0; i < endpoints.size(); i++)
- {
- MAEndpoint endpoint;
- URL address;
-
- endpoint = endpoints.get(i);
- if (! endpoint.isEnabled())
- {
- continue;
- }
-
- try
- {
- address = new URL(endpoint.getEndpoint());
- }
- catch (java.net.MalformedURLException e)
- {
- logger.error("Malformed URL: " + e);
- return null;
- }
- /* Needs a bit more work for IPv6
- * service addresses, see RFC 2732.
- */
- return address.getHost();
- }
-
- /* No active endpoint */
- return null;
- }
-
- public String getEndpointName(MAEndpointList endpoints)
- {
- if (endpoints == null)
- {
- return null;
- }
-
- for (int i = 0; i < endpoints.size(); i++)
- {
- MAEndpoint endpoint;
- String name;
-
- endpoint = endpoints.get(i);
- if (! endpoint.isEnabled())
- {
- continue;
- }
-
- name = endpoint.getTitle();
-
- /* Needs a bit more work for IPv6
- * service addresses, see RFC 2732.
- */
- return name;
- }
-
- /* No active endpoint */
- return null;
- }
-
- public void actionPerformed(ActionEvent event)
- {
- if (event == null) return;
-
- if (event.getActionCommand().equals("TCP"))
- {
- bufferSize.setVisible(false);
- bufferSizeLabel.setVisible(false);
- bandwidth.setVisible(false);
- bandwidthLabel.setVisible(false);
- windowSize.setVisible(true);
- windowSizeLabel.setVisible(true);
- userRTT.setVisible(true);
- userRTTLabel.setVisible(true);
- resetRTTData();
- return;
- }
- if (event.getActionCommand().equals("UDP"))
- {
- windowSize.setVisible(false);
- windowSizeLabel.setVisible(false);
- userRTT.setVisible(false);
- userRTTLabel.setVisible(false);
- bufferSize.setVisible(true);
- bufferSizeLabel.setVisible(true);
- bandwidth.setVisible(true);
- bandwidthLabel.setVisible(true);
- resetRTTData();
- }
- }
- public void resetRTTData(){
- userRTT.setValue(0.0);
- infoLabelLine1.setText("Click 'Estimate RTT' to get the
estimated RTT between two points (based on IPPM OWD)");
- infoLabelLine2.setText(" ");
- }
-
- public void clearInfoLabels(){
- infoLabelLine1.setText(" ");
- infoLabelLine2.setText(" ");
- }
-
- public void addValueToGraph(double time, double value){
- graph.setChartValue(time, value);
- }
-
- public void addAverageToGraph(double startTime, double endTime,
double value){
- graph.setAverageValue(startTime, endTime, value);
- }
-
- public void clearGraph(){
- graph.clearChart();
- }
-
- public void showRTTNotice(){
- String message = "Estimate RTT functionality is limited to a
set of predefined measurement points.\nOne or both of the selected MP is not
in that set and RTT cannot be estimated.\nPlease enter RTT manualy";
- String title = "NOTE";
- if(secondRTTrequest){
-
JOptionPane.showMessageDialog(this,message,title,JOptionPane.INFORMATION_MESSAGE);
- infoLabelLine1.setText("Please enter the estimated
RTT manualy");
- infoLabelLine2.setText(" ");
- secondRTTrequest = false;
- }
- else secondRTTrequest = true;
- }
-}
+package org.perfsonar.perfsonarui.bwctl;
+
+import java.awt.BorderLayout;
+import java.awt.Component;
+import java.awt.Dimension;
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.Insets;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.net.URL;
+import java.text.NumberFormat;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Hashtable;
+
+import javax.swing.ButtonGroup;
+import javax.swing.ButtonModel;
+import javax.swing.JComponent;
+import javax.swing.JDialog;
+import javax.swing.JFormattedTextField;
+import javax.swing.JLabel;
+import javax.swing.JOptionPane;
+import javax.swing.JPanel;
+import javax.swing.JPasswordField;
+import javax.swing.JRadioButton;
+import javax.swing.JScrollPane;
+import javax.swing.JSeparator;
+import javax.swing.JTabbedPane;
+import javax.swing.JTextArea;
+import javax.swing.JTextField;
+import javax.swing.SwingConstants;
+import javax.swing.WindowConstants;
+
+import org.jdesktop.swingx.JXPanel;
+import org.perfsonar.perfsonarui.PSLogger;
+import org.perfsonar.perfsonarui.bwctl.data.HistoricalMetadata;
+import org.perfsonar.perfsonarui.bwctl.data.MeasurementData;
+import org.perfsonar.perfsonarui.bwctl.data.MetadataPair;
+import org.perfsonar.perfsonarui.bwctl.ui.BWCTLGraphPanel;
+import org.perfsonar.perfsonarui.bwctl.ui.BWCTLHistoryGraphPanel;
+import org.perfsonar.perfsonarui.bwctl.ui.BWCTLHistoryMetadataPanelLooker;
+import org.perfsonar.perfsonarui.bwctl.ui.BWCTLHistoryTimeControlPanel;
+import org.perfsonar.perfsonarui.plugins.IPerfsonarTab;
+import org.perfsonar.perfsonarui.plugins.MAEndpoint;
+import org.perfsonar.perfsonarui.plugins.MAEndpointList;
+import org.perfsonar.perfsonarui.ui.PluginMainContainer;
+import org.perfsonar.perfsonarui.ui.actions.PSUIAction;
+
+public class BWCTLMainComponent extends PluginMainContainer implements
ActionListener{
+ private static final long serialVersionUID = 1016070292100053577L;
+
+ protected Hashtable<String,String> namePairs = new
Hashtable<String,String>();
+ protected HistoricalMetadata historicalPairs = new
HistoricalMetadata();
+
+ protected String sourceName;
+ protected String destinationName;
+
+ protected JTextField sourceAddress;
+ protected JLabel sourceAddressLabel;
+
+ protected JTextField destinationAddress;
+ protected JLabel destinationAddressLabel;
+
+ protected JRadioButton addressTypeIPV4;
+ protected JRadioButton addressTypeIPV6;
+ protected ButtonGroup addressType;
+ protected JLabel addressTypeLabel;
+
+ protected JRadioButton protocolTCP;
+ protected JRadioButton protocolUDP;
+ protected ButtonGroup protocol;
+ protected JLabel protocolLabel;
+
+ protected JTextField windowSize;
+ protected JLabel windowSizeLabel;
+
+ protected JFormattedTextField userRTT;
+ protected JLabel userRTTLabel;
+
+ protected JTextField bufferSize;
+ protected JLabel bufferSizeLabel;
+
+ protected JTextField bandwidth;
+ protected JLabel bandwidthLabel;
+
+ protected JTextField interval;
+ protected JLabel intervalLabel;
+
+ protected JTextField duration;
+ protected JLabel durationLabel;
+
+ protected JTextField tos;
+ protected JLabel tosLabel;
+
+ protected JTextField login;
+ protected JLabel loginLabel;
+
+ protected JPasswordField password;
+ protected JLabel passwordLabel;
+
+ protected JSeparator separator1;
+ protected JSeparator separator2;
+ protected JSeparator separator3;
+
+ protected JTextArea result;
+
+ protected BWCTLGraphPanel measurementGraph;
+
+ protected BWCTLHistoryGraphPanel historyGraph;
+ protected JRadioButton chartXY;
+ protected JRadioButton chartBar;
+ protected ButtonGroup chartType;
+ protected BWCTLHistoryTimeControlPanel timeControls;
+
+ protected String expectedMaxBW = "";
+
+ protected boolean secondRTTrequest = false;
+
+ public BWCTLMainComponent(Component parentComponent, IPerfsonarTab
psModel) {
+ super(parentComponent, psModel);
+ namePairs.put("ARNES_Ljubljana_JRA1", "Ljubljana_ARNES");
+ namePairs.put("BELNET_Gent_JRA1","Gent_BELNET");
+ namePairs.put("CARNET_Zagreb_JRA1", "Zagreb_CARNET");
+ namePairs.put("CESNET_Prague_JRA1", "Prague_CESNET");
+ namePairs.put("FCCN_Lisbon_JRA1", "Lisbon_FCCN");
+ namePairs.put("GARR_Bologna_JRA1", "Bologna_GARR");
+ namePairs.put("GARR_Rome_JRA1", "none");
+ namePairs.put("GRNET_Athens_JRA1", "Athens_GRNET");
+ namePairs.put("GRNET_Thessaloniki_JRA1",
"Thessaloniki_GRNET");
+ namePairs.put("Hungarnet_Budapest_JRA1",
"Budapest_HUNGARNET");
+ namePairs.put("ISTF_Sofia_JRA1", "Sofia_ISTF");
+ namePairs.put("RENATER_Paris_JRA1", "none");
+ namePairs.put("SURFNet_Amsterdam_JRA1", "Amsterdam_SURFnet");
+ namePairs.put("PSNC_Poznan_JRA1", "Poznan_PSNC");
+ namePairs.put("UNINet_Tromsoe_JRA1", "Tromso_UNINet");
+ }
+
+ public Collection<JComponent> createComponents() {
+
PSLogger.configureLog4j("/org/perfsonar/perfsonarui/log4.properties");
+ return Arrays.asList(new JComponent[] {createParamsPanel(),
createMeasurementPanel(), createHistoryPanel()});
+ }
+
+ public JXPanel createParamsPanel(){
+ JPanel properties = new JPanel();
+ properties.setLayout(new GridBagLayout());
+ GridBagConstraints constraints = new GridBagConstraints();
+ constraints.fill = GridBagConstraints.BOTH;
+ constraints.insets = new Insets(2,2,2,2);
+
+ Dimension fieldD = new Dimension(100,20);
+ Dimension labelD = new Dimension(135,20);
+
+ addressTypeLabel = new JLabel("Address type");
+ constraints.gridx = 0;
+ constraints.gridy = 0;
+ constraints.gridheight = 1;
+ constraints.gridwidth = 1;
+ properties.add(addressTypeLabel, constraints);
+
+ addressTypeIPV4 = new JRadioButton("IPv4");
+ addressTypeIPV4.setSelected(true);
+ addressTypeIPV4.setActionCommand("ipv4");
+
+ addressTypeIPV6 = new JRadioButton("IPv6");
+ addressTypeIPV6.setActionCommand("ipv6");
+
+ addressType = new ButtonGroup();
+ addressType.add(addressTypeIPV4);
+ addressType.add(addressTypeIPV6);
+
+ constraints.gridx = 1;
+ properties.add(addressTypeIPV4, constraints);
+ constraints.gridx = 2;
+ properties.add(addressTypeIPV6, constraints);
+
+ sourceAddressLabel = new JLabel("Source Address");
+ constraints.gridx = 0;
+ constraints.gridy = 1;
+ properties.add(sourceAddressLabel, constraints);

+
+ sourceAddress = new
JTextField(getEndpointHost(model.getEndpointList()));
+ sourceAddress.setMinimumSize(fieldD);
+ sourceAddress.setPreferredSize(fieldD);
+ constraints.gridx = 1;
+ constraints.gridwidth = 2;
+ properties.add(sourceAddress, constraints);
+
+ destinationAddressLabel = new JLabel("Destination Address");
+ constraints.gridx = 0;
+ constraints.gridy = 2;
+ constraints.gridwidth = 1;
+ properties.add(destinationAddressLabel, constraints);

+
+ destinationAddress = new JTextField("");
+ destinationAddress.setMinimumSize(fieldD);
+ destinationAddress.setPreferredSize(fieldD);
+ constraints.gridx = 1;
+ constraints.gridwidth = 2;
+ properties.add(destinationAddress, constraints);

+
+ separator1 = new JSeparator(JSeparator.VERTICAL);
+ constraints.gridx = 3;
+ constraints.gridy = 0;
+ constraints.gridwidth = 1;
+ constraints.gridheight = 3;
+ properties.add(separator1,constraints);
+
+ protocolLabel = new JLabel("Transport layer");
+ constraints.gridx = 4;
+ constraints.gridy = 0;
+ constraints.gridwidth = 1;
+ constraints.gridheight = 1;
+ properties.add(protocolLabel, constraints);
+
+ protocolTCP = new JRadioButton("TCP");
+ protocolTCP.setSelected(true);
+ protocolTCP.setActionCommand("TCP");
+ protocolTCP.addActionListener(this);
+
+ protocolUDP = new JRadioButton("UDP");
+ protocolUDP.setActionCommand("UDP");
+ protocolUDP.addActionListener(this);
+
+ protocol = new ButtonGroup();
+ protocol.add(protocolTCP);
+ protocol.add(protocolUDP);
+
+ constraints.gridx = 5;
+ properties.add(protocolTCP, constraints);
+ constraints.gridx = 6;
+ properties.add(protocolUDP, constraints);
+
+ windowSizeLabel = new JLabel("TCP Window Size (bytes)");
+ windowSizeLabel.setMinimumSize(labelD);
+ windowSizeLabel.setPreferredSize(labelD);
+ constraints.gridx = 4;
+ constraints.gridy = 1;
+ properties.add(windowSizeLabel, constraints);
+
+ windowSize = new JTextField("");
+ windowSize.setMinimumSize(fieldD);
+ windowSize.setPreferredSize(fieldD);
+ constraints.gridx = 5;
+ constraints.gridwidth = 2;
+ properties.add(windowSize, constraints);
+
+ userRTTLabel = new JLabel("RTT (ms)");
+ userRTTLabel.setMinimumSize(labelD);
+ userRTTLabel.setPreferredSize(labelD);
+ constraints.gridx = 4;
+ constraints.gridy = 2;
+ constraints.gridwidth = 1;
+ properties.add(userRTTLabel, constraints);
+
+ userRTT = new
JFormattedTextField(NumberFormat.getNumberInstance());
+ userRTT.setMinimumSize(fieldD);
+ userRTT.setPreferredSize(fieldD);
+ constraints.gridx = 5;
+ constraints.gridwidth = 2;
+ userRTT.setToolTipText("Note: Either enter RTT manually " +
+ "or retrieve it using IPPM OneWayDelay
requsets "+
+ "by clicking 'Estimate RTT' command");
+ properties.add(userRTT, constraints);
+
+ bufferSizeLabel = new JLabel("UDP Buffer Size (bytes)");
+ bufferSizeLabel.setMinimumSize(labelD);
+ bufferSizeLabel.setPreferredSize(labelD);
+ constraints.gridx = 4;
+ constraints.gridy = 1;
+ constraints.gridwidth = 1;
+ bufferSizeLabel.setVisible(false);
+ properties.add(bufferSizeLabel, constraints);
+
+ bufferSize = new JTextField("");
+ bufferSize.setMinimumSize(fieldD);
+ bufferSize.setPreferredSize(fieldD);
+ constraints.gridx = 5;
+ constraints.gridwidth = 2;
+ bufferSize.setVisible(false);
+ properties.add(bufferSize, constraints);
+
+ bandwidthLabel = new JLabel("Maximum Bandwidth (Mbps)");
+ bandwidthLabel.setMinimumSize(labelD);
+ bandwidthLabel.setPreferredSize(labelD);
+ constraints.gridx = 4;
+ constraints.gridy = 2;
+ constraints.gridwidth = 1;
+ bandwidthLabel.setVisible(false);
+ properties.add(bandwidthLabel, constraints);
+
+ bandwidth = new JTextField("");
+ bandwidth.setMinimumSize(fieldD);
+ bandwidth.setPreferredSize(fieldD);
+ constraints.gridx = 5;
+ constraints.gridwidth = 2;
+ bandwidth.setVisible(false);
+ properties.add(bandwidth, constraints);
+
+ separator2 = new JSeparator(JSeparator.VERTICAL);
+ constraints.gridx = 7;
+ constraints.gridy = 0;
+ constraints.gridheight = 3;
+ constraints.gridwidth = 1;
+ properties.add(separator2, constraints);
+
+ durationLabel = new JLabel("Test Duration (s)");
+ constraints.gridx = 8;
+ constraints.gridy = 0;
+ constraints.gridwidth = 1;
+ constraints.gridheight = 1;
+ properties.add(durationLabel, constraints);
+
+ duration = new JTextField("");
+ duration.setMinimumSize(fieldD);
+ duration.setPreferredSize(fieldD);
+ duration.setToolTipText("Warning: Measurement requests will "
+
+ "need AT LEAST as long as specified here to return " +
+ "results!");
+ constraints.gridx = 9;
+ constraints.gridwidth = 2;
+ properties.add(duration, constraints);
+
+ intervalLabel = new JLabel("Reporting Interval (s)");
+ constraints.gridx = 8;
+ constraints.gridy = 1;
+ constraints.gridwidth = 1;
+ properties.add(intervalLabel, constraints);
+
+ interval = new JTextField("");
+ interval.setMinimumSize(fieldD);
+ interval.setPreferredSize(fieldD);
+ constraints.gridx = 9;
+ constraints.gridwidth = 2;
+ properties.add(interval, constraints);
+
+ tosLabel = new JLabel("Type of Service bits");
+ constraints.gridx = 8;
+ constraints.gridy = 2;
+ constraints.gridwidth = 1;
+ properties.add(tosLabel, constraints);
+
+ tos = new JTextField("");
+ tos.setMinimumSize(fieldD);
+ tos.setPreferredSize(fieldD);
+ constraints.gridx = 9;
+ constraints.gridwidth = 2;
+ properties.add(tos, constraints);
+
+ separator3 = new JSeparator(JSeparator.VERTICAL);
+ constraints.gridx = 11;
+ constraints.gridy = 0;
+ constraints.gridwidth = 1;
+ constraints.gridheight = 3;
+ properties.add(separator3,constraints);
+
+ loginLabel = new JLabel("BWCTL Login");
+ constraints.gridx = 12;
+ constraints.gridy = 0;
+ constraints.gridwidth = 1;
+ constraints.gridheight = 1;
+ properties.add(loginLabel, constraints);
+
+ login = new JTextField("");
+ login.setMinimumSize(fieldD);
+ login.setPreferredSize(fieldD);
+ constraints.gridx = 13;
+ constraints.gridwidth = 2;
+ properties.add(login, constraints);
+
+ passwordLabel = new JLabel("Password");
+ constraints.gridx = 12;
+ constraints.gridy = 1;
+ constraints.gridwidth = 1;
+ properties.add(passwordLabel, constraints);
+
+ password = new JPasswordField();
+ password.setMinimumSize(fieldD);
+ password.setPreferredSize(fieldD);
+ constraints.gridx = 13;
+ constraints.gridwidth = 2;
+ properties.add(password, constraints);
+
+ JXPanel paramsPanel = new JXPanel(new BorderLayout()){
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public String toString(){
+ return "Parameters";
+ }
+ };
+ JScrollPane paramsScrPane = new
JScrollPane(properties,JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
+ paramsPanel.add(paramsScrPane,BorderLayout.NORTH);
+
+ return paramsPanel;
+ }
+
+ public JXPanel createMeasurementPanel(){
+ JXPanel measurement = new JXPanel(new BorderLayout()){
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public String toString(){
+ return "Measurement";
+ }
+ };
+ result = new JTextArea("Result");
+ result.setWrapStyleWord(true);
+ JScrollPane resultScrPane = new
JScrollPane(result,JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
+ measurement.add(resultScrPane,BorderLayout.NORTH);
+ measurementGraph = new BWCTLGraphPanel(this);
+ measurement.add(measurementGraph,BorderLayout.CENTER);
+ return measurement;
+ }
+
+ public JXPanel createHistoryPanel(){
+ JXPanel graphs = new JXPanel(new BorderLayout()){
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public String toString(){
+ return "History";
+ }
+ };
+ historyGraph = new BWCTLHistoryGraphPanel(this);
+ graphs.add(historyGraph,BorderLayout.CENTER);
+ JPanel selectionPanel = new JPanel();
+ selectionPanel.setLayout(new GridBagLayout());
+ GridBagConstraints constraints = new GridBagConstraints();
+ constraints.gridx = 0;
+ constraints.gridy = 0;
+ constraints.gridheight = 1;
+ constraints.gridwidth = 1;
+ constraints.anchor = GridBagConstraints.EAST;
+ constraints.fill = GridBagConstraints.NONE;
+ chartXY = new JRadioButton("Line chart");
+ chartXY.setSelected(true);
+ chartXY.setActionCommand("chartxy");
+ chartXY.addActionListener(this);
+ selectionPanel.add(chartXY,constraints);
+
+ constraints.gridx = 1;
+ constraints.anchor = GridBagConstraints.WEST;
+ chartBar = new JRadioButton("Bar chart");
+ chartBar.setActionCommand("chartbar");
+ chartBar.addActionListener(this);
+ selectionPanel.add(chartBar,constraints);
+
+ chartType = new ButtonGroup();
+ chartType.add(chartXY);
+ chartType.add(chartBar);
+ graphs.add(selectionPanel,BorderLayout.NORTH);
+
+ timeControls = new BWCTLHistoryTimeControlPanel(this);
+ graphs.add(timeControls,BorderLayout.SOUTH);
+ return graphs;
+ }
+
+ public String getAddressType(){
+ ButtonModel selected = addressType.getSelection();
+ return selected.getActionCommand();
+ }
+
+ public String getProtocol(){
+ ButtonModel selected = protocol.getSelection();
+ return selected.getActionCommand();
+ }
+
+ public void updateSource(){
+ MAEndpointList endpoints = model.getEndpointList();
+ sourceAddress.setText(getEndpointHost(endpoints));
+ sourceName = getEndpointName(endpoints);
+ ((BWCTLPerfsonarTab)model).endpointSrcIndex = -1;
+ MAEndpoint endpoint;
+ for (int i = 0; i < endpoints.size(); i++){
+ endpoint = endpoints.get(i);
+ if (endpoint.isEnabled()){
+ model.getUserData().setEndpoint(endpoint);
+ ((BWCTLPerfsonarTab)model).endpointSrcIndex =
i;
+ break;
+ }
+ }
+ resetRTTData();
+ }
+
+ public void updateDestination(){
+ MAEndpointList endpoints = model.getEndpointList();
+ destinationAddress.setText(getEndpointHost(endpoints));
+ destinationName = getEndpointName(endpoints);
+ ((BWCTLPerfsonarTab)model).endpointDstIndex = -1;
+ for(int i = 0; i < endpoints.size(); i++){
+ if(endpoints.get(i).isEnabled()){
+ ((BWCTLPerfsonarTab)model).endpointDstIndex =
i;
+ break;
+ }
+ }
+ resetRTTData();
+ }
+
+ public String getSourceName() {
+ return namePairs.get(sourceName);
+ }
+
+ public String getDestinationName() {
+ return namePairs.get(destinationName);
+ }
+
+ public String getEndpointHost(MAEndpointList endpoints){
+ if (endpoints == null)
+ return null;
+ for (int i = 0; i < endpoints.size(); i++){
+ MAEndpoint endpoint = endpoints.get(i);
+ if (! endpoint.isEnabled())
+ continue;
+ URL address;
+ try{
+ address = new URL(endpoint.getEndpoint());
+ }catch (java.net.MalformedURLException e){
+ logger.error("Malformed URL: " + e);
+ return null;
+ }
+ /* Needs a bit more work for IPv6
+ * service addresses, see RFC 2732.
+ */
+ return address.getHost();
+ }
+ /* No active endpoint */
+ return null;
+ }
+
+ public String getEndpointName(MAEndpointList endpoints){
+ if (endpoints == null)
+ return null;
+ for (int i = 0; i < endpoints.size(); i++){
+ MAEndpoint endpoint = endpoints.get(i);
+ String name;
+ if (! endpoint.isEnabled())
+ continue;
+ name = endpoint.getTitle();
+ /* Needs a bit more work for IPv6
+ * service addresses, see RFC 2732.
+ */
+ return name;
+ }
+ /* No active endpoint */
+ return null;
+ }
+
+ public void actionPerformed(ActionEvent event){
+ if (event == null) return;
+ if (event.getActionCommand().equals("TCP")){
+ bufferSize.setVisible(false);
+ bufferSizeLabel.setVisible(false);
+ bandwidth.setVisible(false);
+ bandwidthLabel.setVisible(false);
+ windowSize.setVisible(true);
+ windowSizeLabel.setVisible(true);
+ userRTT.setVisible(true);
+ userRTTLabel.setVisible(true);
+ resetRTTData();
+ return;
+ }
+ if (event.getActionCommand().equals("UDP")){
+ windowSize.setVisible(false);
+ windowSizeLabel.setVisible(false);
+ userRTT.setVisible(false);
+ userRTTLabel.setVisible(false);
+ bufferSize.setVisible(true);
+ bufferSizeLabel.setVisible(true);
+ bandwidth.setVisible(true);
+ bandwidthLabel.setVisible(true);
+ resetRTTData();
+ }
+ if (event.getActionCommand().equals("chartxy")){
+ historyGraph.changeChartType(0);
+ return;
+ }
+ if (event.getActionCommand().equals("chartbar")){
+ historyGraph.changeChartType(1);
+ return;
+ }
+ }
+
+ public void resetRTTData(){
+ userRTT.setValue(0.0);
+ }
+
+ public void setMeasurementInfo(String info){
+ this.measurementGraph.setInfo(info);
+ }
+
+ public void drawMeasurementGraph(MeasurementData data,boolean
historical){
+ this.measurementGraph.drawMeasurementGraph(data,historical);
+ }
+
+ public void showRTTNotice(){
+ String message = "Estimate RTT functionality is limited to a
set of predefined measurement points.\nOne or both of the selected MP is not
in that set and RTT cannot be estimated.\nPlease enter RTT manualy";
+ String title = "NOTE";
+ if(secondRTTrequest){
+
JOptionPane.showMessageDialog(this,message,title,JOptionPane.INFORMATION_MESSAGE);
+ secondRTTrequest = false;
+ }
+ else secondRTTrequest = true;
+ }
+
+ public String getExpectedMaxBW(){
+ return expectedMaxBW;
+ }
+
+ public void setExpectedMaxBW(String text){
+ this.expectedMaxBW = text;
+ }
+
+ public void clearText(){
+ this.result.setText("");
+ }
+
+ public void appendText(String text){
+ this.result.append(text);
+ this.updateUI();
+ }
+
+ public long getHistoryStartTime(){
+ return timeControls.getStartTime();
+ }
+
+ public long getHistoryEndTime(){
+ return timeControls.getEndTime();
+ }
+
+ public PSUIAction getHistoryRequestAction(){
+ return ((BWCTLPerfsonarTab)model).historyRequestAction;
+ }
+
+ public void addHistoricalPair(String src, String dst){
+ historicalPairs.putPair(src, dst);
+ }
+
+ public void preparePairs(){
+ historicalPairs.clear();
+ historicalPairs.setStartTime(timeControls.getStartTime());
+ historicalPairs.setEndTime(timeControls.getEndTime());
+ }
+
+ public void showPairsPanel(){
+ JDialog dialog = new JDialog();
+ dialog.setTitle("Select from available endpoints");
+ final JTabbedPane pane = new
JTabbedPane(SwingConstants.BOTTOM, JTabbedPane.SCROLL_TAB_LAYOUT);
+ JComponent pairsPanel = new
BWCTLHistoryMetadataPanelLooker(historicalPairs);
+ pane.addTab("pairs", pairsPanel);
+ dialog.setContentPane(pane);
+ dialog.setModal(true);
+ dialog.pack();
+ dialog.setComponentOrientation(((parentFrame == null) ?
dialog.getRootPane() : parentFrame).getComponentOrientation());
+ dialog.setLocationRelativeTo(parentFrame);
+ dialog.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
+ dialog.setVisible(true);
+ setSelectedPair(historicalPairs.getSelectedPair());
+ }
+
+ public void setSelectedPair(MetadataPair pair){
+ if(pair!=null){
+ this.sourceAddress.setText(pair.getSrc());
+ this.destinationAddress.setText(pair.getDst());
+ }
+ }
+
+ public BWCTLHistoryData getHistoryData(){
+ return ((BWCTLPerfsonarTab)model).historyData;
+ }
+}

Modified:
branches/perfsonarui/src/org/perfsonar/perfsonarui/bwctl/BWCTLPerfsonarTab.java
===================================================================
---
branches/perfsonarui/src/org/perfsonar/perfsonarui/bwctl/BWCTLPerfsonarTab.java
2009-12-09 10:29:43 UTC (rev 5389)
+++
branches/perfsonarui/src/org/perfsonar/perfsonarui/bwctl/BWCTLPerfsonarTab.java
2009-12-09 10:38:46 UTC (rev 5390)
@@ -1,6 +1,8 @@
package org.perfsonar.perfsonarui.bwctl;

import java.awt.Component;
+import java.io.File;
+import java.net.URL;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;
@@ -9,12 +11,15 @@

import javax.swing.JDialog;

+import org.apache.commons.cli.CommandLine;
import org.perfsonar.perfsonarui.IPerfsonarSchema;
import org.perfsonar.perfsonarui.PSException;
import org.perfsonar.perfsonarui.PerfsonarSchema;
import org.perfsonar.perfsonarui.SmartMARequest;
import org.perfsonar.perfsonarui.UnsupportedTypeException;
+import org.perfsonar.perfsonarui.ls.LSManager;
import org.perfsonar.perfsonarui.plugins.IPerfsonarRequest;
+import org.perfsonar.perfsonarui.plugins.IPerfsonarTab;
import org.perfsonar.perfsonarui.plugins.MAEndpoint;
import org.perfsonar.perfsonarui.plugins.MAEndpointList;
import org.perfsonar.perfsonarui.ui.PerfsonarModel;
@@ -31,11 +36,13 @@
public class BWCTLPerfsonarTab extends PerfsonarModel {

protected MAEndpointList destinations;
-
+ protected String endpointUrl = "";
+ protected MAEndpointList historyEndpoints;
protected int endpointSrcIndex = -1;
-
protected int endpointDstIndex = -1;
-
+ protected PSUIAction historyRequestAction;
+ protected PSUIAction historyMetadataRequestAction;
+ BWCTLHistoryData historyData;
private BWCTLMainComponent pane;

public BWCTLPerfsonarTab()
@@ -46,7 +53,14 @@
public BWCTLPerfsonarTab(MAEndpointList endpoints)
{
super(endpoints);
-
+ this.historyData = new BWCTLHistoryData();
+ this.getActions().put(createDestinationEndpointAction());
+ this.getActions().put(createHistoryEndpointAction());
+ this.historyRequestAction = createHistoryRequestAction();
+ this.getActions().put(historyRequestAction);
+ this.historyMetadataRequestAction =
createHistoryMetadataRequestAction();
+ this.getActions().put(historyMetadataRequestAction);
+
for (int i=0; i < endpointList.size();i++)
{
if (endpointList.get(i).isEnabled())
@@ -56,6 +70,20 @@
}
}
}
+
+ public PSUIAction getHistoryRequestAction(){
+ return historyRequestAction;
+ }
+
+ @Override
+ protected void setOptions(CommandLine line) {
+ super.setOptions(line);
+ if(line.hasOption('e')) {
+ endpointUrl = line.getOptionValue('e');
+ readHistoryEndpointsFromUrl(line.getOptionValue('e'));
+ }
+ }
+
/**
*
*/
@@ -77,7 +105,23 @@
}
};
}
+
+ protected SmartMARequest createHistoryMetaRequest(){
+ return new SmartMARequest(){
+ public IPerfsonarRequest createMARequest(MAEndpoint
endpoint) throws PSException {
+ return new BWCTLHistoryMetaRequest(pane);
+ }
+ };
+ }

+ protected SmartMARequest createHistoryRequest(){
+ return new SmartMARequest(){
+ public IPerfsonarRequest createMARequest(MAEndpoint
endpoint) throws PSException {
+ return new BWCTLHistoryRequest(pane);
+ }
+ };
+ }
+
public int getOrder()
{
return 5;
@@ -108,6 +152,15 @@
return supported;
}

+ public List<IPerfsonarSchema> getSupportedHistoryRequests()
+ {
+ ArrayList<IPerfsonarSchema> supported;
+
+ supported = new ArrayList<IPerfsonarSchema>();
+ supported.add(PerfsonarSchema.getInstance("bwctl_history"));
+ return supported;
+ }
+
/**
* BWCTL can only deal with one MP, set the appropriate flag for the
* endpoint list.
@@ -117,20 +170,43 @@
MAEndpointList list;
list = super.createEndpoints();
list.setMultipleEndpoints(false);
- return list;
+ historyEndpoints = createHistoryEndpoints();
+ historyEndpoints.setMultipleEndpoints(false);
+ if(historyEndpoints.size()==0){
+ //if no endpoints are found add default
+ MAEndpoint endpoint = new
MAEndpoint("LHCOPN,http://lhcopn-dante-mdm.cern.ch:8080/geant2-java-sql-ma/services/MeasurementArchiveService,bwctl_history,,bwctl_history,bwctl_history";);
+ historyEndpoints.add(endpoint);

+ }
+ for (int i = 0; i < historyEndpoints.size(); i++)
+ {
+ historyEndpoints.get(i).setEnabled(false);
+ }
+ return list;
}

- /**
- * Override in order not to create a default Options button.
- */
- public PSUIAction createOptionsAction() {
- ShowEndpointsAction action = new
ShowEndpointsAction(getEventTypes(), getDestinations(),"BWCTL Destination"){
+ public MAEndpointList createHistoryEndpoints(){
+ if (historyEndpoints == null) return new
MAEndpointList(getMAconf("MA.conf"),getSupportedHistoryRequests());
+ else return historyEndpoints;
+ }
+
+ public PerfsonarRequestAction createHistoryRequestAction() {
+ return new
SetupDataRequestAction(createHistoryRequest(),historyData,responseData,"Query
history",null,defaultGroupQuery);
+ }
+
+ public PerfsonarRequestAction createHistoryMetadataRequestAction() {
+ return new
SetupDataRequestAction(createHistoryMetaRequest(),historyData,responseData,"Query
history endpoints",null,defaultGroupQuery);
+ }
+
+ @SuppressWarnings("serial")
+ public PSUIAction createDestinationEndpointAction(){
+ ShowEndpointsAction action = new
ShowEndpointsAction(getEventTypes(), getDestinations(),"BWCTL MP
Destination"){
protected JDialog createDialog(Set<String>
eventTypes){
setEndpointSelected(endpoints,
endpointDstIndex);
return super.createDialog(eventTypes);
}
};
-
+ action.setGroup(IPerfsonarTab.defaultGroupQueryOption);
+ action.setOrderInGroup(-2);
action.addListener(new ShowEndpointsAction.Listener() {

public void selectionChanged(Collection<MAEndpoint>
selected) {
@@ -139,15 +215,29 @@
});
return action;
}
-
+
+ public PSUIAction createHistoryEndpointAction(){
+ ShowEndpointsAction action = new
ShowEndpointsAction(getHistoryEventType(),getHistoryEndpoints(),"BWCTL MA
Service");
+ action.setGroup(IPerfsonarTab.defaultGroupQueryOption);
+ action.setOrderInGroup(-3);
+ action.addListener(new ShowEndpointsAction.Listener() {
+
+ public void selectionChanged(Collection<MAEndpoint>
selected) {
+ historyData.setEndpoint(selected);
+ }
+ });
+ return action;
+ }
+
+ @SuppressWarnings("serial")
public PSUIAction createEndpointsAction(Set<String> eventTypes,
MAEndpointList endpointList) {
- ShowEndpointsAction action = new
ShowEndpointsAction(eventTypes, endpointList, "BWCTL MP/Source"){

+ ShowEndpointsAction action = new
ShowEndpointsAction(eventTypes, endpointList, "BWCTL MP Source"){

protected JDialog createDialog(Set<String>
eventTypes){
setEndpointSelected(endpoints,
endpointSrcIndex);
return super.createDialog(eventTypes);
}
};
-
+ action.setOrderInGroup(-1);
action.addListener(new ShowEndpointsAction.Listener() {

public void selectionChanged(Collection<MAEndpoint>
selected) {
@@ -172,6 +262,11 @@
return destinations;
}

+ public MAEndpointList getHistoryEndpoints()
+ {
+ return historyEndpoints;
+ }
+
public void setEndpointSelected(MAEndpointList endpoints, int index){
for(int i = 0; i < endpoints.size(); i++){
if(i!=index)endpoints.get(i).setEnabled(false);
@@ -179,10 +274,44 @@
}
}

+ public Set<String> getHistoryEventType(){
+ Set<String> eventTypes = new HashSet<String>();
+ eventTypes.add("bwctl_history");
+ return eventTypes;
+ }
+
@Override
public Set<String> getEventTypes() {
Set<String> eventTypes = new HashSet<String>();
//TODO eventTypes.add("");
return Collections.umodifiableCopy(eventTypes);
}
+
+ public void readHistoryEndpointsFromUrl(String url){
+ try {
+ historyEndpoints.readEndpoints(new URL(url));
+ if(historyEndpoints.size()==0){
+ //if no endpoints are found for bwctl_history then
add a single default one
+ MAEndpoint endpoint = new
MAEndpoint("LHCOPN,http://lhcopn-dante-mdm.cern.ch:8080/geant2-java-sql-ma/services/MeasurementArchiveService,bwctl_history,,bwctl_history,bwctl_history";);
+ historyEndpoints.add(endpoint);

+ }
+ for (int i = 0; i < historyEndpoints.size(); i++)
+ {
+ historyEndpoints.get(i).setEnabled(false);
+ }
+ LSManager.getInstance(new URL(url));
+ } catch (Exception x) {
+ try {
+ logger.error(x);
+ historyEndpoints.readEndpoints(new File("MA.conf"));
+ for (int i = 0; i < historyEndpoints.size(); i++)
+ {
+ historyEndpoints.get(i).setEnabled(false);
+ }
+ LSManager.getInstance(new URL(url));
+ } catch (Exception ex) {
+ logger.error(ex);
+ }
+ }
+ }
}

Modified:
branches/perfsonarui/src/org/perfsonar/perfsonarui/bwctl/BWCTLRequest.java
===================================================================
---
branches/perfsonarui/src/org/perfsonar/perfsonarui/bwctl/BWCTLRequest.java
2009-12-09 10:29:43 UTC (rev 5389)
+++
branches/perfsonarui/src/org/perfsonar/perfsonarui/bwctl/BWCTLRequest.java
2009-12-09 10:38:46 UTC (rev 5390)
@@ -1,6 +1,7 @@
package org.perfsonar.perfsonarui.bwctl;

import java.io.InputStream;
+import java.text.DecimalFormat;

import org.w3c.dom.Document;
import org.w3c.dom.Element;
@@ -10,6 +11,8 @@
import javax.xml.parsers.DocumentBuilder;

import org.perfsonar.perfsonarui.AbstractMARequest;
+import org.perfsonar.perfsonarui.bwctl.data.MeasurementData;
+import org.perfsonar.perfsonarui.bwctl.data.MeasurementSample;
import org.perfsonar.perfsonarui.plugins.MAEndpoint;
import org.perfsonar.perfsonarui.plugins.MetaDataList;
import org.perfsonar.perfsonarui.plugins.IUserData;
@@ -19,6 +22,7 @@
/**
* BWCTL request data structures
* @author Roland Karch

+ * @author Nemanja Zutic

*/

public class BWCTLRequest extends AbstractMARequest
@@ -32,34 +36,21 @@
mainComponent = pane;
}

- public Document createRequest(MAEndpoint endpoint,
- MetaDataList metadata, String messageType) throws Exception
- {
+ public Document createRequest(MAEndpoint endpoint,MetaDataList
metadata, String messageType) throws Exception {
/* FIXME */
throw new Exception("Unsupported message type!");
}

- public Document createRequest(IUserData uData, String messageType)
- throws Exception
- {
- if (messageType == null) {
+ public Document createRequest(IUserData uData, String messageType)
throws Exception {
+ if (messageType == null)
throw new Exception("Unspecified message type!");
- }
-
- if
(messageType.equals(IPerfsonarRequest.MA_SetupDataRequest)) {
- mainComponent.clearInfoLabels();
- mainComponent.infoLabelLine1.setText("Querying
service");
+ if
(messageType.equals(IPerfsonarRequest.MA_SetupDataRequest))
return createSetupDataRequest(uData);
- }
- else {
- throw new Exception("Unknown message type! " +
- messageType);
- }
+ else
+ throw new Exception("Unknown message type "
+messageType);
}

- private Document createSetupDataRequest(IUserData userData)
- throws Exception
- {
+ private Document createSetupDataRequest(IUserData userData)
throws Exception {
String inputFile;
DocumentBuilderFactory factory;
DocumentBuilder builder;
@@ -67,309 +58,183 @@
Document request;
String protocol;
String parameter;
-
inputFile = XML_TEMPLATE;
-
factory = DocumentBuilderFactory.newInstance();
factory.setNamespaceAware(true);
-
builder = factory.newDocumentBuilder();
-
stream =
getClass().getClassLoader().getResourceAsStream(inputFile);
-
request = builder.parse(stream);
-
- setQueryEndpoint(mainComponent.sourceAddress.getText(),
- mainComponent.getAddressType(), request, "src");
- setQueryEndpoint(mainComponent.destinationAddress.getText(),
- mainComponent.getAddressType(), request, "dst");
-
+
setQueryEndpoint(mainComponent.sourceAddress.getText(),mainComponent.getAddressType(),
request, "src");
+
setQueryEndpoint(mainComponent.destinationAddress.getText(),mainComponent.getAddressType(),
request, "dst");
protocol = mainComponent.getProtocol();
setQueryParameter("protocol", protocol, "iperf", request);
- if (protocol.equals("TCP"))
- {
+ if (protocol.equals("TCP")){
parameter = mainComponent.windowSize.getText();
if (! parameter.equals(""))
- {
- setQueryParameter("windowSize", parameter,
"iperf",
- request);
- }
+ setQueryParameter("windowSize", parameter,
"iperf", request);
}
- else if (protocol.equals("UDP"))
- {
-
+ else if (protocol.equals("UDP")){
parameter = mainComponent.bufferSize.getText();
if (! parameter.equals(""))
- {
- setQueryParameter("bufferSize", parameter,
"iperf",
- request);
- }
-
+ setQueryParameter("bufferSize", parameter,
"iperf", request);
parameter = mainComponent.bandwidth.getText();
- if (! parameter.equals(""))
- {
- setQueryParameter("bandwidth", parameter,
"iperf",
- request);
+ if (! parameter.equals("")) {
+ try{
+ long val = Long.parseLong(parameter);
+ val = val*1000*1000;
+ parameter = Long.toString(val);
+ setQueryParameter("bandwidth",
parameter, "iperf",request);
+ }catch(Exception e){
+ //silent fail, do nothing...
+ }
}
}
-
parameter = mainComponent.duration.getText();
if (! parameter.equals(""))
- {
setQueryParameter("duration", parameter, "bwctl",
request);
- }
-
parameter = mainComponent.interval.getText();
if (! parameter.equals(""))
- {
setQueryParameter("interval", parameter, "iperf",
request);
- }
-
parameter = mainComponent.tos.getText();
if (! parameter.equals(""))
- {
setQueryParameter("TOS", parameter, "iperf", request);
- }
-
/* Login/Password are joined together, always send both
* parameters or none.
*/
parameter = mainComponent.login.getText();
- if (! parameter.equals(""))
- {
+ if (! parameter.equals("")){
setQueryParameter("login", parameter, "bwctl",
request);
setQueryParameter("password", new
String(mainComponent.password.getPassword()), "bwctl", request);
}
return request;
}

- public String getMessageNamespace()
- {
+ public String getMessageNamespace(){
/* FIXME */
return null;
}

- public String[] getNamespaces()
- {
+ public String[] getNamespaces(){
/* FIXME */
return null;
}

- public String getRequestType()
- {
+ public String getRequestType(){
return REQUEST_TYPE;
}

- public void process(IUserData uData, Document response,
- IPerfsonarResponse listener)
- {
+ public void process(IUserData uData, Document
response,IPerfsonarResponse listener){
NodeList datas;
Element data;
NodeList datums;
Element datum;
String eventType;
- String output;

- int i;
- int j;
-
/* Check for return code (failure) */
datas = response.getElementsByTagName("nmwg:eventType");
eventType = null;
- for (i = 0; i < datas.getLength(); i++)
- {
+ for (int i = 0; i < datas.getLength(); i++) {
data = (Element) datas.item(i);
eventType = data.getTextContent();
if (eventType.startsWith("error")) break;
eventType = null;
}
- if (eventType != null)
- {
+ /* If event type is null there is no error */
+ if (eventType != null){
String returnMessage;
-
-
datas = response.getElementsByTagName("nmwg:data");
-
- for (i = 0; i < datas.getLength(); i++)
- {
- String xmlId;
-
+ for (int i = 0; i < datas.getLength(); i++) {
data = (Element) datas.item(i);
-
- xmlId = data.getAttribute("id");
- if ((xmlId == null) ||
- (!
xmlId.equals("data_return_iperf-metadata")))
- {
+ String xmlId = data.getAttribute("id");
+ if ((xmlId == null) ||(!
xmlId.equals("data_return_iperf-metadata")))
continue;
- }
-
-
- datums = data.getElementsByTagName(
- "nmwg:datum");
+ datums =
data.getElementsByTagName("nmwg:datum");
/* Free text response? */
- if (datums.getLength() != 1)
- {
- mainComponent.result.setText(
-"The perfSONAR request failed with Event Type " + eventType + "."
- );
+ if (datums.getLength() != 1){
+ mainComponent.result.setText("The
perfSONAR request failed with Event Type " + eventType + ".");
return;
}
datum = (Element) datums.item(0);
returnMessage = datum.getTextContent();
- if (returnMessage == null)
- {
- mainComponent.result.setText(
-"The perfSONAR request failed with Event Type " + eventType + "."
- );
+ if (returnMessage == null){
+ mainComponent.result.setText("The
perfSONAR request failed with Event Type " + eventType + ".");
return;
}
- mainComponent.result.setText(
-"The perfSONAR request failed with Event Type " + eventType + ":\n" +
- returnMessage);
+ mainComponent.result.setText("The perfSONAR
request failed with Event Type " + eventType + ":\n"+returnMessage);
return;
}
- mainComponent.result.setText(
-"The perfSONAR request failed with Event Type " + eventType + "."
- );
+ mainComponent.result.setText("The perfSONAR request
failed with Event Type " + eventType + ".");
return;
}
-
/* No error, read normal return data */
- output = new String();
- mainComponent.clearGraph();
- String startTime = "";
- String endTime = mainComponent.duration.getText();
- if (endTime.equals("")) {
- // BWCTL default
- endTime = "10";
- }
- double duration;
+ double duration = 10.0;
try {
- duration = Double.parseDouble(endTime);
+ duration =
Double.parseDouble(mainComponent.duration.getText());
} catch (NumberFormatException e) {
- mainComponent.infoLabelLine1.setText("Test duration
cannot be converted from string to number");
duration = 10.0;
}
-
datas = response.getElementsByTagName("nmwg:data");
-
- for (i = 0; i < datas.getLength(); i++)
- {
+ MeasurementData mesData = new MeasurementData();
+ for (int i = 0; i < datas.getLength(); i++) {
data = (Element) datas.item(i);
datums = data.getElementsByTagName("iperf:datum");
- for (j = 0; j < datums.getLength(); j++)
- {
+ for (int j = 0; j < datums.getLength(); j++){
datum = (Element) datums.item(j);
String interval =
datum.getAttribute("interval");
- String time = interval.split("-")[1];
- if(startTime.equals("")) startTime = time;
- String value = datum.getAttribute("value");

-// output = output +
-// "Interval: " +
-// datum.getAttribute("duration") +
-// " Transferred: " +
-// datum.getAttribute("numBytes") + " " +
-// datum.getAttribute("numBytesUnits") +
-// " / " +
-// datum.getAttribute("value") +
-// " " +
-// datum.getAttribute("valueUnits") +
-// "\n";
- output = output + "Interval:
"+datum.getAttribute("interval")+" Transferred: ";
- String units1 =
datum.getAttribute("numBytesUnits");
- String value1 =
datum.getAttribute("numBytes");
- Long transferred = Long.parseLong(value1);
- if(units1.equals("Bytes")){
- transferred/=(1024*1024);
- output = output+transferred+" MB ";
- }
- output = output+"("+value1+" "+units1+") / ";
- String units2 =
datum.getAttribute("valueUnits");
- String value2 = datum.getAttribute("value");
- Long througput = Long.parseLong(value2);
- if(units2.equals("bits/sec")){
- througput/=(1000*1000);
- output = output+througput+" Mbps ";
- }
- output = output+"("+value2+" "+units2+")\n";
-
if(!(interval.startsWith("0.0")&&Double.parseDouble(time)>=duration)){
-
mainComponent.addValueToGraph(Double.parseDouble(time),
Double.parseDouble(value)/(1000*1000));
- }
- else{
-
if(!mainComponent.interval.getText().equals(""))mainComponent.addAverageToGraph(Double.parseDouble(startTime),Double.parseDouble(endTime),Double.parseDouble(value)/(1000*1000));
- else
mainComponent.infoLabelLine2.setText("Graph is not displayed because no
reporting interval value was entered");
- }
+ String[] intervalLimits = interval.split("-");
+ double intervalStart =
Double.parseDouble(intervalLimits[0]);
+ double intervalEnd =
Double.parseDouble(intervalLimits[1]);
+ String volumeUnits =
datum.getAttribute("numBytesUnits");
+ String volumeString =
datum.getAttribute("numBytes");
+ Double volume =
Double.parseDouble(volumeString);
+ String throughputUnits =
datum.getAttribute("valueUnits");
+ String throughputString =
datum.getAttribute("value");
+ Double througput =
Double.parseDouble(throughputString);
+ if(!(intervalStart==0.0 &&
intervalEnd>=duration))
+ mesData.addSample(new
MeasurementSample(intervalStart,intervalEnd,volume,volumeUnits,througput,throughputUnits));
+ else
if(!mainComponent.interval.getText().equals(""))
+ mesData.setAverage(througput);
}
+ /* Check to see if max expected BW should be
calculated */
if(mainComponent.protocolTCP.isSelected()){
- Double rtt =
(Double)mainComponent.userRTT.getValue();
- Double window = 0.0;
- Double maxBW = 0.0;
+ double rtt = 0.0;
+ double window = 0.0;
+ double maxBW = 0.0;
try{
window =
Double.parseDouble(mainComponent.windowSize.getText());
- }catch(NumberFormatException e){
-
mainComponent.infoLabelLine1.setText("Window size cannot be converted from
string to number");
- }
+ Number num =
(Number)mainComponent.userRTT.getValue();
+ rtt = num.doubleValue();
+ }catch(Exception e){}
window*=8;
rtt/=1000;
- if(rtt!=0.0) maxBW = window/rtt;
- Long maxBWLong = new Long(maxBW.longValue());
- if (maxBWLong!=0)
mainComponent.infoLabelLine1.setText("Expected maximum theoretical bandwidth
(TCP window size * RTT) is: " + maxBWLong + " bits/sec ("+
maxBWLong/(1000*1000) +" Mbits/sec)");
- else mainComponent.infoLabelLine1.setText("If
you wish to see the Expected maximum theoretical bandwidth (TCP window size *
RTT) both RTT value and a window size must be entered");
+ if(rtt!=0.0){
+ maxBW = window/rtt;
+ DecimalFormat oneDecimal = new
DecimalFormat("0.0");
+
this.mainComponent.setExpectedMaxBW("Expected maximum theoretical bandwidth "
+
+ "(TCP window size / RTT) is:
"+oneDecimal.format(maxBW/(1000.0*1000.0))+" Mbps "
+
+ "("+oneDecimal.format(maxBW)+" bits/sec)"
+
+ "\nRTT is estimated from archived one-way delay
data");
+ }
}
}
- mainComponent.result.setText(output);
+ mainComponent.measurementGraph.setInfo("");
+ mainComponent.drawMeasurementGraph(mesData,false);
}

- /**
- * Helper method to serialize an XML request/response into a String.
- * Not really useful besides for debugging.
- */
- /*private String dumpXML(Document document)
- {
- java.io.StringWriter stringOutput;
- com.sun.org.apache.xml.internal.serialize.OutputFormat
stringFormat;
- com.sun.org.apache.xml.internal.serialize.XMLSerializer
serializer;
-
- stringOutput = new java.io.StringWriter();
- stringFormat = new
com.sun.org.apache.xml.internal.serialize.OutputFormat(document);
- serializer = new
com.sun.org.apache.xml.internal.serialize.XMLSerializer(stringOutput,
stringFormat);
- try
- {
- serializer.serialize(document);
- }
- catch (java.io.IOException e)
- {
- logger.error("IO Exception: " + e);
- return null;
- }
- return stringOutput.toString();
- }*/
-
- private void setQueryEndpoint(String address, String type,
- Document request, String target)
- {
+ private void setQueryEndpoint(String address, String type,Document
request, String target){
NodeList nodes;
-
if (target == null)
- {
return;
- }
nodes = request.getElementsByTagName("nmwgt:endPointPair");
-
/* Loop over the endpoint pairs */
- for (int i = 0; i < nodes.getLength(); i++)
- {
+ for (int i = 0; i < nodes.getLength(); i++){
Element node;
NodeList children;
-
node = (Element) nodes.item(i);
children = node.getElementsByTagName("nmwgt:" +
target);
-
/* Loop over the entries */
- for (int j = 0; j <children.getLength(); j++)
- {
+ for (int j = 0; j <children.getLength(); j++){
Element parameter;
-
parameter = (Element) children.item(j);
parameter.setAttribute("type", type);
parameter.setAttribute("value", address);
@@ -377,58 +242,20 @@
}
}

- /*private void setQueryParameter(String name, String value,
- Document request)
- {
- NodeList nodes;
- Element parameterRoot;
- Element parameterElement;
-
- if ((name == null) || (value == null) || (request == null))
- {
- return;
- }
-
- nodes = request.getElementsByTagName("nmwg:parameters");
- if (nodes.getLength() != 1)
- {
- return;
- }
- parameterRoot = (Element) nodes.item(0);
-
- parameterElement = request.createElementNS("nmwg",
"nmwg:parameter");
- parameterElement.setAttribute("name", name);
- parameterElement.setAttribute("value", value);
-
- parameterRoot.appendChild(parameterElement);
- }*/
-
-
- private void setQueryParameter(String name, String value, String ns,
- Document request)
- {
- NodeList nodes;
- Element parameterRoot;
- Element parameterElement;
-
- String nsParameters = ns + ":parameters";
-
- if ((name == null) || (value == null) || (request == null))
- {
- return;
- }
-
- nodes = request.getElementsByTagName(nsParameters);
- if (nodes.getLength() != 1)
- {
- return;
- }
- parameterRoot = (Element) nodes.item(0);
-
- parameterElement = request.createElementNS("nmwg",
"nmwg:parameter");
- parameterElement.setAttribute("name", name);
- parameterElement.setAttribute("value", value);
-
- parameterRoot.appendChild(parameterElement);
- }
+ private void setQueryParameter(String name, String value, String ns,
Document request){
+ NodeList nodes;
+ Element parameterRoot;
+ Element parameterElement;
+ String nsParameters = ns + ":parameters";
+ if ((name == null) || (value == null) || (request == null))
+ return;
+ nodes = request.getElementsByTagName(nsParameters);
+ if (nodes.getLength() != 1)
+ return;
+ parameterRoot = (Element) nodes.item(0);
+ parameterElement = request.createElementNS("nmwg",
"nmwg:parameter");
+ parameterElement.setAttribute("name", name);
+ parameterElement.setAttribute("value", value);
+ parameterRoot.appendChild(parameterElement);
+ }
}

Deleted:
branches/perfsonarui/src/org/perfsonar/perfsonarui/bwctl/RTTDelays.java

Modified:
branches/perfsonarui/src/org/perfsonar/perfsonarui/bwctl/RTTRequest.java
===================================================================
--- branches/perfsonarui/src/org/perfsonar/perfsonarui/bwctl/RTTRequest.java
2009-12-09 10:29:43 UTC (rev 5389)
+++ branches/perfsonarui/src/org/perfsonar/perfsonarui/bwctl/RTTRequest.java
2009-12-09 10:38:46 UTC (rev 5390)
@@ -1,12 +1,12 @@
package org.perfsonar.perfsonarui.bwctl;

-import java.text.DecimalFormat;
import java.util.Calendar;

import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;

import org.perfsonar.perfsonarui.AbstractMARequest;
+import org.perfsonar.perfsonarui.bwctl.data.RTTDelays;
import org.perfsonar.perfsonarui.plugins.IPerfsonarRequest;
import org.perfsonar.perfsonarui.plugins.IPerfsonarResponse;
import org.perfsonar.perfsonarui.plugins.IUserData;
@@ -21,8 +21,6 @@
public static final String REQUEST_TYPE = "ippm";
protected IPerfsonarResponse response;
protected int timeout = 10000; //10 sec
-
-
private BWCTLMainComponent mainComponent;

public RTTRequest(BWCTLMainComponent pane){
@@ -60,8 +58,6 @@
this.mainComponent.showRTTNotice();
throw new Exception("Unsupported endpoint for
RTT request");
}
-
- mainComponent.clearInfoLabels();

DocumentBuilderFactory factory =
DocumentBuilderFactory.newInstance();
factory.setNamespaceAware(true);
@@ -197,37 +193,17 @@
Double last_med_delay = 0.0;
if(datums.getLength()!=0)datum = (Element)
datums.item(datums.getLength()-1);
else break;
- String mes = datum.getAttribute("med_delay");
+ String mes = datum.getAttribute("min_delay");
if(!mes.equals("")){
last_med_delay=Double.parseDouble(mes);
last_med_delay*=1000;
}
RTTDelays.getInstance().addDelay(last_med_delay);
}
- DecimalFormat fourDigits = new DecimalFormat("0.0000");
- if(RTTDelays.getInstance().getRecievedDelays() == 1){
- Double rtt = RTTDelays.getInstance().getSrc2Dst();
- if(rtt == 0.0){
- mainComponent.infoLabelLine1.setText("No Src
to Dst measurement available");
- }
- else {
- mainComponent.infoLabelLine1.setText("Src to
Dst delay ("+fourDigits.format(rtt)+")");
- }
- }
- else if(RTTDelays.getInstance().getRecievedDelays() == 2){
+ if(RTTDelays.getInstance().getRecievedDelays() == 2){
Double rtt1 = RTTDelays.getInstance().getSrc2Dst();
Double rtt2 = RTTDelays.getInstance().getDst2Src();
- if(rtt1 == 0.0){
- mainComponent.infoLabelLine1.setText("No Src
to Dst measurement available");
- }
- if(rtt2 == 0.0){
- mainComponent.infoLabelLine2.setText("No Dst
to Src measurement available");
- }
- if(rtt1!=0 && rtt2!=0) {
- mainComponent.infoLabelLine1.setText("Src to
Dst delay ("+fourDigits.format(rtt1)+"); Dst to Src delay
("+fourDigits.format(rtt2)+")");
- mainComponent.infoLabelLine2.setText("Total
estimated RTT ("+fourDigits.format(rtt1+rtt2)+")");
- mainComponent.userRTT.setValue(rtt1+rtt2);
- }
+ if(rtt1!=0 && rtt2!=0)
mainComponent.userRTT.setValue(rtt1+rtt2);
}
}
}

Added:
branches/perfsonarui/src/org/perfsonar/perfsonarui/bwctl/data/HistoricalData.java

Added:
branches/perfsonarui/src/org/perfsonar/perfsonarui/bwctl/data/HistoricalInterval.java

Added:
branches/perfsonarui/src/org/perfsonar/perfsonarui/bwctl/data/HistoricalMeasurement.java

Added:
branches/perfsonarui/src/org/perfsonar/perfsonarui/bwctl/data/HistoricalMetadata.java

Added:
branches/perfsonarui/src/org/perfsonar/perfsonarui/bwctl/data/HistoricalSample.java

Added:
branches/perfsonarui/src/org/perfsonar/perfsonarui/bwctl/data/MeasurementData.java

Added:
branches/perfsonarui/src/org/perfsonar/perfsonarui/bwctl/data/MeasurementSample.java

Added:
branches/perfsonarui/src/org/perfsonar/perfsonarui/bwctl/data/MetadataPair.java

Copied:
branches/perfsonarui/src/org/perfsonar/perfsonarui/bwctl/data/RTTDelays.java
(from rev 5353,
branches/perfsonarui/src/org/perfsonar/perfsonarui/bwctl/RTTDelays.java)


Property changes on:
branches/perfsonarui/src/org/perfsonar/perfsonarui/bwctl/data/RTTDelays.java
___________________________________________________________________
Name: svn:mergeinfo
+

Copied:
branches/perfsonarui/src/org/perfsonar/perfsonarui/bwctl/ui/BWCTLGraphPanel.java
(from rev 5239,
branches/perfsonarui/src/org/perfsonar/perfsonarui/bwctl/BWCTLGraphPanel.java)

Added:
branches/perfsonarui/src/org/perfsonar/perfsonarui/bwctl/ui/BWCTLHistoryGraphPanel.java

Added:
branches/perfsonarui/src/org/perfsonar/perfsonarui/bwctl/ui/BWCTLHistoryMetadataPanel.java

Added:
branches/perfsonarui/src/org/perfsonar/perfsonarui/bwctl/ui/BWCTLHistoryMetadataPanelLooker.java

Added:
branches/perfsonarui/src/org/perfsonar/perfsonarui/bwctl/ui/BWCTLHistoryTimeControlPanel.java



  • perfsonar: r5390 - in branches/perfsonarui/src/org/perfsonar/perfsonarui/bwctl: . data ui, svnlog, 12/09/2009

Archive powered by MHonArc 2.6.16.

Top of Page