You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by tr...@apache.org on 2009/02/02 16:58:16 UTC

svn commit: r740017 - /qpid/trunk/qpid/python/qmf/console.py

Author: tross
Date: Mon Feb  2 15:58:16 2009
New Revision: 740017

URL: http://svn.apache.org/viewvc?rev=740017&view=rev
Log:
Added Object.isDeleted(), Object.update()
Fixed a bug in Object.merge()
Added additional pydoc text

Modified:
    qpid/trunk/qpid/python/qmf/console.py

Modified: qpid/trunk/qpid/python/qmf/console.py
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/python/qmf/console.py?rev=740017&r1=740016&r2=740017&view=diff
==============================================================================
--- qpid/trunk/qpid/python/qmf/console.py (original)
+++ qpid/trunk/qpid/python/qmf/console.py Mon Feb  2 15:58:16 2009
@@ -968,9 +968,10 @@
     return (self.first, self.second).__eq__(other)
 
 class Object(object):
-  """ """
+  """ This class defines a 'proxy' object representing a real managed object on an agent.
+      Actions taken on this proxy are remotely affected on the real managed object.
+  """
   def __init__(self, session, broker, schema, codec, prop, stat):
-    """ """
     self._session = session
     self._broker  = broker
     self._schema  = schema
@@ -1015,6 +1016,10 @@
     """ Return the current, creation, and deletion times for this object. """
     return self._currentTime, self._createTime, self._deleteTime
 
+  def isDeleted(self):
+    """ Return True iff this object has been deleted. """
+    return self._deleteTime != 0
+
   def getIndex(self):
     """ Return a string describing this object's primary key. """
     result = u""
@@ -1030,9 +1035,11 @@
     return result
 
   def getProperties(self):
+    """ Return a list of object properties """
     return self._properties
 
   def getStatistics(self):
+    """ Return a list of object statistics """
     return self._statistics
 
   def mergeUpdate(self, newer):
@@ -1040,9 +1047,17 @@
     if self._objectId != newer._objectId:
       raise Exception("Objects with different object-ids")
     if len(newer.getProperties()) > 0:
-      self.properties = newer.getProperties()
+      self._properties = newer.getProperties()
     if len(newer.getStatistics()) > 0:
-      self.statistics = newer.getStatistics()
+      self._statistics = newer.getStatistics()
+
+  def update(self):
+    """ Contact the agent and retrieve the lastest property and statistic values for this object. """
+    obj = self._session.getObjects(_objectId = self._objectId, _broker=self._broker)
+    if obj:
+      self.mergeUpdate(obj[0])
+    else:
+      raise Exception("Underlying object no longer exists")
 
   def __repr__(self):
     key = self.getClassKey()



---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:commits-subscribe@qpid.apache.org