Mercurial > libervia-pubsub
annotate idavoll/memory_backend.py @ 46:979e53b54267
Redefined several classes as subclasses of the implementations in backend.py.
Removed PersistenceService.
author | Ralph Meijer <ralphm@ik.nu> |
---|---|
date | Wed, 03 Nov 2004 14:06:08 +0000 |
parents | 9685b7e291ef |
children | 64f0986d8b35 |
rev | line source |
---|---|
27 | 1 from twisted.application import service |
2 from twisted.internet import defer | |
3 from twisted.protocols.jabber import jid | |
4 import backend | |
5 | |
6 class Subscription: | |
30
ff7c73b253bf
Recode backend to match interaces: one big Service that handles everything
Ralph Meijer <ralphm@ik.nu>
parents:
27
diff
changeset
|
7 def __init__(self, state): |
ff7c73b253bf
Recode backend to match interaces: one big Service that handles everything
Ralph Meijer <ralphm@ik.nu>
parents:
27
diff
changeset
|
8 self.state = state |
27 | 9 |
10 class NodeConfiguration: | |
30
ff7c73b253bf
Recode backend to match interaces: one big Service that handles everything
Ralph Meijer <ralphm@ik.nu>
parents:
27
diff
changeset
|
11 def __init__(self): |
ff7c73b253bf
Recode backend to match interaces: one big Service that handles everything
Ralph Meijer <ralphm@ik.nu>
parents:
27
diff
changeset
|
12 self.persist_items = False |
ff7c73b253bf
Recode backend to match interaces: one big Service that handles everything
Ralph Meijer <ralphm@ik.nu>
parents:
27
diff
changeset
|
13 self.deliver_payloads = False |
27 | 14 |
15 class Node: | |
30
ff7c73b253bf
Recode backend to match interaces: one big Service that handles everything
Ralph Meijer <ralphm@ik.nu>
parents:
27
diff
changeset
|
16 def __init__(self, id): |
ff7c73b253bf
Recode backend to match interaces: one big Service that handles everything
Ralph Meijer <ralphm@ik.nu>
parents:
27
diff
changeset
|
17 self.id = id |
ff7c73b253bf
Recode backend to match interaces: one big Service that handles everything
Ralph Meijer <ralphm@ik.nu>
parents:
27
diff
changeset
|
18 self.configuration = NodeConfiguration() |
ff7c73b253bf
Recode backend to match interaces: one big Service that handles everything
Ralph Meijer <ralphm@ik.nu>
parents:
27
diff
changeset
|
19 self.subscriptions = {} |
ff7c73b253bf
Recode backend to match interaces: one big Service that handles everything
Ralph Meijer <ralphm@ik.nu>
parents:
27
diff
changeset
|
20 self.affiliations = {} |
ff7c73b253bf
Recode backend to match interaces: one big Service that handles everything
Ralph Meijer <ralphm@ik.nu>
parents:
27
diff
changeset
|
21 self.items = {} |
27 | 22 |
43
9685b7e291ef
Moved common stuff out of pgsql_backend.py to backend.py.
Ralph Meijer <ralphm@ik.nu>
parents:
40
diff
changeset
|
23 class Storage: |
30
ff7c73b253bf
Recode backend to match interaces: one big Service that handles everything
Ralph Meijer <ralphm@ik.nu>
parents:
27
diff
changeset
|
24 def __init__(self): |
ff7c73b253bf
Recode backend to match interaces: one big Service that handles everything
Ralph Meijer <ralphm@ik.nu>
parents:
27
diff
changeset
|
25 self.nodes = {} |
27 | 26 |
30
ff7c73b253bf
Recode backend to match interaces: one big Service that handles everything
Ralph Meijer <ralphm@ik.nu>
parents:
27
diff
changeset
|
27 node = Node("ralphm/mood/ralphm@ik.nu") |
ff7c73b253bf
Recode backend to match interaces: one big Service that handles everything
Ralph Meijer <ralphm@ik.nu>
parents:
27
diff
changeset
|
28 node.subscriptions["ralphm@doe.ik.nu"] = Subscription("subscribed") |
ff7c73b253bf
Recode backend to match interaces: one big Service that handles everything
Ralph Meijer <ralphm@ik.nu>
parents:
27
diff
changeset
|
29 node.subscriptions["notify@ik.nu/mood_monitor"] = Subscription("subscribed") |
ff7c73b253bf
Recode backend to match interaces: one big Service that handles everything
Ralph Meijer <ralphm@ik.nu>
parents:
27
diff
changeset
|
30 node.affiliations["ralphm@ik.nu"] = "owner" |
ff7c73b253bf
Recode backend to match interaces: one big Service that handles everything
Ralph Meijer <ralphm@ik.nu>
parents:
27
diff
changeset
|
31 node.affiliations["ralphm@doe.ik.nu"] = "publisher" |
ff7c73b253bf
Recode backend to match interaces: one big Service that handles everything
Ralph Meijer <ralphm@ik.nu>
parents:
27
diff
changeset
|
32 node.configuration.persist_items = True |
ff7c73b253bf
Recode backend to match interaces: one big Service that handles everything
Ralph Meijer <ralphm@ik.nu>
parents:
27
diff
changeset
|
33 node.configuration.deliver_payloads = True |
ff7c73b253bf
Recode backend to match interaces: one big Service that handles everything
Ralph Meijer <ralphm@ik.nu>
parents:
27
diff
changeset
|
34 self.nodes[node.id] = node |
43
9685b7e291ef
Moved common stuff out of pgsql_backend.py to backend.py.
Ralph Meijer <ralphm@ik.nu>
parents:
40
diff
changeset
|
35 |
9685b7e291ef
Moved common stuff out of pgsql_backend.py to backend.py.
Ralph Meijer <ralphm@ik.nu>
parents:
40
diff
changeset
|
36 def get_node_configuration(self, node_id): |
9685b7e291ef
Moved common stuff out of pgsql_backend.py to backend.py.
Ralph Meijer <ralphm@ik.nu>
parents:
40
diff
changeset
|
37 try: |
9685b7e291ef
Moved common stuff out of pgsql_backend.py to backend.py.
Ralph Meijer <ralphm@ik.nu>
parents:
40
diff
changeset
|
38 node = self.nodes[node_id] |
9685b7e291ef
Moved common stuff out of pgsql_backend.py to backend.py.
Ralph Meijer <ralphm@ik.nu>
parents:
40
diff
changeset
|
39 except KeyError: |
9685b7e291ef
Moved common stuff out of pgsql_backend.py to backend.py.
Ralph Meijer <ralphm@ik.nu>
parents:
40
diff
changeset
|
40 raise backend.NodeNotFound |
9685b7e291ef
Moved common stuff out of pgsql_backend.py to backend.py.
Ralph Meijer <ralphm@ik.nu>
parents:
40
diff
changeset
|
41 else: |
9685b7e291ef
Moved common stuff out of pgsql_backend.py to backend.py.
Ralph Meijer <ralphm@ik.nu>
parents:
40
diff
changeset
|
42 c = self.nodes[node_id].configuration |
9685b7e291ef
Moved common stuff out of pgsql_backend.py to backend.py.
Ralph Meijer <ralphm@ik.nu>
parents:
40
diff
changeset
|
43 return defer.succeed({'persist_items': c.persist_items, |
9685b7e291ef
Moved common stuff out of pgsql_backend.py to backend.py.
Ralph Meijer <ralphm@ik.nu>
parents:
40
diff
changeset
|
44 'deliver_payloads': c.deliver_payloads}) |
9685b7e291ef
Moved common stuff out of pgsql_backend.py to backend.py.
Ralph Meijer <ralphm@ik.nu>
parents:
40
diff
changeset
|
45 |
9685b7e291ef
Moved common stuff out of pgsql_backend.py to backend.py.
Ralph Meijer <ralphm@ik.nu>
parents:
40
diff
changeset
|
46 def get_affiliation(self, node_id, entity): |
9685b7e291ef
Moved common stuff out of pgsql_backend.py to backend.py.
Ralph Meijer <ralphm@ik.nu>
parents:
40
diff
changeset
|
47 try: |
9685b7e291ef
Moved common stuff out of pgsql_backend.py to backend.py.
Ralph Meijer <ralphm@ik.nu>
parents:
40
diff
changeset
|
48 node = self.nodes[node_id] |
9685b7e291ef
Moved common stuff out of pgsql_backend.py to backend.py.
Ralph Meijer <ralphm@ik.nu>
parents:
40
diff
changeset
|
49 except KeyError: |
9685b7e291ef
Moved common stuff out of pgsql_backend.py to backend.py.
Ralph Meijer <ralphm@ik.nu>
parents:
40
diff
changeset
|
50 raise backend.NodeNotFound |
9685b7e291ef
Moved common stuff out of pgsql_backend.py to backend.py.
Ralph Meijer <ralphm@ik.nu>
parents:
40
diff
changeset
|
51 else: |
9685b7e291ef
Moved common stuff out of pgsql_backend.py to backend.py.
Ralph Meijer <ralphm@ik.nu>
parents:
40
diff
changeset
|
52 return defer.succeed(node.affiliations.get(entity, None)) |
9685b7e291ef
Moved common stuff out of pgsql_backend.py to backend.py.
Ralph Meijer <ralphm@ik.nu>
parents:
40
diff
changeset
|
53 |
9685b7e291ef
Moved common stuff out of pgsql_backend.py to backend.py.
Ralph Meijer <ralphm@ik.nu>
parents:
40
diff
changeset
|
54 def get_subscribers(self, node_id): |
9685b7e291ef
Moved common stuff out of pgsql_backend.py to backend.py.
Ralph Meijer <ralphm@ik.nu>
parents:
40
diff
changeset
|
55 try: |
9685b7e291ef
Moved common stuff out of pgsql_backend.py to backend.py.
Ralph Meijer <ralphm@ik.nu>
parents:
40
diff
changeset
|
56 node = self.nodes[node_id] |
9685b7e291ef
Moved common stuff out of pgsql_backend.py to backend.py.
Ralph Meijer <ralphm@ik.nu>
parents:
40
diff
changeset
|
57 except KeyError: |
9685b7e291ef
Moved common stuff out of pgsql_backend.py to backend.py.
Ralph Meijer <ralphm@ik.nu>
parents:
40
diff
changeset
|
58 raise backend.NodeNotFound |
9685b7e291ef
Moved common stuff out of pgsql_backend.py to backend.py.
Ralph Meijer <ralphm@ik.nu>
parents:
40
diff
changeset
|
59 else: |
9685b7e291ef
Moved common stuff out of pgsql_backend.py to backend.py.
Ralph Meijer <ralphm@ik.nu>
parents:
40
diff
changeset
|
60 subscriptions = self.nodes[node_id].subscriptions |
9685b7e291ef
Moved common stuff out of pgsql_backend.py to backend.py.
Ralph Meijer <ralphm@ik.nu>
parents:
40
diff
changeset
|
61 subscribers = [s for s in subscriptions |
9685b7e291ef
Moved common stuff out of pgsql_backend.py to backend.py.
Ralph Meijer <ralphm@ik.nu>
parents:
40
diff
changeset
|
62 if subscriptions[s].state == 'subscribed'] |
9685b7e291ef
Moved common stuff out of pgsql_backend.py to backend.py.
Ralph Meijer <ralphm@ik.nu>
parents:
40
diff
changeset
|
63 return defer.succeed(subscribers) |
9685b7e291ef
Moved common stuff out of pgsql_backend.py to backend.py.
Ralph Meijer <ralphm@ik.nu>
parents:
40
diff
changeset
|
64 |
9685b7e291ef
Moved common stuff out of pgsql_backend.py to backend.py.
Ralph Meijer <ralphm@ik.nu>
parents:
40
diff
changeset
|
65 def store_items(self, node_id, items, publisher): |
9685b7e291ef
Moved common stuff out of pgsql_backend.py to backend.py.
Ralph Meijer <ralphm@ik.nu>
parents:
40
diff
changeset
|
66 for item in items: |
9685b7e291ef
Moved common stuff out of pgsql_backend.py to backend.py.
Ralph Meijer <ralphm@ik.nu>
parents:
40
diff
changeset
|
67 self.nodes[node_id].items[item["id"]] = (item, publisher) |
9685b7e291ef
Moved common stuff out of pgsql_backend.py to backend.py.
Ralph Meijer <ralphm@ik.nu>
parents:
40
diff
changeset
|
68 print self.nodes[node_id].items |
9685b7e291ef
Moved common stuff out of pgsql_backend.py to backend.py.
Ralph Meijer <ralphm@ik.nu>
parents:
40
diff
changeset
|
69 return defer.succeed(None) |
9685b7e291ef
Moved common stuff out of pgsql_backend.py to backend.py.
Ralph Meijer <ralphm@ik.nu>
parents:
40
diff
changeset
|
70 |
9685b7e291ef
Moved common stuff out of pgsql_backend.py to backend.py.
Ralph Meijer <ralphm@ik.nu>
parents:
40
diff
changeset
|
71 class BackendService(backend.BackendService): |
9685b7e291ef
Moved common stuff out of pgsql_backend.py to backend.py.
Ralph Meijer <ralphm@ik.nu>
parents:
40
diff
changeset
|
72 |
30
ff7c73b253bf
Recode backend to match interaces: one big Service that handles everything
Ralph Meijer <ralphm@ik.nu>
parents:
27
diff
changeset
|
73 def create_node(self, node_id, requestor): |
ff7c73b253bf
Recode backend to match interaces: one big Service that handles everything
Ralph Meijer <ralphm@ik.nu>
parents:
27
diff
changeset
|
74 if not node_id: |
ff7c73b253bf
Recode backend to match interaces: one big Service that handles everything
Ralph Meijer <ralphm@ik.nu>
parents:
27
diff
changeset
|
75 raise backend.NoInstantNodes |
ff7c73b253bf
Recode backend to match interaces: one big Service that handles everything
Ralph Meijer <ralphm@ik.nu>
parents:
27
diff
changeset
|
76 |
ff7c73b253bf
Recode backend to match interaces: one big Service that handles everything
Ralph Meijer <ralphm@ik.nu>
parents:
27
diff
changeset
|
77 if node_id in self.nodes: |
ff7c73b253bf
Recode backend to match interaces: one big Service that handles everything
Ralph Meijer <ralphm@ik.nu>
parents:
27
diff
changeset
|
78 raise backend.NodeExists |
ff7c73b253bf
Recode backend to match interaces: one big Service that handles everything
Ralph Meijer <ralphm@ik.nu>
parents:
27
diff
changeset
|
79 |
ff7c73b253bf
Recode backend to match interaces: one big Service that handles everything
Ralph Meijer <ralphm@ik.nu>
parents:
27
diff
changeset
|
80 node = Node(node_id) |
ff7c73b253bf
Recode backend to match interaces: one big Service that handles everything
Ralph Meijer <ralphm@ik.nu>
parents:
27
diff
changeset
|
81 node.affiliations[requestor.full()] = 'owner' |
ff7c73b253bf
Recode backend to match interaces: one big Service that handles everything
Ralph Meijer <ralphm@ik.nu>
parents:
27
diff
changeset
|
82 self.nodes[node_id] = node |
ff7c73b253bf
Recode backend to match interaces: one big Service that handles everything
Ralph Meijer <ralphm@ik.nu>
parents:
27
diff
changeset
|
83 |
ff7c73b253bf
Recode backend to match interaces: one big Service that handles everything
Ralph Meijer <ralphm@ik.nu>
parents:
27
diff
changeset
|
84 return defer.succeed({'node_id': node.id}) |
27 | 85 |
30
ff7c73b253bf
Recode backend to match interaces: one big Service that handles everything
Ralph Meijer <ralphm@ik.nu>
parents:
27
diff
changeset
|
86 def subscribe(self, node_id, subscriber, requestor): |
ff7c73b253bf
Recode backend to match interaces: one big Service that handles everything
Ralph Meijer <ralphm@ik.nu>
parents:
27
diff
changeset
|
87 # expect subscriber and requestor to be a jid.JID |
ff7c73b253bf
Recode backend to match interaces: one big Service that handles everything
Ralph Meijer <ralphm@ik.nu>
parents:
27
diff
changeset
|
88 try: |
ff7c73b253bf
Recode backend to match interaces: one big Service that handles everything
Ralph Meijer <ralphm@ik.nu>
parents:
27
diff
changeset
|
89 node = self.nodes[node_id] |
ff7c73b253bf
Recode backend to match interaces: one big Service that handles everything
Ralph Meijer <ralphm@ik.nu>
parents:
27
diff
changeset
|
90 except KeyError: |
ff7c73b253bf
Recode backend to match interaces: one big Service that handles everything
Ralph Meijer <ralphm@ik.nu>
parents:
27
diff
changeset
|
91 raise backend.NodeNotFound |
27 | 92 |
30
ff7c73b253bf
Recode backend to match interaces: one big Service that handles everything
Ralph Meijer <ralphm@ik.nu>
parents:
27
diff
changeset
|
93 if subscriber.userhostJID() != requestor: |
ff7c73b253bf
Recode backend to match interaces: one big Service that handles everything
Ralph Meijer <ralphm@ik.nu>
parents:
27
diff
changeset
|
94 raise backend.NotAuthorized |
27 | 95 |
30
ff7c73b253bf
Recode backend to match interaces: one big Service that handles everything
Ralph Meijer <ralphm@ik.nu>
parents:
27
diff
changeset
|
96 affiliation = node.affiliations.get(subscriber.full(), 'none') |
ff7c73b253bf
Recode backend to match interaces: one big Service that handles everything
Ralph Meijer <ralphm@ik.nu>
parents:
27
diff
changeset
|
97 |
ff7c73b253bf
Recode backend to match interaces: one big Service that handles everything
Ralph Meijer <ralphm@ik.nu>
parents:
27
diff
changeset
|
98 if affiliation == 'outcast': |
ff7c73b253bf
Recode backend to match interaces: one big Service that handles everything
Ralph Meijer <ralphm@ik.nu>
parents:
27
diff
changeset
|
99 raise backend.NotAuthorized |
27 | 100 |
30
ff7c73b253bf
Recode backend to match interaces: one big Service that handles everything
Ralph Meijer <ralphm@ik.nu>
parents:
27
diff
changeset
|
101 try: |
ff7c73b253bf
Recode backend to match interaces: one big Service that handles everything
Ralph Meijer <ralphm@ik.nu>
parents:
27
diff
changeset
|
102 subscription = node.subscriptions[subscriber.full()] |
ff7c73b253bf
Recode backend to match interaces: one big Service that handles everything
Ralph Meijer <ralphm@ik.nu>
parents:
27
diff
changeset
|
103 except KeyError: |
ff7c73b253bf
Recode backend to match interaces: one big Service that handles everything
Ralph Meijer <ralphm@ik.nu>
parents:
27
diff
changeset
|
104 subscription = Subscription('subscribed') |
ff7c73b253bf
Recode backend to match interaces: one big Service that handles everything
Ralph Meijer <ralphm@ik.nu>
parents:
27
diff
changeset
|
105 node.subscriptions[subscriber.full()] = subscription |
ff7c73b253bf
Recode backend to match interaces: one big Service that handles everything
Ralph Meijer <ralphm@ik.nu>
parents:
27
diff
changeset
|
106 |
ff7c73b253bf
Recode backend to match interaces: one big Service that handles everything
Ralph Meijer <ralphm@ik.nu>
parents:
27
diff
changeset
|
107 print node.subscriptions |
27 | 108 |
30
ff7c73b253bf
Recode backend to match interaces: one big Service that handles everything
Ralph Meijer <ralphm@ik.nu>
parents:
27
diff
changeset
|
109 return defer.succeed({ |
ff7c73b253bf
Recode backend to match interaces: one big Service that handles everything
Ralph Meijer <ralphm@ik.nu>
parents:
27
diff
changeset
|
110 'affiliation': affiliation, |
ff7c73b253bf
Recode backend to match interaces: one big Service that handles everything
Ralph Meijer <ralphm@ik.nu>
parents:
27
diff
changeset
|
111 'node': node_id, |
ff7c73b253bf
Recode backend to match interaces: one big Service that handles everything
Ralph Meijer <ralphm@ik.nu>
parents:
27
diff
changeset
|
112 'jid': subscriber, |
ff7c73b253bf
Recode backend to match interaces: one big Service that handles everything
Ralph Meijer <ralphm@ik.nu>
parents:
27
diff
changeset
|
113 'subscription': subscription.state}) |
ff7c73b253bf
Recode backend to match interaces: one big Service that handles everything
Ralph Meijer <ralphm@ik.nu>
parents:
27
diff
changeset
|
114 |
37
9aa20efac203
Fix get_notification_list() to only return JIDs for subscriptions in the
Ralph Meijer <ralphm@ik.nu>
parents:
30
diff
changeset
|
115 def unsubscribe(self, node_id, subscriber, requestor): |
9aa20efac203
Fix get_notification_list() to only return JIDs for subscriptions in the
Ralph Meijer <ralphm@ik.nu>
parents:
30
diff
changeset
|
116 try: |
9aa20efac203
Fix get_notification_list() to only return JIDs for subscriptions in the
Ralph Meijer <ralphm@ik.nu>
parents:
30
diff
changeset
|
117 node = self.nodes[node_id] |
9aa20efac203
Fix get_notification_list() to only return JIDs for subscriptions in the
Ralph Meijer <ralphm@ik.nu>
parents:
30
diff
changeset
|
118 except KeyError: |
9aa20efac203
Fix get_notification_list() to only return JIDs for subscriptions in the
Ralph Meijer <ralphm@ik.nu>
parents:
30
diff
changeset
|
119 raise backend.NodeNotFound |
9aa20efac203
Fix get_notification_list() to only return JIDs for subscriptions in the
Ralph Meijer <ralphm@ik.nu>
parents:
30
diff
changeset
|
120 |
9aa20efac203
Fix get_notification_list() to only return JIDs for subscriptions in the
Ralph Meijer <ralphm@ik.nu>
parents:
30
diff
changeset
|
121 if subscriber.userhostJID() != requestor: |
9aa20efac203
Fix get_notification_list() to only return JIDs for subscriptions in the
Ralph Meijer <ralphm@ik.nu>
parents:
30
diff
changeset
|
122 raise backend.NotAuthorized |
9aa20efac203
Fix get_notification_list() to only return JIDs for subscriptions in the
Ralph Meijer <ralphm@ik.nu>
parents:
30
diff
changeset
|
123 |
9aa20efac203
Fix get_notification_list() to only return JIDs for subscriptions in the
Ralph Meijer <ralphm@ik.nu>
parents:
30
diff
changeset
|
124 try: |
9aa20efac203
Fix get_notification_list() to only return JIDs for subscriptions in the
Ralph Meijer <ralphm@ik.nu>
parents:
30
diff
changeset
|
125 del node.subscriptions[subscriber.full()] |
9aa20efac203
Fix get_notification_list() to only return JIDs for subscriptions in the
Ralph Meijer <ralphm@ik.nu>
parents:
30
diff
changeset
|
126 except KeyError: |
9aa20efac203
Fix get_notification_list() to only return JIDs for subscriptions in the
Ralph Meijer <ralphm@ik.nu>
parents:
30
diff
changeset
|
127 raise backend.NotSubscribed |
9aa20efac203
Fix get_notification_list() to only return JIDs for subscriptions in the
Ralph Meijer <ralphm@ik.nu>
parents:
30
diff
changeset
|
128 |
9aa20efac203
Fix get_notification_list() to only return JIDs for subscriptions in the
Ralph Meijer <ralphm@ik.nu>
parents:
30
diff
changeset
|
129 return defer.succeed(None) |
9aa20efac203
Fix get_notification_list() to only return JIDs for subscriptions in the
Ralph Meijer <ralphm@ik.nu>
parents:
30
diff
changeset
|
130 |
30
ff7c73b253bf
Recode backend to match interaces: one big Service that handles everything
Ralph Meijer <ralphm@ik.nu>
parents:
27
diff
changeset
|
131 class NodeCreationService(service.Service): |
ff7c73b253bf
Recode backend to match interaces: one big Service that handles everything
Ralph Meijer <ralphm@ik.nu>
parents:
27
diff
changeset
|
132 |
ff7c73b253bf
Recode backend to match interaces: one big Service that handles everything
Ralph Meijer <ralphm@ik.nu>
parents:
27
diff
changeset
|
133 __implements__ = backend.INodeCreationService, |
27 | 134 |
30
ff7c73b253bf
Recode backend to match interaces: one big Service that handles everything
Ralph Meijer <ralphm@ik.nu>
parents:
27
diff
changeset
|
135 def create_node(self, node_id, requestor): |
ff7c73b253bf
Recode backend to match interaces: one big Service that handles everything
Ralph Meijer <ralphm@ik.nu>
parents:
27
diff
changeset
|
136 return self.parent.create_node(node_id, requestor) |
ff7c73b253bf
Recode backend to match interaces: one big Service that handles everything
Ralph Meijer <ralphm@ik.nu>
parents:
27
diff
changeset
|
137 |
46
979e53b54267
Redefined several classes as subclasses of the implementations in backend.py.
Ralph Meijer <ralphm@ik.nu>
parents:
43
diff
changeset
|
138 class PublishService(backend.PublishService): |
979e53b54267
Redefined several classes as subclasses of the implementations in backend.py.
Ralph Meijer <ralphm@ik.nu>
parents:
43
diff
changeset
|
139 pass |
27 | 140 |
30
ff7c73b253bf
Recode backend to match interaces: one big Service that handles everything
Ralph Meijer <ralphm@ik.nu>
parents:
27
diff
changeset
|
141 class NotificationService(backend.NotificationService): |
46
979e53b54267
Redefined several classes as subclasses of the implementations in backend.py.
Ralph Meijer <ralphm@ik.nu>
parents:
43
diff
changeset
|
142 pass |
30
ff7c73b253bf
Recode backend to match interaces: one big Service that handles everything
Ralph Meijer <ralphm@ik.nu>
parents:
27
diff
changeset
|
143 |
ff7c73b253bf
Recode backend to match interaces: one big Service that handles everything
Ralph Meijer <ralphm@ik.nu>
parents:
27
diff
changeset
|
144 class SubscriptionService(service.Service): |
27 | 145 |
30
ff7c73b253bf
Recode backend to match interaces: one big Service that handles everything
Ralph Meijer <ralphm@ik.nu>
parents:
27
diff
changeset
|
146 __implements__ = backend.ISubscriptionService, |
ff7c73b253bf
Recode backend to match interaces: one big Service that handles everything
Ralph Meijer <ralphm@ik.nu>
parents:
27
diff
changeset
|
147 |
ff7c73b253bf
Recode backend to match interaces: one big Service that handles everything
Ralph Meijer <ralphm@ik.nu>
parents:
27
diff
changeset
|
148 def subscribe(self, node_id, subscriber, requestor): |
ff7c73b253bf
Recode backend to match interaces: one big Service that handles everything
Ralph Meijer <ralphm@ik.nu>
parents:
27
diff
changeset
|
149 return self.parent.subscribe(node_id, subscriber, requestor) |
ff7c73b253bf
Recode backend to match interaces: one big Service that handles everything
Ralph Meijer <ralphm@ik.nu>
parents:
27
diff
changeset
|
150 |
ff7c73b253bf
Recode backend to match interaces: one big Service that handles everything
Ralph Meijer <ralphm@ik.nu>
parents:
27
diff
changeset
|
151 def unsubscribe(self, node_id, subscriber, requestor): |
37
9aa20efac203
Fix get_notification_list() to only return JIDs for subscriptions in the
Ralph Meijer <ralphm@ik.nu>
parents:
30
diff
changeset
|
152 return self.parent.unsubscribe(node_id, subscriber, requestor) |