annotate idavoll/backend.py @ 29:d4fc29bb5381

Define interfaces of blocks of functionality.
author Ralph Meijer <ralphm@ik.nu>
date Tue, 26 Oct 2004 16:25:59 +0000
parents 4f3bbefc6fad
children b65b7ea5c992
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):
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
30 msg = 'Oops!'
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
31
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
32 class IBackendService(components.Interface):
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
33 """ 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
34
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
35 def get_supported_affiliations(self):
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
36 """ Reports the list of supported affiliation types.
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 @return: a list of supported affiliation types.
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
39 """
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 class INodeCreationService(components.Interface):
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
42 """ A service for creating nodes """
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 def create_node(self, node_id, requestor):
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
45 """ Create a node.
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 @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
48 """
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 class IPublishService(components.Interface):
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
51 """ A service for publishing items to a node. """
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 def publish(self, node_id, items, requestor):
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
54 """ Publish items to a pubsub 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 @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
57 """
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
58 class INotificationService(components.Interface):
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
59 """ A service for notification of published items. """
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 def register_notifier(self, observerfn, *args, **kwargs):
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
62 """ Register callback which is called for notification. """
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 get_notification_list(self, node_id, items):
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
65 pass
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 class ISubscriptionService(components.Interface):
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
68 """ A service for managing subscriptions. """
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 def subscribe(self, node_id, subscriber, requestor):
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
71 """ 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
72
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
73 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
74 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
75 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
76 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
77 exception should be raised.
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
78
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
79 @return: a deferred that returns the subscription state
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
80 """
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 def unsubscribe(self, node_id, subscriber, requestor):
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
83 """ 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
84
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
85 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
86 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
87 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
88 be raised.
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
89
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
90 @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
91 """
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 class IAffiliationsService(components.Interface):
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
94 """ 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
95
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
96 def get_affiliations(self, entity):
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
97 """ 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
98
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
99 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
100 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
101 C{entity}.
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
102
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
103 @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
104 and subscriptions.
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
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
107 class IPersistenceService(components.Interface):
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
108 """ A service for persisting published items """
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 def store_items(self, node_id, items, publisher):
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
111 """ Store items for a node, recording the publisher """
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 class IRetractionService(components.Interface):
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
114 """ A service for retracting published items """
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 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
117 """ Removes item in node from persistent storage """
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 purge_node(self, node_id, requestor):
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
120 """ Removes all items 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 class IItemRetrievalService(components.Interface):
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
123 """ A service for retrieving previously published items. """
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 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
126 requestor=None):
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
127 """ Retrieve items from persistent storage
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
128
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
129 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
130 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
131 If neither is given, return all items.
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
132
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
133 @return: a deferred that returns the requested items
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
134 """
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 class BackendService(service.MultiService, utility.EventDispatcher):
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 __implements__ = IBackendService,
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
139
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
140 def __init__(self):
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
141 service.MultiService.__init__(self)
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
142 utility.EventDispatcher.__init__(self)
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
143
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
144 class NotificationService(service.Service):
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
145
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
146 def register_notifier(self, observerfn, *args, **kwargs):
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
147 self.parent.addObserver('//event/pubsub/notify', observerfn,
d4fc29bb5381 Define interfaces of blocks of functionality.
Ralph Meijer <ralphm@ik.nu>
parents: 24
diff changeset
148 *args, **kwargs)