Skip to Content.
Sympa Menu

perfsonar-dev - perfsonar: r2658 - in branches/perfsonarui/src/org/perfsonar/perfsonarui/flowsa: . panels requestTemplates

Subject: perfsonar development work

List archive

perfsonar: r2658 - in branches/perfsonarui/src/org/perfsonar/perfsonarui/flowsa: . panels requestTemplates


Chronological Thread 
  • From:
  • To:
  • Subject: perfsonar: r2658 - in branches/perfsonarui/src/org/perfsonar/perfsonarui/flowsa: . panels requestTemplates
  • Date: Wed, 15 Aug 2007 09:01:39 -0400

Author: gijs
Date: 2007-08-15 09:01:38 -0400 (Wed, 15 Aug 2007)
New Revision: 2658

Modified:

branches/perfsonarui/src/org/perfsonar/perfsonarui/flowsa/FlowSARequest.java

branches/perfsonarui/src/org/perfsonar/perfsonarui/flowsa/panels/TopPanel.java

branches/perfsonarui/src/org/perfsonar/perfsonarui/flowsa/requestTemplates/top.xml
Log:


Modified:
branches/perfsonarui/src/org/perfsonar/perfsonarui/flowsa/FlowSARequest.java
===================================================================
---
branches/perfsonarui/src/org/perfsonar/perfsonarui/flowsa/FlowSARequest.java
2007-08-15 11:44:26 UTC (rev 2657)
+++
branches/perfsonarui/src/org/perfsonar/perfsonarui/flowsa/FlowSARequest.java
2007-08-15 13:01:38 UTC (rev 2658)
@@ -64,12 +64,22 @@

public Document createRawRequest(IUserData data) throws Exception {
String inputFile =
"org/perfsonar/perfsonarui/flowsa/requestTemplates/raw.xml";
- // String inputFile =
- //
"/home/gijs/stuff/eclipse/perfsonarui/src/org/perfsonar/perfsonarui/flowsa/SetupDataRequest-rawFlows.xml";
Document request = parseXmlFile(inputFile);

replaceGenericParameters(request, data);

+ // replace filter rule & aggregationRule rule
+ NodeList paraNodes =
request.getElementsByTagName("nmwg:parameter");
+ for (int j = 0; j < paraNodes.getLength(); j++) {
+ Element paraNode = (Element) paraNodes.item(j);
+ String nameAttr = paraNode.getAttribute("name");
+ if (nameAttr.equals("aggregationRule")) {
+
paraNode.getFirstChild().setTextContent(data.getQuery(FlowSAUserData.RAWAGGREGATION));
+ } else if (nameAttr.equals("filterRule")) {
+
paraNode.getFirstChild().setTextContent(data.getQuery(FlowSAUserData.RAWFILTER));
+ }
+ }
+
// add fields parameters
Node parameters =
request.getElementsByTagName("flow:parameters").item(0);
for (String field :
data.getQuery(FlowSAUserData.RAWFIELDS).split(" ")) {
@@ -92,12 +102,14 @@
return createRawRequest(data);

} else if (type.equals("Top")) {
+ logger.error("top request");
return createTopRequest(data);

} else if (type.equals("Statistical")) {
return createStatRequest(data);

} else {
+ logger.error("querytype not supported: " + type);
return null;
}
}
@@ -118,9 +130,39 @@

private Document createTopRequest(IUserData data) throws
ParserConfigurationException, SAXException, IOException {
String inputFile =
"org/perfsonar/perfsonarui/flowsa/requestTemplates/top.xml";
+
Document request = parseXmlFile(inputFile);
+
replaceGenericParameters(request, data);
+
+ // replace filter rule & aggregationRule rule and other
parameters
+ NodeList paraNodes =
request.getElementsByTagName("nmwg:parameter");
+ for (int j = 0; j < paraNodes.getLength(); j++) {
+ Element paraNode = (Element) paraNodes.item(j);
+ String nameAttr = paraNode.getAttribute("name");
+ if (nameAttr.equals("aggregationRule")) {
+
paraNode.getFirstChild().setTextContent(data.getQuery(FlowSAUserData.RAWAGGREGATION));
+ } else if (nameAttr.equals("filterRule")) {
+
paraNode.getFirstChild().setTextContent(data.getQuery(FlowSAUserData.RAWFILTER));
+ } else if (nameAttr.equals("startTime")) {
+ Element startNode = (Element)
paraNode.getElementsByTagName("nmtm:time").item(0);
+ startNode.setAttribute("value",
data.getStartTime());
+ } else if (nameAttr.equals("topStatistic")) {
+
paraNode.getFirstChild().setTextContent(data.getQuery(FlowSAUserData.TOPELEMENTS));
+ } else if (nameAttr.equals("orderBy")) {
+
paraNode.getFirstChild().setTextContent(data.getQuery(FlowSAUserData.TOPORDERBY));
+ } else if (nameAttr.equals("splitProtocol")) {
+
paraNode.getFirstChild().setTextContent(data.getQuery(FlowSAUserData.TOPTRANSGROUP));
+ } else if (nameAttr.equals("topN")) {
+
paraNode.getFirstChild().setTextContent(data.getQuery(FlowSAUserData.TOPNUMBER));
+ } else if (nameAttr.equals("filterRule")) {
+
paraNode.getFirstChild().setTextContent(data.getQuery(FlowSAUserData.TOPFILTER));
+ } else if (nameAttr.equals("aggregationRule")) {
+
paraNode.getFirstChild().setTextContent(data.getQuery(FlowSAUserData.TOPAGGREGATION));
+ }
+ }
return request;
+
}

@Override
@@ -160,12 +202,22 @@

}

- private Document parseXmlFile(String inputFile) throws
ParserConfigurationException, SAXException, IOException {
+ private Document parseXmlFile(String inputFile) {
DocumentBuilderFactory factory =
DocumentBuilderFactory.newInstance();
factory.setNamespaceAware(true);
- DocumentBuilder builder = factory.newDocumentBuilder();
InputStream stream =
this.getClass().getClassLoader().getResourceAsStream(inputFile);
- return builder.parse(stream);
+
+ try {
+ DocumentBuilder builder =
factory.newDocumentBuilder();
+ return builder.parse(stream);
+ } catch (SAXException e) {
+ e.printStackTrace();
+ } catch (IOException e) {
+ e.printStackTrace();
+ } catch (ParserConfigurationException e) {
+ e.printStackTrace();
+ }
+ return null;
}

public void process(IUserData data, Document response,
IPerfsonarResponse listener) throws Exception {
@@ -173,7 +225,7 @@
}

private void replaceGenericParameters(Document request, IUserData
data) {
- // change start moment, end moment, filter rule &
aggregationRule rule
+ // change start moment, end moment
NodeList paraNodes =
request.getElementsByTagName("nmwg:parameter");
for (int j = 0; j < paraNodes.getLength(); j++) {
Element paraNode = (Element) paraNodes.item(j);
@@ -184,10 +236,7 @@
} else if (nameAttr.equals("endTime")) {
Element endNode = (Element)
paraNode.getElementsByTagName("nmtm:time").item(0);
endNode.setAttribute("value",
data.getEndTime());
- } else if (nameAttr.equals("aggregationRule")) {
-
paraNode.getFirstChild().setTextContent(data.getQuery(FlowSAUserData.RAWAGGREGATION));
- } else if (nameAttr.equals("filterRule")) {
-
paraNode.getFirstChild().setTextContent(data.getQuery(FlowSAUserData.RAWFILTER));
+
}
}


Modified:
branches/perfsonarui/src/org/perfsonar/perfsonarui/flowsa/panels/TopPanel.java
===================================================================
---
branches/perfsonarui/src/org/perfsonar/perfsonarui/flowsa/panels/TopPanel.java
2007-08-15 11:44:26 UTC (rev 2657)
+++
branches/perfsonarui/src/org/perfsonar/perfsonarui/flowsa/panels/TopPanel.java
2007-08-15 13:01:38 UTC (rev 2658)
@@ -13,6 +13,9 @@
import java.util.Observable;
import java.util.Observer;

+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.JTable;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;

@@ -23,12 +26,10 @@

private static final long serialVersionUID = 1L;

- private javax.swing.JScrollPane topDataScrollPane;
+ private JScrollPane topDataScrollPane;
+ private JTable topDataTable;
+ private JPanel topPane;

- private javax.swing.JTable topDataTable;
-
- private javax.swing.JPanel topQueryPanel;
-
public TopPanel(Component parentFrame, IPerfsonarTab model) {
super(parentFrame, model);
this.addWidgets();
@@ -36,49 +37,45 @@

@Override
public void addWidgets() {
- topQueryPanel = new javax.swing.JPanel();
+ topPane = new javax.swing.JPanel();
topDataScrollPane = new javax.swing.JScrollPane();
topDataTable = new javax.swing.JTable();

- topDataTable.setModel(new
javax.swing.table.DefaultTableModel(new Object[][] {
- { null, null, null, null, null, null, null,
null, null, null },
- { null, null, null, null, null, null, null,
null, null, null },
- { null, null, null, null, null, null, null,
null, null, null },
- { null, null, null, null, null, null, null,
null, null, null } }, new String[] { "#", "Date first seen",
- "Duration", "Proto", "Flows", "Packets",
"Bytes", "Pps", "Bps", "Bpp" }) {
+
topPane.setBorder(javax.swing.BorderFactory.createTitledBorder("Top Query
Results"));
+
topDataScrollPane.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
+ topDataScrollPane.setAutoscrolls(true);
+ topDataTable.setModel(new
javax.swing.table.DefaultTableModel(new Object[][] { {} }, new String[] { "#",
+ "Date first seen", "Duration", "Proto",
"Flows", "Packets", "Bytes", "Pps", "Bps", "Bpp" }) {
+
private static final long serialVersionUID = 1L;

- boolean[] canEdit = new boolean[] { false, false,
false, false, true, true, true, true, true, true };
+ boolean[] canEdit = new boolean[] { false, false,
false, false, false, false, false, false, false, false };

@Override
public boolean isCellEditable(int rowIndex, int
columnIndex) {
return canEdit[columnIndex];
}
});
+
topDataTable.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_OFF);
+ topDataTable.setMinimumSize(new java.awt.Dimension(500, 400));
topDataScrollPane.setViewportView(topDataTable);

- org.jdesktop.layout.GroupLayout topQueryPanelLayout = new
org.jdesktop.layout.GroupLayout(topQueryPanel);
- topQueryPanel.setLayout(topQueryPanelLayout);
-
topQueryPanelLayout.setHorizontalGroup(topQueryPanelLayout.createParallelGroup(
-
org.jdesktop.layout.GroupLayout.LEADING).add(topDataScrollPane,
org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
- 827, Short.MAX_VALUE));
-
topQueryPanelLayout.setVerticalGroup(topQueryPanelLayout.createParallelGroup(
-
org.jdesktop.layout.GroupLayout.LEADING).add(topDataScrollPane,
org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
- 372, Short.MAX_VALUE));
+ org.jdesktop.layout.GroupLayout topPaneLayout = new
org.jdesktop.layout.GroupLayout(topPane);
+ topPane.setLayout(topPaneLayout);
+
topPaneLayout.setHorizontalGroup(topPaneLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(
+ topDataScrollPane,
org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 642, Short.MAX_VALUE));
+
topPaneLayout.setVerticalGroup(topPaneLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(
+ topDataScrollPane,
org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 356, Short.MAX_VALUE));

org.jdesktop.layout.GroupLayout layout = new
org.jdesktop.layout.GroupLayout(this);
this.setLayout(layout);

layout.setHorizontalGroup(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(
-
layout.createSequentialGroup().addContainerGap().add(topQueryPanel,
-
org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
-
org.jdesktop.layout.GroupLayout.PREFERRED_SIZE).addContainerGap(
-
org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));
+
layout.createSequentialGroup().addContainerGap().add(topPane,
org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
+
org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
Short.MAX_VALUE).addContainerGap()));

layout.setVerticalGroup(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(
- org.jdesktop.layout.GroupLayout.TRAILING,
-
layout.createSequentialGroup().addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
Short.MAX_VALUE)
- .add(topQueryPanel,
org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
-
org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
- .addContainerGap()));
+
layout.createSequentialGroup().addContainerGap().add(topPane,
org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
+
org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
Short.MAX_VALUE).addContainerGap()));
+
}

public void changedUpdate(DocumentEvent e) {

Modified:
branches/perfsonarui/src/org/perfsonar/perfsonarui/flowsa/requestTemplates/top.xml
===================================================================
---
branches/perfsonarui/src/org/perfsonar/perfsonarui/flowsa/requestTemplates/top.xml
2007-08-15 11:44:26 UTC (rev 2657)
+++
branches/perfsonarui/src/org/perfsonar/perfsonarui/flowsa/requestTemplates/top.xml
2007-08-15 13:01:38 UTC (rev 2658)
@@ -34,12 +34,12 @@
<nmwg:metadata id="meta2">
<flow:subject id="flowsub2" metadataIdRef="meta1"/>
<flow:parameters id="flowparamid1">
- <nmwg:parameter name="topStatistic">srcip</nmwg:parameter>
- <nmwg:parameter name="orderBy">bytes</nmwg:parameter>
- <nmwg:parameter name="splitProtocol">yes</nmwg:parameter>
- <nmwg:parameter name="topN">20</nmwg:parameter>
- <nmwg:parameter name="filterRule">port = 53</nmwg:parameter>
- <nmwg:parameter name="aggregationRule">srcip4/24</nmwg:parameter>
+ <nmwg:parameter name="topStatistic">top field</nmwg:parameter>
+ <nmwg:parameter name="orderBy">order field</nmwg:parameter>
+ <nmwg:parameter name="splitProtocol">split field</nmwg:parameter>
+ <nmwg:parameter name="topN">top field</nmwg:parameter>
+ <nmwg:parameter name="filterRule">filter field</nmwg:parameter>
+ <nmwg:parameter name="aggregationRule">aggregation
field</nmwg:parameter>
</flow:parameters>
</nmwg:metadata>




  • perfsonar: r2658 - in branches/perfsonarui/src/org/perfsonar/perfsonarui/flowsa: . panels requestTemplates, svnlog, 08/15/2007

Archive powered by MHonArc 2.6.16.

Top of Page