in qpid/managementdata.py [0:0]
def showObjects (self, tokens):
""" Generate a display of object data for a particular class """
self.lock.acquire ()
try:
self.lastUnit = None
if self.isOid (tokens[0]):
if tokens[0].find ("-") != -1:
rootId = int (tokens[0][0:tokens[0].find ("-")])
else:
rootId = int (tokens[0])
classKey = self.getClassForId (self.rawObjId (rootId))
remaining = tokens
if classKey == None:
print("Id not known: %d" % int (tokens[0]))
raise ValueError ()
else:
classKey = self.getClassKey (tokens[0])
remaining = tokens[1:]
if classKey not in self.tables:
print("Class not known: %s" % tokens[0])
raise ValueError ()
userIds = self.listOfIds (classKey, remaining)
if len (userIds) == 0:
print("No object IDs supplied")
raise ValueError ()
ids = []
for id in userIds:
if self.getClassForId (self.rawObjId (long (id))) == classKey:
ids.append (self.rawObjId (long (id)))
rows = []
timestamp = None
config = self.tables[classKey][ids[0].index()][1]
for eIdx in range (len (config)):
key = config[eIdx][0]
if key != "id":
row = ("property", key)
for id in ids:
if timestamp == None or \
timestamp < self.tables[classKey][id.index()][0][0]:
timestamp = self.tables[classKey][id.index()][0][0]
(key, value) = self.tables[classKey][id.index()][1][eIdx]
row = row + (self.valueDisplay (classKey, key, value),)
rows.append (row)
inst = self.tables[classKey][ids[0].index()][2]
for eIdx in range (len (inst)):
key = inst[eIdx][0]
if key != "id":
row = ("statistic", key)
for id in ids:
(key, value) = self.tables[classKey][id.index()][2][eIdx]
row = row + (self.valueDisplay (classKey, key, value),)
rows.append (row)
titleRow = ("Type", "Element")
for id in ids:
titleRow = titleRow + (self.refName(id),)
caption = "Object of type %s:" % self.displayClassName(classKey)
if timestamp != None:
caption = caption + " (last sample time: " + self.disp.timestamp (timestamp) + ")"
self.disp.table (caption, titleRow, rows)
except:
pass
self.lock.release ()