Return-Path: Delivered-To: apmail-incubator-qpid-commits-archive@locus.apache.org Received: (qmail 22638 invoked from network); 5 Aug 2008 15:46:45 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 5 Aug 2008 15:46:45 -0000 Received: (qmail 61448 invoked by uid 500); 5 Aug 2008 15:46:44 -0000 Delivered-To: apmail-incubator-qpid-commits-archive@incubator.apache.org Received: (qmail 61434 invoked by uid 500); 5 Aug 2008 15:46:44 -0000 Mailing-List: contact qpid-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: qpid-dev@incubator.apache.org Delivered-To: mailing list qpid-commits@incubator.apache.org Received: (qmail 61425 invoked by uid 99); 5 Aug 2008 15:46:44 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 05 Aug 2008 08:46:44 -0700 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 05 Aug 2008 15:45:57 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 42DEA2388A01; Tue, 5 Aug 2008 08:45:54 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r682764 - in /incubator/qpid/trunk/qpid/python: commands/qpid-tool qpid/managementdata.py Date: Tue, 05 Aug 2008 15:45:53 -0000 To: qpid-commits@incubator.apache.org From: tross@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20080805154554.42DEA2388A01@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: tross Date: Tue Aug 5 08:45:53 2008 New Revision: 682764 URL: http://svn.apache.org/viewvc?rev=682764&view=rev Log: Restructured qpid-tool commands to allow active-only lists Modified: incubator/qpid/trunk/qpid/python/commands/qpid-tool incubator/qpid/trunk/qpid/python/qpid/managementdata.py Modified: incubator/qpid/trunk/qpid/python/commands/qpid-tool URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/python/commands/qpid-tool?rev=682764&r1=682763&r2=682764&view=diff ============================================================================== --- incubator/qpid/trunk/qpid/python/commands/qpid-tool (original) +++ incubator/qpid/trunk/qpid/python/commands/qpid-tool Tue Aug 5 08:45:53 2008 @@ -55,10 +55,11 @@ print "Commands:" print " list - Print summary of existing objects by class" print " list - Print list of objects of the specified class" - print " list all - Print contents of all objects of specified class" - print " list active - Print contents of all non-deleted objects of specified class" - print " list - Print contents of one or more objects (infer className)" - print " list - Print contents of one or more objects" + print " list active - Print list of non-deleted objects of the specified class" + print " show - Print contents of all objects of specified class" + print " show active - Print contents of all non-deleted objects of specified class" + print " show - Print contents of one or more objects (infer className)" + print " show - Print contents of one or more objects" print " list is space-separated, ranges may be specified (i.e. 1004-1010)" print " call [] - Invoke a method on an object" print " schema - Print summary of object classes seen on the target" @@ -115,6 +116,9 @@ def do_list (self, data): self.dataObject.do_list (data) + def do_show (self, data): + self.dataObject.do_show (data) + def do_call (self, data): try: self.dataObject.do_call (data) Modified: incubator/qpid/trunk/qpid/python/qpid/managementdata.py URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/python/qpid/managementdata.py?rev=682764&r1=682763&r2=682764&view=diff ============================================================================== --- incubator/qpid/trunk/qpid/python/qpid/managementdata.py (original) +++ incubator/qpid/trunk/qpid/python/qpid/managementdata.py Tue Aug 5 08:45:53 2008 @@ -367,7 +367,7 @@ def listOfIds (self, classKey, tokens): """ Generate a tuple of object ids for a classname based on command tokens. """ list = [] - if tokens[0] == "all": + if len(tokens) == 0 or tokens[0] == "all": for id in self.tables[classKey]: list.append (self.displayObjId (id)) @@ -385,7 +385,7 @@ if self.getClassForId (self.rawObjId (long (id))) == classKey: list.append (id) else: - list.append (token) + list.append (int(token)) list.sort () result = () @@ -421,26 +421,29 @@ finally: self.lock.release () - def listObjects (self, className): + def listObjects (self, tokens): """ Generate a display of a list of objects in a class """ + if len(tokens) == 0: + print "Error - No class name provided" + return + self.lock.acquire () try: - classKey = self.getClassKey (className) + classKey = self.getClassKey (tokens[0]) if classKey == None: - print ("Object type %s not known" % className) + print ("Object type %s not known" % tokens[0]) else: rows = [] if classKey in self.tables: - sorted = self.tables[classKey].keys () - sorted.sort () - for objId in sorted: - (ts, config, inst) = self.tables[classKey][objId] + ids = self.listOfIds(classKey, tokens[1:]) + for objId in ids: + (ts, config, inst) = self.tables[classKey][self.rawObjId(objId)] createTime = self.disp.timestamp (ts[1]) destroyTime = "-" if ts[2] > 0: destroyTime = self.disp.timestamp (ts[2]) objIndex = self.getObjIndex (classKey, config) - row = (self.refName (objId), createTime, destroyTime, objIndex) + row = (objId, createTime, destroyTime, objIndex) rows.append (row) self.disp.table ("Objects of type %s.%s" % (classKey[0], classKey[1]), ("ID", "Created", "Destroyed", "Index"), @@ -687,10 +690,12 @@ tokens = data.split () if len (tokens) == 0: self.listClasses () - elif len (tokens) == 1 and not self.isOid (tokens[0]): - self.listObjects (data) else: - self.showObjects (tokens) + self.listObjects (tokens) + + def do_show (self, data): + tokens = data.split () + self.showObjects (tokens) def do_schema (self, data): if data == "":