[rhmessaging-commits] rhmessaging commits: r1372 - mgmt/mint/python/mint.

rhmessaging-commits at lists.jboss.org rhmessaging-commits at lists.jboss.org
Tue Nov 27 14:32:35 EST 2007


Author: nunofsantos
Date: 2007-11-27 14:32:35 -0500 (Tue, 27 Nov 2007)
New Revision: 1372

Modified:
   mgmt/mint/python/mint/__init__.py
   mgmt/mint/python/mint/schemaparser.py
Log:
add stats attrib, rename existing stats attrib to statsCurr

Modified: mgmt/mint/python/mint/__init__.py
===================================================================
--- mgmt/mint/python/mint/__init__.py	2007-11-27 16:44:33 UTC (rev 1371)
+++ mgmt/mint/python/mint/__init__.py	2007-11-27 19:32:35 UTC (rev 1372)
@@ -127,8 +127,8 @@
     label = "%s:%d" % (host, port)
     self.connectedBrokers[label] = ConnectedBroker(broker)
     broker.configListener(label, self.configCallback)
-    broker.instrumentationListener (label, self.instCallback)
-    broker.methodListener (label, self.methodCallback)
+    broker.instrumentationListener(label, self.instCallback)
+    broker.methodListener(label, self.methodCallback)
     broker.start()
     return label
 

Modified: mgmt/mint/python/mint/schemaparser.py
===================================================================
--- mgmt/mint/python/mint/schemaparser.py	2007-11-27 16:44:33 UTC (rev 1371)
+++ mgmt/mint/python/mint/schemaparser.py	2007-11-27 19:32:35 UTC (rev 1372)
@@ -51,8 +51,9 @@
     self.generateAttrib(name + "Low", type)
     self.generateAttrib(name + "High", type)
 
-  def generateMultipleJoin(self, tableFrom, tableTo):
-    attrib = tableTo.lower() + "s"
+  def generateMultipleJoin(self, tableFrom, tableTo, attrib=""):
+    if (attrib == ""):
+      attrib = tableTo.lower() + "s"
     self.additionalPythonOutput += "\n%s.sqlmeta.addJoin(MultipleJoin('%s', joinMethodName='%s'))\n" % (tableFrom, tableTo, attrib)
 
   def generateClassAttribs(self, schemaName, elements):
@@ -74,6 +75,7 @@
 
   def startClass(self, schemaName, stats=False):
     if (stats):
+      origPythonName = self.style.dbTableToPythonClass(schemaName)
       pythonName = self.style.dbTableToPythonClass(schemaName + "_stats")
       colPythonName = self.style.dbColumnToPythonAttr(schemaName)
       keyPythonName = self.style.dbTableToPythonClass(schemaName)
@@ -86,11 +88,12 @@
     self.generateTimestampAttrib("rec")
     if (stats):
       self.generateForeignKeyAttrib(colPythonName, keyPythonName)
+      self.generateMultipleJoin(origPythonName, pythonName, "stats")
     else:
       self.generateTimestampAttrib("creation")
       self.generateTimestampAttrib("deletion")
       self.generateAttrib("managedBroker", "StringCol", "length=1000")
-      self.generateForeignKeyAttrib("stats", statsPythonName)
+      self.generateForeignKeyAttrib("statsCurr", statsPythonName)
       self.generateForeignKeyAttrib("statsPrev", statsPythonName)
       self.finalPythonOutput += "classToSchemaNameMap['%s'] = '%s'\n" % (pythonName, schemaName)
       self.finalPythonOutput += "schemaNameToClassMap['%s'] = %s\n" % (schemaName, pythonName)




More information about the rhmessaging-commits mailing list