perfsonar-dev - perfsonar: r3393 - in branches/perfsonarui/src/org/perfsonar/perfsonarui/flowsa: . components
Subject: perfsonar development work
List archive
perfsonar: r3393 - in branches/perfsonarui/src/org/perfsonar/perfsonarui/flowsa: . components
Chronological Thread
- From:
- To:
- Subject: perfsonar: r3393 - in branches/perfsonarui/src/org/perfsonar/perfsonarui/flowsa: . components
- Date: Fri, 22 Feb 2008 17:30:10 -0500
Author: michael.bischoff
Date: 2008-02-22 17:30:10 -0500 (Fri, 22 Feb 2008)
New Revision: 3393
Added:
branches/perfsonarui/src/org/perfsonar/perfsonarui/flowsa/TimeRange.java
Modified:
branches/perfsonarui/src/org/perfsonar/perfsonarui/flowsa/FlowsaMAResponse.java
branches/perfsonarui/src/org/perfsonar/perfsonarui/flowsa/Statistics.java
branches/perfsonarui/src/org/perfsonar/perfsonarui/flowsa/components/ResultPanel.java
branches/perfsonarui/src/org/perfsonar/perfsonarui/flowsa/components/StatisticsPanel.java
Log:
RESOLVED - bug 345: statistics don't report the range.
https://bugzilla.perfsonar.net/show_bug.cgi?id=345
Modified:
branches/perfsonarui/src/org/perfsonar/perfsonarui/flowsa/FlowsaMAResponse.java
===================================================================
---
branches/perfsonarui/src/org/perfsonar/perfsonarui/flowsa/FlowsaMAResponse.java
2008-02-22 22:28:00 UTC (rev 3392)
+++
branches/perfsonarui/src/org/perfsonar/perfsonarui/flowsa/FlowsaMAResponse.java
2008-02-22 22:30:10 UTC (rev 3393)
@@ -9,6 +9,8 @@
import java.awt.EventQueue;
import java.text.DateFormat;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collection;
@@ -33,6 +35,9 @@
*
*/
public class FlowsaMAResponse extends AbstractPerfsonarResponse {
+
+ private static final String ISO8601_PATTERN =
"yyyy-MM-dd'T'HH:mm:ssZ";
+
protected FlowsaMAUserData userData;
public FlowsaMAResponse(FlowsaMAUserData userData) {
@@ -132,10 +137,38 @@
result.setPacketsUdp(getAttribute(attributes,"packetsUdp"));
result.setPacketsOther(getAttribute(attributes,"packetsOther"));
result.setSequenceFailures(getAttribute(attributes,"sequenceFailures"));
-
+ NodeList childeren = datum.getChildNodes();
+ Node child = null;
+ for(int index =0;(child = childeren.item(index)) != null; index++) {
+ if("time".equals(child.getLocalName())) {
+ result.setRange(extractRange(child));
+ }
+ }
userData.pushQuery(new Query(new Question("Statistics
query"), result));
}
+ private TimeRange extractRange(Node timeNode) {
+ NodeList nodes = timeNode.getChildNodes();
+ String start = null;
+ String end = null;
+ Node node = null;
+ for(int index =0;(node = nodes.item(index)) != null; index++) {
+ if("start".equals(node.getLocalName())) {
+ start = getAttribute(node.getAttributes(), "value");
+ }
+ if("end".equals(node.getLocalName())) {
+ end = getAttribute(node.getAttributes(), "value");
+ }
+ }
+ DateFormat iso = new SimpleDateFormat(ISO8601_PATTERN);
+ try {
+ return new TimeRange(iso.parse(start),
iso.parse(end));
+ } catch (ParseException e) {
+ logger.error("can't parse range");
+ }
+ return null;
+ }
+
private void handleRawResponse(NodeList datums) {
List<String> headerList = getHeader(datums);
String[][] data = extractData(datums, headerList);
Modified:
branches/perfsonarui/src/org/perfsonar/perfsonarui/flowsa/Statistics.java
===================================================================
--- branches/perfsonarui/src/org/perfsonar/perfsonarui/flowsa/Statistics.java
2008-02-22 22:28:00 UTC (rev 3392)
+++ branches/perfsonarui/src/org/perfsonar/perfsonarui/flowsa/Statistics.java
2008-02-22 22:30:10 UTC (rev 3393)
@@ -27,6 +27,7 @@
private String msecFirst;
private String msecLast;
private String sequenceFailures;
+ private TimeRange range;
public String getFlows() {
return flows;
@@ -148,4 +149,10 @@
public void setSequenceFailures(String sequenceFailures) {
this.sequenceFailures = sequenceFailures;
}
+ public TimeRange getRange() {
+ return range;
+ }
+ public void setRange(TimeRange range) {
+ this.range = range;
+ }
}
Added:
branches/perfsonarui/src/org/perfsonar/perfsonarui/flowsa/TimeRange.java
Modified:
branches/perfsonarui/src/org/perfsonar/perfsonarui/flowsa/components/ResultPanel.java
===================================================================
---
branches/perfsonarui/src/org/perfsonar/perfsonarui/flowsa/components/ResultPanel.java
2008-02-22 22:28:00 UTC (rev 3392)
+++
branches/perfsonarui/src/org/perfsonar/perfsonarui/flowsa/components/ResultPanel.java
2008-02-22 22:30:10 UTC (rev 3393)
@@ -12,7 +12,6 @@
import javax.swing.BorderFactory;
import javax.swing.JComponent;
import javax.swing.JLabel;
-import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JToolBar;
Modified:
branches/perfsonarui/src/org/perfsonar/perfsonarui/flowsa/components/StatisticsPanel.java
===================================================================
---
branches/perfsonarui/src/org/perfsonar/perfsonarui/flowsa/components/StatisticsPanel.java
2008-02-22 22:28:00 UTC (rev 3392)
+++
branches/perfsonarui/src/org/perfsonar/perfsonarui/flowsa/components/StatisticsPanel.java
2008-02-22 22:30:10 UTC (rev 3393)
@@ -13,15 +13,23 @@
import static org.jdesktop.layout.GroupLayout.TRAILING;
import static org.jdesktop.layout.LayoutStyle.RELATED;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+
+import javax.swing.BorderFactory;
+import javax.swing.JComponent;
import javax.swing.JLabel;
import javax.swing.JPanel;
+import javax.swing.JTextField;
import javax.swing.SwingConstants;
import org.jdesktop.layout.GroupLayout;
import org.perfsonar.perfsonarui.flowsa.Statistics;
+import org.perfsonar.perfsonarui.flowsa.TimeRange;
public class StatisticsPanel extends JPanel{
+ private static final String ISO8601_PATTERN = "yyyy-MM-dd' 'HH:mm:ss";
private static final long serialVersionUID = 1L;
private javax.swing.JTextField statsBytesField;
@@ -45,6 +53,10 @@
private javax.swing.JTextField statsPacketsotherField;
private javax.swing.JTextField statsSeqFailField;
+ private JTextField rangeStartField;
+
+ private JTextField rangeEndField;
+
public StatisticsPanel() {
JLabel statsFlowsLabel = new javax.swing.JLabel("Flows");
JLabel statsFlowsTcpLabel = new javax.swing.JLabel("Flows
TCP");
@@ -86,6 +98,12 @@
statsMsecFirstField = new javax.swing.JTextField();
statsMsecLastField = new javax.swing.JTextField();
statsSeqFailField = new javax.swing.JTextField();
+
+ JLabel rangeStartLabel = new JLabel("Start");
+ JLabel rangeEndLabel = new JLabel("End");
+ rangeStartField = new JTextField();
+ rangeEndField = new JTextField();
+ JComponent rangePanel = createRangePanel(rangeStartLabel,
rangeStartField, rangeEndLabel, rangeEndField);
statsFlowsField.setEditable(false);
statsFlowsField.setHorizontalAlignment(SwingConstants.RIGHT);
@@ -177,95 +195,137 @@
.add(statsLastField)
.add(statsBytesTcpField)
)
- .addContainerGap(38,
Short.MAX_VALUE)
+ .addPreferredGap(RELATED,
RELATED, 30)
+ .add(rangePanel)
+ .addContainerGap(0,
Short.MAX_VALUE)
+
)
);
layout.setVerticalGroup(layout.createSequentialGroup()
.addContainerGap(5,40)
- .add(layout.createParallelGroup(BASELINE)
- .add(statsFlowsLabel)
- .add(statsFlowsField)
+ .add(layout.createParallelGroup()
+ .add(layout.createSequentialGroup()
+
.add(layout.createParallelGroup(BASELINE)
+
.add(statsFlowsLabel)
+
.add(statsFlowsField)
+ )
+
.add(layout.createParallelGroup(BASELINE)
+
.add(statsFlowsTcpField)
+
.add(statsFlowsTcpLabel)
+ )
+
.add(layout.createParallelGroup(BASELINE)
+
.add(statsFlowsudpField)
+
.add(statsFlowsUdpLabel)
+ )
+
.add(layout.createParallelGroup(BASELINE)
+
.add(statsFlowsIcmpField)
+
.add(statsFlowsIcmpLabel)
+ )
+
.add(layout.createParallelGroup(BASELINE)
+
.add(statsFlowsOtherField)
+
.add(statsFlowsOthersLabel)
+ )
+
.add(layout.createParallelGroup(BASELINE)
+
.add(statsPacketsField)
+
.add(statsFlowsPacketsLabel)
+ )
+
.add(layout.createParallelGroup(BASELINE)
+
.add(statsPacketsotherField)
+
.add(statsPacketsTcpLabel)
+ )
+
.add(layout.createParallelGroup(BASELINE)
+
.add(statsPacketsTcpField)
+
.add(statsPacketsUdpLabel)
+ )
+
.add(layout.createParallelGroup(BASELINE)
+
.add(statsPacketsUdpField)
+
.add(statsPacketsIcmpLabel)
+ )
+
.add(layout.createParallelGroup(BASELINE)
+
.add(statsPacketsIcmpField)
+
.add(statsPacketsOtherLabel)
+ )
+
.add(layout.createParallelGroup(BASELINE)
+
.add(statsBytesLabel)
+
.add(statsBytesField)
+ )
+
.add(layout.createParallelGroup(BASELINE)
+
.add(statsBytesTcpLabel)
+
.add(statsBytesTcpField)
+ )
+
.add(layout.createParallelGroup(BASELINE)
+
.add(statsBytesUdpLabel)
+
.add(statsBytesUdpField)
+ )
+
.add(layout.createParallelGroup(BASELINE)
+
.add(statsBytesIcmpLabel)
+
.add(statsBytesIcmpField)
+ )
+
.add(layout.createParallelGroup(BASELINE)
+
.add(statsBytesOtherLabel)
+
.add(statsBytesOtherField)
+ )
+
.add(layout.createParallelGroup(BASELINE)
+
.add(statsFirstLabel)
+
.add(statsFirstField)
+ )
+
.add(layout.createParallelGroup(BASELINE)
+
.add(statsLastLabel)
+
.add(statsLastField)
+ )
+
.add(layout.createParallelGroup(BASELINE)
+
.add(statsMsecFirstLabel)
+
.add(statsMsecFirstField)
+ )
+
.add(layout.createParallelGroup(BASELINE)
+
.add(statsMsecLastLabel)
+
.add(statsMsecLastField)
+ )
+
.add(layout.createParallelGroup(BASELINE)
+
.add(statsSeqFailLabel)
+
.add(statsSeqFailField)
+ )
+ )
+ .add(layout.createSequentialGroup()
+ .add(rangePanel)
+ .addContainerGap(0,
Short.MAX_VALUE)
+ )
)
- .add(layout.createParallelGroup(BASELINE)
- .add(statsFlowsTcpField)
- .add(statsFlowsTcpLabel)
- )
- .add(layout.createParallelGroup(BASELINE)
- .add(statsFlowsudpField)
- .add(statsFlowsUdpLabel)
- )
- .add(layout.createParallelGroup(BASELINE)
- .add(statsFlowsIcmpField)
- .add(statsFlowsIcmpLabel)
- )
- .add(layout.createParallelGroup(BASELINE)
- .add(statsFlowsOtherField)
- .add(statsFlowsOthersLabel)
- )
- .add(layout.createParallelGroup(BASELINE)
- .add(statsPacketsField)
- .add(statsFlowsPacketsLabel)
- )
- .add(layout.createParallelGroup(BASELINE)
- .add(statsPacketsotherField)
- .add(statsPacketsTcpLabel)
- )
- .add(layout.createParallelGroup(BASELINE)
- .add(statsPacketsTcpField)
- .add(statsPacketsUdpLabel)
- )
- .add(layout.createParallelGroup(BASELINE)
- .add(statsPacketsUdpField)
- .add(statsPacketsIcmpLabel)
- )
- .add(layout.createParallelGroup(BASELINE)
- .add(statsPacketsIcmpField)
- .add(statsPacketsOtherLabel)
- )
- .add(layout.createParallelGroup(BASELINE)
- .add(statsBytesLabel)
- .add(statsBytesField)
- )
- .add(layout.createParallelGroup(BASELINE)
- .add(statsBytesTcpLabel)
- .add(statsBytesTcpField)
- )
- .add(layout.createParallelGroup(BASELINE)
- .add(statsBytesUdpLabel)
- .add(statsBytesUdpField)
- )
- .add(layout.createParallelGroup(BASELINE)
- .add(statsBytesIcmpLabel)
- .add(statsBytesIcmpField)
- )
- .add(layout.createParallelGroup(BASELINE)
- .add(statsBytesOtherLabel)
- .add(statsBytesOtherField)
- )
- .add(layout.createParallelGroup(BASELINE)
- .add(statsFirstLabel)
- .add(statsFirstField)
- )
- .add(layout.createParallelGroup(BASELINE)
- .add(statsLastLabel)
- .add(statsLastField)
- )
- .add(layout.createParallelGroup(BASELINE)
- .add(statsMsecFirstLabel)
- .add(statsMsecFirstField)
- )
- .add(layout.createParallelGroup(BASELINE)
- .add(statsMsecLastLabel)
- .add(statsMsecLastField)
- )
- .add(layout.createParallelGroup(BASELINE)
- .add(statsSeqFailLabel)
- .add(statsSeqFailField)
- )
.addContainerGap()
);
setLayout(layout);
}
+
+ protected JComponent createRangePanel(JLabel rangeStartLabel,
JTextField rangeStartField, JLabel rangeEndLabel, JTextField rangeEndField) {
+ JPanel rangePanel = new JPanel();
+
rangePanel.setBorder(BorderFactory.createTitledBorder("Range"));
+ GroupLayout layout = new GroupLayout(rangePanel);
+ layout.setHorizontalGroup(
+ layout.createSequentialGroup()
+ .addContainerGap()
+ .add(layout.createParallelGroup()
+ .add(rangeStartLabel)
+ .add(rangeEndLabel))
+ .addPreferredGap(RELATED)
+ .add(layout.createParallelGroup()
+ .add(rangeStartField, 160, 160, PREFERRED_SIZE)
+ .add(rangeEndField, 160, 160, PREFERRED_SIZE))
+ .addContainerGap()
+ );
+ layout.setVerticalGroup(
+ layout.createSequentialGroup()
+ .add(layout.createParallelGroup()
+ .add(rangeStartLabel)
+ .add(rangeStartField, PREFERRED_SIZE,
PREFERRED_SIZE, PREFERRED_SIZE))
+ .addPreferredGap(RELATED)
+ .add(layout.createParallelGroup()
+ .add(rangeEndLabel)
+ .add(rangeEndField, PREFERRED_SIZE, PREFERRED_SIZE,
PREFERRED_SIZE))
+ .addContainerGap()
+ );
+ rangePanel.setLayout(layout);
+ return rangePanel;
+ }
public void setStatistics(Statistics statistics) {
if(statistics==null) {
@@ -289,6 +349,8 @@
statsPacketsUdpField.setText(null);
statsPacketsotherField.setText(null);
statsSeqFailField.setText(null);
+ rangeStartField.setText(null);
+ rangeEndField.setText(null);
} else {
statsBytesField.setText(statistics.getBytes());
statsBytesIcmpField.setText(statistics.getBytesIcmp());
@@ -310,6 +372,10 @@
statsPacketsUdpField.setText(statistics.getPacketsUdp());
statsPacketsotherField.setText(statistics.getPacketsOther());
statsSeqFailField.setText(statistics.getSequenceFailures());
+ TimeRange range = statistics.getRange();
+ DateFormat iso = new
SimpleDateFormat(ISO8601_PATTERN);
+ rangeStartField.setText(iso.format(range.getStart()));
+ rangeEndField.setText(iso.format(range.getEnd()));
}
}
}
- perfsonar: r3393 - in branches/perfsonarui/src/org/perfsonar/perfsonarui/flowsa: . components, svnlog, 02/22/2008
Archive powered by MHonArc 2.6.16.