[rhmessaging-commits] rhmessaging commits: r1139 - in mgmt/cumin/python: wooly and 1 other directory.

rhmessaging-commits at lists.jboss.org rhmessaging-commits at lists.jboss.org
Mon Oct 22 17:03:02 EDT 2007


Author: justi9
Date: 2007-10-22 17:03:02 -0400 (Mon, 22 Oct 2007)
New Revision: 1139

Added:
   mgmt/cumin/python/cumin/client.py
Modified:
   mgmt/cumin/python/cumin/demo.py
   mgmt/cumin/python/cumin/model.py
   mgmt/cumin/python/cumin/virtualhost.py
   mgmt/cumin/python/wooly/resources.py
Log:
Adds a clients tab to the vhost view.



Added: mgmt/cumin/python/cumin/client.py
===================================================================
--- mgmt/cumin/python/cumin/client.py	                        (rev 0)
+++ mgmt/cumin/python/cumin/client.py	2007-10-22 21:03:02 UTC (rev 1139)
@@ -0,0 +1,19 @@
+from wooly import *
+from wooly.widgets import *
+
+from widgets import *
+from parameters import *
+from util import *
+
+#strings = StringCatalog(__file__)
+
+class ClientSet(ItemSet):
+    def render_title(self, session, vhost):
+        return "Clients (%i)" % len(vhost.client_items())
+
+    def get_items(self, session, vhost):
+        return sorted_by(vhost.client_items(), "address")
+
+    def render_item_link(self, session, client):
+        branch = session.branch()
+        return mlink(branch.marshal(), "Client", client.address)

Modified: mgmt/cumin/python/cumin/demo.py
===================================================================
--- mgmt/cumin/python/cumin/demo.py	2007-10-22 20:25:38 UTC (rev 1138)
+++ mgmt/cumin/python/cumin/demo.py	2007-10-22 21:03:02 UTC (rev 1139)
@@ -144,6 +144,11 @@
             queue.name = fmt("queue", queue_count)
             vhost.add_queue(queue)
 
+        for num in range(100, 200, 10):
+            client = Client(self.model)
+            client.address = "192.168.0.%i:16565" % num
+            vhost.add_client(client)
+
     def start_updates(self):
         thread = UpdateThread(self.model)
         thread.start()

Modified: mgmt/cumin/python/cumin/model.py
===================================================================
--- mgmt/cumin/python/cumin/model.py	2007-10-22 20:25:38 UTC (rev 1138)
+++ mgmt/cumin/python/cumin/model.py	2007-10-22 21:03:02 UTC (rev 1139)
@@ -15,6 +15,7 @@
         self.virtual_host_group = ModelClass(self, "virtual_host_group")
         self.queue = ModelClass(self, "queue")
         self.exchange = ModelClass(self, "exchange")
+        self.client = ModelClass(self, "client")
         self.realm = ModelClass(self, "realm")
         self.binding = ModelClass(self, "binding")
 
@@ -71,6 +72,10 @@
         assoc.add_endpoint(self.virtual_host, "exchange", "0..n")
         assoc.add_endpoint(self.exchange, "virtual_host", "0..1")
 
+        assoc = ModelAssociation(self, "virtual_host_to_clients")
+        assoc.add_endpoint(self.virtual_host, "client", "0..n")
+        assoc.add_endpoint(self.client, "virtual_host", "0..1")
+
         assoc = ModelAssociation(self, "virtual_host_to_realms")
         assoc.add_endpoint(self.virtual_host, "realm", "0..n")
         assoc.add_endpoint(self.realm, "virtual_host", "0..1")
@@ -146,6 +151,9 @@
     def get_exchange(self, id):
         return self.get_index(self.exchange).get(id)
 
+    def get_client(self, id):
+        return self.get_index(self.client).get(id)
+
     def get_realm(self, id):
         return self.get_index(self.realm).get(id)
 
@@ -605,3 +613,9 @@
         writer.write("<queue ref=\"queue-%i\"/>" % self.queue.id)
         writer.write("<routing-key>%s</routing-key>" % self.routing_key)
         writer.write("</binding>")
+
+class Client(ModelObject):
+    def __init__(self, model):
+        super(Client, self).__init__(model, model.client)
+
+        self.address = None

Modified: mgmt/cumin/python/cumin/virtualhost.py
===================================================================
--- mgmt/cumin/python/cumin/virtualhost.py	2007-10-22 20:25:38 UTC (rev 1138)
+++ mgmt/cumin/python/cumin/virtualhost.py	2007-10-22 21:03:02 UTC (rev 1139)
@@ -2,8 +2,8 @@
 from wooly.widgets import *
 
 from queue import *
-from realm import *
 from exchange import *
+from client import *
 from widgets import *
 from parameters import *
 from util import *
@@ -63,6 +63,7 @@
 
         self.tabs.add_tab(QueueSet(app, "queues"))
         self.tabs.add_tab(ExchangeSet(app, "exchanges"))
+        self.tabs.add_tab(ClientSet(app, "clients"))
 
     def render_title(self, session, vhost):
         return "Functional Host '%s'" % vhost.name

Modified: mgmt/cumin/python/wooly/resources.py
===================================================================
--- mgmt/cumin/python/wooly/resources.py	2007-10-22 20:25:38 UTC (rev 1138)
+++ mgmt/cumin/python/wooly/resources.py	2007-10-22 21:03:02 UTC (rev 1139)
@@ -13,6 +13,7 @@
         try:
             file = open(self.path)
             self.strings = parse_catalog_file(file)
+            # XXX catch file not found
         finally:
             file.close()
 




More information about the rhmessaging-commits mailing list