Commit c4af3a75 authored by Armando Jagucki's avatar Armando Jagucki Committed by ajagucki

Changed occurences of HashSet to the more abstact Set in declarations where appropriate.

git-svn-id: http://svn.igniterealtime.org/svn/repos/openfire/branches/pep@8942 b35dd754-fafc-0310-a699-88a17e54d16e
parent ccc6da6b
......@@ -60,6 +60,7 @@ import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
/**
......@@ -90,10 +91,12 @@ import java.util.concurrent.ConcurrentHashMap;
* @author Armando Jagucki
*
*/
public class IQPEPHandler extends IQHandler implements ServerIdentitiesProvider, ServerFeaturesProvider, UserIdentitiesProvider, UserItemsProvider,
PresenceEventListener, RosterEventListener, PacketInterceptor {
public class IQPEPHandler extends IQHandler implements ServerIdentitiesProvider, ServerFeaturesProvider,
UserIdentitiesProvider, UserItemsProvider, PresenceEventListener, RosterEventListener, PacketInterceptor {
// Map of PEP services. Table, Key: bare JID (String); Value: PEPService
/**
* Map of PEP services. Table, Key: bare JID (String); Value: PEPService
*/
private Map<String, PEPService> pepServices;
/**
......@@ -103,7 +106,7 @@ public class IQPEPHandler extends IQHandler implements ServerIdentitiesProvider,
* of a user is associated with a set of PEP node IDs they are interested in receiving notifications
* for.
*/
private Map<String, HashSet<String>> filteredNodesMap = new ConcurrentHashMap<String, HashSet<String>>();
private Map<String, Set<String>> filteredNodesMap = new ConcurrentHashMap<String, Set<String>>();
private IQHandlerInfo info;
......@@ -111,12 +114,12 @@ public class IQPEPHandler extends IQHandler implements ServerIdentitiesProvider,
/**
* A map of all known full JIDs that have sent presences from a remote server.
* table: key Bare JID (String); value HashSet of JIDs
* table: key Bare JID (String); value Set of JIDs
*
* This map is convenient for sending notifications to the full JID of remote users
* that have sent available presences to the PEP service.
*/
private Map<String, HashSet<JID>> knownRemotePresences = new ConcurrentHashMap<String, HashSet<JID>>();
private Map<String, Set<JID>> knownRemotePresences = new ConcurrentHashMap<String, Set<JID>>();
private static final String GET_PEP_SERVICES = "SELECT DISTINCT serviceID FROM pubsubNode";
......@@ -555,7 +558,7 @@ public class IQPEPHandler extends IQHandler implements ServerIdentitiesProvider,
// If none of the feature variables contain the node ID ending in "+notify",
// remove it from the set of filtered nodes that jidFrom is interested in being
// notified about.
HashSet<String> supportedNodesSet = new HashSet<String>();
Set<String> supportedNodesSet = new HashSet<String>();
while (featuresIterator.hasNext()) {
Element featureElement = (Element) featuresIterator.next();
......@@ -570,7 +573,7 @@ public class IQPEPHandler extends IQHandler implements ServerIdentitiesProvider,
for (String nodeID : supportedNodesSet) {
if (nodeID.endsWith("+notify")) {
// Add the nodeID to the sender's filteredNodesSet.
HashSet<String> filteredNodesSet = filteredNodesMap.get(jidFrom);
Set<String> filteredNodesSet = filteredNodesMap.get(jidFrom);
if (filteredNodesSet == null) {
filteredNodesSet = new HashSet<String>();
......@@ -598,7 +601,7 @@ public class IQPEPHandler extends IQHandler implements ServerIdentitiesProvider,
else {
// Remove the nodeID from the sender's filteredNodesSet if nodeIDPlusNotify
// is not in supportedNodesSet.
HashSet<String> filteredNodesSet = filteredNodesMap.get(jidFrom);
Set<String> filteredNodesSet = filteredNodesMap.get(jidFrom);
if (filteredNodesSet == null) {
return;
}
......@@ -628,7 +631,7 @@ public class IQPEPHandler extends IQHandler implements ServerIdentitiesProvider,
Log.debug("PEP: received presence from: " + jidFrom + " to: " + jidTo);
}
HashSet<JID> remotePresenceSet = knownRemotePresences.get(jidTo.toBareJID());
Set<JID> remotePresenceSet = knownRemotePresences.get(jidTo.toBareJID());
Presence.Type type = ((Presence) packet).getType();
if (type != null && type == Presence.Type.unavailable) {
......@@ -668,7 +671,7 @@ public class IQPEPHandler extends IQHandler implements ServerIdentitiesProvider,
*
* @return the filteredNodesMap
*/
public Map<String, HashSet<String>> getFilteredNodesMap() {
public Map<String, Set<String>> getFilteredNodesMap() {
return filteredNodesMap;
}
......@@ -677,7 +680,7 @@ public class IQPEPHandler extends IQHandler implements ServerIdentitiesProvider,
*
* @return the knownRemotePresences map
*/
public Map<String, HashSet<JID>> getKnownRemotePresenes() {
public Map<String, Set<JID>> getKnownRemotePresenes() {
return knownRemotePresences;
}
......
......@@ -47,6 +47,7 @@ import java.util.Collection;
import java.util.HashSet;
import java.util.Map;
import java.util.Queue;
import java.util.Set;
import java.util.TimeZone;
import java.util.Timer;
import java.util.concurrent.ConcurrentHashMap;
......@@ -326,7 +327,7 @@ public class PEPService implements PubSubService {
// If the recipient subscribed with a bare JID and this PEPService can retrieve
// presence information for the recipient, collect all of their full JIDs and
// send the notification to each below.
HashSet<JID> recipientFullJIDs = new HashSet<JID>();
Set<JID> recipientFullJIDs = new HashSet<JID>();
if (recipientJID.getResource() == null && XMPPServer.getInstance().isLocal(recipientJID)) {
for (ClientSession clientSession : SessionManager.getInstance().getSessions(recipientJID.getNode())) {
recipientFullJIDs.add(clientSession.getAddress());
......@@ -335,10 +336,10 @@ public class PEPService implements PubSubService {
else {
// Since recipientJID is not local, try to get presence info from cached known remote
// presences.
Map<String, HashSet<JID>> knownRemotePresences =
Map<String, Set<JID>> knownRemotePresences =
XMPPServer.getInstance().getIQPEPHandler().getKnownRemotePresenes();
HashSet<JID> remotePresenceSet = knownRemotePresences.get(getAddress().toBareJID());
Set<JID> remotePresenceSet = knownRemotePresences.get(getAddress().toBareJID());
if (remotePresenceSet != null) {
for (JID remotePresence : remotePresenceSet) {
if (recipientJID.toBareJID().equals(remotePresence.toBareJID())) {
......@@ -380,8 +381,8 @@ public class PEPService implements PubSubService {
// Check if the recipientFullJID is interested in notifications for this node.
// If the recipient has not yet requested any notification filtering, continue and send
// the notification.
Map<String, HashSet<String>> filteredNodesMap = XMPPServer.getInstance().getIQPEPHandler().getFilteredNodesMap();
HashSet<String> filteredNodesSet = filteredNodesMap.get(recipientFullJID.toString());
Map<String, Set<String>> filteredNodesMap = XMPPServer.getInstance().getIQPEPHandler().getFilteredNodesMap();
Set<String> filteredNodesSet = filteredNodesMap.get(recipientFullJID.toString());
if (filteredNodesSet != null && !filteredNodesSet.contains(nodeID + "+notify")) {
return;
}
......
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
</head>
<body>
<p>Implementation of Personal Eventing via Pubsub (XEP-0163).</p>
</body>
</html>
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