diff options
author | Lyubomir Marinov <lyubomir.marinov@jitsi.org> | 2009-10-17 21:12:14 +0000 |
---|---|---|
committer | Lyubomir Marinov <lyubomir.marinov@jitsi.org> | 2009-10-17 21:12:14 +0000 |
commit | 4268a877c9752967456772cbbc2e33200e2a476c (patch) | |
tree | 86e6492dd9d601b1fdea7bd29bd19534e45f7f9e /src/net/java | |
parent | 7277bf34b9abb4a5b2fa4f4984d2bc02952b432d (diff) | |
download | jitsi-4268a877c9752967456772cbbc2e33200e2a476c.zip jitsi-4268a877c9752967456772cbbc2e33200e2a476c.tar.gz jitsi-4268a877c9752967456772cbbc2e33200e2a476c.tar.bz2 |
Uses AbstractProtocolProviderService#addSupportedOperationSet in its extenders because it's type-safe and shortens the code.
Diffstat (limited to 'src/net/java')
12 files changed, 262 insertions, 329 deletions
diff --git a/src/net/java/sip/communicator/impl/protocol/dict/ProtocolProviderServiceDictImpl.java b/src/net/java/sip/communicator/impl/protocol/dict/ProtocolProviderServiceDictImpl.java index 35d507c..93e9e21 100644 --- a/src/net/java/sip/communicator/impl/protocol/dict/ProtocolProviderServiceDictImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/dict/ProtocolProviderServiceDictImpl.java @@ -100,25 +100,22 @@ public class ProtocolProviderServiceDictImpl OperationSetPersistentPresenceDictImpl persistentPresence = new OperationSetPersistentPresenceDictImpl(this); - supportedOperationSets.put( - OperationSetPersistentPresence.class.getName(), + addSupportedOperationSet( + OperationSetPersistentPresence.class, persistentPresence); - - //register it once again for those that simply need presence and //won't be smart enough to check for a persistent presence //alternative - supportedOperationSets.put( OperationSetPresence.class.getName(), - persistentPresence); + addSupportedOperationSet( + OperationSetPresence.class, + persistentPresence); //initialize the IM operation set - OperationSetBasicInstantMessagingDictImpl basicInstantMessaging - = new OperationSetBasicInstantMessagingDictImpl( - this, persistentPresence); - - supportedOperationSets.put( - OperationSetBasicInstantMessaging.class.getName(), - basicInstantMessaging); + addSupportedOperationSet( + OperationSetBasicInstantMessaging.class, + new OperationSetBasicInstantMessagingDictImpl( + this, + persistentPresence)); //initialize the typing notifications operation set /*OperationSetTypingNotifications typingNotifications = @@ -132,7 +129,7 @@ public class ProtocolProviderServiceDictImpl isInitialized = true; } } - + /** * Returns the <tt>DictConnection</tt> opened by this provider * @return the <tt>DictConnection</tt> opened by this provider diff --git a/src/net/java/sip/communicator/impl/protocol/facebook/ProtocolProviderServiceFacebookImpl.java b/src/net/java/sip/communicator/impl/protocol/facebook/ProtocolProviderServiceFacebookImpl.java index d04d4bd..e8d8624 100644 --- a/src/net/java/sip/communicator/impl/protocol/facebook/ProtocolProviderServiceFacebookImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/facebook/ProtocolProviderServiceFacebookImpl.java @@ -89,18 +89,15 @@ public class ProtocolProviderServiceFacebookImpl OperationSetPersistentPresenceFacebookImpl persistentPresence
= new OperationSetPersistentPresenceFacebookImpl(this);
- supportedOperationSets
- .put(
- OperationSetPersistentPresence.class.getName(),
- persistentPresence);
-
+ addSupportedOperationSet(
+ OperationSetPersistentPresence.class,
+ persistentPresence);
// register it once again for those that simply need presence and
// won't be smart enough to check for a persistent presence
// alternative
- supportedOperationSets
- .put(
- OperationSetPresence.class.getName(),
- persistentPresence);
+ addSupportedOperationSet(
+ OperationSetPresence.class,
+ persistentPresence);
// initialize the IM operation set
OperationSetBasicInstantMessagingFacebookImpl basicInstantMessaging
@@ -108,32 +105,29 @@ public class ProtocolProviderServiceFacebookImpl this,
persistentPresence);
- supportedOperationSets
- .put(
- OperationSetBasicInstantMessaging.class.getName(),
- basicInstantMessaging);
+ addSupportedOperationSet(
+ OperationSetBasicInstantMessaging.class,
+ basicInstantMessaging);
// initialize the message operation set
- supportedOperationSets
- .put(
- OperationSetSmsMessaging.class.getName(),
- new OperationSetSmsMessagingFacebookImpl(
- this,
- persistentPresence));
+ addSupportedOperationSet(
+ OperationSetSmsMessaging.class,
+ new OperationSetSmsMessagingFacebookImpl(
+ this,
+ persistentPresence));
// initialize the typing notifications operation set
OperationSetTypingNotificationsFacebookImpl typingNotifications
= new OperationSetTypingNotificationsFacebookImpl(this);
- supportedOperationSets
- .put(
- OperationSetTypingNotifications.class.getName(),
- typingNotifications);
+
+ addSupportedOperationSet(
+ OperationSetTypingNotifications.class,
+ typingNotifications);
// initialize the server stored contact info operation set
- supportedOperationSets
- .put(
- OperationSetServerStoredContactInfo.class.getName(),
- new OperationSetServerStoredContactInfoFacebookImpl(this));
+ addSupportedOperationSet(
+ OperationSetServerStoredContactInfo.class,
+ new OperationSetServerStoredContactInfoFacebookImpl(this));
facebookAdapter
= new FacebookAdapter(
diff --git a/src/net/java/sip/communicator/impl/protocol/gibberish/ProtocolProviderServiceGibberishImpl.java b/src/net/java/sip/communicator/impl/protocol/gibberish/ProtocolProviderServiceGibberishImpl.java index 05e4c73..40cf85c 100644 --- a/src/net/java/sip/communicator/impl/protocol/gibberish/ProtocolProviderServiceGibberishImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/gibberish/ProtocolProviderServiceGibberishImpl.java @@ -88,51 +88,46 @@ public class ProtocolProviderServiceGibberishImpl OperationSetPersistentPresenceGibberishImpl persistentPresence = new OperationSetPersistentPresenceGibberishImpl(this); - supportedOperationSets.put( - OperationSetPersistentPresence.class.getName(), + addSupportedOperationSet( + OperationSetPersistentPresence.class, persistentPresence); - - //register it once again for those that simply need presence and //won't be smart enough to check for a persistent presence //alternative - supportedOperationSets.put( OperationSetPresence.class.getName(), - persistentPresence); + addSupportedOperationSet( + OperationSetPresence.class, + persistentPresence); //initialize the IM operation set - OperationSetBasicInstantMessagingGibberishImpl basicInstantMessaging - = new OperationSetBasicInstantMessagingGibberishImpl( - this, persistentPresence); - - supportedOperationSets.put( - OperationSetBasicInstantMessaging.class.getName(), - basicInstantMessaging); + addSupportedOperationSet( + OperationSetBasicInstantMessaging.class, + new OperationSetBasicInstantMessagingGibberishImpl( + this, + persistentPresence)); //initialize the typing notifications operation set - OperationSetTypingNotifications typingNotifications = + addSupportedOperationSet( + OperationSetTypingNotifications.class, new OperationSetTypingNotificationsGibberishImpl( - this, persistentPresence); - - supportedOperationSets.put( - OperationSetTypingNotifications.class.getName(), - typingNotifications); + this, + persistentPresence)); //initialize the basic telephony operation set OperationSetBasicTelephonyGibberishImpl telphonyOpSet = new OperationSetBasicTelephonyGibberishImpl(this); - this.supportedOperationSets.put( - OperationSetBasicTelephony.class.getName(), - telphonyOpSet); + addSupportedOperationSet( + OperationSetBasicTelephony.class, + telphonyOpSet); //initialize the telephony conferencing operation set OperationSetTelephonyConferencing conferenceOpSet = new OperationSetTelephonyConferencingGibberishImpl( this, telphonyOpSet); - this.supportedOperationSets.put( - OperationSetTelephonyConferencing.class.getName(), - conferenceOpSet); + addSupportedOperationSet( + OperationSetTelephonyConferencing.class, + conferenceOpSet); isInitialized = true; } diff --git a/src/net/java/sip/communicator/impl/protocol/icq/ProtocolProviderServiceIcqImpl.java b/src/net/java/sip/communicator/impl/protocol/icq/ProtocolProviderServiceIcqImpl.java index 3d1d518..72c99c7 100644 --- a/src/net/java/sip/communicator/impl/protocol/icq/ProtocolProviderServiceIcqImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/icq/ProtocolProviderServiceIcqImpl.java @@ -455,91 +455,70 @@ public class ProtocolProviderServiceIcqImpl if(IcqAccountID.isAIM(accountID.getAccountProperties())) USING_ICQ = false; - supportedOperationSets.put( - OperationSetInstantMessageTransform.class.getName(), + addSupportedOperationSet( + OperationSetInstantMessageTransform.class, new OperationSetInstantMessageTransformImpl()); //initialize the presence operationset OperationSetPersistentPresence persistentPresence = new OperationSetPersistentPresenceIcqImpl(this, screenname); - supportedOperationSets.put( - OperationSetPersistentPresence.class.getName(), + addSupportedOperationSet( + OperationSetPersistentPresence.class, persistentPresence); - //register it once again for those that simply need presence - supportedOperationSets.put( OperationSetPresence.class.getName(), - persistentPresence); + addSupportedOperationSet( + OperationSetPresence.class, + persistentPresence); //initialize the IM operation set - OperationSetBasicInstantMessaging basicInstantMessaging = - new OperationSetBasicInstantMessagingIcqImpl(this); - - supportedOperationSets.put( - OperationSetBasicInstantMessaging.class.getName(), - basicInstantMessaging); + addSupportedOperationSet( + OperationSetBasicInstantMessaging.class, + new OperationSetBasicInstantMessagingIcqImpl(this)); - //initialize the multi chat operation set - OperationSetAdHocMultiUserChatIcqImpl multiUserOpSet - = new OperationSetAdHocMultiUserChatIcqImpl(this); - - supportedOperationSets.put( - OperationSetAdHocMultiUserChat.class.getName(), - multiUserOpSet); + //initialize the multi chat operation set + addSupportedOperationSet( + OperationSetAdHocMultiUserChat.class, + new OperationSetAdHocMultiUserChatIcqImpl(this)); //initialize the typing notifications operation set - OperationSetTypingNotifications typingNotifications = - new OperationSetTypingNotificationsIcqImpl(this); - - supportedOperationSets.put( - OperationSetTypingNotifications.class.getName(), - typingNotifications); + addSupportedOperationSet( + OperationSetTypingNotifications.class, + new OperationSetTypingNotificationsIcqImpl(this)); if(USING_ICQ) { this.infoRetreiver = new InfoRetreiver(this, screenname); - OperationSetServerStoredContactInfo serverStoredContactInfo = - new OperationSetServerStoredContactInfoIcqImpl - (infoRetreiver, this); - - supportedOperationSets.put( - OperationSetServerStoredContactInfo.class.getName(), - serverStoredContactInfo); - - OperationSetServerStoredAccountInfo serverStoredAccountInfo = - new OperationSetServerStoredAccountInfoIcqImpl - (infoRetreiver, screenname, this); - - supportedOperationSets.put( - OperationSetServerStoredAccountInfo.class.getName(), - serverStoredAccountInfo); - - OperationSetWebAccountRegistration webAccountRegistration = - new OperationSetWebAccountRegistrationIcqImpl(); - supportedOperationSets.put( - OperationSetWebAccountRegistration.class.getName(), - webAccountRegistration); - - OperationSetWebContactInfo webContactInfo = - new OperationSetWebContactInfoIcqImpl(); - supportedOperationSets.put( - OperationSetWebContactInfo.class.getName(), - webContactInfo); - - OperationSetExtendedAuthorizationsIcqImpl extendedAuth = - new OperationSetExtendedAuthorizationsIcqImpl(this); - supportedOperationSets.put( - OperationSetExtendedAuthorizations.class.getName(), - extendedAuth); - + addSupportedOperationSet( + OperationSetServerStoredContactInfo.class, + new OperationSetServerStoredContactInfoIcqImpl( + infoRetreiver, + this)); + + addSupportedOperationSet( + OperationSetServerStoredAccountInfo.class, + new OperationSetServerStoredAccountInfoIcqImpl( + infoRetreiver, + screenname, + this)); + + addSupportedOperationSet( + OperationSetWebAccountRegistration.class, + new OperationSetWebAccountRegistrationIcqImpl()); + + addSupportedOperationSet( + OperationSetWebContactInfo.class, + new OperationSetWebContactInfoIcqImpl()); + + addSupportedOperationSet( + OperationSetExtendedAuthorizations.class, + new OperationSetExtendedAuthorizationsIcqImpl(this)); } - OperationSetFileTransferIcqImpl fileTransferOpSet - = new OperationSetFileTransferIcqImpl(this); - supportedOperationSets.put( - OperationSetFileTransfer.class.getName(), - fileTransferOpSet); + addSupportedOperationSet( + OperationSetFileTransfer.class, + new OperationSetFileTransferIcqImpl(this)); isInitialized = true; } diff --git a/src/net/java/sip/communicator/impl/protocol/irc/ProtocolProviderServiceIrcImpl.java b/src/net/java/sip/communicator/impl/protocol/irc/ProtocolProviderServiceIrcImpl.java index e618b69..86cd780 100644 --- a/src/net/java/sip/communicator/impl/protocol/irc/ProtocolProviderServiceIrcImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/irc/ProtocolProviderServiceIrcImpl.java @@ -88,14 +88,19 @@ public class ProtocolProviderServiceIrcImpl //Initialize the multi user chat support multiUserChat = new OperationSetMultiUserChatIrcImpl(this); - supportedOperationSets.put( - OperationSetMultiUserChat.class.getName(), multiUserChat); + addSupportedOperationSet( + OperationSetMultiUserChat.class, + multiUserChat); - this.ircStack = new IrcStack( this, - getAccountID().getUserID(), - getAccountID().getUserID(), - "SIP Communicator 1.0", - ""); + userID = getAccountID().getUserID(); + + ircStack + = new IrcStack( + this, + userID, + userID, + "SIP Communicator 1.0", + ""); isInitialized = true; } @@ -151,28 +156,21 @@ public class ProtocolProviderServiceIrcImpl throws OperationFailedException { AccountID accountID = getAccountID(); - - String serverAddress = - accountID - .getAccountPropertyString(ProtocolProviderFactory.SERVER_ADDRESS); - - String serverPort = - accountID - .getAccountPropertyString(ProtocolProviderFactory.SERVER_PORT); - - if(serverPort == null || serverPort.equals("")) - { - serverPort = "6667"; - } - + String serverAddress + = accountID + .getAccountPropertyString( + ProtocolProviderFactory.SERVER_ADDRESS); + int serverPort + = accountID + .getAccountPropertyInt( + ProtocolProviderFactory.SERVER_PORT, + 6667); //Verify whether a password has already been stored for this account String serverPassword = IrcActivator. getProtocolProviderFactory().loadPassword(getAccountID()); - boolean autoNickChange = accountID.getAccountPropertyBoolean( ProtocolProviderFactory.AUTO_CHANGE_USER_NAME, true); - boolean passwordRequired = accountID.getAccountPropertyBoolean( ProtocolProviderFactory.NO_PASSWORD_REQUIRED, true); @@ -215,7 +213,7 @@ public class ProtocolProviderServiceIrcImpl } this.ircStack.connect( serverAddress, - Integer.parseInt(serverPort), + serverPort, serverPassword, autoNickChange); } diff --git a/src/net/java/sip/communicator/impl/protocol/jabber/ProtocolProviderServiceJabberImpl.java b/src/net/java/sip/communicator/impl/protocol/jabber/ProtocolProviderServiceJabberImpl.java index 99b5879..f968ccf 100644 --- a/src/net/java/sip/communicator/impl/protocol/jabber/ProtocolProviderServiceJabberImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/jabber/ProtocolProviderServiceJabberImpl.java @@ -567,16 +567,17 @@ public class ProtocolProviderServiceJabberImpl "http://www.xmpp.org/extensions/xep-0168.html#ns"); } - supportedOperationSets.put( - OperationSetPersistentPresence.class.getName(), + addSupportedOperationSet( + OperationSetPersistentPresence.class, persistentPresence); // TODO: add the feature, if any, corresponding to persistent // presence, if someone knows // supportedFeatures.add(_PRESENCE_); //register it once again for those that simply need presence - supportedOperationSets.put( OperationSetPresence.class.getName(), - persistentPresence); + addSupportedOperationSet( + OperationSetPresence.class, + persistentPresence); //initialize the IM operation set OperationSetBasicInstantMessagingJabberImpl basicInstantMessaging = @@ -586,70 +587,53 @@ public class ProtocolProviderServiceJabberImpl basicInstantMessaging.setKeepAliveEnabled(Boolean .parseBoolean(keepAliveStrValue)); - supportedOperationSets.put( - OperationSetBasicInstantMessaging.class.getName(), + addSupportedOperationSet( + OperationSetBasicInstantMessaging.class, basicInstantMessaging); // The http://jabber.org/protocol/xhtml-im feature is included // already in smack. //initialize the Whiteboard operation set - OperationSetWhiteboardingJabberImpl whiteboard = - new OperationSetWhiteboardingJabberImpl (this); - - supportedOperationSets.put ( - OperationSetWhiteboarding.class.getName(), whiteboard); + addSupportedOperationSet( + OperationSetWhiteboarding.class, + new OperationSetWhiteboardingJabberImpl(this)); //initialize the typing notifications operation set - OperationSetTypingNotifications typingNotifications = - new OperationSetTypingNotificationsJabberImpl(this); - - supportedOperationSets.put( - OperationSetTypingNotifications.class.getName(), - typingNotifications); + addSupportedOperationSet( + OperationSetTypingNotifications.class, + new OperationSetTypingNotificationsJabberImpl(this)); // The http://jabber.org/protocol/chatstates feature implemented in // OperationSetTypingNotifications is included already in smack. //initialize the multi user chat operation set - OperationSetMultiUserChat multiUserChat = - new OperationSetMultiUserChatJabberImpl(this); - - supportedOperationSets.put( - OperationSetMultiUserChat.class.getName(), - multiUserChat); + addSupportedOperationSet( + OperationSetMultiUserChat.class, + new OperationSetMultiUserChatJabberImpl(this)); InfoRetreiver infoRetreiver = new InfoRetreiver(this, screenname); - OperationSetServerStoredContactInfo contactInfo = - new OperationSetServerStoredContactInfoJabberImpl(infoRetreiver); - - supportedOperationSets.put( - OperationSetServerStoredContactInfo.class.getName(), - contactInfo); + addSupportedOperationSet( + OperationSetServerStoredContactInfo.class, + new OperationSetServerStoredContactInfoJabberImpl( + infoRetreiver)); - OperationSetServerStoredAccountInfo accountInfo = + addSupportedOperationSet( + OperationSetServerStoredAccountInfo.class, new OperationSetServerStoredAccountInfoJabberImpl( - this, infoRetreiver, screenname); - - supportedOperationSets.put( - OperationSetServerStoredAccountInfo.class.getName(), - accountInfo); + this, + infoRetreiver, + screenname)); // initialize the file transfer operation set - OperationSetFileTransfer fileTransfer - = new OperationSetFileTransferJabberImpl(this); - - supportedOperationSets.put( - OperationSetFileTransfer.class.getName(), - fileTransfer); - - OperationSetInstantMessageTransform messageTransform - = new OperationSetInstantMessageTransformImpl(); + addSupportedOperationSet( + OperationSetFileTransfer.class, + new OperationSetFileTransferJabberImpl(this)); - supportedOperationSets.put( - OperationSetInstantMessageTransform.class.getName(), - messageTransform); + addSupportedOperationSet( + OperationSetInstantMessageTransform.class, + new OperationSetInstantMessageTransformImpl()); // Include features we're supporting in plus of the four that // included by smack itself: @@ -661,12 +645,9 @@ public class ProtocolProviderServiceJabberImpl supportedFeatures.add("urn:xmpp:bob"); // initialize the thumbnailed file factory operation set - OperationSetThumbnailedFileFactory thumbnailFactory - = new OperationSetThumbnailedFileFactoryImpl(); - - supportedOperationSets.put( - OperationSetThumbnailedFileFactory.class.getName(), - thumbnailFactory); + addSupportedOperationSet( + OperationSetThumbnailedFileFactory.class, + new OperationSetThumbnailedFileFactoryImpl()); // TODO: this is the "main" feature to advertise when a client // support muc. We have to add some features for @@ -681,17 +662,15 @@ public class ProtocolProviderServiceJabberImpl //check if we are supposed to start telephony //initialize the telephony opset - String enableJingle = (String)JabberActivator - .getConfigurationService().getProperty(PNAME_ENABLE_JINGLE); - if( Boolean.getBoolean(enableJingle) - && JabberActivator.getMediaService() != null) + boolean enableJingle + = JabberActivator + .getConfigurationService() + .getBoolean(PNAME_ENABLE_JINGLE, false); + if(enableJingle && JabberActivator.getMediaService() != null) { - OperationSetBasicTelephony opSetBasicTelephony - = new OperationSetBasicTelephonyJabberImpl(this); - - supportedOperationSets.put( - OperationSetBasicTelephony.class.getName(), - opSetBasicTelephony); + addSupportedOperationSet( + OperationSetBasicTelephony.class, + new OperationSetBasicTelephonyJabberImpl(this)); // Add Jingle features to supported features. supportedFeatures.add("urn:xmpp:jingle:1"); diff --git a/src/net/java/sip/communicator/impl/protocol/rss/ProtocolProviderServiceRssImpl.java b/src/net/java/sip/communicator/impl/protocol/rss/ProtocolProviderServiceRssImpl.java index 4027e12..46ffb20 100644 --- a/src/net/java/sip/communicator/impl/protocol/rss/ProtocolProviderServiceRssImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/rss/ProtocolProviderServiceRssImpl.java @@ -92,25 +92,24 @@ public class ProtocolProviderServiceRssImpl OperationSetPersistentPresenceRssImpl persistentPresence = new OperationSetPersistentPresenceRssImpl(this); - supportedOperationSets.put( - OperationSetPersistentPresence.class.getName(), + addSupportedOperationSet( + OperationSetPersistentPresence.class, persistentPresence); - - //register it once again for those that simply need presence and //won't be smart enough to check for a persistent presence //alternative - supportedOperationSets.put( OperationSetPresence.class.getName(), - persistentPresence); + addSupportedOperationSet( + OperationSetPresence.class, + persistentPresence); //initialize the IM operation set //OperationSetBasicInstantMessagingRssImpl - basicInstantMessaging + basicInstantMessaging = new OperationSetBasicInstantMessagingRssImpl( - this, persistentPresence); - - supportedOperationSets.put( - OperationSetBasicInstantMessaging.class.getName(), + this, + persistentPresence); + addSupportedOperationSet( + OperationSetBasicInstantMessaging.class, basicInstantMessaging); isInitialized = true; diff --git a/src/net/java/sip/communicator/impl/protocol/sip/ProtocolProviderServiceSipImpl.java b/src/net/java/sip/communicator/impl/protocol/sip/ProtocolProviderServiceSipImpl.java index bc7a3d1..1f328c1 100644 --- a/src/net/java/sip/communicator/impl/protocol/sip/ProtocolProviderServiceSipImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/sip/ProtocolProviderServiceSipImpl.java @@ -425,60 +425,63 @@ public class ProtocolProviderServiceSipImpl //init our call processor OperationSetBasicTelephonySipImpl opSetBasicTelephonySipImpl = new OperationSetBasicTelephonySipImpl(this); - this.supportedOperationSets.put( - OperationSetBasicTelephony.class.getName() - , opSetBasicTelephonySipImpl); - this.supportedOperationSets.put( - OperationSetAdvancedTelephony.class.getName() - , opSetBasicTelephonySipImpl); + addSupportedOperationSet( + OperationSetBasicTelephony.class, + opSetBasicTelephonySipImpl); + addSupportedOperationSet( + OperationSetAdvancedTelephony.class, + opSetBasicTelephonySipImpl); // init ZRTP (OperationSetBasicTelephonySipImpl implements // OperationSetSecureTelephony) - this.supportedOperationSets.put( - OperationSetSecureTelephony.class.getName() - , opSetBasicTelephonySipImpl); + addSupportedOperationSet( + OperationSetSecureTelephony.class, + opSetBasicTelephonySipImpl); //init presence op set. OperationSetPersistentPresence opSetPersPresence = new OperationSetPresenceSipImpl(this, enablePresence, forceP2P, pollingValue, subscriptionExpiration); - this.supportedOperationSets.put( - OperationSetPersistentPresence.class.getName() - , opSetPersPresence); + + addSupportedOperationSet( + OperationSetPersistentPresence.class, + opSetPersPresence); //also register with standard presence - this.supportedOperationSets.put( - OperationSetPresence.class.getName() - , opSetPersPresence); + addSupportedOperationSet( + OperationSetPresence.class, + opSetPersPresence); if (enablePresence) { // init instant messaging OperationSetBasicInstantMessagingSipImpl opSetBasicIM = new OperationSetBasicInstantMessagingSipImpl(this); - this.supportedOperationSets.put( - OperationSetBasicInstantMessaging.class.getName(), + + addSupportedOperationSet( + OperationSetBasicInstantMessaging.class, opSetBasicIM); // init typing notifications - OperationSetTypingNotificationsSipImpl opSetTyping = - new OperationSetTypingNotificationsSipImpl(this, opSetBasicIM); - this.supportedOperationSets.put( - OperationSetTypingNotifications.class.getName(), - opSetTyping); + addSupportedOperationSet( + OperationSetTypingNotifications.class, + new OperationSetTypingNotificationsSipImpl( + this, + opSetBasicIM)); } // OperationSetVideoTelephony - supportedOperationSets.put( - OperationSetVideoTelephony.class.getName(), - new OperationSetVideoTelephonySipImpl(opSetBasicTelephonySipImpl)); + addSupportedOperationSet( + OperationSetVideoTelephony.class, + new OperationSetVideoTelephonySipImpl( + opSetBasicTelephonySipImpl)); // init DTMF (from JM Heitz) - supportedOperationSets.put( - OperationSetDTMF.class.getName(), + addSupportedOperationSet( + OperationSetDTMF.class, new OperationSetDTMFSipImpl(this)); - supportedOperationSets.put( - OperationSetTelephonyConferencing.class.getName(), + addSupportedOperationSet( + OperationSetTelephonyConferencing.class, new OperationSetTelephonyConferencingSipImpl(this)); //initialize our OPTIONS handler diff --git a/src/net/java/sip/communicator/impl/protocol/ssh/ProtocolProviderServiceSSHImpl.java b/src/net/java/sip/communicator/impl/protocol/ssh/ProtocolProviderServiceSSHImpl.java index f493424..10b1354 100644 --- a/src/net/java/sip/communicator/impl/protocol/ssh/ProtocolProviderServiceSSHImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/ssh/ProtocolProviderServiceSSHImpl.java @@ -144,33 +144,29 @@ public class ProtocolProviderServiceSSHImpl OperationSetPersistentPresenceSSHImpl persistentPresence = new OperationSetPersistentPresenceSSHImpl(this); - supportedOperationSets.put( - OperationSetPersistentPresence.class.getName(), - persistentPresence); - + addSupportedOperationSet( + OperationSetPersistentPresence.class, + persistentPresence); //register it once again for those that simply need presence and //won't be smart enough to check for a persistent presence //alternative - supportedOperationSets.put( - OperationSetPresence.class.getName(), - persistentPresence); + addSupportedOperationSet( + OperationSetPresence.class, + persistentPresence); //initialize the IM operation set basicInstantMessaging = new OperationSetBasicInstantMessagingSSHImpl( this); - - supportedOperationSets.put( - OperationSetBasicInstantMessaging.class.getName(), - basicInstantMessaging); + addSupportedOperationSet( + OperationSetBasicInstantMessaging.class, + basicInstantMessaging); //initialze the file transfer operation set - fileTranfer = new OperationSetFileTransferSSHImpl( - this); - - supportedOperationSets.put( - OperationSetFileTransfer.class.getName(), - fileTranfer); + fileTranfer = new OperationSetFileTransferSSHImpl(this); + addSupportedOperationSet( + OperationSetFileTransfer.class, + fileTranfer); isInitialized = true; } diff --git a/src/net/java/sip/communicator/impl/protocol/yahoo/ProtocolProviderServiceYahooImpl.java b/src/net/java/sip/communicator/impl/protocol/yahoo/ProtocolProviderServiceYahooImpl.java index 519828c..572d327 100644 --- a/src/net/java/sip/communicator/impl/protocol/yahoo/ProtocolProviderServiceYahooImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/yahoo/ProtocolProviderServiceYahooImpl.java @@ -318,50 +318,41 @@ public class ProtocolProviderServiceYahooImpl { this.accountID = accountID; - supportedOperationSets.put( - OperationSetInstantMessageTransform.class.getName(), + addSupportedOperationSet( + OperationSetInstantMessageTransform.class, new OperationSetInstantMessageTransformImpl()); //initialize the presence operationset - persistentPresence = new OperationSetPersistentPresenceYahooImpl(this); - - supportedOperationSets.put( - OperationSetPersistentPresence.class.getName(), + persistentPresence + = new OperationSetPersistentPresenceYahooImpl(this); + addSupportedOperationSet( + OperationSetPersistentPresence.class, persistentPresence); - //register it once again for those that simply need presence - supportedOperationSets.put( OperationSetPresence.class.getName(), - persistentPresence); + addSupportedOperationSet( + OperationSetPresence.class, + persistentPresence); //initialize the IM operation set - OperationSetBasicInstantMessagingYahooImpl basicInstantMessaging = - new OperationSetBasicInstantMessagingYahooImpl(this); - - supportedOperationSets.put( - OperationSetBasicInstantMessaging.class.getName(), - basicInstantMessaging); + addSupportedOperationSet( + OperationSetBasicInstantMessaging.class, + new OperationSetBasicInstantMessagingYahooImpl(this)); - //initialize the multi user chat operation set - OperationSetAdHocMultiUserChatYahooImpl multiUserChatOpSet = - new OperationSetAdHocMultiUserChatYahooImpl(this); - - supportedOperationSets.put( - OperationSetAdHocMultiUserChat.class.getName(), - multiUserChatOpSet); + //initialize the multi user chat operation set + addSupportedOperationSet( + OperationSetAdHocMultiUserChat.class, + new OperationSetAdHocMultiUserChatYahooImpl(this)); //initialize the typing notifications operation set - typingNotifications = - new OperationSetTypingNotificationsYahooImpl(this); - - supportedOperationSets.put( - OperationSetTypingNotifications.class.getName(), + typingNotifications + = new OperationSetTypingNotificationsYahooImpl(this); + addSupportedOperationSet( + OperationSetTypingNotifications.class, typingNotifications); - OperationSetFileTransferYahooImpl fileTransferOpSet = - new OperationSetFileTransferYahooImpl(this); - - supportedOperationSets.put(OperationSetFileTransfer.class.getName(), - fileTransferOpSet); + addSupportedOperationSet( + OperationSetFileTransfer.class, + new OperationSetFileTransferYahooImpl(this)); isInitialized = true; } 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 80f9e54..fba8b40 100644 --- a/src/net/java/sip/communicator/impl/protocol/zeroconf/ProtocolProviderServiceZeroconfImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/zeroconf/ProtocolProviderServiceZeroconfImpl.java @@ -112,29 +112,26 @@ public class ProtocolProviderServiceZeroconfImpl OperationSetPersistentPresenceZeroconfImpl persistentPresence = new OperationSetPersistentPresenceZeroconfImpl(this); - supportedOperationSets.put( - OperationSetPersistentPresence.class.getName(), + addSupportedOperationSet( + OperationSetPersistentPresence.class, persistentPresence); - - //register it once again for those that simply need presence and //won't be smart enough to check for a persistent presence //alternative - supportedOperationSets.put( OperationSetPresence.class.getName(), - persistentPresence); + addSupportedOperationSet( + OperationSetPresence.class, + persistentPresence); //initialize the IM operation set - OperationSetBasicInstantMessagingZeroconfImpl basicInstantMessaging - = new OperationSetBasicInstantMessagingZeroconfImpl( - this, persistentPresence); - - supportedOperationSets.put( - OperationSetBasicInstantMessaging.class.getName(), - basicInstantMessaging); + addSupportedOperationSet( + OperationSetBasicInstantMessaging.class, + new OperationSetBasicInstantMessagingZeroconfImpl( + this, + persistentPresence)); //initialize the typing notifications operation set - supportedOperationSets.put( - OperationSetTypingNotifications.class.getName(), + addSupportedOperationSet( + OperationSetTypingNotifications.class, new OperationSetTypingNotificationsZeroconfImpl(this)); isInitialized = true; diff --git a/src/net/java/sip/communicator/service/protocol/AbstractProtocolProviderService.java b/src/net/java/sip/communicator/service/protocol/AbstractProtocolProviderService.java index c8d6fb5..8f4e2b0 100644 --- a/src/net/java/sip/communicator/service/protocol/AbstractProtocolProviderService.java +++ b/src/net/java/sip/communicator/service/protocol/AbstractProtocolProviderService.java @@ -21,8 +21,11 @@ import net.java.sip.communicator.util.*; public abstract class AbstractProtocolProviderService implements ProtocolProviderService { + /** - * Logger of this class + * The <tt>Logger</tt> instances used by the + * <tt>AbstractProtocolProviderService</tt> class and its instances for + * logging output. */ private static final Logger logger = Logger.getLogger(AbstractProtocolProviderService.class); @@ -37,7 +40,7 @@ public abstract class AbstractProtocolProviderService /** * The hashtable with the operation sets that we support locally. */ - protected final Map<String, OperationSet> supportedOperationSets + private final Map<String, OperationSet> supportedOperationSets = new Hashtable<String, OperationSet>(); /** @@ -60,9 +63,9 @@ public abstract class AbstractProtocolProviderService /** * Adds a specific <tt>OperationSet</tt> implementation to the set of * supported <tt>OperationSet</tt>s of this instance. Serves as a type-safe - * wrapper around {@link #supportedOperationSets} and its - * {@link Hashtable#put(String, OperationSet)} and also shortens the code - * which performs such additions. + * wrapper around {@link #supportedOperationSets} which works with class + * names instead of <tt>Class</tt> and also shortens the code which performs + * such additions. * * @param <T> the exact type of the <tt>OperationSet</tt> implementation to * be added @@ -146,11 +149,13 @@ public abstract class AbstractProtocolProviderService /** * Returns the operation set corresponding to the specified class or null if * this operation set is not supported by the provider implementation. - * + * + * @param <T> the exact type of the <tt>OperationSet</tt> that we're looking + * for * @param opsetClass the <tt>Class</tt> of the operation set that we're * looking for. * @return returns an <tt>OperationSet</tt> of the specified <tt>Class</tt> - * if the undelying implementation supports it; <tt>null</tt>, otherwise. + * if the underlying implementation supports it; <tt>null</tt>, otherwise. */ @SuppressWarnings("unchecked") public <T extends OperationSet> T getOperationSet(Class<T> opsetClass) |