Author: eallen
Date: 2008-11-05 10:05:44 -0500 (Wed, 05 Nov 2008)
New Revision: 2740
Modified:
mgmt/trunk/cumin/python/cumin/model.py
Log:
If property is a dict(), use the new fmt_dict method to display it.
Move add queue static strings out of method and make them class variables.
Modified: mgmt/trunk/cumin/python/cumin/model.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/model.py 2008-11-05 15:03:33 UTC (rev 2739)
+++ mgmt/trunk/cumin/python/cumin/model.py 2008-11-05 15:05:44 UTC (rev 2740)
@@ -163,6 +163,7 @@
self.category = "general"
self.summary = False
self.escape = True
+ self.prefix = None
self.cumin_class.add_property(self)
@@ -181,6 +182,9 @@
if isinstance(value, datetime):
value = fmt_datetime(value)
+ if isinstance(value, dict):
+ value = fmt_dict(value, self.prefix)
+
return value
class CuminAction(object):
@@ -787,6 +791,15 @@
authMechanism, username, password)
class AddQueue(CuminAction):
+ FILECOUNT = "qpid.file_count"
+ FILESIZE = "qpid.file_size"
+ MAX_QUEUE_SIZE = "qpid.max_size"
+ MAX_QUEUE_COUNT = "qpid.max_count"
+ POLICY_TYPE = "qpid.policy_type"
+ CLUSTER_DURABLE = "qpid.persist_last_node"
+ LVQ = "qpid.last_value_queue"
+ OPTIMISTIC_CONSUME = "qpid.optimistic_consume"
+
def get_title(self, session):
return "Add Queue"
@@ -798,33 +811,28 @@
return frame.queue_add.show(session)
def do_invoke(self, queue, args, completion):
- FILECOUNT = "qpid.file_count"
- FILESIZE = "qpid.file_size"
- MAX_QUEUE_SIZE = "qpid.max_size"
- MAX_QUEUE_COUNT = "qpid.max_count"
- POLICY_TYPE = "qpid.policy_type"
- CLUSTER_DURABLE = "qpid.persist_last_node"
- LVQ = "qpid.last_value_queue"
- OPTIMISTIC_CONSUME = "qpid.optimistic_consume"
reg = args["reg"]
declArgs = {}
if queue.durable:
- declArgs[FILECOUNT] = args["file_count"]
- declArgs[FILESIZE] = args["file_size"]
+ if args["file_count"]:
+ declArgs[self.FILECOUNT] = args["file_count"]
+ if args["file_size"]:
+ declArgs[self.FILESIZE] = args["file_size"]
- if args["q_size"]:
- declArgs[MAX_QUEUE_SIZE] = args["q_size"]
- if args["q_count"]:
- declArgs[MAX_QUEUE_COUNT] = args["q_count"]
if args["policy"]:
- declArgs[POLICY_TYPE] = args["policy"]
+ declArgs[self.POLICY_TYPE] = args["policy"]
+ if args["q_size"]:
+ declArgs[self.MAX_QUEUE_SIZE] = args["q_size"]
+ if args["q_count"]:
+ declArgs[self.MAX_QUEUE_COUNT] = args["q_count"]
+
if args["cluster_durable"]:
- declArgs[CLUSTER_DURABLE] = 1
+ declArgs[self.CLUSTER_DURABLE] = 1
if args["lvq"]:
- declArgs[LVQ] = 1
+ declArgs[self.LVQ] = 1
if args["optimistic"]:
- declArgs[OPTIMISTIC_CONSUME] = 1
+ declArgs[self.OPTIMISTIC_CONSUME] = 1
session = self.getSessionFromRegistration(reg)
session.queue_declare(queue=queue.name,
@@ -867,6 +875,11 @@
prop.title = "Exclusive?"
prop.summary = True
+ prop = CuminProperty(self, "arguments")
+ prop.title = "Arguments"
+ prop.prefix = "qpid."
+ prop.escape = False
+
stat = CuminStat(self, "consumerCount")
stat.title = "Consumers"
stat.unit = "consumer"