rhmessaging commits: r1307 - mgmt/cumin/bin.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2007-11-13 15:52:35 -0500 (Tue, 13 Nov 2007)
New Revision: 1307
Modified:
mgmt/cumin/bin/cumin-test
Log:
Makes cumin-test set up a database connection. Makes cumin-test load
params from a config file as well as from its arguments.
Modified: mgmt/cumin/bin/cumin-test
===================================================================
--- mgmt/cumin/bin/cumin-test 2007-11-13 20:43:12 UTC (rev 1306)
+++ mgmt/cumin/bin/cumin-test 2007-11-13 20:52:35 UTC (rev 1307)
@@ -1,16 +1,17 @@
#!/usr/bin/env python
-import sys
-from time import time
-from wooly.devel import BenchmarkHarness
-from wooly.server import WebServer
+import sys, os
+from ConfigParser import SafeConfigParser
-from cumin import *
-from cumin.demo import *
-from cumin.model import *
-
def load_args(argv):
args = dict()
+
+ conf = SafeConfigParser()
+ conf.read(os.path.expanduser("~/.cumin.conf"))
+
+ for key, value in conf.items("main"):
+ args[key] = value
+
key = None
for arg in sys.argv:
@@ -21,8 +22,32 @@
args[key] = arg
key = None
+ print "Parameters:"
+ for key in args:
+ print " %10s %s" % (key, args[key])
+
return args
+from sqlobject import *
+
+args = load_args(sys.argv)
+
+try:
+ connuri = args["data"]
+ conn = connectionForURI(connuri)
+ sqlhub.processConnection = conn
+except KeyError:
+ print "No data source; use --data DATABASE-URL"
+ sys.exit(1)
+
+from time import time
+from wooly.devel import BenchmarkHarness
+from wooly.server import WebServer
+
+from cumin import *
+from cumin.demo import *
+from cumin.model import *
+
def do_main(port, bench_hits, debug=True, demodata=True):
model = CuminModel()
@@ -44,8 +69,6 @@
server.run()
def main():
- args = load_args(sys.argv)
-
in_port = int(args.get("port", 9090))
in_profile = "profile" in args
in_debug = "no-debug" not in args
17 years, 1 month
rhmessaging commits: r1306 - in mgmt/mint: python/mint and 1 other directory.
by rhmessaging-commits@lists.jboss.org
Author: nunofsantos
Date: 2007-11-13 15:43:12 -0500 (Tue, 13 Nov 2007)
New Revision: 1306
Modified:
mgmt/mint/python/mint/__init__.py
mgmt/mint/schemaparser.py
Log:
remove extraneous declarations
Modified: mgmt/mint/python/mint/__init__.py
===================================================================
--- mgmt/mint/python/mint/__init__.py 2007-11-13 20:11:26 UTC (rev 1305)
+++ mgmt/mint/python/mint/__init__.py 2007-11-13 20:43:12 UTC (rev 1306)
@@ -5,10 +5,6 @@
from schema import *
class MintModel:
- currentMethodId = None
- outstandingMethodCalls = None
- managedBrokers = None
-
def __init__(self):
self.currentMethodId = 1
self.outstandingMethodCalls = dict()
Modified: mgmt/mint/schemaparser.py
===================================================================
--- mgmt/mint/schemaparser.py 2007-11-13 20:11:26 UTC (rev 1305)
+++ mgmt/mint/schemaparser.py 2007-11-13 20:43:12 UTC (rev 1306)
@@ -5,19 +5,14 @@
class SqlGenerator:
"""generates SQL code from broker XML schema"""
- # mapping between xml schema types and database column types
- dataTypesMap = {}
- sqlOutput = ""
- indexes = ""
- currentTable = ""
- syle = None
-
def __init__(self, style):
self.sqlOutput = ""
self.indexes = ""
self.currentTable = ""
self.style = style
+ # mapping between xml schema types and database column types
# see xml/MgmtTypes.xml
+ self.dataTypesMap = dict()
self.dataTypesMap["objId"] = "INT8"
self.dataTypesMap["uint8"] = self.dataTypesMap["hilo8"] = self.dataTypesMap["count8"] = "INT2"
self.dataTypesMap["uint16"] = self.dataTypesMap["hilo16"] = self.dataTypesMap["count16"] = "INT2"
@@ -97,10 +92,6 @@
class PythonGenerator:
"""generates Python code from broker XML schema"""
- pythonOutput = ""
- additional = ""
- syle = None
-
def __init__(self, style, dsn):
self.pythonOutput = "from sqlobject import *\n\n"
self.pythonOutput += "conn = connectionForURI(\"%s\")\n" % (dsn)
@@ -181,13 +172,8 @@
class SchemaParser:
"""parses broker XML schema"""
- options = dict()
- schema = None
- style = None
- pythonGen = None
- sqlGen = None
-
def __init__(self):
+ self.options = dict()
self.parseConfigFile()
self.style = MixedCaseUnderscoreStyle()
self.pythonGen = PythonGenerator(self.style, self.options["dsn"])
17 years, 1 month
rhmessaging commits: r1305 - mgmt/mint.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2007-11-13 15:11:26 -0500 (Tue, 13 Nov 2007)
New Revision: 1305
Removed:
mgmt/mint/model.py
Log:
Remove model.py as its contents went into mint/python/mint/__init__.py.
Deleted: mgmt/mint/model.py
===================================================================
--- mgmt/mint/model.py 2007-11-13 20:01:06 UTC (rev 1304)
+++ mgmt/mint/model.py 2007-11-13 20:11:26 UTC (rev 1305)
@@ -1,185 +0,0 @@
-from qpid.management import ManagedBroker
-from schema import *
-from time import sleep
-from datetime import *
-from sqlobject import *
-
-class Model:
- currentMethodId = None
- outstandingMethodCalls = None
- managedBrokers = None
-
- def __init__(self):
- self.currentMethodId = 1
- self.outstandingMethodCalls = dict()
- self.managedBrokers = dict()
-
- def getQueueByOriginalId(self, id, create=False):
- queue = None
- try:
- queue = MgmtQueue.selectBy(idOriginal=id)[:1][0]
- except IndexError:
- if (create): queue = MgmtQueue(idOriginal=id)
- return queue
-
- def getQueueByName(self, name, vhost, create=False):
- queue = None
- try:
- queue = MgmtQueue.selectBy(name=name, mgmtVhost=vhost)[:1][0]
- except IndexError:
- if (create): queue = MgmtQueue(name=name, mgmtVhost=vhost)
- return queue
-
- def getVhostByName(self, name, broker, create=False):
- vhost = None
- try:
- vhost = MgmtVhost.selectBy(name=name, mgmtBroker=broker)[:1][0]
- except IndexError:
- if (create): vhost = MgmtVhost(name=name, mgmtBroker=broker)
- return vhost
-
- def getVhostByOriginalId(self, id, create=False):
- vhost = None
- try:
- vhost = MgmtVhost.selectBy(idOriginal=id)[:1][0]
- except IndexError:
- if (create): vhost = MgmtVhost(idOriginal=id)
- return vhost
-
- def getBrokerByPort(self, port, system, create=False):
- broker = None
- try:
- broker = MgmtBroker.selectBy(port=port, mgmtSystem=system)[:1][0]
- except IndexError:
- if (create): broker = MgmtBroker(port=port, mgmtSystem=system)
- return broker
-
- def getBrokerByOriginalId(self, id, create=False):
- broker = None
- try:
- broker = MgmtBroker.selectBy(idOriginal=id)[:1][0]
- except IndexError:
- if (create): broker = MgmtBroker(idOriginal=id)
- return broker
-
- def getSystemByOriginalId(self, id, create=False):
- system = None
- try:
- system = MgmtSystem.selectBy(idOriginal=id)[:1][0]
- except IndexError:
- if (create): system = MgmtSystem(idOriginal=id)
- return system
-
- def sanitizeDict(self, d):
- for k in d.iterkeys():
- if (k.endswith("Id")):
- d[self.convertKey(k)] = d.pop(k)
- elif (k == "id"):
- d[self.convertKey(k)] = d.pop(k)
- for k in d.iterkeys():
- if (k.endswith("Ref")):
- d[self.convertKey(k)] = d.pop(k)
- return d
-
- def convertKey(self, k):
- if (k == "id"):
- return k + "Original"
- if (k.endswith("Id")):
- return k + "ent"
- elif (k.endswith("Ref")):
- oldK = k
- k = k[0].upper() + k[1:]
- return "mgmt" + k.replace("Ref", "ID")
-
- def configCallback(self, broker, objectName, list, timestamps):
- print "\nCONFIG---------------------------------------------------"
- print "broker=" + broker
- print objectName
- print list
- result = None
- d = self.sanitizeDict(dict(list))
- d["managedBroker"] = self.managedBrokers[broker]
- print d
-
- d["recTime"] = datetime.fromtimestamp(timestamps[0]/1000000000)
- d["creationTime"] = datetime.fromtimestamp(timestamps[1]/1000000000)
- if (objectName == "queue"):
- print "* QUEUE"
- queue = self.getQueueByName(d["name"], self.getVhostByOriginalId(d.pop(self.convertKey("vhostRef"))), True)
- queue.set(**d)
- print "queue id = %d" % (queue.id)
- result = queue
- elif (objectName == "vhost"):
- print "* VHOST"
- vhost = self.getVhostByName(d["name"], self.getBrokerByOriginalId(d.pop(self.convertKey("brokerRef"))), True)
- vhost.set(**d)
- print "vhost id = %d" % (vhost.id)
- result = vhost
- elif (objectName == "broker"):
- print "* BROKER"
- d.pop(self.convertKey("systemRef"))
- broker = self.getBrokerByPort(d["port"], self.getSystemByOriginalId("0"), True)
- broker.set(**d)
- broker.sync()
- print "broker id = %d" % (broker.id)
- result = broker
- print "END CONFIG---------------------------------------------------\n"
- return result
-
- def instCallback(self, broker, objectName, list, timestamps):
- print "\nINST---------------------------------------------------"
- print "broker=" + broker
- print objectName
- print list
- result = None
- d = self.sanitizeDict(dict(list))
- if (objectName == "queue"):
- print "* QUEUE"
- queue = self.getQueueByOriginalId(d[self.convertKey("id")])
- d["mgmtQueue"] = queue.id
- d["recTime"] = datetime.fromtimestamp(timestamps[0]/1000000000)
- queueStats = MgmtQueueStats()
- queueStats.set(**d)
- d = dict()
- if (timestamps[2] != 0):
- d["deletionTime"] = datetime.fromtimestamp(timestamps[2]/1000000000)
- d["mgmtQueueStats"] = queueStats
- queue.set(**d)
- print queue.id
- result = queueStats
- elif (objectName == "vhost"):
- print "* VHOST"
- elif (objectName == "broker"):
- print "* BROKER"
- print "END INST---------------------------------------------------\n"
- return result
-
- def methodCallback(self, broker, methodId, errorNo, errorText, args):
- print "\nMETHOD---------------------------------------------------"
- print "broker=" + broker
- print "MethodId=%d" % (methodId)
- print "Error: %d %s" % (errorNo, errorText)
- print args
- method = self.outstandingMethodCalls.pop(methodId)
- method(errorText, args)
- print "END METHOD---------------------------------------------------\n"
-
- def addManagedBroker(self, host, port):
- broker = ManagedBroker(host=host, port=port)
- label = "%s:%d" % (host, port)
- self.managedBrokers[label] = broker
- broker.configListener(label, self.configCallback)
- broker.instrumentationListener (label, self.instCallback)
- broker.methodListener (label, self.methodCallback)
- broker.start()
- return label
-
- def registerCallback(self, callback):
- self.currentMethodId += 1
- methodId = self.currentMethodId
- self.outstandingMethodCalls[methodId] = callback
- return methodId
-
- def allSystems(self):
- return MgmtSystem.select()
-
17 years, 1 month
rhmessaging commits: r1304 - mgmt/mint/bin.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2007-11-13 15:01:06 -0500 (Tue, 13 Nov 2007)
New Revision: 1304
Modified:
mgmt/mint/bin/mint-test
Log:
Adds a sleep-forever loop.
Modified: mgmt/mint/bin/mint-test
===================================================================
--- mgmt/mint/bin/mint-test 2007-11-13 19:45:55 UTC (rev 1303)
+++ mgmt/mint/bin/mint-test 2007-11-13 20:01:06 UTC (rev 1304)
@@ -16,13 +16,18 @@
except IndexError:
usage()
-from mint import *
from qpid.management import ManagedBroker
+from time import sleep
+from mint import *
+
def do_main(dburi, brokerhost, brokerport):
model = MintModel()
model.addManagedBroker(brokerhost, brokerport)
+ while (True):
+ sleep(5)
+
def main():
if len(sys.argv) != 3:
usage()
17 years, 1 month
rhmessaging commits: r1303 - in mgmt/mint: python/mint and 1 other directory.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2007-11-13 14:45:55 -0500 (Tue, 13 Nov 2007)
New Revision: 1303
Added:
mgmt/mint/python/mint/schema.sql
Removed:
mgmt/mint/python/mint/updater.py
Modified:
mgmt/mint/bin/mint-test
mgmt/mint/python/mint/__init__.py
mgmt/mint/python/mint/schema.py
Log:
Updates mint-test to use Nuno's new model stuff. Moves model.py's
Model to MintModel in mint/__init__.py.
Modified: mgmt/mint/bin/mint-test
===================================================================
--- mgmt/mint/bin/mint-test 2007-11-13 18:36:01 UTC (rev 1302)
+++ mgmt/mint/bin/mint-test 2007-11-13 19:45:55 UTC (rev 1303)
@@ -17,18 +17,12 @@
usage()
from mint import *
-from mint.updater import *
from qpid.management import ManagedBroker
def do_main(dburi, brokerhost, brokerport):
- model = MintModel(dburi)
- model.init()
-
- broker = ManagedBroker(host=brokerhost, port=brokerport)
+ model = MintModel()
+ model.addManagedBroker(brokerhost, brokerport)
- updater = MintUpdater(model, broker)
- updater.start()
-
def main():
if len(sys.argv) != 3:
usage()
Modified: mgmt/mint/python/mint/__init__.py
===================================================================
--- mgmt/mint/python/mint/__init__.py 2007-11-13 18:36:01 UTC (rev 1302)
+++ mgmt/mint/python/mint/__init__.py 2007-11-13 19:45:55 UTC (rev 1303)
@@ -1,3 +1,5 @@
+from qpid.management import ManagedBroker
+from datetime import *
from sqlobject import *
from schema import *
@@ -2,7 +4,179 @@
-class MintModel(object):
- def __init__(self, dburi):
- self.dburi = dburi
+class MintModel:
+ currentMethodId = None
+ outstandingMethodCalls = None
+ managedBrokers = None
+
+ def __init__(self):
+ self.currentMethodId = 1
+ self.outstandingMethodCalls = dict()
+ self.managedBrokers = dict()
+
+ def getQueueByOriginalId(self, id, create=False):
+ queue = None
+ try:
+ queue = MgmtQueue.selectBy(idOriginal=id)[:1][0]
+ except IndexError:
+ if (create): queue = MgmtQueue(idOriginal=id)
+ return queue
- def init(self):
- pass
+ def getQueueByName(self, name, vhost, create=False):
+ queue = None
+ try:
+ queue = MgmtQueue.selectBy(name=name, mgmtVhost=vhost)[:1][0]
+ except IndexError:
+ if (create): queue = MgmtQueue(name=name, mgmtVhost=vhost)
+ return queue
+
+ def getVhostByName(self, name, broker, create=False):
+ vhost = None
+ try:
+ vhost = MgmtVhost.selectBy(name=name, mgmtBroker=broker)[:1][0]
+ except IndexError:
+ if (create): vhost = MgmtVhost(name=name, mgmtBroker=broker)
+ return vhost
+
+ def getVhostByOriginalId(self, id, create=False):
+ vhost = None
+ try:
+ vhost = MgmtVhost.selectBy(idOriginal=id)[:1][0]
+ except IndexError:
+ if (create): vhost = MgmtVhost(idOriginal=id)
+ return vhost
+
+ def getBrokerByPort(self, port, system, create=False):
+ broker = None
+ try:
+ broker = MgmtBroker.selectBy(port=port, mgmtSystem=system)[:1][0]
+ except IndexError:
+ if (create): broker = MgmtBroker(port=port, mgmtSystem=system)
+ return broker
+
+ def getBrokerByOriginalId(self, id, create=False):
+ broker = None
+ try:
+ broker = MgmtBroker.selectBy(idOriginal=id)[:1][0]
+ except IndexError:
+ if (create): broker = MgmtBroker(idOriginal=id)
+ return broker
+
+ def getSystemByOriginalId(self, id, create=False):
+ system = None
+ try:
+ system = MgmtSystem.selectBy(idOriginal=id)[:1][0]
+ except IndexError:
+ if (create): system = MgmtSystem(idOriginal=id)
+ return system
+
+ def sanitizeDict(self, d):
+ for k in d.iterkeys():
+ if (k.endswith("Id")):
+ d[self.convertKey(k)] = d.pop(k)
+ elif (k == "id"):
+ d[self.convertKey(k)] = d.pop(k)
+ for k in d.iterkeys():
+ if (k.endswith("Ref")):
+ d[self.convertKey(k)] = d.pop(k)
+ return d
+
+ def convertKey(self, k):
+ if (k == "id"):
+ return k + "Original"
+ if (k.endswith("Id")):
+ return k + "ent"
+ elif (k.endswith("Ref")):
+ oldK = k
+ k = k[0].upper() + k[1:]
+ return "mgmt" + k.replace("Ref", "ID")
+
+ def configCallback(self, broker, objectName, list, timestamps):
+ print "\nCONFIG---------------------------------------------------"
+ print "broker=" + broker
+ print objectName
+ print list
+ result = None
+ d = self.sanitizeDict(dict(list))
+ d["managedBroker"] = self.managedBrokers[broker]
+ print d
+
+ d["recTime"] = datetime.fromtimestamp(timestamps[0]/1000000000)
+ d["creationTime"] = datetime.fromtimestamp(timestamps[1]/1000000000)
+ if (objectName == "queue"):
+ print "* QUEUE"
+ queue = self.getQueueByName(d["name"], self.getVhostByOriginalId(d.pop(self.convertKey("vhostRef"))), True)
+ queue.set(**d)
+ print "queue id = %d" % (queue.id)
+ result = queue
+ elif (objectName == "vhost"):
+ print "* VHOST"
+ vhost = self.getVhostByName(d["name"], self.getBrokerByOriginalId(d.pop(self.convertKey("brokerRef"))), True)
+ vhost.set(**d)
+ print "vhost id = %d" % (vhost.id)
+ result = vhost
+ elif (objectName == "broker"):
+ print "* BROKER"
+ d.pop(self.convertKey("systemRef"))
+ broker = self.getBrokerByPort(d["port"], self.getSystemByOriginalId("0"), True)
+ broker.set(**d)
+ broker.sync()
+ print "broker id = %d" % (broker.id)
+ result = broker
+ print "END CONFIG---------------------------------------------------\n"
+ return result
+
+ def instCallback(self, broker, objectName, list, timestamps):
+ print "\nINST---------------------------------------------------"
+ print "broker=" + broker
+ print objectName
+ print list
+ result = None
+ d = self.sanitizeDict(dict(list))
+ if (objectName == "queue"):
+ print "* QUEUE"
+ queue = self.getQueueByOriginalId(d[self.convertKey("id")])
+ d["mgmtQueue"] = queue.id
+ d["recTime"] = datetime.fromtimestamp(timestamps[0]/1000000000)
+ queueStats = MgmtQueueStats()
+ queueStats.set(**d)
+ d = dict()
+ if (timestamps[2] != 0):
+ d["deletionTime"] = datetime.fromtimestamp(timestamps[2]/1000000000)
+ d["mgmtQueueStats"] = queueStats
+ queue.set(**d)
+ print queue.id
+ result = queueStats
+ elif (objectName == "vhost"):
+ print "* VHOST"
+ elif (objectName == "broker"):
+ print "* BROKER"
+ print "END INST---------------------------------------------------\n"
+ return result
+
+ def methodCallback(self, broker, methodId, errorNo, errorText, args):
+ print "\nMETHOD---------------------------------------------------"
+ print "broker=" + broker
+ print "MethodId=%d" % (methodId)
+ print "Error: %d %s" % (errorNo, errorText)
+ print args
+ method = self.outstandingMethodCalls.pop(methodId)
+ method(errorText, args)
+ print "END METHOD---------------------------------------------------\n"
+
+ def addManagedBroker(self, host, port):
+ broker = ManagedBroker(host=host, port=port)
+ label = "%s:%d" % (host, port)
+ self.managedBrokers[label] = broker
+ broker.configListener(label, self.configCallback)
+ broker.instrumentationListener (label, self.instCallback)
+ broker.methodListener (label, self.methodCallback)
+ broker.start()
+ return label
+
+ def registerCallback(self, callback):
+ self.currentMethodId += 1
+ methodId = self.currentMethodId
+ self.outstandingMethodCalls[methodId] = callback
+ return methodId
+
+ def allSystems(self):
+ return MgmtSystem.select()
Modified: mgmt/mint/python/mint/schema.py
===================================================================
--- mgmt/mint/python/mint/schema.py 2007-11-13 18:36:01 UTC (rev 1302)
+++ mgmt/mint/python/mint/schema.py 2007-11-13 19:45:55 UTC (rev 1303)
@@ -1,127 +1,241 @@
from sqlobject import *
-class MgmtServer(SQLObject):
+class MgmtSystemStats(SQLObject):
class sqlmeta:
fromDatabase = True
- def joinCluster():
- pass
- def leaveCluster():
- pass
+class MgmtSystem(SQLObject):
+ schemaId = 1
+ schemaName = "system"
+ managedBroker = None
+ class sqlmeta:
+ fromDatabase = True
+ _SO_class_Mgmt_system_stats = None
+class MgmtBrokerStats(SQLObject):
+ class sqlmeta:
+ fromDatabase = True
-class MgmtServerStats(SQLObject):
+class MgmtBroker(SQLObject):
+ schemaId = 2
+ schemaName = "broker"
+ managedBroker = None
class sqlmeta:
fromDatabase = True
+ def joinCluster(self, model, callbackMethod, clusterName):
+ actualArgs = dict()
+ actualArgs["clusterName"] = clusterName
+ methodId = model.registerCallback(callbackMethod)
+ self.managedBroker.method(methodId, self.idOriginal, self.schemaName, "joinCluster", args=actualArgs, packageName="qpid")
+ def leaveCluster(self, model, callbackMethod):
+ actualArgs = dict()
+ methodId = model.registerCallback(callbackMethod)
+ self.managedBroker.method(methodId, self.idOriginal, self.schemaName, "leaveCluster", args=actualArgs, packageName="qpid")
+ def echo(self, model, callbackMethod, sequence, body):
+ actualArgs = dict()
+ actualArgs["sequence"] = sequence
+ actualArgs["body"] = body
+ methodId = model.registerCallback(callbackMethod)
+ self.managedBroker.method(methodId, self.idOriginal, self.schemaName, "echo", args=actualArgs, packageName="qpid")
+ def crash(self, model, callbackMethod):
+ """Temporary test method to crash the broker"""
+ actualArgs = dict()
+ methodId = model.registerCallback(callbackMethod)
+ self.managedBroker.method(methodId, self.idOriginal, self.schemaName, "crash", args=actualArgs, packageName="qpid")
+ _SO_class_Mgmt_broker_stats = None
+ _SO_class_Mgmt_system = None
+class MgmtVhostStats(SQLObject):
+ class sqlmeta:
+ fromDatabase = True
+
+MgmtSystem.sqlmeta.addJoin(MultipleJoin('MgmtBroker', joinMethodName='allBrokers'))
+
class MgmtVhost(SQLObject):
+ schemaId = 3
+ schemaName = "vhost"
+ managedBroker = None
class sqlmeta:
fromDatabase = True
+ _SO_class_Mgmt_vhost_stats = None
+ _SO_class_Mgmt_broker = None
-class MgmtVhostStats(SQLObject):
+class MgmtQueueStats(SQLObject):
class sqlmeta:
fromDatabase = True
+MgmtBroker.sqlmeta.addJoin(MultipleJoin('MgmtVhost', joinMethodName='allVhosts'))
+
class MgmtQueue(SQLObject):
+ schemaId = 4
+ schemaName = "queue"
+ managedBroker = None
class sqlmeta:
fromDatabase = True
- def purge():
+ def purge(self, model, callbackMethod):
"""Discard all messages on queue"""
- pass
-
- def increaseDiskSize():
+ actualArgs = dict()
+ methodId = model.registerCallback(callbackMethod)
+ self.managedBroker.method(methodId, self.idOriginal, self.schemaName, "purge", args=actualArgs, packageName="qpid")
+ def increaseDiskSize(self, model, callbackMethod, pages):
"""Increase number of disk pages allocated for this queue"""
- pass
+ actualArgs = dict()
+ actualArgs["pages"] = pages
+ methodId = model.registerCallback(callbackMethod)
+ self.managedBroker.method(methodId, self.idOriginal, self.schemaName, "increaseDiskSize", args=actualArgs, packageName="qpid")
+ _SO_class_Mgmt_queue_stats = None
+ _SO_class_Mgmt_vhost = None
-
-class MgmtQueueStats(SQLObject):
+class MgmtExchangeStats(SQLObject):
class sqlmeta:
fromDatabase = True
+MgmtVhost.sqlmeta.addJoin(MultipleJoin('MgmtQueue', joinMethodName='allQueues'))
+
class MgmtExchange(SQLObject):
+ schemaId = 5
+ schemaName = "exchange"
+ managedBroker = None
class sqlmeta:
fromDatabase = True
+ _SO_class_Mgmt_exchange_stats = None
+ _SO_class_Mgmt_vhost = None
-class MgmtExchangeStats(SQLObject):
+class MgmtBindingStats(SQLObject):
class sqlmeta:
fromDatabase = True
+MgmtVhost.sqlmeta.addJoin(MultipleJoin('MgmtExchange', joinMethodName='allExchanges'))
+
class MgmtBinding(SQLObject):
+ schemaId = 6
+ schemaName = "binding"
+ managedBroker = None
class sqlmeta:
fromDatabase = True
+ _SO_class_Mgmt_binding_stats = None
+ _SO_class_Mgmt_queue = None
+ _SO_class_Mgmt_exchange = None
-class MgmtBindingStats(SQLObject):
+class MgmtClientStats(SQLObject):
class sqlmeta:
fromDatabase = True
+MgmtQueue.sqlmeta.addJoin(MultipleJoin('MgmtBinding', joinMethodName='allBindings'))
+MgmtExchange.sqlmeta.addJoin(MultipleJoin('MgmtBinding', joinMethodName='allBindings'))
+
class MgmtClient(SQLObject):
+ schemaId = 7
+ schemaName = "client"
+ managedBroker = None
class sqlmeta:
fromDatabase = True
- def close():
- pass
+ def close(self, model, callbackMethod):
+ actualArgs = dict()
+ methodId = model.registerCallback(callbackMethod)
+ self.managedBroker.method(methodId, self.idOriginal, self.schemaName, "close", args=actualArgs, packageName="qpid")
+ def detach(self, model, callbackMethod):
+ actualArgs = dict()
+ methodId = model.registerCallback(callbackMethod)
+ self.managedBroker.method(methodId, self.idOriginal, self.schemaName, "detach", args=actualArgs, packageName="qpid")
+ _SO_class_Mgmt_client_stats = None
+ _SO_class_Mgmt_vhost = None
- def detach():
- pass
-
-
-class MgmtClientStats(SQLObject):
+class MgmtSessionStats(SQLObject):
class sqlmeta:
fromDatabase = True
+MgmtVhost.sqlmeta.addJoin(MultipleJoin('MgmtClient', joinMethodName='allClients'))
+
class MgmtSession(SQLObject):
+ schemaId = 8
+ schemaName = "session"
+ managedBroker = None
class sqlmeta:
fromDatabase = True
- def solicitAck():
- pass
+ def solicitAck(self, model, callbackMethod):
+ actualArgs = dict()
+ methodId = model.registerCallback(callbackMethod)
+ self.managedBroker.method(methodId, self.idOriginal, self.schemaName, "solicitAck", args=actualArgs, packageName="qpid")
+ def detach(self, model, callbackMethod):
+ actualArgs = dict()
+ methodId = model.registerCallback(callbackMethod)
+ self.managedBroker.method(methodId, self.idOriginal, self.schemaName, "detach", args=actualArgs, packageName="qpid")
+ def resetLifespan(self, model, callbackMethod):
+ actualArgs = dict()
+ methodId = model.registerCallback(callbackMethod)
+ self.managedBroker.method(methodId, self.idOriginal, self.schemaName, "resetLifespan", args=actualArgs, packageName="qpid")
+ def close(self, model, callbackMethod):
+ actualArgs = dict()
+ methodId = model.registerCallback(callbackMethod)
+ self.managedBroker.method(methodId, self.idOriginal, self.schemaName, "close", args=actualArgs, packageName="qpid")
+ _SO_class_Mgmt_session_stats = None
+ _SO_class_Mgmt_vhost = None
+ _SO_class_Mgmt_client = None
- def detach():
- pass
-
- def resetLifespan():
- pass
-
- def close():
- pass
-
-
-class MgmtSessionStats(SQLObject):
+class MgmtDestinationStats(SQLObject):
class sqlmeta:
fromDatabase = True
+MgmtVhost.sqlmeta.addJoin(MultipleJoin('MgmtSession', joinMethodName='allSessions'))
+MgmtClient.sqlmeta.addJoin(MultipleJoin('MgmtSession', joinMethodName='allSessions'))
+
class MgmtDestination(SQLObject):
+ schemaId = 9
+ schemaName = "destination"
+ managedBroker = None
class sqlmeta:
fromDatabase = True
- def throttle():
+ def throttle(self, model, callbackMethod, strength):
"""Apply extra rate limiting to destination: 0 = Normal, 10 = Maximum"""
- pass
+ actualArgs = dict()
+ actualArgs["strength"] = strength
+ methodId = model.registerCallback(callbackMethod)
+ self.managedBroker.method(methodId, self.idOriginal, self.schemaName, "throttle", args=actualArgs, packageName="qpid")
+ def stop(self, model, callbackMethod):
+ actualArgs = dict()
+ methodId = model.registerCallback(callbackMethod)
+ self.managedBroker.method(methodId, self.idOriginal, self.schemaName, "stop", args=actualArgs, packageName="qpid")
+ def start(self, model, callbackMethod):
+ actualArgs = dict()
+ methodId = model.registerCallback(callbackMethod)
+ self.managedBroker.method(methodId, self.idOriginal, self.schemaName, "start", args=actualArgs, packageName="qpid")
+ _SO_class_Mgmt_destination_stats = None
+ _SO_class_Mgmt_session = None
- def stop():
- pass
-
- def start():
- pass
-
-
-class MgmtDestinationStats(SQLObject):
+class MgmtProducerStats(SQLObject):
class sqlmeta:
fromDatabase = True
+MgmtSession.sqlmeta.addJoin(MultipleJoin('MgmtDestination', joinMethodName='allDestinations'))
+
class MgmtProducer(SQLObject):
+ schemaId = 10
+ schemaName = "producer"
+ managedBroker = None
class sqlmeta:
fromDatabase = True
+ _SO_class_Mgmt_producer_stats = None
+ _SO_class_Mgmt_destination = None
+ _SO_class_Mgmt_exchange = None
-class MgmtProducerStats(SQLObject):
+class MgmtConsumerStats(SQLObject):
class sqlmeta:
fromDatabase = True
+MgmtDestination.sqlmeta.addJoin(MultipleJoin('MgmtProducer', joinMethodName='allProducers'))
+MgmtExchange.sqlmeta.addJoin(MultipleJoin('MgmtProducer', joinMethodName='allProducers'))
+
class MgmtConsumer(SQLObject):
+ schemaId = 11
+ schemaName = "consumer"
+ managedBroker = None
class sqlmeta:
fromDatabase = True
- def close():
- pass
-
-
-class MgmtConsumerStats(SQLObject):
- class sqlmeta:
- fromDatabase = True
-
+ def close(self, model, callbackMethod):
+ actualArgs = dict()
+ methodId = model.registerCallback(callbackMethod)
+ self.managedBroker.method(methodId, self.idOriginal, self.schemaName, "close", args=actualArgs, packageName="qpid")
+ _SO_class_Mgmt_consumer_stats = None
+ _SO_class_Mgmt_destination = None
+ _SO_class_Mgmt_queue = None
Added: mgmt/mint/python/mint/schema.sql
===================================================================
--- mgmt/mint/python/mint/schema.sql (rev 0)
+++ mgmt/mint/python/mint/schema.sql 2007-11-13 19:45:55 UTC (rev 1303)
@@ -0,0 +1,332 @@
+
+CREATE TABLE mgmt_system (
+ id BIGSERIAL PRIMARY KEY,
+ id_original BIGINT,
+ mgmt_system_stats_id BIGINT,
+ rec_time TIMESTAMP,
+ creation_time TIMESTAMP,
+ deletion_time TIMESTAMP,
+ sys_ident VARCHAR(1000)
+);
+
+CREATE INDEX mgmt_system_sys_ident_index ON mgmt_system(sys_ident);
+
+CREATE TABLE mgmt_system_stats (
+ id BIGSERIAL PRIMARY KEY,
+ id_original BIGINT,
+ mgmt_system_id BIGINT REFERENCES mgmt_system ,
+ rec_time TIMESTAMP
+);
+
+ALTER TABLE mgmt_system ADD FOREIGN KEY (mgmt_system_stats_id) REFERENCES mgmt_system_stats;
+
+CREATE TABLE mgmt_broker (
+ id BIGSERIAL PRIMARY KEY,
+ id_original BIGINT,
+ mgmt_broker_stats_id BIGINT,
+ rec_time TIMESTAMP,
+ creation_time TIMESTAMP,
+ deletion_time TIMESTAMP,
+ mgmt_system_id BIGINT REFERENCES mgmt_system,
+ port INT2 ,
+ worker_threads INT2 ,
+ max_conns INT2 ,
+ conn_backlog INT2 ,
+ staging_threshold INT4 ,
+ store_lib VARCHAR(1000) ,
+ async_store BOOLEAN ,
+ mgmt_pub_interval INT2 ,
+ initial_disk_page_size INT4 ,
+ initial_pages_per_queue INT4 ,
+ cluster_name VARCHAR(1000) ,
+ version VARCHAR(1000)
+);
+
+CREATE INDEX mgmt_broker_port_index ON mgmt_broker(port);
+
+CREATE TABLE mgmt_broker_stats (
+ id BIGSERIAL PRIMARY KEY,
+ id_original BIGINT,
+ mgmt_broker_id BIGINT REFERENCES mgmt_broker ,
+ rec_time TIMESTAMP
+);
+
+ALTER TABLE mgmt_broker ADD FOREIGN KEY (mgmt_broker_stats_id) REFERENCES mgmt_broker_stats;
+
+CREATE TABLE mgmt_vhost (
+ id BIGSERIAL PRIMARY KEY,
+ id_original BIGINT,
+ mgmt_vhost_stats_id BIGINT,
+ rec_time TIMESTAMP,
+ creation_time TIMESTAMP,
+ deletion_time TIMESTAMP,
+ mgmt_broker_id BIGINT REFERENCES mgmt_broker,
+ name VARCHAR(1000)
+);
+
+CREATE INDEX mgmt_vhost_name_index ON mgmt_vhost(name);
+
+CREATE TABLE mgmt_vhost_stats (
+ id BIGSERIAL PRIMARY KEY,
+ id_original BIGINT,
+ mgmt_vhost_id BIGINT REFERENCES mgmt_vhost ,
+ rec_time TIMESTAMP
+);
+
+ALTER TABLE mgmt_vhost ADD FOREIGN KEY (mgmt_vhost_stats_id) REFERENCES mgmt_vhost_stats;
+
+CREATE TABLE mgmt_queue (
+ id BIGSERIAL PRIMARY KEY,
+ id_original BIGINT,
+ mgmt_queue_stats_id BIGINT,
+ rec_time TIMESTAMP,
+ creation_time TIMESTAMP,
+ deletion_time TIMESTAMP,
+ mgmt_vhost_id BIGINT REFERENCES mgmt_vhost,
+ name VARCHAR(1000) ,
+ durable BOOLEAN ,
+ auto_delete BOOLEAN ,
+ exclusive BOOLEAN ,
+ page_memory_limit INT4
+);
+
+CREATE INDEX mgmt_queue_name_index ON mgmt_queue(name);
+
+CREATE TABLE mgmt_queue_stats (
+ id BIGSERIAL PRIMARY KEY,
+ id_original BIGINT,
+ mgmt_queue_id BIGINT REFERENCES mgmt_queue ,
+ rec_time TIMESTAMP,
+ disk_page_size INT4 ,
+ disk_pages INT4 ,
+ disk_available_size INT4 ,
+ msg_total_enqueues INT8 ,
+ msg_total_dequeues INT8 ,
+ msg_txn_enqueues INT8 ,
+ msg_txn_dequeues INT8 ,
+ msg_persist_enqueues INT8 ,
+ msg_persist_dequeues INT8 ,
+ msg_depth INT4 ,
+ msg_depth_high INT4 ,
+ msg_depth_low INT4 ,
+ byte_total_enqueues INT8 ,
+ byte_total_dequeues INT8 ,
+ byte_txn_enqueues INT8 ,
+ byte_txn_dequeues INT8 ,
+ byte_persist_enqueues INT8 ,
+ byte_persist_dequeues INT8 ,
+ byte_depth INT4 ,
+ byte_depth_high INT4 ,
+ byte_depth_low INT4 ,
+ enqueue_txn_starts INT8 ,
+ enqueue_txn_commits INT8 ,
+ enqueue_txn_rejects INT8 ,
+ enqueue_txn_count INT4 ,
+ enqueue_txn_count_high INT4 ,
+ enqueue_txn_count_low INT4 ,
+ dequeue_txn_starts INT8 ,
+ dequeue_txn_commits INT8 ,
+ dequeue_txn_rejects INT8 ,
+ dequeue_txn_count INT4 ,
+ dequeue_txn_count_high INT4 ,
+ dequeue_txn_count_low INT4 ,
+ consumers INT4 ,
+ consumers_high INT4 ,
+ consumers_low INT4 ,
+ bindings INT4 ,
+ bindings_high INT4 ,
+ bindings_low INT4 ,
+ unacked_messages INT4 ,
+ unacked_messages_high INT4 ,
+ unacked_messages_low INT4
+);
+
+ALTER TABLE mgmt_queue ADD FOREIGN KEY (mgmt_queue_stats_id) REFERENCES mgmt_queue_stats;
+
+CREATE TABLE mgmt_exchange (
+ id BIGSERIAL PRIMARY KEY,
+ id_original BIGINT,
+ mgmt_exchange_stats_id BIGINT,
+ rec_time TIMESTAMP,
+ creation_time TIMESTAMP,
+ deletion_time TIMESTAMP,
+ mgmt_vhost_id BIGINT REFERENCES mgmt_vhost,
+ name VARCHAR(1000) ,
+ type VARCHAR(1000)
+);
+
+CREATE INDEX mgmt_exchange_name_index ON mgmt_exchange(name);
+
+CREATE TABLE mgmt_exchange_stats (
+ id BIGSERIAL PRIMARY KEY,
+ id_original BIGINT,
+ mgmt_exchange_id BIGINT REFERENCES mgmt_exchange ,
+ rec_time TIMESTAMP,
+ producers INT4 ,
+ producers_high INT4 ,
+ producers_low INT4 ,
+ bindings INT4 ,
+ bindings_high INT4 ,
+ bindings_low INT4 ,
+ msg_receives INT8 ,
+ msg_drops INT8 ,
+ msg_routes INT8 ,
+ byte_receives INT8 ,
+ byte_drops INT8 ,
+ byte_routes INT8
+);
+
+ALTER TABLE mgmt_exchange ADD FOREIGN KEY (mgmt_exchange_stats_id) REFERENCES mgmt_exchange_stats;
+
+CREATE TABLE mgmt_binding (
+ id BIGSERIAL PRIMARY KEY,
+ id_original BIGINT,
+ mgmt_binding_stats_id BIGINT,
+ rec_time TIMESTAMP,
+ creation_time TIMESTAMP,
+ deletion_time TIMESTAMP,
+ mgmt_queue_id BIGINT REFERENCES mgmt_queue,
+ mgmt_exchange_id BIGINT REFERENCES mgmt_exchange,
+ binding_key VARCHAR(1000)
+);
+
+CREATE TABLE mgmt_binding_stats (
+ id BIGSERIAL PRIMARY KEY,
+ id_original BIGINT,
+ mgmt_binding_id BIGINT REFERENCES mgmt_binding ,
+ rec_time TIMESTAMP,
+ msg_matched INT8
+);
+
+ALTER TABLE mgmt_binding ADD FOREIGN KEY (mgmt_binding_stats_id) REFERENCES mgmt_binding_stats;
+
+CREATE TABLE mgmt_client (
+ id BIGSERIAL PRIMARY KEY,
+ id_original BIGINT,
+ mgmt_client_stats_id BIGINT,
+ rec_time TIMESTAMP,
+ creation_time TIMESTAMP,
+ deletion_time TIMESTAMP,
+ mgmt_vhost_id BIGINT REFERENCES mgmt_vhost,
+ ip_addr INT4 ,
+ port INT2
+);
+
+CREATE INDEX mgmt_client_ip_addr_index ON mgmt_client(ip_addr);
+
+CREATE INDEX mgmt_client_port_index ON mgmt_client(port);
+
+CREATE TABLE mgmt_client_stats (
+ id BIGSERIAL PRIMARY KEY,
+ id_original BIGINT,
+ mgmt_client_id BIGINT REFERENCES mgmt_client ,
+ rec_time TIMESTAMP,
+ auth_identity VARCHAR(1000) ,
+ msgs_produced INT8 ,
+ msgs_consumed INT8 ,
+ bytes_produced INT8 ,
+ bytes_consumed INT8
+);
+
+ALTER TABLE mgmt_client ADD FOREIGN KEY (mgmt_client_stats_id) REFERENCES mgmt_client_stats;
+
+CREATE TABLE mgmt_session (
+ id BIGSERIAL PRIMARY KEY,
+ id_original BIGINT,
+ mgmt_session_stats_id BIGINT,
+ rec_time TIMESTAMP,
+ creation_time TIMESTAMP,
+ deletion_time TIMESTAMP,
+ mgmt_vhost_id BIGINT REFERENCES mgmt_vhost,
+ name VARCHAR(1000) ,
+ mgmt_client_id BIGINT REFERENCES mgmt_client,
+ detached_lifespan INT4
+);
+
+CREATE INDEX mgmt_session_name_index ON mgmt_session(name);
+
+CREATE TABLE mgmt_session_stats (
+ id BIGSERIAL PRIMARY KEY,
+ id_original BIGINT,
+ mgmt_session_id BIGINT REFERENCES mgmt_session ,
+ rec_time TIMESTAMP,
+ attached BOOLEAN ,
+ remaining_lifespan INT4 ,
+ frames_outstanding INT4
+);
+
+ALTER TABLE mgmt_session ADD FOREIGN KEY (mgmt_session_stats_id) REFERENCES mgmt_session_stats;
+
+CREATE TABLE mgmt_destination (
+ id BIGSERIAL PRIMARY KEY,
+ id_original BIGINT,
+ mgmt_destination_stats_id BIGINT,
+ rec_time TIMESTAMP,
+ creation_time TIMESTAMP,
+ deletion_time TIMESTAMP,
+ mgmt_session_id BIGINT REFERENCES mgmt_session,
+ name VARCHAR(1000)
+);
+
+CREATE INDEX mgmt_destination_name_index ON mgmt_destination(name);
+
+CREATE TABLE mgmt_destination_stats (
+ id BIGSERIAL PRIMARY KEY,
+ id_original BIGINT,
+ mgmt_destination_id BIGINT REFERENCES mgmt_destination ,
+ rec_time TIMESTAMP,
+ flow_mode INT2 ,
+ max_msg_credits INT4 ,
+ max_byte_credits INT4 ,
+ msg_credits INT4 ,
+ byte_credits INT4
+);
+
+ALTER TABLE mgmt_destination ADD FOREIGN KEY (mgmt_destination_stats_id) REFERENCES mgmt_destination_stats;
+
+CREATE TABLE mgmt_producer (
+ id BIGSERIAL PRIMARY KEY,
+ id_original BIGINT,
+ mgmt_producer_stats_id BIGINT,
+ rec_time TIMESTAMP,
+ creation_time TIMESTAMP,
+ deletion_time TIMESTAMP,
+ mgmt_destination_id BIGINT REFERENCES mgmt_destination,
+ mgmt_exchange_id BIGINT REFERENCES mgmt_exchange
+);
+
+CREATE TABLE mgmt_producer_stats (
+ id BIGSERIAL PRIMARY KEY,
+ id_original BIGINT,
+ mgmt_producer_id BIGINT REFERENCES mgmt_producer ,
+ rec_time TIMESTAMP,
+ msgs_produced INT8 ,
+ bytes_produced INT8
+);
+
+ALTER TABLE mgmt_producer ADD FOREIGN KEY (mgmt_producer_stats_id) REFERENCES mgmt_producer_stats;
+
+CREATE TABLE mgmt_consumer (
+ id BIGSERIAL PRIMARY KEY,
+ id_original BIGINT,
+ mgmt_consumer_stats_id BIGINT,
+ rec_time TIMESTAMP,
+ creation_time TIMESTAMP,
+ deletion_time TIMESTAMP,
+ mgmt_destination_id BIGINT REFERENCES mgmt_destination,
+ mgmt_queue_id BIGINT REFERENCES mgmt_queue
+);
+
+CREATE TABLE mgmt_consumer_stats (
+ id BIGSERIAL PRIMARY KEY,
+ id_original BIGINT,
+ mgmt_consumer_id BIGINT REFERENCES mgmt_consumer ,
+ rec_time TIMESTAMP,
+ msgs_consumed INT8 ,
+ bytes_consumed INT8 ,
+ unacked_messages INT4 ,
+ unacked_messages_high INT4 ,
+ unacked_messages_low INT4
+);
+
+ALTER TABLE mgmt_consumer ADD FOREIGN KEY (mgmt_consumer_stats_id) REFERENCES mgmt_consumer_stats;
Deleted: mgmt/mint/python/mint/updater.py
===================================================================
--- mgmt/mint/python/mint/updater.py 2007-11-13 18:36:01 UTC (rev 1302)
+++ mgmt/mint/python/mint/updater.py 2007-11-13 19:45:55 UTC (rev 1303)
@@ -1,57 +0,0 @@
-from time import sleep
-from datetime import datetime
-
-from schema import *
-
-class MintUpdater(object):
- def __init__(self, model, broker):
- self.model = model
- self.broker = broker
-
- self.broker.configListener("XXXcontext", configCallback)
- self.broker.instrumentationListener("XXXcontext", instCallback)
-
- def start(self):
- self.broker.start()
-
- while True:
- sleep(1)
-
-def getQueueByName(name, create=False):
- try:
- queues = MgmtQueue.selectBy(name=name)[:1]
- queue = queues[0]
- except IndexError:
- if (create): queue = MgmtQueue()
- return queue
-
-def configCallback(broker, oid, list, timestamps):
- print "broker=" + broker
- if oid == 4:
- print list
- d = dict(list)
- queue = getQueueByName(d["name"], True)
- queue.set(**d)
- recOn = datetime.fromtimestamp(timestamps[0]/1000000000)
- createdOn = datetime.fromtimestamp(timestamps[1]/1000000000)
- queue.set(recTime=recOn,creationTime=createdOn)
- print queue.id
- print " -> " + d["name"]
- return queue
-
-def instCallback(broker, oid, list, timestamps):
- print "broker=" + broker
- if oid == 4:
- print list
- d = dict(list)
- queue = getQueueByName(d.pop("name"))
- d["mgmtQueue"] = queue.id
- recOn = datetime.fromtimestamp(timestamps[0]/1000000000)
- queueStats = MgmtQueueStats()
- queueStats.set(recTime=recOn)
- queueStats.set(**d)
- if (timestamps[2] != 0):
- deletedOn = datetime.fromtimestamp(timestamps[2]/1000000000)
- queue.set(deletionTime=deletedOn)
- print queue.id
- return queueStats
17 years, 1 month
rhmessaging commits: r1302 - mgmt/cumin/python/wooly.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2007-11-13 13:36:01 -0500 (Tue, 13 Nov 2007)
New Revision: 1302
Modified:
mgmt/cumin/python/wooly/__init__.py
Log:
More field renaming.
Modified: mgmt/cumin/python/wooly/__init__.py
===================================================================
--- mgmt/cumin/python/wooly/__init__.py 2007-11-13 18:26:00 UTC (rev 1301)
+++ mgmt/cumin/python/wooly/__init__.py 2007-11-13 18:36:01 UTC (rev 1302)
@@ -18,15 +18,15 @@
self.attributes = list()
self.parameters = list()
- self.template = Template(self, "html")
+ self.__template = Template(self, "html")
self.errors = Attribute(app, "errors")
self.errors.set_default(list())
self.add_attribute(self.errors)
- self.cached_ancestors = None
- self.cached_path = None
- self.cached_page = None
+ self.__ancestors = None
+ self.__path = None
+ self.__page = None
self.child_index = None
app.add_widget(self)
@@ -38,36 +38,36 @@
return self.__parent
def ancestors(self):
- if not self.cached_ancestors:
+ if not self.__ancestors:
if not self.parent():
- self.cached_ancestors = tuple()
+ self.__ancestors = tuple()
else:
ancs = list(self.parent().ancestors())
ancs.append(self.parent())
- self.cached_ancestors = tuple(ancs)
+ self.__ancestors = tuple(ancs)
- return self.cached_ancestors
+ return self.__ancestors
def path(self):
- if self.cached_path == None:
+ if self.__path == None:
if not self.parent():
- self.cached_path = ""
+ self.__path = ""
elif not self.parent().parent():
- self.cached_path = self.name();
+ self.__path = self.name();
else:
- self.cached_path = self.parent().path() + "." + self.name()
+ self.__path = self.parent().path() + "." + self.name()
- return self.cached_path
+ return self.__path
def page(self):
- if self.cached_page == None:
+ if self.__page == None:
if not self.parent():
- self.cached_page = self
+ self.__page = self
else:
- self.cached_page = self.parent().page()
+ self.__page = self.parent().page()
- return self.cached_page
+ return self.__page
def add_child(self, widget):
self.children.append(widget)
@@ -164,7 +164,7 @@
def do_render(self, session, object):
writer = Writer()
- self.template.render(session, object, writer)
+ self.__template.render(session, object, writer)
return writer.to_string()
@@ -202,16 +202,16 @@
self.default = None
self.is_required = True
- self.cached_path = None
+ self.__path = None
def path(self):
- if self.cached_path == None:
+ if self.__path == None:
if not self.widget.parent():
- self.cached_path = self.name
+ self.__path = self.name
else:
- self.cached_path = self.widget.path() + "." + self.name
+ self.__path = self.widget.path() + "." + self.name
- return self.cached_path
+ return self.__path
def set_required(self, is_required):
self.is_required = is_required
@@ -490,8 +490,8 @@
self.debug = None
class Debug(object):
- def __init__(self, app):
- self.app = app
+ def __init__(self, session):
+ self.session = session
self.process_stack = list()
self.render_stack = list()
@@ -565,16 +565,8 @@
vars = list()
for param in params:
- #key = param.path()
+ key = param.path()
- # Inlined below saving about a half a second in a
- # 1000-hit profile
-
- if param.cached_path == None:
- key = param.path()
- else:
- key = param.cached_path
-
if param.is_collection:
collection = self.get(key)
17 years, 1 month
rhmessaging commits: r1301 - mgmt/mint.
by rhmessaging-commits@lists.jboss.org
Author: nunofsantos
Date: 2007-11-13 13:26:00 -0500 (Tue, 13 Nov 2007)
New Revision: 1301
Modified:
mgmt/mint/model.py
mgmt/mint/schemaparser.py
Log:
include changes to MgmtSchema.xml, handle method calls with args
Modified: mgmt/mint/model.py
===================================================================
--- mgmt/mint/model.py 2007-11-13 17:28:13 UTC (rev 1300)
+++ mgmt/mint/model.py 2007-11-13 18:26:00 UTC (rev 1301)
@@ -7,16 +7,17 @@
class Model:
currentMethodId = None
outstandingMethodCalls = None
+ managedBrokers = None
def __init__(self):
self.currentMethodId = 1
self.outstandingMethodCalls = dict()
+ self.managedBrokers = dict()
def getQueueByOriginalId(self, id, create=False):
queue = None
try:
- queues = MgmtQueue.selectBy(idOriginal=id)[:1]
- queue = queues[0]
+ queue = MgmtQueue.selectBy(idOriginal=id)[:1][0]
except IndexError:
if (create): queue = MgmtQueue(idOriginal=id)
return queue
@@ -24,8 +25,7 @@
def getQueueByName(self, name, vhost, create=False):
queue = None
try:
- queues = MgmtQueue.selectBy(name=name, mgmtVhost=vhost)[:1]
- queue = queues[0]
+ queue = MgmtQueue.selectBy(name=name, mgmtVhost=vhost)[:1][0]
except IndexError:
if (create): queue = MgmtQueue(name=name, mgmtVhost=vhost)
return queue
@@ -33,8 +33,7 @@
def getVhostByName(self, name, broker, create=False):
vhost = None
try:
- vhosts = MgmtVhost.selectBy(name=name, mgmtBroker=broker)[:1]
- vhost = vhosts[0]
+ vhost = MgmtVhost.selectBy(name=name, mgmtBroker=broker)[:1][0]
except IndexError:
if (create): vhost = MgmtVhost(name=name, mgmtBroker=broker)
return vhost
@@ -42,8 +41,7 @@
def getVhostByOriginalId(self, id, create=False):
vhost = None
try:
- vhosts = MgmtVhost.selectBy(idOriginal=id)[:1]
- vhost = vhosts[0]
+ vhost = MgmtVhost.selectBy(idOriginal=id)[:1][0]
except IndexError:
if (create): vhost = MgmtVhost(idOriginal=id)
return vhost
@@ -51,8 +49,7 @@
def getBrokerByPort(self, port, system, create=False):
broker = None
try:
- brokers = MgmtBroker.selectBy(port=port, mgmtSystem=system)[:1]
- broker = brokers[0]
+ broker = MgmtBroker.selectBy(port=port, mgmtSystem=system)[:1][0]
except IndexError:
if (create): broker = MgmtBroker(port=port, mgmtSystem=system)
return broker
@@ -60,8 +57,7 @@
def getBrokerByOriginalId(self, id, create=False):
broker = None
try:
- brokers = MgmtBroker.selectBy(idOriginal=id)[:1]
- broker = brokers[0]
+ broker = MgmtBroker.selectBy(idOriginal=id)[:1][0]
except IndexError:
if (create): broker = MgmtBroker(idOriginal=id)
return broker
@@ -69,8 +65,7 @@
def getSystemByOriginalId(self, id, create=False):
system = None
try:
- systems = MgmtSystem.selectBy(idOriginal=id)[:1]
- system = systems[0]
+ system = MgmtSystem.selectBy(idOriginal=id)[:1][0]
except IndexError:
if (create): system = MgmtSystem(idOriginal=id)
return system
@@ -103,31 +98,30 @@
print list
result = None
d = self.sanitizeDict(dict(list))
-
+ d["managedBroker"] = self.managedBrokers[broker]
print d
d["recTime"] = datetime.fromtimestamp(timestamps[0]/1000000000)
d["creationTime"] = datetime.fromtimestamp(timestamps[1]/1000000000)
- if (objectName == "Queue"):
+ if (objectName == "queue"):
print "* QUEUE"
queue = self.getQueueByName(d["name"], self.getVhostByOriginalId(d.pop(self.convertKey("vhostRef"))), True)
queue.set(**d)
- print queue.id
- print " -> " + queue.name
+ print "queue id = %d" % (queue.id)
result = queue
- elif (objectName == "Vhost"):
+ elif (objectName == "vhost"):
print "* VHOST"
vhost = self.getVhostByName(d["name"], self.getBrokerByOriginalId(d.pop(self.convertKey("brokerRef"))), True)
vhost.set(**d)
- print vhost.id
- print " -> " + vhost.name
+ print "vhost id = %d" % (vhost.id)
result = vhost
- elif (objectName == "Broker"):
+ elif (objectName == "broker"):
print "* BROKER"
d.pop(self.convertKey("systemRef"))
- broker = self.getBrokerByPort(d["port"], self.getSystemByOriginalId("123456789"), True)
+ broker = self.getBrokerByPort(d["port"], self.getSystemByOriginalId("0"), True)
broker.set(**d)
- print broker.id
+ broker.sync()
+ print "broker id = %d" % (broker.id)
result = broker
print "END CONFIG---------------------------------------------------\n"
return result
@@ -139,7 +133,7 @@
print list
result = None
d = self.sanitizeDict(dict(list))
- if (objectName == "Queue"):
+ if (objectName == "queue"):
print "* QUEUE"
queue = self.getQueueByOriginalId(d[self.convertKey("id")])
d["mgmtQueue"] = queue.id
@@ -153,32 +147,39 @@
queue.set(**d)
print queue.id
result = queueStats
- elif (objectName == "Vhost"):
+ elif (objectName == "vhost"):
print "* VHOST"
- elif (objectName == "Broker"):
+ elif (objectName == "broker"):
print "* BROKER"
print "END INST---------------------------------------------------\n"
return result
- def methodCallback(self, broker, methodId, error, args):
+ def methodCallback(self, broker, methodId, errorNo, errorText, args):
print "\nMETHOD---------------------------------------------------"
print "broker=" + broker
- print methodId
- print error
+ print "MethodId=%d" % (methodId)
+ print "Error: %d %s" % (errorNo, errorText)
print args
- methodCallback = self.outstandingMethodCalls.pop(methodId)
- print methodCallback
- eval(methodCallback)
+ method = self.outstandingMethodCalls.pop(methodId)
+ method(errorText, args)
print "END METHOD---------------------------------------------------\n"
- def addManagedBroker(self, broker, label):
+ def addManagedBroker(self, host, port):
+ broker = ManagedBroker(host=host, port=port)
+ label = "%s:%d" % (host, port)
+ self.managedBrokers[label] = broker
broker.configListener(label, self.configCallback)
broker.instrumentationListener (label, self.instCallback)
broker.methodListener (label, self.methodCallback)
+ broker.start()
+ return label
def registerCallback(self, callback):
self.currentMethodId += 1
methodId = self.currentMethodId
self.outstandingMethodCalls[methodId] = callback
return methodId
+
+ def allSystems(self):
+ return MgmtSystem.select()
Modified: mgmt/mint/schemaparser.py
===================================================================
--- mgmt/mint/schemaparser.py 2007-11-13 17:28:13 UTC (rev 1300)
+++ mgmt/mint/schemaparser.py 2007-11-13 18:26:00 UTC (rev 1301)
@@ -130,7 +130,7 @@
# generate foreign keys
refName = self.attrNameFromDbColumn(refName, "Mgmt", "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 = %s()\n" % (self.style.pythonAttrToDBColumn(refName).capitalize(), refName)
+ 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", ""))
@@ -139,6 +139,7 @@
if (schemaName != ""):
self.pythonOutput += " schemaId = %d\n" % int(schemaId)
self.pythonOutput += " schemaName = \"%s\"\n" % schemaName
+ self.pythonOutput += " managedBroker = None\n"
self.pythonOutput += " class sqlmeta:\n"
self.pythonOutput += " fromDatabase = True\n"
@@ -147,11 +148,22 @@
comment = ' """' + elem["@desc"] + '"""\n'
else:
comment = ""
- self.pythonOutput += " def %s(self, managedBroker, model, callbackMethod):\n" % (elem["@name"])
+
+ formalArgs = ", "
+ actualArgs = " actualArgs = dict()\n"
+ for arg in elem.query["arg"]:
+ formalArgs += "%s, " % (arg["@name"])
+ actualArgs += " actualArgs[\"%s\"] = %s\n" % (arg["@name"], arg["@name"])
+ if (formalArgs != ", "):
+ formalArgs = formalArgs[:-2]
+ else:
+ formalArgs = ""
+ self.pythonOutput += " def %s(self, model, callbackMethod%s):\n" % (elem["@name"], formalArgs)
self.pythonOutput += comment
+ self.pythonOutput += actualArgs
self.pythonOutput += " methodId = model.registerCallback(callbackMethod)\n"
- self.pythonOutput += " managedBroker.method(self.schemaId, methodId, self.schemaName, \"%s\", packageName=\"qpid\", " % (elem["@name"])
- self.pythonOutput += "args=())\n"
+ self.pythonOutput += " self.managedBroker.method(methodId, self.idOriginal, self.schemaName, \"%s\", " % (elem["@name"])
+ self.pythonOutput += "args=actualArgs, packageName=\"qpid\")\n"
def endClass(self, name=""):
if (self.additional != ""):
@@ -159,7 +171,7 @@
self.additional = ""
if (name != "" and not name.endswith("Stats")):
# add missing attribute (not added correctly with SqlObject 0.7.7; may need to be removed in later versions)
- self.pythonOutput += " _SO_class_%s_stats = %sStats()\n" % (self.style.pythonAttrToDBColumn(name).capitalize(), name)
+ self.pythonOutput += " _SO_class_%s_stats = None\n" % (self.style.pythonAttrToDBColumn(name).capitalize())
def getCode(self):
return self.pythonOutput
17 years, 1 month
rhmessaging commits: r1300 - in mgmt: cumin/python/wooly and 1 other directories.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2007-11-13 12:28:13 -0500 (Tue, 13 Nov 2007)
New Revision: 1300
Modified:
mgmt/cumin/python/cumin/broker.py
mgmt/cumin/python/cumin/brokercluster.py
mgmt/cumin/python/cumin/brokerprofile.py
mgmt/cumin/python/cumin/widgets.py
mgmt/cumin/python/wooly/__init__.py
mgmt/cumin/python/wooly/widgets.py
mgmt/misc/boneyard.py
Log:
Protects the name and parent fields of Widget with __.
Modified: mgmt/cumin/python/cumin/broker.py
===================================================================
--- mgmt/cumin/python/cumin/broker.py 2007-11-13 17:10:06 UTC (rev 1299)
+++ mgmt/cumin/python/cumin/broker.py 2007-11-13 17:28:13 UTC (rev 1300)
@@ -367,9 +367,9 @@
class BrowserBrokers(BrokerSetForm):
def get_items(self, session, model):
brokers = sorted_by(model.get_brokers())
- group = self.parent.group.get(session)
- profile = self.parent.profile.get(session)
- cluster = self.parent.cluster.get(session)
+ group = self.parent().group.get(session)
+ profile = self.parent().profile.get(session)
+ cluster = self.parent().cluster.get(session)
for broker in model.get_brokers():
if group and group not in broker.broker_group_items():
Modified: mgmt/cumin/python/cumin/brokercluster.py
===================================================================
--- mgmt/cumin/python/cumin/brokercluster.py 2007-11-13 17:10:06 UTC (rev 1299)
+++ mgmt/cumin/python/cumin/brokercluster.py 2007-11-13 17:28:13 UTC (rev 1300)
@@ -137,7 +137,7 @@
def process_cancel(self, session, cluster):
branch = session.branch()
- self.parent.show_view(branch)
+ self.parent().show_view(branch)
self.page().set_redirect_url(session, branch.marshal())
def process_submit(self, session, cluster):
Modified: mgmt/cumin/python/cumin/brokerprofile.py
===================================================================
--- mgmt/cumin/python/cumin/brokerprofile.py 2007-11-13 17:10:06 UTC (rev 1299)
+++ mgmt/cumin/python/cumin/brokerprofile.py 2007-11-13 17:28:13 UTC (rev 1300)
@@ -134,7 +134,7 @@
def process_cancel(self, session, profile):
branch = session.branch()
- self.parent.show_view(branch)
+ self.parent().show_view(branch)
self.page().set_redirect_url(session, branch.marshal())
def process_submit(self, session, profile):
Modified: mgmt/cumin/python/cumin/widgets.py
===================================================================
--- mgmt/cumin/python/cumin/widgets.py 2007-11-13 17:10:06 UTC (rev 1299)
+++ mgmt/cumin/python/cumin/widgets.py 2007-11-13 17:28:13 UTC (rev 1300)
@@ -94,11 +94,11 @@
class Cancel(FormButton):
def render_content(self, session, object):
- return self.parent.render_cancel_content(session, object)
+ return self.parent().render_cancel_content(session, object)
class Submit(FormButton):
def render_content(self, session, object):
- return self.parent.render_submit_content(session, object)
+ return self.parent().render_submit_content(session, object)
class CuminConfirmForm(CuminForm):
def __init__(self, app, name):
Modified: mgmt/cumin/python/wooly/__init__.py
===================================================================
--- mgmt/cumin/python/wooly/__init__.py 2007-11-13 17:10:06 UTC (rev 1299)
+++ mgmt/cumin/python/wooly/__init__.py 2007-11-13 17:28:13 UTC (rev 1300)
@@ -12,8 +12,8 @@
def __init__(self, app, name):
self.app = app
- self.name = name
- self.parent = None
+ self.__name = name
+ self.__parent = None
self.children = list()
self.attributes = list()
self.parameters = list()
@@ -31,13 +31,19 @@
app.add_widget(self)
+ def name(self):
+ return self.__name
+
+ def parent(self):
+ return self.__parent
+
def ancestors(self):
if not self.cached_ancestors:
- if not self.parent:
+ if not self.parent():
self.cached_ancestors = tuple()
else:
- ancs = list(self.parent.ancestors())
- ancs.append(self.parent)
+ ancs = list(self.parent().ancestors())
+ ancs.append(self.parent())
self.cached_ancestors = tuple(ancs)
@@ -45,34 +51,34 @@
def path(self):
if self.cached_path == None:
- if not self.parent:
+ if not self.parent():
self.cached_path = ""
- elif not self.parent.parent:
- self.cached_path = self.name;
+ elif not self.parent().parent():
+ self.cached_path = self.name();
else:
- self.cached_path = self.parent.path() + "." + self.name
+ self.cached_path = self.parent().path() + "." + self.name()
return self.cached_path
def page(self):
if self.cached_page == None:
- if not self.parent:
+ if not self.parent():
self.cached_page = self
else:
- self.cached_page = self.parent.page()
+ self.cached_page = self.parent().page()
return self.cached_page
def add_child(self, widget):
self.children.append(widget)
- widget.parent = self
+ widget.__parent = self
def get_child(self, name):
if not self.child_index:
self.child_index = dict()
for child in self.children:
- self.child_index[child.name] = child
+ self.child_index[child.name()] = child
return self.child_index.get(name, None)
@@ -200,7 +206,7 @@
def path(self):
if self.cached_path == None:
- if not self.widget.parent:
+ if not self.widget.parent():
self.cached_path = self.name
else:
self.cached_path = self.widget.path() + "." + self.name
@@ -377,10 +383,10 @@
self.urls = set()
def add_page(self, page):
- if page.parent:
- raise Exception("Page '%s' is not a root widget" % page.name)
+ if page.parent():
+ raise Exception("Page '%s' is not a root widget" % page.name())
- self.pages[page.name] = page
+ self.pages[page.name()] = page
def get_page(self, name):
return self.pages.get(name, self.default_page)
@@ -550,7 +556,7 @@
return url
def marshal_page(self):
- return self.get_page().name
+ return self.get_page().name()
def marshal_url_vars(self, separator=";"):
params = self.get_page().get_saved_parameters(self)
Modified: mgmt/cumin/python/wooly/widgets.py
===================================================================
--- mgmt/cumin/python/wooly/widgets.py 2007-11-13 17:10:06 UTC (rev 1299)
+++ mgmt/cumin/python/wooly/widgets.py 2007-11-13 17:28:13 UTC (rev 1300)
@@ -19,13 +19,13 @@
super(ModeSet, self).add_child(mode)
if not self.mode.default:
- self.mode.set_default(mode.name)
+ self.mode.set_default(mode.name())
def get_selected_mode(self, session):
return self.get_child(self.mode.get(session))
def set_selected_mode(self, session, mode):
- self.mode.set(session, mode.name)
+ self.mode.set(session, mode.name())
def show_mode(self, session, mode):
self.set_selected_mode(session, mode)
Modified: mgmt/misc/boneyard.py
===================================================================
--- mgmt/misc/boneyard.py 2007-11-13 17:10:06 UTC (rev 1299)
+++ mgmt/misc/boneyard.py 2007-11-13 17:28:13 UTC (rev 1300)
@@ -77,9 +77,9 @@
def render_group_link(self, session, group):
branch = session.branch()
- self.parent.param.set(branch, group)
+ self.parent().param.set(branch, group)
- selected = self.parent.param.get(session) is group
+ selected = self.parent().param.get(session) is group
return mlink(branch.marshal(), "ServerGroup", group.name, selected)
17 years, 1 month
rhmessaging commits: r1299 - mgmt/mint/xml.
by rhmessaging-commits@lists.jboss.org
Author: tedross
Date: 2007-11-13 12:10:06 -0500 (Tue, 13 Nov 2007)
New Revision: 1299
Modified:
mgmt/mint/xml/MgmtSchema.xml
mgmt/mint/xml/MgmtTypes.xml
Log:
Updated schema XML
Modified: mgmt/mint/xml/MgmtSchema.xml
===================================================================
--- mgmt/mint/xml/MgmtSchema.xml 2007-11-13 16:47:39 UTC (rev 1298)
+++ mgmt/mint/xml/MgmtSchema.xml 2007-11-13 17:10:06 UTC (rev 1299)
@@ -82,6 +82,7 @@
<arg name="sequence" dir="IO" type="uint32" default="0"/>
<arg name="body" dir="IO" type="lstr" default=""/>
</method>
+ <method name="crash" desc="Temporary test method to crash the broker"/>
</class>
<!--
@@ -142,6 +143,7 @@
<method name="increaseDiskSize" desc="Increase number of disk pages allocated for this queue">
<arg name="pages" type="uint32" dir="I" desc="New total page allocation"/>
</method>
+
</class>
<!--
Modified: mgmt/mint/xml/MgmtTypes.xml
===================================================================
--- mgmt/mint/xml/MgmtTypes.xml 2007-11-13 16:47:39 UTC (rev 1298)
+++ mgmt/mint/xml/MgmtTypes.xml 2007-11-13 17:10:06 UTC (rev 1299)
@@ -19,23 +19,30 @@
under the License.
-->
-<type name="objId" base="u64" cpp="uint64_t" encode="@.putLongLong(#)" decode="# = @.getLongLong()" accessor="direct"/>
-<type name="uint8" base="u8" cpp="uint8_t" encode="@.putOctet(#)" decode="# = @.getOctet()" accessor="direct"/>
-<type name="uint16" base="u16" cpp="uint16_t" encode="@.putShort(#)" decode="# = @.getShort()" accessor="direct"/>
-<type name="uint32" base="u32" cpp="uint32_t" encode="@.putLong(#)" decode="# = @.getLong()" accessor="direct"/>
-<type name="uint64" base="u64" cpp="uint64_t" encode="@.putLongLong(#)" decode="# = @.getLongLong()" accessor="direct"/>
-<type name="bool" base="u8" cpp="bool" encode="@.putOctet(#?1:0)" decode="# = @.getOctet()==1" accessor="direct"/>
-<type name="sstr" base="sstr" cpp="std::string" encode="@.putShortString(#)" decode="@.getShortString(#)" accessor="direct"/>
-<type name="lstr" base="lstr" cpp="std::string" encode="@.putLongString(#)" decode="@.getLongString(#)" accessor="direct"/>
+<type name="objId" base="U64" cpp="uint64_t" encode="@.putLongLong(#)" decode="# = @.getLongLong()" accessor="direct"/>
+<type name="uint8" base="U8" cpp="uint8_t" encode="@.putOctet(#)" decode="# = @.getOctet()" accessor="direct"/>
+<type name="uint16" base="U16" cpp="uint16_t" encode="@.putShort(#)" decode="# = @.getShort()" accessor="direct"/>
+<type name="uint32" base="U32" cpp="uint32_t" encode="@.putLong(#)" decode="# = @.getLong()" accessor="direct"/>
+<type name="uint64" base="U64" cpp="uint64_t" encode="@.putLongLong(#)" decode="# = @.getLongLong()" accessor="direct"/>
+<type name="bool" base="U8" cpp="bool" encode="@.putOctet(#?1:0)" decode="# = @.getOctet()==1" accessor="direct"/>
+<type name="sstr" base="SSTR" cpp="std::string" encode="@.putShortString(#)" decode="@.getShortString(#)" accessor="direct"/>
+<type name="lstr" base="LSTR" cpp="std::string" encode="@.putLongString(#)" decode="@.getLongString(#)" accessor="direct"/>
-<type name="hilo8" base="u8" cpp="uint8_t" encode="@.putOctet(#)" decode="# = @.getOctet()" style="wm" accessor="counter"/>
-<type name="hilo16" base="u16" cpp="uint16_t" encode="@.putShort(#)" decode="# = @.getShort()" style="wm" accessor="counter"/>
-<type name="hilo32" base="u32" cpp="uint32_t" encode="@.putLong(#)" decode="# = @.getLong()" style="wm" accessor="counter"/>
-<type name="hilo64" base="u64" cpp="uint64_t" encode="@.putLongLong(#)" decode="# = @.getLongLong()" style="wm" accessor="counter"/>
+<type name="hilo8" base="U8" cpp="uint8_t" encode="@.putOctet(#)" decode="# = @.getOctet()" style="wm" accessor="counter"/>
+<type name="hilo16" base="U16" cpp="uint16_t" encode="@.putShort(#)" decode="# = @.getShort()" style="wm" accessor="counter"/>
+<type name="hilo32" base="U32" cpp="uint32_t" encode="@.putLong(#)" decode="# = @.getLong()" style="wm" accessor="counter"/>
+<type name="hilo64" base="U64" cpp="uint64_t" encode="@.putLongLong(#)" decode="# = @.getLongLong()" style="wm" accessor="counter"/>
-<type name="count8" base="u8" cpp="uint8_t" encode="@.putOctet(#)" decode="# = @.getOctet()" accessor="counter"/>
-<type name="count16" base="u16" cpp="uint16_t" encode="@.putShort(#)" decode="# = @.getShort()" accessor="counter"/>
-<type name="count32" base="u32" cpp="uint32_t" encode="@.putLong(#)" decode="# = @.getLong()" accessor="counter"/>
-<type name="count64" base="u64" cpp="uint64_t" encode="@.putLongLong(#)" decode="# = @.getLongLong()" accessor="counter"/>
+<type name="count8" base="U8" cpp="uint8_t" encode="@.putOctet(#)" decode="# = @.getOctet()" accessor="counter"/>
+<type name="count16" base="U16" cpp="uint16_t" encode="@.putShort(#)" decode="# = @.getShort()" accessor="counter"/>
+<type name="count32" base="U32" cpp="uint32_t" encode="@.putLong(#)" decode="# = @.getLong()" accessor="counter"/>
+<type name="count64" base="U64" cpp="uint64_t" encode="@.putLongLong(#)" decode="# = @.getLongLong()" accessor="counter"/>
+<!-- Some Proposed Syntax for User-Defined Types:
+<enum name="enumeratedType" base="U8">
+ <item name="value-name1" value="1"/>
+ <item name="value-name2" value="2"/>
+</enum>
+-->
+
</schema-types>
17 years, 1 month
rhmessaging commits: r1298 - mgmt/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2007-11-13 11:47:39 -0500 (Tue, 13 Nov 2007)
New Revision: 1298
Modified:
mgmt/cumin/python/cumin/brokercluster.py
mgmt/cumin/python/cumin/brokercluster.strings
mgmt/cumin/python/cumin/page.py
Log:
Adds cluster add and edit forms.
Modified: mgmt/cumin/python/cumin/brokercluster.py
===================================================================
--- mgmt/cumin/python/cumin/brokercluster.py 2007-11-13 16:14:26 UTC (rev 1297)
+++ mgmt/cumin/python/cumin/brokercluster.py 2007-11-13 16:47:39 UTC (rev 1298)
@@ -12,10 +12,10 @@
strings = StringCatalog(__file__)
class BrokerClusterSet(ItemSet):
- def __init__(self, app, name):
- super(BrokerClusterSet, self).__init__(app, name)
-
- self.broker_tmpl = Template(self, "broker_html")
+ def render_cluster_add_href(self, session, model):
+ branch = session.branch()
+ self.page().show_broker_cluster_add(branch)
+ return branch.marshal()
def get_title(self, session, model):
return "Broker Clusters %s" \
@@ -53,6 +53,10 @@
self.add_mode(self.view)
self.set_view_mode(self.view)
+ self.edit = BrokerClusterEdit(app, "edit")
+ self.add_mode(self.edit)
+ self.set_edit_mode(self.edit)
+
self.broker = BrokerFrame(app, "broker")
self.add_mode(self.broker)
@@ -95,3 +99,49 @@
class ClusterStatsTab(Widget):
def get_title(self, session, cluster):
return "Statistics"
+
+class BrokerClusterForm(CuminForm):
+ def __init__(self, app, name):
+ super(BrokerClusterForm, self).__init__(app, name)
+
+ self.cluster_name = TextInput(app, "name", self)
+ self.add_child(self.cluster_name)
+
+ def process_cluster(self, session, cluster):
+ cluster.lock()
+ try:
+ cluster.name = self.cluster_name.get(session)
+ finally:
+ cluster.unlock()
+
+ branch = session.branch()
+ self.page().show_broker_cluster(branch, cluster).show_view(branch)
+ self.page().set_redirect_url(session, branch.marshal())
+
+class BrokerClusterAdd(BrokerClusterForm, Frame):
+ def get_title(self, session, model):
+ return "Add Cluster"
+
+ def process_cancel(self, session, model):
+ branch = session.branch()
+ self.page().show_view(branch)
+ self.page().set_redirect_url(session, branch.marshal())
+
+ def process_submit(self, session, model):
+ cluster = BrokerCluster(model)
+ self.process_cluster(session, cluster)
+
+class BrokerClusterEdit(BrokerClusterForm, Frame):
+ def get_title(self, session, cluster):
+ return "Edit Cluster '%s'" % cluster.name
+
+ def process_cancel(self, session, cluster):
+ branch = session.branch()
+ self.parent.show_view(branch)
+ self.page().set_redirect_url(session, branch.marshal())
+
+ def process_submit(self, session, cluster):
+ self.process_cluster(session, cluster)
+
+ def process_display(self, session, cluster):
+ self.cluster_name.set(session, cluster.name)
Modified: mgmt/cumin/python/cumin/brokercluster.strings
===================================================================
--- mgmt/cumin/python/cumin/brokercluster.strings 2007-11-13 16:14:26 UTC (rev 1297)
+++ mgmt/cumin/python/cumin/brokercluster.strings 2007-11-13 16:47:39 UTC (rev 1298)
@@ -14,7 +14,7 @@
[BrokerClusterSet.html]
<ul class="actions">
- <li><a class="nav" href="{href}">Add Broker Cluster</a></li>
+ <li><a class="nav" href="{cluster_add_href}">Add Broker Cluster</a></li>
</ul>
<table class="mobjects">
@@ -84,3 +84,28 @@
<td>10 queues, 5 exchanges</td>
<td><a class="action" href="">Remove</a></td>
</tr>
+
+[BrokerClusterForm.html]
+<form id="{id}" class="mform" method="post" action="?">
+ <div class="head">
+ <h1>{title}</h1>
+ </div>
+ <div class="body">
+ <span class="legend">Name</span>
+ <fieldset>{name}</fieldset>
+
+ {hidden_inputs}
+ </div>
+ <div class="foot">
+ <a class="help action" href="{href}" target="help">Help</a>
+ {cancel}
+ {submit}
+ </div>
+</form>
+<script defer="defer">
+(function() {
+ var elem = wooly.doc().elembyid("{id}").node.elements[1];
+ elem.focus();
+ elem.select();
+}())
+</script>
Modified: mgmt/cumin/python/cumin/page.py
===================================================================
--- mgmt/cumin/python/cumin/page.py 2007-11-13 16:14:26 UTC (rev 1297)
+++ mgmt/cumin/python/cumin/page.py 2007-11-13 16:47:39 UTC (rev 1298)
@@ -50,6 +50,9 @@
self.cluster = BrokerClusterFrame(app, "cluster")
self.add_mode(self.cluster)
+ self.cluster_add = BrokerClusterAdd(app, "clusteradd")
+ self.add_mode(self.cluster_add)
+
def save_session(self, session):
if self.app.debug:
self.app.debug.sessions.append(session)
@@ -110,6 +113,10 @@
frame.set_object(session, cluster)
return self.set_current_frame(session, frame)
+ def show_broker_cluster_add(self, session):
+ frame = self.show_mode(session, self.cluster_add)
+ return self.set_current_frame(session, frame)
+
def show_queue(self, session, queue):
broker = queue.get_virtual_host().get_broker()
frame = self.show_broker(session, broker)
17 years, 1 month