[rhmessaging-commits] rhmessaging commits: r4102 - in mgmt/newdata/cumin: python/cumin/messaging and 1 other directory.

rhmessaging-commits at lists.jboss.org rhmessaging-commits at lists.jboss.org
Sun Jul 11 19:16:10 EDT 2010


Author: justi9
Date: 2010-07-11 19:16:10 -0400 (Sun, 11 Jul 2010)
New Revision: 4102

Modified:
   mgmt/newdata/cumin/model/rosemary.xml
   mgmt/newdata/cumin/python/cumin/messaging/binding.py
   mgmt/newdata/cumin/python/cumin/messaging/broker.py
   mgmt/newdata/cumin/python/cumin/messaging/brokerlink.py
   mgmt/newdata/cumin/python/cumin/messaging/connection.py
   mgmt/newdata/cumin/python/cumin/messaging/exchange.py
   mgmt/newdata/cumin/python/cumin/messaging/queue.py
Log:
Reorganize the broker plumbing around vhosts.  This makes things
easier, and it gives us a name attribute to use.


Modified: mgmt/newdata/cumin/model/rosemary.xml
===================================================================
--- mgmt/newdata/cumin/model/rosemary.xml	2010-07-11 22:10:39 UTC (rev 4101)
+++ mgmt/newdata/cumin/model/rosemary.xml	2010-07-11 23:16:10 UTC (rev 4102)
@@ -37,17 +37,9 @@
 
     <class name="Broker">
       <object>
-        <title>host:%(port)s</title>
+        <title>%(name)s</title>
       </object>
 
-      <property name="port">
-        <title>Port</title>
-      </property>
-
-      <property name="workerThreads">
-        <title>Worker Threads</title>
-      </property>
-
       <property name="maxConns">
         <title>Max Connections</title>
       </property>
@@ -56,24 +48,10 @@
         <title>Connection Backlog</title>
       </property>
 
-      <property name="stagingThreshold">
-        <title>Staging Threshold</title>
-      </property>
-
       <property name="mgmtPubInterval">
         <title>QMF Publish Interval</title>
       </property>
 
-      <!--
-      <property name="clusterName">
-        <title>Cluster Name</title>
-      </property>
-      -->
-
-      <property name="version">
-        <title>Version</title>
-      </property>
-
       <property name="dataDir">
         <title>Data Directory</title>
       </property>
@@ -183,6 +161,10 @@
         <title>Host</title>
       </property>
     </class>
+
+    <class name="Vhost">
+      <title>Broker</title>
+    </class>
   </package>
 
   <package name="org.apache.qpid.cluster">

Modified: mgmt/newdata/cumin/python/cumin/messaging/binding.py
===================================================================
--- mgmt/newdata/cumin/python/cumin/messaging/binding.py	2010-07-11 22:10:39 UTC (rev 4101)
+++ mgmt/newdata/cumin/python/cumin/messaging/binding.py	2010-07-11 23:16:10 UTC (rev 4102)
@@ -31,7 +31,7 @@
         invoc.end()
 
 class BindingFrame(ObjectFrame):
-    def __init__(self, app, name):
+    def __init__(self, app, name, vhost):
         cls = app.model.org_apache_qpid_broker.Binding
 
         super(BindingFrame, self).__init__(app, name, cls)

Modified: mgmt/newdata/cumin/python/cumin/messaging/broker.py
===================================================================
--- mgmt/newdata/cumin/python/cumin/messaging/broker.py	2010-07-11 22:10:39 UTC (rev 4101)
+++ mgmt/newdata/cumin/python/cumin/messaging/broker.py	2010-07-11 23:16:10 UTC (rev 4102)
@@ -23,13 +23,15 @@
 
 class BrokerData(ObjectSqlAdapter):
     def __init__(self, app):
+        vhost = app.model.org_apache_qpid_broker.Vhost
         broker = app.model.org_apache_qpid_broker.Broker
         system = app.model.org_apache_qpid_broker.System
         cluster = app.model.org_apache_qpid_cluster.Cluster
         mapping = app.model.com_redhat_cumin.BrokerGroupMapping
 
-        super(BrokerData, self).__init__(app, broker)
+        super(BrokerData, self).__init__(app, vhost)
 
+        self.add_join(broker, vhost.brokerRef, broker._id)
         self.add_join(system, broker.systemRef, system._id)
         self.add_outer_join(cluster, broker._id, cluster.brokerRef)
 
@@ -53,6 +55,9 @@
 
 class BrokerSelector(ObjectSelector):
     def __init__(self, app, name, data):
+        # Actually a vhost selector, as it happens
+
+        vhost = app.model.org_apache_qpid_broker.Vhost
         broker = app.model.org_apache_qpid_broker.Broker
         system = app.model.org_apache_qpid_broker.System
         cluster = app.model.org_apache_qpid_cluster.Cluster
@@ -64,9 +69,10 @@
         self.group = SessionAttribute(self, "group")
 
         frame = "main.messaging.broker"
-        col = ObjectLinkColumn(app, "name", system.nodeName, broker._id, frame)
+        col = ObjectLinkColumn(app, "name", vhost.name, vhost._id, frame)
         self.add_column(col)
 
+        self.add_attribute_column(system.nodeName)
         self.add_attribute_column(broker.port)
         self.add_attribute_column(cluster.clusterName)
 
@@ -92,7 +98,7 @@
 
 class BrokerFrame(ObjectFrame):
     def __init__(self, app, name):
-        cls = app.model.org_apache_qpid_broker.Broker
+        cls = app.model.org_apache_qpid_broker.Vhost
 
         super(BrokerFrame, self).__init__(app, name, cls)
 
@@ -100,23 +106,23 @@
 
         self.broker = SessionAttribute(self, "broker")
 
-        self.queue = QueueFrame(app, "queue") # XXX pass self.vhost
+        self.queue = QueueFrame(app, "queue", self.object)
         self.add_mode(self.queue)
 
-        self.exchange = ExchangeFrame(app, "exchange")
+        self.exchange = ExchangeFrame(app, "exchange", self.object)
         self.add_mode(self.exchange)
 
-        self.binding = BindingFrame(app, "binding")
+        self.binding = BindingFrame(app, "binding", self.object)
         self.add_mode(self.binding)
 
-        self.connection = ConnectionFrame(app, "connection")
+        self.connection = ConnectionFrame(app, "connection", self.object)
         self.add_mode(self.connection)
 
-        self.brokerlink = BrokerLinkFrame(app, "link")
+        self.brokerlink = BrokerLinkFrame(app, "link", self.broker)
         self.add_mode(self.brokerlink)
 
-        self.view = ObjectView(app, "view", self.broker)
-        self.replace_child(self.view)
+        # self.view = ObjectView(app, "view", self.broker)
+        # self.replace_child(self.view)
 
         self.view.add_tab(QueueSelector(app, "queues", self.object))
         self.view.add_tab(ExchangeSelector(app, "exchanges", self.object))
@@ -130,26 +136,18 @@
         self.engroup = BrokerEngroup(app, self)
         #self.add_selection_task(app.messaging.BrokerEngroup)
 
+    def do_process(self, session):
+        super(BrokerFrame, self).do_process(session)
 
-    def get_object(self, session, id):
-        # self.object is Vhost, and we stick Broker in self.broker
+        vhost = self.object.get(session)
 
-        broker = super(BrokerFrame, self).get_object(session, id)
+        cls = self.app.model.org_apache_qpid_broker.Broker
+        obj = cls.get_object(session.cursor, _id=vhost._brokerRef_id)
 
-        self.broker.set(session, broker)
+        assert obj
 
-        cls = self.app.model.org_apache_qpid_broker.Vhost
-        args = {"_brokerRef_id": id, "name": "/"}
+        self.broker.set(session, obj)
 
-        for obj in cls.get_selection(session.cursor, **args):
-            break
-
-        return obj
-
-    def get_title(self, session):
-        obj = self.broker.get(session)
-        return "%s '%s'" % (obj._class._title, obj.get_title())
-
 class ModuleNotEnabled(Widget):
     def do_render(self, session):
         return "This module is not enabled"

Modified: mgmt/newdata/cumin/python/cumin/messaging/brokerlink.py
===================================================================
--- mgmt/newdata/cumin/python/cumin/messaging/brokerlink.py	2010-07-11 22:10:39 UTC (rev 4101)
+++ mgmt/newdata/cumin/python/cumin/messaging/brokerlink.py	2010-07-11 23:16:10 UTC (rev 4102)
@@ -19,7 +19,7 @@
 strings = StringCatalog(__file__)
 
 class BrokerLinkFrame(ObjectFrame):
-    def __init__(self, app, name):
+    def __init__(self, app, name, broker):
         cls = app.model.org_apache_qpid_broker.Link
 
         super(BrokerLinkFrame, self).__init__(app, name, cls)

Modified: mgmt/newdata/cumin/python/cumin/messaging/connection.py
===================================================================
--- mgmt/newdata/cumin/python/cumin/messaging/connection.py	2010-07-11 22:10:39 UTC (rev 4101)
+++ mgmt/newdata/cumin/python/cumin/messaging/connection.py	2010-07-11 23:16:10 UTC (rev 4102)
@@ -16,7 +16,7 @@
 strings = StringCatalog(__file__)
 
 class ConnectionFrame(ObjectFrame):
-    def __init__(self, app, name):
+    def __init__(self, app, name, vhost):
         cls = app.model.org_apache_qpid_broker.Connection
 
         super(ConnectionFrame, self).__init__(app, name, cls)

Modified: mgmt/newdata/cumin/python/cumin/messaging/exchange.py
===================================================================
--- mgmt/newdata/cumin/python/cumin/messaging/exchange.py	2010-07-11 22:10:39 UTC (rev 4101)
+++ mgmt/newdata/cumin/python/cumin/messaging/exchange.py	2010-07-11 23:16:10 UTC (rev 4102)
@@ -19,7 +19,7 @@
 log = logging.getLogger("cumin.messaging.exchange")
 
 class ExchangeFrame(ObjectFrame):
-    def __init__(self, app, name):
+    def __init__(self, app, name, vhost):
         cls = app.model.org_apache_qpid_broker.Exchange
 
         super(ExchangeFrame, self).__init__(app, name, cls)

Modified: mgmt/newdata/cumin/python/cumin/messaging/queue.py
===================================================================
--- mgmt/newdata/cumin/python/cumin/messaging/queue.py	2010-07-11 22:10:39 UTC (rev 4101)
+++ mgmt/newdata/cumin/python/cumin/messaging/queue.py	2010-07-11 23:16:10 UTC (rev 4102)
@@ -22,7 +22,7 @@
 log = logging.getLogger("cumin.messaging.queue")
 
 class QueueFrame(ObjectFrame):
-    def __init__(self, app, name):
+    def __init__(self, app, name, vhost):
         cls = app.model.org_apache_qpid_broker.Queue
 
         super(QueueFrame, self).__init__(app, name, cls)



More information about the rhmessaging-commits mailing list