aboutsummaryrefslogtreecommitdiffstats
path: root/src/net/java/sip/communicator/impl/protocol/zeroconf
diff options
context:
space:
mode:
authorLyubomir Marinov <lyubomir.marinov@jitsi.org>2008-12-09 20:45:16 +0000
committerLyubomir Marinov <lyubomir.marinov@jitsi.org>2008-12-09 20:45:16 +0000
commit331d75a93a6f83444b5d295c1697d6e707c19d46 (patch)
treecaee2201bed2c1c616acc70e0b52f5b52a68d23b /src/net/java/sip/communicator/impl/protocol/zeroconf
parent690b5fa412f7e98f5e5e342d5879aaf4fda02922 (diff)
downloadjitsi-331d75a93a6f83444b5d295c1697d6e707c19d46.zip
jitsi-331d75a93a6f83444b5d295c1697d6e707c19d46.tar.gz
jitsi-331d75a93a6f83444b5d295c1697d6e707c19d46.tar.bz2
Eliminates duplication of ProtocolProviderService.getOperationSet() and .getSupportedOperationSets() for all protocol implementations by moving the implementations into AbstractProtocolProviderService. Uses .getOperationSet() instead of .getSupportedOperationSets() where appropriate in order to produce less garbage (due to Hashtable cloning).
Diffstat (limited to 'src/net/java/sip/communicator/impl/protocol/zeroconf')
-rw-r--r--src/net/java/sip/communicator/impl/protocol/zeroconf/BonjourService.java6
-rw-r--r--src/net/java/sip/communicator/impl/protocol/zeroconf/ClientThread.java16
-rw-r--r--src/net/java/sip/communicator/impl/protocol/zeroconf/ProtocolProviderServiceZeroconfImpl.java36
3 files changed, 12 insertions, 46 deletions
diff --git a/src/net/java/sip/communicator/impl/protocol/zeroconf/BonjourService.java b/src/net/java/sip/communicator/impl/protocol/zeroconf/BonjourService.java
index 8942303..2139e7e 100644
--- a/src/net/java/sip/communicator/impl/protocol/zeroconf/BonjourService.java
+++ b/src/net/java/sip/communicator/impl/protocol/zeroconf/BonjourService.java
@@ -75,9 +75,9 @@ public class BonjourService extends Thread
this.id = acc.getUserID();
this.pps = pps;
- opSetPersPresence = (OperationSetPersistentPresenceZeroconfImpl)
- pps.getSupportedOperationSets()
- .get(OperationSetPersistentPresence.class.getName());
+ opSetPersPresence =
+ (OperationSetPersistentPresenceZeroconfImpl) pps
+ .getOperationSet(OperationSetPersistentPresence.class);
props = new Hashtable();
diff --git a/src/net/java/sip/communicator/impl/protocol/zeroconf/ClientThread.java b/src/net/java/sip/communicator/impl/protocol/zeroconf/ClientThread.java
index 135f45f..35da61a 100644
--- a/src/net/java/sip/communicator/impl/protocol/zeroconf/ClientThread.java
+++ b/src/net/java/sip/communicator/impl/protocol/zeroconf/ClientThread.java
@@ -81,13 +81,15 @@ public class ClientThread
this.sock = sock;
this.remoteIPAddress = sock.getInetAddress();
this.bonjourService = bonjourService;
- this.opSetBasicIM = (OperationSetBasicInstantMessagingZeroconfImpl)
- bonjourService.getPPS().getSupportedOperationSets()
- .get(OperationSetBasicInstantMessaging.class.getName());
-
- this.opSetTyping = (OperationSetTypingNotificationsZeroconfImpl)
- bonjourService.getPPS().getSupportedOperationSets()
- .get(OperationSetTypingNotifications.class.getName());
+ this.opSetBasicIM =
+ (OperationSetBasicInstantMessagingZeroconfImpl) bonjourService
+ .getPPS().getOperationSet(
+ OperationSetBasicInstantMessaging.class);
+
+ this.opSetTyping =
+ (OperationSetTypingNotificationsZeroconfImpl) bonjourService
+ .getPPS()
+ .getOperationSet(OperationSetTypingNotifications.class);
this.setDaemon(true);
try
diff --git a/src/net/java/sip/communicator/impl/protocol/zeroconf/ProtocolProviderServiceZeroconfImpl.java b/src/net/java/sip/communicator/impl/protocol/zeroconf/ProtocolProviderServiceZeroconfImpl.java
index 9b479aa..ef76386 100644
--- a/src/net/java/sip/communicator/impl/protocol/zeroconf/ProtocolProviderServiceZeroconfImpl.java
+++ b/src/net/java/sip/communicator/impl/protocol/zeroconf/ProtocolProviderServiceZeroconfImpl.java
@@ -6,8 +6,6 @@
*/
package net.java.sip.communicator.impl.protocol.zeroconf;
-import java.util.*;
-
import net.java.sip.communicator.service.protocol.*;
import net.java.sip.communicator.service.protocol.event.*;
import net.java.sip.communicator.util.*;
@@ -23,11 +21,6 @@ public class ProtocolProviderServiceZeroconfImpl
{
private static final Logger logger =
Logger.getLogger(ProtocolProviderServiceZeroconfImpl.class);
-
- /**
- * The hashtable with the operation sets that we support locally.
- */
- private Hashtable supportedOperationSets = new Hashtable();
/**
* We use this to lock access to initialization.
@@ -152,21 +145,6 @@ public class ProtocolProviderServiceZeroconfImpl
}
}
-
- /**
- * Returns the operation set corresponding to the specified class or null
- * if this operation set is not supported by the provider implementation.
- *
- * @param opsetClass the <tt>Class</tt> of the operation set that we're
- * looking for.
- * @return returns an OperationSet of the specified <tt>Class</tt> if
- * the undelying implementation supports it or null otherwise.
- */
- public OperationSet getOperationSet(Class opsetClass)
- {
- return (OperationSet) getSupportedOperationSets()
- .get(opsetClass.getName());
- }
/**
* Returns the short name of the protocol that the implementation of this
@@ -194,20 +172,6 @@ public class ProtocolProviderServiceZeroconfImpl
}
/**
- * Returns an array containing all operation sets supported by the
- * current implementation.
- *
- * @return a java.util.Map containing instance of all supported
- * operation sets mapped against their class names (e.g.
- * OperationSetPresence.class.getName()) .
- */
- public Map getSupportedOperationSets()
- {
- //Copy the map so that the caller is not able to modify it.
- return (Map)supportedOperationSets.clone();
- }
-
- /**
* Starts the registration process.
*
* @param authority the security authority that will be used for