Package ZenHub :: Module HubService
[hide private]
[frames] | no frames]

Source Code for Module ZenHub.HubService

 1  ########################################################################### 
 2  # 
 3  # This program is part of Zenoss Core, an open source monitoring platform. 
 4  # Copyright (C) 2007, Zenoss Inc. 
 5  # 
 6  # This program is free software; you can redistribute it and/or modify it 
 7  # under the terms of the GNU General Public License version 2 as published by 
 8  # the Free Software Foundation. 
 9  # 
10  # For complete information please visit: http://www.zenoss.com/oss/ 
11  # 
12  ########################################################################### 
13  from twisted.spread import pb 
14   
15  import logging 
16  hubLog = logging.getLogger("zenhub") 
17   
18   
19 -class HubService(pb.Referenceable):
20 21 log = hubLog 22
23 - def __init__(self, dmd, instance):
24 self.dmd = dmd 25 self.zem = dmd.ZenEventManager 26 self.instance = instance 27 self.listeners = []
28
29 - def update(self, object):
30 pass
31
32 - def deleted(self, object):
33 pass
34
35 - def addListener(self, remote):
36 remote.notifyOnDisconnect(self.removeListener) 37 self.log.info("adding listener") 38 self.listeners.append(remote)
39
40 - def removeListener(self, listener):
41 self.log.warning("removing listener") 42 try: 43 self.listeners.remove(listener) 44 except ValueError: 45 self.warning("Unable to remove listener... ignoring")
46