annotate idavoll/backend.py @ 35:c51bca11699b

Remove erroneous second invocation of NotificationService and matching component.IService adapter.
author Ralph Meijer <ralphm@ik.nu>
date Sun, 31 Oct 2004 15:57:23 +0000
parents b65b7ea5c992
children 788114f9b5bc
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
24
4f3bbefc6fad Moved memory backend to its own file.
Ralph Meijer <ralphm@ik.nu>
parents: 23
diff changeset
1 from twisted.python import components
29
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
2 from twisted.application import service
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
3 from twisted.xish import utility
2
9701df89c534 First take at notifications
Ralph Meijer <ralphm@ik.nu>
parents: 1
diff changeset
4
24
4f3bbefc6fad Moved memory backend to its own file.
Ralph Meijer <ralphm@ik.nu>
parents: 23
diff changeset
5 class Error(Exception):
29
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
6 msg = ''
1
4cc41776b7d7 Initial revision
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
7
29
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
8 def __str__(self):
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
9 return self.msg
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
10
24
4f3bbefc6fad Moved memory backend to its own file.
Ralph Meijer <ralphm@ik.nu>
parents: 23
diff changeset
11 class NodeNotFound(Error):
29
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
12 msg = 'Node not found'
1
4cc41776b7d7 Initial revision
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
13
24
4f3bbefc6fad Moved memory backend to its own file.
Ralph Meijer <ralphm@ik.nu>
parents: 23
diff changeset
14 class NotAuthorized(Error):
29
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
15 pass
20
eddea65d1032 Added two exceptions: NoInstantNodes and NodeExists.
Ralph Meijer <ralphm@ik.nu>
parents: 18
diff changeset
16
24
4f3bbefc6fad Moved memory backend to its own file.
Ralph Meijer <ralphm@ik.nu>
parents: 23
diff changeset
17 class PayloadExpected(Error):
29
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
18 msg = 'Payload expected'
15
46cd13c68ac0 Redone memory storage of nodes.
Ralph Meijer <ralphm@ik.nu>
parents: 5
diff changeset
19
24
4f3bbefc6fad Moved memory backend to its own file.
Ralph Meijer <ralphm@ik.nu>
parents: 23
diff changeset
20 class NoPayloadAllowed(Error):
29
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
21 msg = 'No payload allowed'
2
9701df89c534 First take at notifications
Ralph Meijer <ralphm@ik.nu>
parents: 1
diff changeset
22
24
4f3bbefc6fad Moved memory backend to its own file.
Ralph Meijer <ralphm@ik.nu>
parents: 23
diff changeset
23 class NoInstantNodes(Error):
29
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
24 pass
23
884268687229 Simplify call chain by mapping incoming requests directly to method
Ralph Meijer <ralphm@ik.nu>
parents: 20
diff changeset
25
24
4f3bbefc6fad Moved memory backend to its own file.
Ralph Meijer <ralphm@ik.nu>
parents: 23
diff changeset
26 class NodeExists(Error):
29
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
27 pass
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
28
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
29 class NotImplemented(Error):
34
b65b7ea5c992 Remove nonsense message.
Ralph Meijer <ralphm@ik.nu>
parents: 29
diff changeset
30 pass
b65b7ea5c992 Remove nonsense message.
Ralph Meijer <ralphm@ik.nu>
parents: 29
diff changeset
31
b65b7ea5c992 Remove nonsense message.
Ralph Meijer <ralphm@ik.nu>
parents: 29
diff changeset
32 class NotSubscribed(Error):
b65b7ea5c992 Remove nonsense message.
Ralph Meijer <ralphm@ik.nu>
parents: 29
diff changeset
33 pass
29
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
34
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
35 class IBackendService(components.Interface):
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
36 """ Interface to a backend service of a pubsub service. """
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
37
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
38 def get_supported_affiliations(self):
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
39 """ Reports the list of supported affiliation types.
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
40
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
41 @return: a list of supported affiliation types.
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
42 """
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
43
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
44 class INodeCreationService(components.Interface):
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
45 """ A service for creating nodes """
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
46
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
47 def create_node(self, node_id, requestor):
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
48 """ Create a node.
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
49
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
50 @return: a deferred that fires when the node has been created.
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
51 """
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
52
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
53 class IPublishService(components.Interface):
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
54 """ A service for publishing items to a node. """
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
55
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
56 def publish(self, node_id, items, requestor):
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
57 """ Publish items to a pubsub node.
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
58
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
59 @return: a deferred that fires when the items have been published.
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
60 """
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
61 class INotificationService(components.Interface):
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
62 """ A service for notification of published items. """
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
63
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
64 def register_notifier(self, observerfn, *args, **kwargs):
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
65 """ Register callback which is called for notification. """
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
66
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
67 def get_notification_list(self, node_id, items):
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
68 pass
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
69
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
70 class ISubscriptionService(components.Interface):
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
71 """ A service for managing subscriptions. """
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
72
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
73 def subscribe(self, node_id, subscriber, requestor):
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
74 """ Request the subscription of an entity to a pubsub node.
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
75
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
76 Depending on the node's configuration and possible business rules, the
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
77 C{subscriber} is added to the list of subscriptions of the node with id
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
78 C{node_id}. The C{subscriber} might be different from the C{requestor},
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
79 and if the C{requestor} is not allowed to subscribe this entity an
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
80 exception should be raised.
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
81
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
82 @return: a deferred that returns the subscription state
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
83 """
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
84
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
85 def unsubscribe(self, node_id, subscriber, requestor):
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
86 """ Cancel the subscription of an entity to a pubsub node.
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
87
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
88 The subscription of C{subscriber} is removed from the list of
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
89 subscriptions of the node with id C{node_id}. If the C{requestor}
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
90 is not allowed to unsubscribe C{subscriber}, an an exception should
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
91 be raised.
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
92
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
93 @return: a deferred that fires when unsubscription is complete.
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
94 """
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
95
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
96 class IAffiliationsService(components.Interface):
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
97 """ A service for retrieving the affiliations with this pubsub service. """
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
98
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
99 def get_affiliations(self, entity):
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
100 """ Report the list of current affiliations with this pubsub service.
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
101
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
102 Report the list of the current affiliations with all nodes within this
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
103 pubsub service, along with subscriptions to such nodes, for the
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
104 C{entity}.
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
105
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
106 @return: a deferred that returns the list of all current affiliations
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
107 and subscriptions.
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
108 """
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
109
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
110 class IPersistenceService(components.Interface):
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
111 """ A service for persisting published items """
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
112
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
113 def store_items(self, node_id, items, publisher):
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
114 """ Store items for a node, recording the publisher """
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
115
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
116 class IRetractionService(components.Interface):
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
117 """ A service for retracting published items """
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
118
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
119 def retract_item(self, node_id, item_id, requestor):
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
120 """ Removes item in node from persistent storage """
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
121
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
122 def purge_node(self, node_id, requestor):
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
123 """ Removes all items in node from persistent storage """
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
124
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
125 class IItemRetrievalService(components.Interface):
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
126 """ A service for retrieving previously published items. """
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
127
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
128 def get_items(self, node_id, max_items=None, item_ids=[],
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
129 requestor=None):
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
130 """ Retrieve items from persistent storage
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
131
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
132 If C{max_items} is given, return the C{max_items} last published
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
133 items, else if C{item_ids} is not empty, return the items requested.
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
134 If neither is given, return all items.
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
135
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
136 @return: a deferred that returns the requested items
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
137 """
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
138
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
139 class BackendService(service.MultiService, utility.EventDispatcher):
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
140
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
141 __implements__ = IBackendService,
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
142
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
143 def __init__(self):
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
144 service.MultiService.__init__(self)
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
145 utility.EventDispatcher.__init__(self)
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
146
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
147 class NotificationService(service.Service):
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
148
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
149 def register_notifier(self, observerfn, *args, **kwargs):
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
150 self.parent.addObserver('//event/pubsub/notify', observerfn,
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
151 *args, **kwargs)