Commit 5e7b3384 authored by Gaston Dombiak's avatar Gaston Dombiak Committed by gato

Small refactoring.

git-svn-id: http://svn.igniterealtime.org/svn/repos/openfire/trunk@8691 b35dd754-fafc-0310-a699-88a17e54d16e
parent 4b70f72c
......@@ -16,9 +16,9 @@ import org.jivesoftware.util.LocaleUtils;
import org.jivesoftware.util.StringUtils;
import org.xmpp.forms.DataForm;
import org.xmpp.forms.FormField;
import org.xmpp.packet.IQ;
import org.xmpp.packet.JID;
import org.xmpp.packet.Message;
import org.xmpp.packet.IQ;
import java.util.*;
......@@ -110,7 +110,7 @@ public class LeafNode extends Node {
itemsByID.remove(removedItem.getID());
// Add the removed item to the queue of items to delete from the database. The
// queue is going to be processed by another thread
service.getPubSubEngine().queueItemToRemove(removedItem);
service.queueItemToRemove(removedItem);
}
}
}
......@@ -161,7 +161,7 @@ public class LeafNode extends Node {
itemsByID.remove(removedItem.getID());
// Add the removed item to the queue of items to delete from the database. The
// queue is going to be processed by another thread
service.getPubSubEngine().queueItemToRemove(removedItem);
service.queueItemToRemove(removedItem);
}
}
}
......@@ -257,12 +257,12 @@ public class LeafNode extends Node {
itemsByID.remove(removedItem.getID());
// Add the removed item to the queue of items to delete from the database. The
// queue is going to be processed by another thread
service.getPubSubEngine().queueItemToRemove(removedItem);
service.queueItemToRemove(removedItem);
}
addPublishedItem(newItem);
// Add the new published item to the queue of items to add to the database. The
// queue is going to be processed by another thread
service.getPubSubEngine().queueItemToAdd(newItem);
service.queueItemToAdd(newItem);
}
}
}
......@@ -307,7 +307,7 @@ public class LeafNode extends Node {
}
// Remove deleted items from the database
for (PublishedItem item : toDelete) {
service.getPubSubEngine().queueItemToRemove(item);
service.queueItemToRemove(item);
}
if (isNotifiedOfRetract()) {
// Broadcast notification deletion to subscribers
......@@ -447,7 +447,7 @@ public class LeafNode extends Node {
if (toDelete != null) {
// Delete purged items from the database
for (PublishedItem item : toDelete) {
service.getPubSubEngine().queueItemToRemove(item);
service.queueItemToRemove(item);
}
// Broadcast purge notification to subscribers
// Build packet to broadcast to subscribers
......
......@@ -227,8 +227,12 @@ public class PubSubModule extends BasicModule implements ServerItemsProvider, Di
engine.presenceSubscriptionRequired(node, user);
}
public PubSubEngine getPubSubEngine() {
return engine;
public void queueItemToAdd(PublishedItem newItem) {
engine.queueItemToAdd(newItem);
}
public void queueItemToRemove(PublishedItem removedItem) {
engine.queueItemToRemove(removedItem);
}
public String getServiceName() {
......
......@@ -186,15 +186,6 @@ public interface PubSubService {
*/
Collection<String> getShowPresences(JID subscriber);
/**
* Returns the pubsub engine responsible for handling packets sent to the pub-sub service.
* The engine is the actual place where the pubsub magic happens like creating nodes,
* publishing items or subscribing to nodes.
*
* @return the pubsub engine responsible for handling packets sent to the pub-sub service.
*/
PubSubEngine getPubSubEngine();
/**
* Requests the pubsub service to subscribe to the presence of the user. If the service
* has already subscribed to the user's presence then do nothing.
......@@ -222,4 +213,20 @@ public interface PubSubService {
* @return true if a user may have more than one subscription with the node.
*/
boolean isMultipleSubscriptionsEnabled();
/**
* Adds the item to the queue of items to add to the database. The queue is going
* to be processed by another thread.
*
* @param newItem the item to add to the database.
*/
void queueItemToAdd(PublishedItem newItem);
/**
* Adds the item to the queue of items to remove from the database. The queue is going
* to be processed by another thread.
*
* @param removedItem the item to remove from the database.
*/
void queueItemToRemove(PublishedItem removedItem);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment