[rhmessaging-commits] rhmessaging commits: r1408 - in mgmt: mint/python/mint and 1 other directory.
rhmessaging-commits at lists.jboss.org
rhmessaging-commits at lists.jboss.org
Mon Dec 3 09:22:08 EST 2007
Author: justi9
Date: 2007-12-03 09:22:08 -0500 (Mon, 03 Dec 2007)
New Revision: 1408
Modified:
mgmt/cumin/python/cumin/broker.py
mgmt/cumin/python/cumin/client.py
mgmt/cumin/python/cumin/exchange.py
mgmt/cumin/python/cumin/parameters.py
mgmt/cumin/python/cumin/queue.py
mgmt/mint/python/mint/__init__.py
mgmt/mint/python/mint/schema.sql
Log:
Adds a registration assoc endpoint to Broker.
Makes the broker view work with broker registrations that are not
attached to a real broker.
Modified: mgmt/cumin/python/cumin/broker.py
===================================================================
--- mgmt/cumin/python/cumin/broker.py 2007-11-30 22:57:44 UTC (rev 1407)
+++ mgmt/cumin/python/cumin/broker.py 2007-12-03 14:22:08 UTC (rev 1408)
@@ -38,7 +38,7 @@
def get_items(self, session, model):
start, end = self.paginator.get_bounds(session)
- return list(Broker.select()[start:end])
+ return list(BrokerRegistration.select()[start:end])
def do_process(self, session, model):
if self.submit.get(session):
@@ -149,7 +149,7 @@
return self.show_mode(session, self.client)
def get_title(self, session, broker):
- return "Broker '%s'" % broker.port
+ return "Broker '%s'" % broker.name
class BrokerConfigPropertyForm(CuminForm, Frame):
def __init__(self, app, name):
@@ -248,8 +248,8 @@
self.tabs.add_tab(self.BrokerQueueTab(app, "queues"))
self.tabs.add_tab(self.BrokerExchangeTab(app, "exchanges"))
self.tabs.add_tab(self.BrokerClientTab(app, "clients"))
- self.config = self.BrokerConfigTab(app, "config")
- self.tabs.add_tab(self.config)
+ #self.config = self.BrokerConfigTab(app, "config")
+ #self.tabs.add_tab(self.config)
self.tabs.add_tab(self.BrokerStatsTab(app, "stats"))
self.tabs.add_tab(self.BrokerLogTab(app, "log"))
@@ -257,13 +257,13 @@
return self.tabs.show_mode(session, self.config)
def get_title(self, session, broker):
- return "Broker '%s'" % broker.port
+ return "Broker '%s'" % broker.name
def render_name(self, session, broker):
- return broker.port
+ return broker.name
def render_cluster_link(self, session, broker):
- cluster = None #broker.get_broker_cluster()
+ cluster = broker.cluster
if cluster:
branch = session.branch()
@@ -273,7 +273,7 @@
return fmt_none()
def render_profile_link(self, session, broker):
- profile = None #broker.get_broker_profile()
+ profile = broker.profile
if profile:
branch = session.branch()
@@ -288,41 +288,51 @@
class BrokerQueueTab(QueueSet):
def get_title(self, session, broker):
vhost = self.get_object(session, broker)
- return "Queues %s" % fmt_count(len(vhost.queues))
+ return "Queues %s" % fmt_count(vhost and len(vhost.queues) or 0)
def get_object(self, session, broker):
- return Vhost.selectBy(broker=broker, name="/")[0]
+ broker = broker.broker # Navigate from registration to real broker
+ if broker:
+ return Vhost.selectBy(broker=broker, name="/")[0]
class BrokerExchangeTab(ExchangeSet):
def get_title(self, session, broker):
vhost = self.get_object(session, broker)
- return "Exchanges %s" % fmt_count(len(vhost.exchanges))
+ return "Exchanges %s" \
+ % fmt_count(vhost and len(vhost.exchanges) or 0)
def get_object(self, session, broker):
- return Vhost.selectBy(broker=broker, name="/")[0]
+ broker = broker.broker # Navigate from registration to real broker
+ if broker:
+ return Vhost.selectBy(broker=broker, name="/")[0]
class BrokerClientTab(ClientSet):
def get_title(self, session, broker):
vhost = self.get_object(session, broker)
- return "Clients %s" % fmt_count(len(vhost.clients))
+ return "Clients %s" % fmt_count(vhost and len(vhost.clients) or 0)
def get_object(self, session, broker):
- return Vhost.selectBy(broker=broker, name="/")[0]
+ broker = broker.broker # Navigate from registration to real broker
+ if broker:
+ return Vhost.selectBy(broker=broker, name="/")[0]
class BrokerVirtualHostTab(VirtualHostSet):
def get_title(self, session, broker):
- return "Functional Hosts %s" % \
- fmt_count(len(broker.vhosts))
+ broker = broker.broker # Navigate from registration to real broker
+ if broker:
+ return "Functional Hosts %s" % fmt_count(len(broker.vhosts))
def get_items(self, session, broker):
- return sorted_by(broker.vhosts)
+ broker = broker.broker # Navigate from registration to real broker
+ if broker:
+ return sorted_by(broker.vhosts)
class BrokerConfigTab(ConfigPropertySet):
def get_title(self, session, broker):
return "Configuration"
def get_items(self, session, broker):
- return list() #XXX sorted_by(broker.config_property_items())
+ return broker.properties
def maybe_highlight(self, value, comparedto):
if str(value) != str(comparedto):
Modified: mgmt/cumin/python/cumin/client.py
===================================================================
--- mgmt/cumin/python/cumin/client.py 2007-11-30 22:57:44 UTC (rev 1407)
+++ mgmt/cumin/python/cumin/client.py 2007-12-03 14:22:08 UTC (rev 1408)
@@ -23,7 +23,8 @@
return self.unit.get(session) == "b" and "Bytes" or "Msgs."
def get_items(self, session, vhost):
- return sorted_by(vhost.clients, "ipAddr")
+ if vhost:
+ return sorted_by(vhost.clients, "ipAddr")
def render_item_link(self, session, client):
branch = session.branch()
Modified: mgmt/cumin/python/cumin/exchange.py
===================================================================
--- mgmt/cumin/python/cumin/exchange.py 2007-11-30 22:57:44 UTC (rev 1407)
+++ mgmt/cumin/python/cumin/exchange.py 2007-12-03 14:22:08 UTC (rev 1408)
@@ -46,7 +46,8 @@
return self.unit.get(session) == "b" and "Bytes" or "Msgs."
def get_items(self, session, vhost):
- return sorted_by(vhost.exchanges)
+ if vhost:
+ return sorted_by(vhost.exchanges)
def render_item_link(self, session, exchange):
branch = session.branch()
Modified: mgmt/cumin/python/cumin/parameters.py
===================================================================
--- mgmt/cumin/python/cumin/parameters.py 2007-11-30 22:57:44 UTC (rev 1407)
+++ mgmt/cumin/python/cumin/parameters.py 2007-12-03 14:22:08 UTC (rev 1408)
@@ -17,7 +17,7 @@
class BrokerParameter(Parameter):
def do_unmarshal(self, string):
- return Broker.get(int(string))
+ return BrokerRegistration.get(int(string))
def do_marshal(self, broker):
return str(broker.id)
Modified: mgmt/cumin/python/cumin/queue.py
===================================================================
--- mgmt/cumin/python/cumin/queue.py 2007-11-30 22:57:44 UTC (rev 1407)
+++ mgmt/cumin/python/cumin/queue.py 2007-12-03 14:22:08 UTC (rev 1408)
@@ -30,7 +30,8 @@
return self.unit.get(session) == "b" and "Bytes" or "Msgs."
def get_items(self, session, vhost):
- return sorted_by(vhost.queues)
+ if vhost:
+ return sorted_by(vhost.queues)
def render_item_link(self, session, queue):
branch = session.branch()
Modified: mgmt/mint/python/mint/__init__.py
===================================================================
--- mgmt/mint/python/mint/__init__.py 2007-11-30 22:57:44 UTC (rev 1407)
+++ mgmt/mint/python/mint/__init__.py 2007-12-03 14:22:08 UTC (rev 1408)
@@ -15,6 +15,9 @@
except TypeError:
pass
+Broker.sqlmeta.addColumn(ForeignKey("BrokerRegistration", cascade="null",
+ default="none", name="registration"))
+
class BrokerRegistration(SQLObject):
name = StringCol(length=1000, default=None)
host = StringCol(length=1000, default=None)
@@ -41,7 +44,6 @@
name = StringCol(length=1000, default=None)
value = StringCol(length=1000, default=None)
type = StringCol(length=1, default="s")
- profile = ForeignKey("BrokerProfile", cascade="null", default=None)
class OriginalIdDict:
def __init__(self):
Modified: mgmt/mint/python/mint/schema.sql
===================================================================
--- mgmt/mint/python/mint/schema.sql 2007-11-30 22:57:44 UTC (rev 1407)
+++ mgmt/mint/python/mint/schema.sql 2007-12-03 14:22:08 UTC (rev 1408)
@@ -78,7 +78,8 @@
initial_disk_page_size INT,
initial_pages_per_queue INT,
cluster_name VARCHAR(1000),
- version VARCHAR(1000)
+ version VARCHAR(1000),
+ registration_id INT
);
CREATE TABLE broker_stats (
@@ -398,6 +399,8 @@
ALTER TABLE broker ADD CONSTRAINT system_id_exists FOREIGN KEY (system_id) REFERENCES system (id) ON DELETE SET NULL;
+ALTER TABLE broker ADD CONSTRAINT registration_id_exists FOREIGN KEY (registration_id) REFERENCES broker_registration (id) ON DELETE SET NULL;
+
ALTER TABLE broker_stats ADD CONSTRAINT broker_id_exists FOREIGN KEY (broker_id) REFERENCES broker (id) ON DELETE SET NULL;
ALTER TABLE client ADD CONSTRAINT stats_curr_id_exists FOREIGN KEY (stats_curr_id) REFERENCES client_stats (id) ON DELETE SET NULL;
More information about the rhmessaging-commits
mailing list