use of org.jivesoftware.openfire.pubsub.Node in project Openfire by igniterealtime.
the class PEPServiceManager method remove.
/**
* Deletes the {@link PEPService} belonging to the specified owner.
*
* @param owner
* The JID of the owner of the service to be deleted.
*/
public void remove(JID owner) {
PEPService service = null;
final Lock lock = CacheFactory.getLock(owner, pepServices);
try {
lock.lock();
service = pepServices.remove(owner.toBareJID());
} finally {
lock.unlock();
}
if (service == null) {
return;
}
// Delete the user's PEP nodes from memory and the database.
CollectionNode rootNode = service.getRootCollectionNode();
for (final Node node : service.getNodes()) {
if (rootNode.isChildNode(node)) {
node.delete();
}
}
rootNode.delete();
}
use of org.jivesoftware.openfire.pubsub.Node in project Openfire by igniterealtime.
the class CancelSubscriptionTask method run.
@Override
public void run() {
log.debug("[TASK] Cancel Subscription : {}", toString());
Node node = getNode();
// case since any changes will get loaded from the db when it is loaded.
if (node == null)
return;
// This method will make a db call, but it will simply do nothing since
// the record will already be deleted.
node.cancelSubscription(getSubscription(), false);
}
use of org.jivesoftware.openfire.pubsub.Node in project Openfire by igniterealtime.
the class NewSubscriptionTask method run.
@Override
public void run() {
log.debug("[TASK] New subscription : {}", toString());
Node node = getNode();
// case since any changes will get loaded from the db when it is loaded.
if (node == null)
return;
if (node.getAffiliate(getOwner()) == null) {
// add the missing 'none' affiliation
NodeAffiliate affiliate = new NodeAffiliate(node, getOwner());
affiliate.setAffiliation(NodeAffiliate.Affiliation.none);
node.addAffiliate(affiliate);
}
node.addSubscription(getSubscription());
if (node.isPresenceBasedDelivery() && node.getSubscriptions(getSubscription().getOwner()).size() == 1) {
if (getSubscription().getPresenceStates().isEmpty()) {
// Subscribe to the owner's presence since the node is only
// sending events to online subscribers and this is the first
// subscription of the user and the subscription is not
// filtering notifications based on presence show values.
getService().presenceSubscriptionRequired(getNode(), getOwner());
}
}
}
Aggregations