[rhmessaging-commits] rhmessaging commits: r1418 - mgmt/cumin/python/cumin.

rhmessaging-commits at lists.jboss.org rhmessaging-commits at lists.jboss.org
Mon Dec 3 14:28:18 EST 2007


Author: justi9
Date: 2007-12-03 14:28:17 -0500 (Mon, 03 Dec 2007)
New Revision: 1418

Added:
   mgmt/cumin/python/cumin/stat.py
   mgmt/cumin/python/cumin/stat.strings
Removed:
   mgmt/cumin/python/cumin/measurement.py
   mgmt/cumin/python/cumin/measurement.strings
Modified:
   mgmt/cumin/python/cumin/client.py
   mgmt/cumin/python/cumin/client.strings
   mgmt/cumin/python/cumin/exchange.py
   mgmt/cumin/python/cumin/exchange.strings
   mgmt/cumin/python/cumin/queue.py
   mgmt/cumin/python/cumin/queue.strings
Log:
Renames measurement* to stat*, consistent with the new model.



Modified: mgmt/cumin/python/cumin/client.py
===================================================================
--- mgmt/cumin/python/cumin/client.py	2007-12-03 19:11:22 UTC (rev 1417)
+++ mgmt/cumin/python/cumin/client.py	2007-12-03 19:28:17 UTC (rev 1418)
@@ -1,7 +1,7 @@
 from wooly import *
 from wooly.widgets import *
 
-from measurement import *
+from stat import *
 from widgets import *
 from parameters import *
 from formats import *
@@ -134,7 +134,7 @@
         def __init__(self, app, name):
             super(ClientStatistics.StatisticsCurrent, self).__init__(app, name)
 
-            self.add_child(MeasurementSet(app, "general", "general"))
+            self.add_child(StatSet(app, "general", "general"))
 
         def get_title(self, session, client):
             return "Current"

Modified: mgmt/cumin/python/cumin/client.strings
===================================================================
--- mgmt/cumin/python/cumin/client.strings	2007-12-03 19:11:22 UTC (rev 1417)
+++ mgmt/cumin/python/cumin/client.strings	2007-12-03 19:28:17 UTC (rev 1418)
@@ -132,7 +132,7 @@
   </tr>
 </table>
 <script>
-  cumin.client.listeners["{id}.general"] = updateMeasurements;
+  cumin.client.listeners["{id}.general"] = updateStats;
 </script>
 
 [StatisticsHistory.html]

Modified: mgmt/cumin/python/cumin/exchange.py
===================================================================
--- mgmt/cumin/python/cumin/exchange.py	2007-12-03 19:11:22 UTC (rev 1417)
+++ mgmt/cumin/python/cumin/exchange.py	2007-12-03 19:28:17 UTC (rev 1418)
@@ -3,7 +3,7 @@
 from wooly.forms import *
 from wooly.resources import *
 
-from measurement import *
+from stat import *
 from model import *
 from widgets import *
 from parameters import *
@@ -141,7 +141,7 @@
         return fmt_rate(value, "byte", "sec")
 
     def render_bytes_dropped(self, session, exchange):
-        return self.app.cmodel.exchange.get_stat("byteDrops").value(exchange)
+        return self.app.model.exchange.get_stat("byteDrops").value(exchange)
 
 class ExchangeView(Widget):
     def __init__(self, app, name):
@@ -343,7 +343,7 @@
         def __init__(self, app, name):
             super(ExchangeStatistics.StatisticsCurrent, self).__init__(app, name)
 
-            self.add_child(MeasurementSet(app, "general", "general"))
+            self.add_child(StatSet(app, "general", "general"))
 
         def get_title(self, session, exchange):
             return "Current"

Modified: mgmt/cumin/python/cumin/exchange.strings
===================================================================
--- mgmt/cumin/python/cumin/exchange.strings	2007-12-03 19:11:22 UTC (rev 1417)
+++ mgmt/cumin/python/cumin/exchange.strings	2007-12-03 19:28:17 UTC (rev 1418)
@@ -200,7 +200,7 @@
   </tr>
 </table>
 <script>
-  cumin.exchange.listeners["{id}.general"] = updateMeasurements;
+  cumin.exchange.listeners["{id}.general"] = updateStats;
 </script>
 
 [StatisticsHistory.html]

Deleted: mgmt/cumin/python/cumin/measurement.py
===================================================================
--- mgmt/cumin/python/cumin/measurement.py	2007-12-03 19:11:22 UTC (rev 1417)
+++ mgmt/cumin/python/cumin/measurement.py	2007-12-03 19:28:17 UTC (rev 1418)
@@ -1,66 +0,0 @@
-from wooly import *
-from wooly.widgets import *
-from mint import *
-
-from widgets import *
-from parameters import *
-from util import *
-from formats import *
-
-strings = StringCatalog(__file__)
-
-class MeasurementSet(ItemSet):
-    unit_abbrevs = dict()
-    unit_abbrevs["message"] = "msg"
-    unit_abbrevs["transaction"] = "trans"
-    
-    def __init__(self, app, name, category):
-        super(MeasurementSet, self).__init__(app, name)
-
-        self.category = category
-
-        self.object = Attribute(app, "object");
-        self.add_attribute(self.object);
-
-    def do_get_items(self, session, object):
-        stats = list()
-        cls = self.app.model.get_class(object)
-
-        for stat in cls.stats:
-            if self.category in stat.categories:
-                stats.append((stat, object))
-        
-        return stats
-
-    def render_item_title(self, session, args):
-        stat, object = args
-        return stat.title
-
-    def render_item_name(self, session, args):
-        stat, object = args
-        return stat.name
-
-    def render_item_value(self, session, args):
-        stat, object = args
-        
-        if stat.link_cb:
-            branch = session.branch()
-            stat.link_cb(self.page(), branch, object)
-            return fmt_link(branch.marshal(), stat.value(object))
-        else:
-            return stat.value(object)
-
-    def render_item_extra(self, session, args):
-        stat, object = args
-        
-        if False and stat.highlow: #XXX
-            return "<small>high</small>&nbsp;<span>%i</span> " + \
-                   "<small>low</small>&nbsp;<span>%i</span>" \
-                   % (stat.high(object) or 0, stat.low(object) or 0)
-        else:
-            unit = self.unit_abbrevs.get(stat.unit, stat.unit)
-            return fmt_rate(stat.rate(object), unit, "sec")
-
-    def render_item_average(self, session, args):
-        stat, object = args
-        return None #XXX "%0.2f" % (sum(measure.values) / float(len(measure.values)))

Deleted: mgmt/cumin/python/cumin/measurement.strings
===================================================================
--- mgmt/cumin/python/cumin/measurement.strings	2007-12-03 19:11:22 UTC (rev 1417)
+++ mgmt/cumin/python/cumin/measurement.strings	2007-12-03 19:28:17 UTC (rev 1418)
@@ -1,52 +0,0 @@
-[MeasurementSet.javascript]
-function updateMeasurements(id, object) {
-    var table = wooly.doc().elembyid(id)
-    var trs = table.elem("tbody").elems("tr");
-    var tr = trs.next();
-
-    while (tr) {
-        var attr = tr.getattr("stat");
-
-        if (attr) {
-            var stat = object.stat[attr];
-            var tds = tr.elems("td", null, null, 0, 2);
-
-            tds.next().text().set(stat.value);
-
-            var td = tds.next();
-
-            var phs = td.elems("span", null, null, 0, 2);
-            var ph = phs.next();
-
-            if (ph) {
-                ph.set(stat.high);
-
-                ph = phs.next();
-
-                ph.set(stat.low);
-            } else {
-                td.text().set(stat.rate);
-            }
-        }
-
-        tr = trs.next();
-    }
-}
-
-[MeasurementSet.html]
-<table id="{id}" class="mobjects">
-  <tr>
-    <th style="width: 45%;">Statistic</th>
-    <th style="width: 20%;" class="ralign">Current</th>
-    <th style="width: 35%;" class="ralign"></th>
-  </tr>
-
-  {items}
-</table>
-
-[MeasurementSet.item_html]
-<tr stat="{item_name}">
-  <th>{item_title}</th>
-  <td class="ralign"> {item_value}</td>
-  <td class="ralign"> {item_extra}</td>
-</tr>

Modified: mgmt/cumin/python/cumin/queue.py
===================================================================
--- mgmt/cumin/python/cumin/queue.py	2007-12-03 19:11:22 UTC (rev 1417)
+++ mgmt/cumin/python/cumin/queue.py	2007-12-03 19:28:17 UTC (rev 1418)
@@ -6,7 +6,7 @@
 from datetime import datetime
 
 from exchange import ExchangeInputSet
-from measurement import *
+from stat import *
 from widgets import *
 from parameters import *
 from formats import *
@@ -451,14 +451,11 @@
         def __init__(self, app, name):
             super(QueueStatistics.StatisticsCurrent, self).__init__(app, name)
 
-            self.add_child(MeasurementSet(app, "general", "general"))
-            self.add_child(MeasurementSet(app, "disk", "disk"))
-            self.add_child(MeasurementSet \
-                           (app, "transactional", "transactional"))
-            self.add_child(MeasurementSet \
-                           (app, "persistent", "persistent"))
-            self.add_child(MeasurementSet \
-                           (app, "transaction", "transaction"))
+            self.add_child(StatSet(app, "general", "general"))
+            self.add_child(StatSet(app, "disk", "disk"))
+            self.add_child(StatSet(app, "transactional", "transactional"))
+            self.add_child(StatSet(app, "persistent", "persistent"))
+            self.add_child(StatSet(app, "transaction", "transaction"))
 
         def get_title(self, session, queue):
             return "Current"

Modified: mgmt/cumin/python/cumin/queue.strings
===================================================================
--- mgmt/cumin/python/cumin/queue.strings	2007-12-03 19:11:22 UTC (rev 1417)
+++ mgmt/cumin/python/cumin/queue.strings	2007-12-03 19:28:17 UTC (rev 1418)
@@ -257,10 +257,10 @@
   </tr>
 </table>
 <script>
-  cumin.queue.listeners["{id}.general"] = updateMeasurements;
-  cumin.queue.listeners["{id}.persistent"] = updateMeasurements;
-  cumin.queue.listeners["{id}.transactional"] = updateMeasurements;
-  cumin.queue.listeners["{id}.transaction"] = updateMeasurements;
+  cumin.queue.listeners["{id}.general"] = updateStats;
+  cumin.queue.listeners["{id}.persistent"] = updateStats;
+  cumin.queue.listeners["{id}.transactional"] = updateStats;
+  cumin.queue.listeners["{id}.transaction"] = updateStats;
 </script>
 
 [StatisticsHistory.html]

Copied: mgmt/cumin/python/cumin/stat.py (from rev 1417, mgmt/cumin/python/cumin/measurement.py)
===================================================================
--- mgmt/cumin/python/cumin/stat.py	                        (rev 0)
+++ mgmt/cumin/python/cumin/stat.py	2007-12-03 19:28:17 UTC (rev 1418)
@@ -0,0 +1,66 @@
+from wooly import *
+from wooly.widgets import *
+from mint import *
+
+from widgets import *
+from parameters import *
+from util import *
+from formats import *
+
+strings = StringCatalog(__file__)
+
+class StatSet(ItemSet):
+    unit_abbrevs = dict()
+    unit_abbrevs["message"] = "msg"
+    unit_abbrevs["transaction"] = "trans"
+    
+    def __init__(self, app, name, category):
+        super(StatSet, self).__init__(app, name)
+
+        self.category = category
+
+        self.object = Attribute(app, "object");
+        self.add_attribute(self.object);
+
+    def do_get_items(self, session, object):
+        stats = list()
+        cls = self.app.model.get_class(object)
+
+        for stat in cls.stats:
+            if self.category in stat.categories:
+                stats.append((stat, object))
+        
+        return stats
+
+    def render_item_title(self, session, args):
+        stat, object = args
+        return stat.title
+
+    def render_item_name(self, session, args):
+        stat, object = args
+        return stat.name
+
+    def render_item_value(self, session, args):
+        stat, object = args
+        
+        if stat.link_cb:
+            branch = session.branch()
+            stat.link_cb(self.page(), branch, object)
+            return fmt_link(branch.marshal(), stat.value(object))
+        else:
+            return stat.value(object)
+
+    def render_item_extra(self, session, args):
+        stat, object = args
+        
+        if False and stat.highlow: #XXX
+            return "<small>high</small>&nbsp;<span>%i</span> " + \
+                   "<small>low</small>&nbsp;<span>%i</span>" \
+                   % (stat.high(object) or 0, stat.low(object) or 0)
+        else:
+            unit = self.unit_abbrevs.get(stat.unit, stat.unit)
+            return fmt_rate(stat.rate(object), unit, "sec")
+
+    def render_item_average(self, session, args):
+        stat, object = args
+        return None #XXX "%0.2f" % (sum(stat.values) / float(len(stat.values)))

Copied: mgmt/cumin/python/cumin/stat.strings (from rev 1403, mgmt/cumin/python/cumin/measurement.strings)
===================================================================
--- mgmt/cumin/python/cumin/stat.strings	                        (rev 0)
+++ mgmt/cumin/python/cumin/stat.strings	2007-12-03 19:28:17 UTC (rev 1418)
@@ -0,0 +1,52 @@
+[StatSet.javascript]
+function updateStats(id, object) {
+    var table = wooly.doc().elembyid(id)
+    var trs = table.elem("tbody").elems("tr");
+    var tr = trs.next();
+
+    while (tr) {
+        var attr = tr.getattr("stat");
+
+        if (attr) {
+            var stat = object.stat[attr];
+            var tds = tr.elems("td", null, null, 0, 2);
+
+            tds.next().text().set(stat.value);
+
+            var td = tds.next();
+
+            var phs = td.elems("span", null, null, 0, 2);
+            var ph = phs.next();
+
+            if (ph) {
+                ph.set(stat.high);
+
+                ph = phs.next();
+
+                ph.set(stat.low);
+            } else {
+                td.text().set(stat.rate);
+            }
+        }
+
+        tr = trs.next();
+    }
+}
+
+[StatSet.html]
+<table id="{id}" class="mobjects">
+  <tr>
+    <th style="width: 45%;">Statistic</th>
+    <th style="width: 20%;" class="ralign">Current</th>
+    <th style="width: 35%;" class="ralign"></th>
+  </tr>
+
+  {items}
+</table>
+
+[StatSet.item_html]
+<tr stat="{item_name}">
+  <th>{item_title}</th>
+  <td class="ralign"> {item_value}</td>
+  <td class="ralign"> {item_extra}</td>
+</tr>




More information about the rhmessaging-commits mailing list