|
@@ -78,6 +78,8 @@ class DoInterestManager(DirectObject.DirectObject):
|
|
|
def __init__(self):
|
|
def __init__(self):
|
|
|
assert DoInterestManager.notify.debugCall()
|
|
assert DoInterestManager.notify.debugCall()
|
|
|
DirectObject.DirectObject.__init__(self)
|
|
DirectObject.DirectObject.__init__(self)
|
|
|
|
|
+ self._addInterestEvent = uniqueName('DoInterestManager-Add')
|
|
|
|
|
+ self._removeInterestEvent = uniqueName('DoInterestManager-Remove')
|
|
|
|
|
|
|
|
def addInterest(self, parentId, zoneIdList, description, event=None):
|
|
def addInterest(self, parentId, zoneIdList, description, event=None):
|
|
|
"""
|
|
"""
|
|
@@ -92,6 +94,8 @@ class DoInterestManager(DirectObject.DirectObject):
|
|
|
print 'INTEREST DEBUG: addInterest(): handle=%s, parent=%s, zoneIds=%s, description=%s, event=%s' % (
|
|
print 'INTEREST DEBUG: addInterest(): handle=%s, parent=%s, zoneIds=%s, description=%s, event=%s' % (
|
|
|
handle, parentId, zoneIdList, description, event)
|
|
handle, parentId, zoneIdList, description, event)
|
|
|
self._sendAddInterest(handle, scopeId, parentId, zoneIdList, description)
|
|
self._sendAddInterest(handle, scopeId, parentId, zoneIdList, description)
|
|
|
|
|
+ if event:
|
|
|
|
|
+ messenger.send(self._getAddInterestEvent(), [event])
|
|
|
assert self.printInterestsIfDebug()
|
|
assert self.printInterestsIfDebug()
|
|
|
return handle
|
|
return handle
|
|
|
|
|
|
|
@@ -115,6 +119,9 @@ class DoInterestManager(DirectObject.DirectObject):
|
|
|
if DoInterestManager._interests.has_key(handle):
|
|
if DoInterestManager._interests.has_key(handle):
|
|
|
existed = True
|
|
existed = True
|
|
|
intState = DoInterestManager._interests[handle]
|
|
intState = DoInterestManager._interests[handle]
|
|
|
|
|
+ if event:
|
|
|
|
|
+ messenger.send(self._getRemoveInterestEvent(),
|
|
|
|
|
+ [event, intState.parentId, intState.zoneIdList])
|
|
|
if intState.isPendingDelete():
|
|
if intState.isPendingDelete():
|
|
|
self.notify.warning(
|
|
self.notify.warning(
|
|
|
'removeInterest: interest %s already pending removal' %
|
|
'removeInterest: interest %s already pending removal' %
|
|
@@ -184,6 +191,12 @@ class DoInterestManager(DirectObject.DirectObject):
|
|
|
"alterInterest: handle not found: %s" % (handle))
|
|
"alterInterest: handle not found: %s" % (handle))
|
|
|
return exists
|
|
return exists
|
|
|
|
|
|
|
|
|
|
+ # events for InterestWatcher
|
|
|
|
|
+ def _getAddInterestEvent(self):
|
|
|
|
|
+ return self._addInterestEvent
|
|
|
|
|
+ def _getRemoveInterestEvent(self):
|
|
|
|
|
+ return self._removeInterestEvent
|
|
|
|
|
+
|
|
|
def _getInterestState(self, handle):
|
|
def _getInterestState(self, handle):
|
|
|
return DoInterestManager._interests[handle]
|
|
return DoInterestManager._interests[handle]
|
|
|
|
|
|