[rhmessaging-commits] rhmessaging commits: r1406 - in mgmt: mint/python/mint and 1 other directory.

rhmessaging-commits at lists.jboss.org rhmessaging-commits at lists.jboss.org
Fri Nov 30 10:43:01 EST 2007


Author: justi9
Date: 2007-11-30 10:43:01 -0500 (Fri, 30 Nov 2007)
New Revision: 1406

Modified:
   mgmt/cumin/python/cumin/__init__.py
   mgmt/cumin/python/cumin/broker.py
   mgmt/mint/python/mint/__init__.py
   mgmt/mint/python/mint/schema.sql
Log:
Fixes my use of sqlobject to be more natural, using the joinColumn arg
to MultipleJoin.

Makes group, profile, and cluster associate with broker registrations,
not brokers.  This is what we want, so someone can group and configure
brokers that are not yet up and represented in objects sent by a
managed broker instance out in the world.



Modified: mgmt/cumin/python/cumin/__init__.py
===================================================================
--- mgmt/cumin/python/cumin/__init__.py	2007-11-30 14:57:59 UTC (rev 1405)
+++ mgmt/cumin/python/cumin/__init__.py	2007-11-30 15:43:01 UTC (rev 1406)
@@ -41,7 +41,7 @@
         self.model.sys = sys
 
         for reg in BrokerRegistration.select():
-            self.mint.addManagedBroker(reg.host, reg.port)
+            self.mint.addManagedBroker(reg.host, reg.port or 5672)
 
         self.cumin_page = CuminPage(self, "cumin.html")
         self.set_default_page(self.cumin_page)

Modified: mgmt/cumin/python/cumin/broker.py
===================================================================
--- mgmt/cumin/python/cumin/broker.py	2007-11-30 14:57:59 UTC (rev 1405)
+++ mgmt/cumin/python/cumin/broker.py	2007-11-30 15:43:01 UTC (rev 1406)
@@ -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(Broker.select()[start:end])
 
     def do_process(self, session, model):
         if self.submit.get(session):

Modified: mgmt/mint/python/mint/__init__.py
===================================================================
--- mgmt/mint/python/mint/__init__.py	2007-11-30 14:57:59 UTC (rev 1405)
+++ mgmt/mint/python/mint/__init__.py	2007-11-30 15:43:01 UTC (rev 1406)
@@ -20,42 +20,29 @@
   host = StringCol(length=1000, default=None)
   port = SmallIntCol(default=None)
   broker = ForeignKey("Broker", cascade="null", default=None)
+  groups = RelatedJoin("BrokerGroup")
+  cluster = ForeignKey("BrokerCluster", cascade="null", default=None)
+  profile = ForeignKey("BrokerProfile", cascade="null", default=None)
 
 class BrokerGroup(SQLObject):
   name = StringCol(length=1000, default=None)
-  brokers = RelatedJoin("Broker")
+  brokers = RelatedJoin("BrokerRegistration")
 
-Broker.sqlmeta.addJoin(RelatedJoin("BrokerGroup", joinMethodName="groups"))
-
 class BrokerCluster(SQLObject):
   name = StringCol(length=1000, default=None)
-  brokers = MultipleJoin("Broker")
+  brokers = MultipleJoin("BrokerRegistration", joinColumn="cluster_id")
 
-fk = ForeignKey("BrokerCluster", cascade="null",
-                default=None, name="brokerCluster")
-Broker.sqlmeta.addColumn(fk)
-setattr(Broker, "cluster", fk)
-
 class BrokerProfile(SQLObject):
   name = StringCol(length=1000, default=None)
-  brokers = MultipleJoin("Broker")
-  properties = MultipleJoin("ConfigProperty")
+  brokers = MultipleJoin("BrokerRegistration", joinColumn="profile_id")
+  properties = MultipleJoin("ConfigProperty", joinColumn="profile_id")
 
-fk = ForeignKey("BrokerProfile", cascade="null", default=None,
-                name="brokerProfile")
-Broker.sqlmeta.addColumn(fk)
-setattr(Broker, "profile", fk)
-
 class ConfigProperty(SQLObject):
   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)
 
-fk = ForeignKey("BrokerProfile", cascade="null", default=None,
-                name="brokerProfile")
-ConfigProperty.sqlmeta.addColumn(fk)
-setattr(ConfigProperty, "profile", fk)
-
 class OriginalIdDict:
   def __init__(self):
     self.idMap = dict()

Modified: mgmt/mint/python/mint/schema.sql
===================================================================
--- mgmt/mint/python/mint/schema.sql	2007-11-30 14:57:59 UTC (rev 1405)
+++ mgmt/mint/python/mint/schema.sql	2007-11-30 15:43:01 UTC (rev 1406)
@@ -7,6 +7,10 @@
     id SERIAL PRIMARY KEY,
     name VARCHAR(1000)
 );
+CREATE TABLE broker_group_broker_registration (
+broker_group_id INT NOT NULL,
+broker_registration_id INT NOT NULL
+);
 
 CREATE TABLE broker_profile (
     id SERIAL PRIMARY KEY,
@@ -18,7 +22,9 @@
     name VARCHAR(1000),
     host VARCHAR(1000),
     port SMALLINT,
-    broker_id INT
+    broker_id INT,
+    cluster_id INT,
+    profile_id INT
 );
 
 CREATE TABLE config_property (
@@ -26,7 +32,7 @@
     name VARCHAR(1000),
     value VARCHAR(1000),
     type VARCHAR(1),
-    broker_profile_id INT
+    profile_id INT
 );
 
 CREATE TABLE binding (
@@ -72,14 +78,8 @@
     initial_disk_page_size INT,
     initial_pages_per_queue INT,
     cluster_name VARCHAR(1000),
-    version VARCHAR(1000),
-    broker_cluster_id INT,
-    broker_profile_id INT
+    version VARCHAR(1000)
 );
-CREATE TABLE broker_broker_group (
-broker_id INT NOT NULL,
-broker_group_id INT NOT NULL
-);
 
 CREATE TABLE broker_stats (
     id SERIAL PRIMARY KEY,
@@ -376,8 +376,12 @@
 
 ALTER TABLE broker_registration ADD CONSTRAINT broker_id_exists FOREIGN KEY (broker_id) REFERENCES broker (id) ON DELETE SET NULL;
 
-ALTER TABLE config_property ADD CONSTRAINT broker_profile_id_exists FOREIGN KEY (broker_profile_id) REFERENCES broker_profile (id) ON DELETE SET NULL;
+ALTER TABLE broker_registration ADD CONSTRAINT cluster_id_exists FOREIGN KEY (cluster_id) REFERENCES broker_cluster (id) ON DELETE SET NULL;
 
+ALTER TABLE broker_registration ADD CONSTRAINT profile_id_exists FOREIGN KEY (profile_id) REFERENCES broker_profile (id) ON DELETE SET NULL;
+
+ALTER TABLE config_property ADD CONSTRAINT profile_id_exists FOREIGN KEY (profile_id) REFERENCES broker_profile (id) ON DELETE SET NULL;
+
 ALTER TABLE binding ADD CONSTRAINT stats_curr_id_exists FOREIGN KEY (stats_curr_id) REFERENCES binding_stats (id) ON DELETE SET NULL;
 
 ALTER TABLE binding ADD CONSTRAINT stats_prev_id_exists FOREIGN KEY (stats_prev_id) REFERENCES binding_stats (id) ON DELETE SET NULL;
@@ -394,10 +398,6 @@
 
 ALTER TABLE broker ADD CONSTRAINT system_id_exists FOREIGN KEY (system_id) REFERENCES system (id) ON DELETE SET NULL;
 
-ALTER TABLE broker ADD CONSTRAINT broker_cluster_id_exists FOREIGN KEY (broker_cluster_id) REFERENCES broker_cluster (id) ON DELETE SET NULL;
-
-ALTER TABLE broker ADD CONSTRAINT broker_profile_id_exists FOREIGN KEY (broker_profile_id) REFERENCES broker_profile (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