Author: nunofsantos
Date: 2007-11-14 11:11:17 -0500 (Wed, 14 Nov 2007)
New Revision: 1311
Modified:
mgmt/mint/python/mint/__init__.py
mgmt/mint/schemaparser.py
Log:
global rename of MgmtXXX to MintXXX; rename of allXXX methods to simply XXX (allQueues
becomes queues)
Modified: mgmt/mint/python/mint/__init__.py
===================================================================
--- mgmt/mint/python/mint/__init__.py 2007-11-14 00:54:29 UTC (rev 1310)
+++ mgmt/mint/python/mint/__init__.py 2007-11-14 16:11:17 UTC (rev 1311)
@@ -13,57 +13,57 @@
def getQueueByOriginalId(self, id, create=False):
queue = None
try:
- queue = MgmtQueue.selectBy(idOriginal=id)[:1][0]
+ queue = MintQueue.selectBy(idOriginal=id)[:1][0]
except IndexError:
- if (create): queue = MgmtQueue(idOriginal=id)
+ if (create): queue = MintQueue(idOriginal=id)
return queue
def getQueueByName(self, name, vhost, create=False):
queue = None
try:
- queue = MgmtQueue.selectBy(name=name, mgmtVhost=vhost)[:1][0]
+ queue = MintQueue.selectBy(name=name, mintVhost=vhost)[:1][0]
except IndexError:
- if (create): queue = MgmtQueue(name=name, mgmtVhost=vhost)
+ if (create): queue = MintQueue(name=name, mintVhost=vhost)
return queue
def getVhostByName(self, name, broker, create=False):
vhost = None
try:
- vhost = MgmtVhost.selectBy(name=name, mgmtBroker=broker)[:1][0]
+ vhost = MintVhost.selectBy(name=name, mintBroker=broker)[:1][0]
except IndexError:
- if (create): vhost = MgmtVhost(name=name, mgmtBroker=broker)
+ if (create): vhost = MintVhost(name=name, mintBroker=broker)
return vhost
def getVhostByOriginalId(self, id, create=False):
vhost = None
try:
- vhost = MgmtVhost.selectBy(idOriginal=id)[:1][0]
+ vhost = MintVhost.selectBy(idOriginal=id)[:1][0]
except IndexError:
- if (create): vhost = MgmtVhost(idOriginal=id)
+ if (create): vhost = MintVhost(idOriginal=id)
return vhost
def getBrokerByPort(self, port, system, create=False):
broker = None
try:
- broker = MgmtBroker.selectBy(port=port, mgmtSystem=system)[:1][0]
+ broker = MintBroker.selectBy(port=port, mintSystem=system)[:1][0]
except IndexError:
- if (create): broker = MgmtBroker(port=port, mgmtSystem=system)
+ if (create): broker = MintBroker(port=port, mintSystem=system)
return broker
def getBrokerByOriginalId(self, id, create=False):
broker = None
try:
- broker = MgmtBroker.selectBy(idOriginal=id)[:1][0]
+ broker = MintBroker.selectBy(idOriginal=id)[:1][0]
except IndexError:
- if (create): broker = MgmtBroker(idOriginal=id)
+ if (create): broker = MintBroker(idOriginal=id)
return broker
def getSystemByOriginalId(self, id, create=False):
system = None
try:
- system = MgmtSystem.selectBy(idOriginal=id)[:1][0]
+ system = MintSystem.selectBy(idOriginal=id)[:1][0]
except IndexError:
- if (create): system = MgmtSystem(idOriginal=id)
+ if (create): system = MintSystem(idOriginal=id)
return system
def sanitizeDict(self, d):
@@ -85,7 +85,7 @@
elif (k.endswith("Ref")):
oldK = k
k = k[0].upper() + k[1:]
- return "mgmt" + k.replace("Ref", "ID")
+ return "mint" + k.replace("Ref", "ID")
def configCallback(self, broker, objectName, list, timestamps):
print "\nCONFIG---------------------------------------------------"
@@ -132,14 +132,14 @@
if (objectName == "queue"):
print "* QUEUE"
queue = self.getQueueByOriginalId(d[self.convertKey("id")])
- d["mgmtQueue"] = queue.id
+ d["mintQueue"] = queue.id
d["recTime"] = datetime.fromtimestamp(timestamps[0]/1000000000)
- queueStats = MgmtQueueStats()
+ queueStats = MintQueueStats()
queueStats.set(**d)
d = dict()
if (timestamps[2] != 0):
d["deletionTime"] = datetime.fromtimestamp(timestamps[2]/1000000000)
- d["mgmtQueueStats"] = queueStats
+ d["mintQueueStats"] = queueStats
queue.set(**d)
print queue.id
result = queueStats
@@ -176,5 +176,5 @@
self.outstandingMethodCalls[methodId] = callback
return methodId
- def allSystems(self):
- return MgmtSystem.select()
+ def systems(self):
+ return MintSystem.select()
Modified: mgmt/mint/schemaparser.py
===================================================================
--- mgmt/mint/schemaparser.py 2007-11-14 00:54:29 UTC (rev 1310)
+++ mgmt/mint/schemaparser.py 2007-11-14 16:11:17 UTC (rev 1311)
@@ -11,7 +11,7 @@
self.currentTable = ""
self.style = style
# mapping between xml schema types and database column types
- # see xml/MgmtTypes.xml
+ # see xml/MintTypes.xml
self.dataTypesMap = dict()
self.dataTypesMap["objId"] = "INT8"
self.dataTypesMap["uint8"] = self.dataTypesMap["hilo8"] =
self.dataTypesMap["count8"] = "INT2"
@@ -67,7 +67,7 @@
actualType = elem["@type"]
params = ""
if (elem["(a)name"].endswith("Ref")):
- foreignKeyTable = "mgmt_" + actualName.replace("_ref",
"")
+ foreignKeyTable = "mint_" + actualName.replace("_ref",
"")
self.sqlOutput += " %s_id BIGINT REFERENCES %s,\n" % (foreignKeyTable,
foreignKeyTable)
else:
self.sqlOutput += " %s %s %s,\n" % (actualName,
self.dataTypesMap[actualType], params)
@@ -119,11 +119,11 @@
refName = elem["@name"]
if (refName.endswith("Ref")):
# generate foreign keys
- refName = self.attrNameFromDbColumn(refName, "Mgmt", "Ref")
+ refName = self.attrNameFromDbColumn(refName, "Mint", "Ref")
# add missing attribute (not added correctly with SqlObject 0.7.7; may need to be
removed in later versions)
self.pythonOutput += " _SO_class_%s = None\n" %
(self.style.pythonAttrToDBColumn(refName).capitalize())
self.additional += "\n%s.sqlmeta.addJoin(MultipleJoin('%s" %
(refName, name)
- self.additional += "', joinMethodName='all%ss'))" %
(name.replace("Mgmt", ""))
+ self.additional += "', joinMethodName='%ss'))" %
(name.replace("Mint", "").lower())
def startClass(self, pythonName, schemaName="", schemaId=""):
self.pythonOutput += "\nclass %s(SQLObject):\n" % (pythonName)
@@ -193,7 +193,7 @@
schema = mllib.xml_parse(self.options["schemaXML"])
classes = schema.query["schema/class"]
for cls in classes:
- actualName = "mgmt_" + cls["@name"]
+ actualName = "mint_" + cls["@name"]
self.sqlGen.generate(actualName, cls.query["configElement"],
"config")
self.sqlGen.generate(actualName, cls.query["instElement"],
"inst")
self.pythonGen.generate(actualName, cls["@name"],
cls["@schemaId"], cls.query["method"])