self.notify -> Class.notify

This commit is contained in:
Darren Ranalli 2005-08-04 00:38:13 +00:00
parent 5a1d6ed111
commit 4b5be27da3
2 changed files with 24 additions and 23 deletions

View File

@ -408,7 +408,7 @@ class ConnectionRepository(
pass pass
def send(self, datagram): def send(self, datagram):
if self.notify.getDebug(): if ConnectionRepository.notify.getDebug():
print "ConnectionRepository sending datagram:" print "ConnectionRepository sending datagram:"
datagram.dumpHex(ostream) datagram.dumpHex(ostream)

View File

@ -29,14 +29,14 @@ class DoInterestManager(DirectObject.DirectObject):
_debug_currentInterests = [] _debug_currentInterests = []
def __init__(self): def __init__(self):
assert self.notify.debugCall() assert DoInterestManager.notify.debugCall()
DirectObject.DirectObject.__init__(self) DirectObject.DirectObject.__init__(self)
def addInterest(self, parentId, zoneIdList, description, event=None): def addInterest(self, parentId, zoneIdList, description, event=None):
""" """
Look into a zone. Look into a zone.
""" """
assert self.notify.debugCall() assert DoInterestManager.notify.debugCall()
DoInterestManager._interestIdAssign += 1 DoInterestManager._interestIdAssign += 1
contextId = DoInterestManager._interestIdAssign contextId = DoInterestManager._interestIdAssign
scopeId = 0 scopeId = 0
@ -53,7 +53,7 @@ class DoInterestManager(DirectObject.DirectObject):
""" """
Stop looking in a zone Stop looking in a zone
""" """
assert self.notify.debugCall() assert DoInterestManager.notify.debugCall()
answer = 0 answer = 0
if DoInterestManager._interests.has_key(contextId): if DoInterestManager._interests.has_key(contextId):
if event is not None: if event is not None:
@ -69,7 +69,7 @@ class DoInterestManager(DirectObject.DirectObject):
del DoInterestManager._interests[contextId] del DoInterestManager._interests[contextId]
answer = 1 answer = 1
else: else:
self.notify.warning("removeInterest: contextId not found: %s" % (contextId)) DoInterestManager.notify.warning("removeInterest: contextId not found: %s" % (contextId))
assert self.printInterestsIfDebug() assert self.printInterestsIfDebug()
return answer return answer
@ -77,7 +77,7 @@ class DoInterestManager(DirectObject.DirectObject):
""" """
Removes old interests and adds new interests. Removes old interests and adds new interests.
""" """
assert self.notify.debugCall() assert DoInterestManager.notify.debugCall()
answer = 0 answer = 0
if DoInterestManager._interests.has_key(contextId): if DoInterestManager._interests.has_key(contextId):
if description is not None: if description is not None:
@ -94,7 +94,7 @@ class DoInterestManager(DirectObject.DirectObject):
answer = 1 answer = 1
assert self.printInterestsIfDebug() assert self.printInterestsIfDebug()
else: else:
self.notify.warning("alterInterest: contextId not found: %s" % (contextId)) DoInterestManager.notify.warning("alterInterest: contextId not found: %s" % (contextId))
return answer return answer
@ -103,12 +103,12 @@ class DoInterestManager(DirectObject.DirectObject):
Part of the new otp-server code. Part of the new otp-server code.
Return a ScopeId Id for an Interest Return a ScopeId Id for an Interest
""" """
assert self.notify.debugCall() assert DoInterestManager.notify.debugCall()
answer = 0 answer = 0
if DoInterestManager._interests.has_key(contextId): if DoInterestManager._interests.has_key(contextId):
answer = DoInterestManager._interests[contextId][1] answer = DoInterestManager._interests[contextId][1]
else: else:
self.notify.warning("GetInterestScopeID: contextId not found: %s" % (contextId)) DoInterestManager.notify.warning("GetInterestScopeID: contextId not found: %s" % (contextId))
return answer return answer
@ -116,35 +116,36 @@ class DoInterestManager(DirectObject.DirectObject):
""" """
returns an event for an interest. returns an event for an interest.
""" """
assert self.notify.debugCall() assert DoInterestManager.notify.debugCall()
answer = None answer = None
if DoInterestManager._interests.has_key(contextId): if DoInterestManager._interests.has_key(contextId):
answer = DoInterestManager._interests[contextId][2] answer = DoInterestManager._interests[contextId][2]
else: else:
self.notify.warning("GetInterestScopeEvent: contextId not found: %s" % (contextId)) DoInterestManager.notify.warning("GetInterestScopeEvent: contextId not found: %s" % (contextId))
return answer return answer
def _ponderRemoveFlaggedInterest(self, handle): def _ponderRemoveFlaggedInterest(self, handle):
""" """
Consider whether we should cull the interest set. Consider whether we should cull the interest set.
""" """
assert self.notify.debugCall() assert DoInterestManager.notify.debugCall()
if DoInterestManager._interests.has_key(handle): if DoInterestManager._interests.has_key(handle):
if DoInterestManager._interests[handle][3] == "PendingDel": if DoInterestManager._interests[handle][3] == "PendingDel":
del DoInterestManager._interests[handle] del DoInterestManager._interests[handle]
if __debug__: if __debug__:
def printInterestsIfDebug(self): def printInterestsIfDebug(self):
if self.notify.getDebug(): if DoInterestManager.notify.getDebug():
self.printInterests() self.printInterests()
return 1 # for assert() return 1 # for assert()
def printInterests(self): def printInterests(self):
print "*********************** Interest Sets **************" print "*********************** Interest Sets **************"
print "(Interest ID, Description, Scope, Event, Mode)" print "(Description, Scope, Event, Mode)"
for i in DoInterestManager._interests.values(): for i in DoInterestManager._interests.values():
print i print i
print "****************************************************" print "****************************************************"
print "(ContextId, ScopeId, ParentId, ZoneIdList)"
for i in DoInterestManager._debug_currentInterests: for i in DoInterestManager._debug_currentInterests:
print i print i
print "****************************************************" print "****************************************************"
@ -158,7 +159,7 @@ class DoInterestManager(DirectObject.DirectObject):
necessarily have any relationship to the same contextId necessarily have any relationship to the same contextId
on another client. on another client.
""" """
assert self.notify.debugCall() assert DoInterestManager.notify.debugCall()
if __debug__: if __debug__:
DoInterestManager._debug_currentInterests.append( DoInterestManager._debug_currentInterests.append(
(contextId, scopeId, parentId, zoneIdList)) (contextId, scopeId, parentId, zoneIdList))
@ -185,7 +186,7 @@ class DoInterestManager(DirectObject.DirectObject):
necessarily have any relationship to the same contextId necessarily have any relationship to the same contextId
on another client. on another client.
""" """
assert self.notify.debugCall() assert DoInterestManager.notify.debugCall()
datagram = PyDatagram() datagram = PyDatagram()
# Add message type # Add message type
datagram.addUint16(CLIENT_REMOVE_INTEREST) datagram.addUint16(CLIENT_REMOVE_INTEREST)
@ -199,26 +200,26 @@ class DoInterestManager(DirectObject.DirectObject):
This handles the interest done messages and may dispatch a This handles the interest done messages and may dispatch a
action based on the ID, Context action based on the ID, Context
""" """
assert self.notify.debugCall() assert DoInterestManager.notify.debugCall()
id = di.getUint16() id = di.getUint16()
scope = di.getUint32() scope = di.getUint32()
expect_scope = self.getInterestScopeId(id) expect_scope = self.getInterestScopeId(id)
self.notify.debug( DoInterestManager.notify.debug(
"handleInterestDoneMessage--> Received ID:%s Scope:%s"%(id,scope)) "handleInterestDoneMessage--> Received ID:%s Scope:%s"%(id,scope))
if expect_scope == scope: if expect_scope == scope:
self.notify.debug( DoInterestManager.notify.debug(
"handleInterestDoneMessage--> Scope Match:%s Scope:%s" "handleInterestDoneMessage--> Scope Match:%s Scope:%s"
%(id,scope)) %(id,scope))
event = self.getInterestScopeEvent(id) event = self.getInterestScopeEvent(id)
if event is not None: if event is not None:
self.notify.debug( DoInterestManager.notify.debug(
"handleInterestDoneMessage--> Send Event : %s"%(event)) "handleInterestDoneMessage--> Send Event : %s"%(event))
messenger.send(event) messenger.send(event)
else: else:
self.notify.debug("handleInterestDoneMessage--> No Event ") DoInterestManager.notify.debug("handleInterestDoneMessage--> No Event ")
self._ponderRemoveFlaggedInterest(id) self._ponderRemoveFlaggedInterest(id)
else: else:
self.notify.debug( DoInterestManager.notify.debug(
"handleInterestDoneMessage--> Scope MisMatch :%s :%s" "handleInterestDoneMessage--> Scope MisMatch :%s :%s"
%(expect_scope,scope)) %(expect_scope,scope))