|
1 | 1 | package org.buddycloud.channelserver.packetprocessor.iq.namespace.pubsub.set; |
2 | 2 |
|
| 3 | +import java.util.ArrayList; |
3 | 4 | import java.util.Collection; |
4 | 5 | import java.util.concurrent.BlockingQueue; |
5 | 6 |
|
|
19 | 20 | import org.xmpp.packet.Packet; |
20 | 21 | import org.xmpp.packet.PacketError; |
21 | 22 | import org.xmpp.resultsetmanagement.ResultSet; |
| 23 | +import org.xmpp.resultsetmanagement.ResultSetImpl; |
22 | 24 |
|
23 | 25 | public class NodeDelete extends PubSubElementProcessorAbstract { |
24 | 26 |
|
25 | 27 | private static final String NODE_REG_EX = "^/user/[^@]+@[^/]+/[^/]+$"; |
| 28 | + private ResultSet<NodeSubscription> subscriptions; |
26 | 29 |
|
27 | 30 | public NodeDelete(BlockingQueue<Packet> outQueue, ChannelManager channelManager) { |
28 | 31 | setChannelManager(channelManager); |
@@ -52,13 +55,21 @@ public void process(Element elm, JID actorJID, IQ reqIQ, Element rsm) throws Exc |
52 | 55 | outQueue.put(response); |
53 | 56 | return; |
54 | 57 | } |
| 58 | + getNodeListeners(); |
55 | 59 | deleteNode(); |
56 | 60 | sendNotifications(); |
57 | 61 | } |
58 | 62 |
|
59 | | - private void sendNotifications() throws NodeStoreException { |
| 63 | + private void getNodeListeners() { |
| 64 | + try { |
| 65 | + subscriptions = channelManager.getNodeSubscriptionListeners(node); |
| 66 | + } catch (NodeStoreException e) { |
| 67 | + subscriptions = new ResultSetImpl<NodeSubscription>(new ArrayList<NodeSubscription>()); |
| 68 | + } |
| 69 | + } |
| 70 | + |
| 71 | + private void sendNotifications() throws NodeStoreException { |
60 | 72 | try { |
61 | | - ResultSet<NodeSubscription> subscriptions = channelManager.getNodeSubscriptionListeners(node); |
62 | 73 | Message notification = createNotificationMessage(); |
63 | 74 | if (subscriptions != null) { |
64 | 75 | for (NodeSubscription subscription : subscriptions) { |
|
0 commit comments