summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGordon Sim <gsim@apache.org>2011-03-01 16:32:46 +0000
committerGordon Sim <gsim@apache.org>2011-03-01 16:32:46 +0000
commit255fd6d72c6586890b4c02d80c83c68da66b3bfe (patch)
treed08ddebb15e564aeece55dfcaf8db7e803bcaad4
parent0c5ab93477b4009767fd33b3d2df9455f98eef2f (diff)
downloadqpid-python-255fd6d72c6586890b4c02d80c83c68da66b3bfe.tar.gz
QPID-3091: add generic mechanism for adding and listing queue arguments
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1075889 13f79535-47bb-0310-9956-ffa450edef68
-rwxr-xr-xqpid/tools/src/py/qpid-config18
1 files changed, 17 insertions, 1 deletions
diff --git a/qpid/tools/src/py/qpid-config b/qpid/tools/src/py/qpid-config
index b02bd2c1e1..5ddf4f4358 100755
--- a/qpid/tools/src/py/qpid-config
+++ b/qpid/tools/src/py/qpid-config
@@ -101,6 +101,7 @@ class Config:
self._flowResumeCount = None
self._flowStopSize = None
self._flowResumeSize = None
+ self._extra_arguments = []
config = Config()
@@ -119,6 +120,13 @@ FLOW_STOP_COUNT = "qpid.flow_stop_count"
FLOW_RESUME_COUNT = "qpid.flow_resume_count"
FLOW_STOP_SIZE = "qpid.flow_stop_size"
FLOW_RESUME_SIZE = "qpid.flow_resume_size"
+#There are various arguments to declare that have specific program
+#options in this utility. However there is now a generic mechanism for
+#passing arguments as well. The SPECIAL_ARGS list contains the
+#arguments for which there are specific program options defined
+#i.e. the arguments for which there is special processing on add and
+#list
+SPECIAL_ARGS=[FILECOUNT,FILESIZE,MAX_QUEUE_SIZE,MAX_QUEUE_COUNT,POLICY_TYPE,CLUSTER_DURABLE,LVQ,LVQNB,MSG_SEQUENCE,IVE,QUEUE_EVENT_GENERATION,FLOW_STOP_COUNT,FLOW_STOP_SIZE,FLOW_RESUME_SIZE]
class JHelpFormatter(IndentedHelpFormatter):
"""Format usage and description without stripping newlines from usage strings
@@ -178,6 +186,8 @@ def OptionsAndArguments(argv):
help="Turn on sender flow control when the number of queued messages exceeds this value.")
group3.add_option("--flow-resume-count", action="store", type="int", metavar="<n>",
help="Turn off sender flow control when the number of queued messages drops below this value.")
+ group3.add_option("--argument", dest="extra_arguments", action="append", default=[],
+ metavar="<NAME=VALUE>", help="Specify a key-value pair to add to queue arguments")
# no option for declaring an exclusive queue - which can only be used by the session that creates it.
parser.add_option_group(group3)
@@ -257,6 +267,8 @@ def OptionsAndArguments(argv):
config._flowStopCount = opts.flow_stop_count
if opts.flow_resume_count:
config._flowResumeCount = opts.flow_resume_count
+ if opts.extra_arguments:
+ config._extra_arguments = opts.extra_arguments
return args
@@ -419,7 +431,7 @@ class BrokerManager:
if FLOW_RESUME_SIZE in args: print "--flow-resume-size=%s" % args[FLOW_RESUME_SIZE],
if FLOW_STOP_COUNT in args: print "--flow-stop-count=%s" % args[FLOW_STOP_COUNT],
if FLOW_RESUME_COUNT in args: print "--flow-resume-count=%s" % args[FLOW_RESUME_COUNT],
- print
+ print " ".join(["--argument %s=%s" % (k, v) for k,v in args.iteritems() if not k in SPECIAL_ARGS])
def QueueListRecurse(self, filter):
exchanges = self.qmf.getObjects(_class="exchange", _agent=self.brokerAgent)
@@ -464,6 +476,10 @@ class BrokerManager:
Usage()
qname = args[0]
declArgs = {}
+ for a in config._extra_arguments:
+ r = a.split("=", 1)
+ declArgs[r[0]] = r[1] if len(r) == 2 else None
+
if config._durable:
declArgs[FILECOUNT] = config._fileCount
declArgs[FILESIZE] = config._fileSize