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).

cusax-fix
Lyubomir Marinov 18 years ago
parent 690b5fa412
commit 331d75a93a

@ -10,6 +10,7 @@
import java.util.*;
import org.osgi.framework.*;
import net.java.sip.communicator.service.callhistory.*;
import net.java.sip.communicator.service.callhistory.event.*;
import net.java.sip.communicator.service.contactlist.*;
@ -678,10 +679,9 @@ private void handleProviderAdded(ProtocolProviderService provider)
logger.debug("Adding protocol provider " + provider.getProtocolName());
// check whether the provider has a basic telephony operation set
OperationSetBasicTelephony opSetTelephony
= (OperationSetBasicTelephony) provider
.getSupportedOperationSets().get(
OperationSetBasicTelephony.class.getName());
OperationSetBasicTelephony opSetTelephony =
(OperationSetBasicTelephony) provider
.getOperationSet(OperationSetBasicTelephony.class);
if (opSetTelephony != null)
{
@ -701,10 +701,9 @@ private void handleProviderAdded(ProtocolProviderService provider)
*/
private void handleProviderRemoved(ProtocolProviderService provider)
{
OperationSetBasicTelephony opSetTelephony
= (OperationSetBasicTelephony) provider
.getSupportedOperationSets().get(
OperationSetBasicTelephony.class.getName());
OperationSetBasicTelephony opSetTelephony =
(OperationSetBasicTelephony) provider
.getOperationSet(OperationSetBasicTelephony.class);
if (opSetTelephony != null)
{

@ -9,6 +9,7 @@
import java.util.*;
import org.osgi.framework.*;
import net.java.sip.communicator.service.contactlist.*;
import net.java.sip.communicator.service.contactlist.event.*;
import net.java.sip.communicator.service.protocol.*;
@ -356,10 +357,9 @@ private void addNewContactToMetaContact( ProtocolProviderService provider,
boolean fireEvent)
throws MetaContactListException
{
OperationSetPersistentPresence opSetPersPresence
= (OperationSetPersistentPresence) provider
.getSupportedOperationSets().get(
OperationSetPersistentPresence.class.getName());
OperationSetPersistentPresence opSetPersPresence =
(OperationSetPersistentPresence) provider
.getOperationSet(OperationSetPersistentPresence.class);
if (opSetPersPresence == null)
{
/** @todo handle non-persistent presence operation sets as well */
@ -507,10 +507,9 @@ private ContactGroup resolveProtoPath(ProtocolProviderService protoProvider,
throw new NullPointerException("Internal Error. Orphan group.");
}
OperationSetPersistentPresence opSetPersPresence
= (OperationSetPersistentPresence) protoProvider
.getSupportedOperationSets().get(OperationSetPersistentPresence
.class.getName());
OperationSetPersistentPresence opSetPersPresence =
(OperationSetPersistentPresence) protoProvider
.getOperationSet(OperationSetPersistentPresence.class);
//if persistent presence is not supported - just bail
//we should have verified this earlier anyway
@ -889,10 +888,9 @@ public void moveContact(Contact contact,
currentParentMetaContact.removeProtoContact(contact);
//get a persistent presence operation set
OperationSetPersistentPresence opSetPresence
= (OperationSetPersistentPresence) contact
.getProtocolProvider().getSupportedOperationSets()
.get(OperationSetPersistentPresence.class.getName());
OperationSetPersistentPresence opSetPresence =
(OperationSetPersistentPresence) contact.getProtocolProvider()
.getOperationSet(OperationSetPersistentPresence.class);
if (opSetPresence == null)
{
@ -991,10 +989,10 @@ public void moveMetaContact(MetaContact metaContact,
.getProtocolProvider(), (MetaContactGroupImpl) newMetaGroup);
//get a persistent or non persistent presence operation set
OperationSetPersistentPresence opSetPresence
= (OperationSetPersistentPresence) protoContact
.getProtocolProvider().getSupportedOperationSets()
.get(OperationSetPersistentPresence.class.getName());
OperationSetPersistentPresence opSetPresence =
(OperationSetPersistentPresence) protoContact
.getProtocolProvider().getOperationSet(
OperationSetPersistentPresence.class);
if (opSetPresence == null)
{
@ -1040,15 +1038,14 @@ public void removeContact(Contact contact) throws MetaContactListException
//provider
OperationSetPresence opSetPresence =
(OperationSetPresence) contact.getProtocolProvider()
.getSupportedOperationSets().get(OperationSetPresence.class
.getName());
.getOperationSet(OperationSetPresence.class);
//in case the provider only hase a persistent operation set:
//in case the provider only has a persistent operation set:
if (opSetPresence == null)
{
opSetPresence = (OperationSetPresence) contact.getProtocolProvider()
.getSupportedOperationSets().get(
OperationSetPersistentPresence.class.getName());
opSetPresence =
(OperationSetPresence) contact.getProtocolProvider()
.getOperationSet(OperationSetPersistentPresence.class);
if (opSetPresence == null)
{
@ -1145,10 +1142,10 @@ public void removeMetaContactGroup(
{
ContactGroup protoGroup = protoGroups.next();
OperationSetPersistentPresence opSetPersPresence
= (OperationSetPersistentPresence) protoGroup
.getProtocolProvider().getSupportedOperationSets().get(
OperationSetPersistentPresence.class.getName());
OperationSetPersistentPresence opSetPersPresence =
(OperationSetPersistentPresence) protoGroup
.getProtocolProvider().getOperationSet(
OperationSetPersistentPresence.class);
if (opSetPersPresence == null)
{
@ -1405,7 +1402,7 @@ public MetaContactGroup findMetaContactGroupByMetaUID(String metaGroupID)
public Iterator<MetaContact> findAllMetaContactsForProvider(
ProtocolProviderService protocolProvider)
{
ArrayList<MetaContact> resultList = new ArrayList();
List<MetaContact> resultList = new ArrayList<MetaContact>();
this.findAllMetaContactsForProvider(protocolProvider,
rootMetaGroup,
@ -1619,11 +1616,9 @@ private void handleProviderAdded(
+ provider.getProtocolName());
// check whether the provider has a persistent presence op set
OperationSetPersistentPresence opSetPersPresence
= (OperationSetPersistentPresence) provider
.getSupportedOperationSets().get(
OperationSetPersistentPresence.class
.getName());
OperationSetPersistentPresence opSetPersPresence =
(OperationSetPersistentPresence) provider
.getOperationSet(OperationSetPersistentPresence.class);
this.currentlyInstalledProviders.put(
provider.getAccountID().getAccountUniqueID(),
@ -2760,9 +2755,8 @@ ContactGroup loadStoredContactGroup(MetaContactGroupImpl containingMetaGroup,
ProtocolProviderService sourceProvider = (ProtocolProviderService)
currentlyInstalledProviders.get(accountID);
OperationSetPersistentPresence presenceOpSet =
(OperationSetPersistentPresence)sourceProvider
.getSupportedOperationSets().get(OperationSetPersistentPresence
.class.getName());
(OperationSetPersistentPresence) sourceProvider
.getOperationSet(OperationSetPersistentPresence.class);
ContactGroup newProtoGroup = presenceOpSet.createUnresolvedContactGroup(
contactGroupUID, persistentData,
@ -2812,9 +2806,8 @@ void loadStoredMetaContact(
ProtocolProviderService sourceProvider = (ProtocolProviderService)
currentlyInstalledProviders.get(accountID);
OperationSetPersistentPresence presenceOpSet =
(OperationSetPersistentPresence)sourceProvider
.getSupportedOperationSets().get(OperationSetPersistentPresence
.class.getName());
(OperationSetPersistentPresence) sourceProvider
.getOperationSet(OperationSetPersistentPresence.class);
Iterator<MclStorageManager.StoredProtoContactDescriptor> contactsIter
= protoContacts.iterator();

@ -300,10 +300,9 @@ private void handleProviderAdded(ProtocolProviderService provider)
logger.debug("Adding protocol provider " + provider.getProtocolName());
// check whether the provider has a basic im operation set
OperationSetBasicInstantMessaging opSetIm
= (OperationSetBasicInstantMessaging) provider
.getSupportedOperationSets().get(
OperationSetBasicInstantMessaging.class.getName());
OperationSetBasicInstantMessaging opSetIm =
(OperationSetBasicInstantMessaging) provider
.getOperationSet(OperationSetBasicInstantMessaging.class);
if (opSetIm != null)
{
@ -334,10 +333,9 @@ private void handleProviderAdded(ProtocolProviderService provider)
*/
private void handleProviderRemoved(ProtocolProviderService provider)
{
OperationSetBasicInstantMessaging opSetIm
= (OperationSetBasicInstantMessaging) provider
.getSupportedOperationSets().get(
OperationSetBasicInstantMessaging.class.getName());
OperationSetBasicInstantMessaging opSetIm =
(OperationSetBasicInstantMessaging) provider
.getOperationSet(OperationSetBasicInstantMessaging.class);
if (opSetIm != null)
{

@ -293,8 +293,8 @@ private void init()
this.moveSubcontactMenu.add(contactItem1);
// add all the contacts that support telephony to the call menu
if (contact.getProtocolProvider().getSupportedOperationSets()
.get(OperationSetBasicTelephony.class.getName()) != null)
if (contact.getProtocolProvider().getOperationSet(
OperationSetBasicTelephony.class) != null)
{
JMenuItem callContactItem = new JMenuItem(contactDisplayName);
callContactItem.setIcon(protocolIcon);
@ -304,9 +304,8 @@ private void init()
this.callContactMenu.add(callContactItem);
}
OperationSetWebContactInfo wContactInfo
= (OperationSetWebContactInfo) protocolProvider
.getOperationSet(OperationSetWebContactInfo.class);
// TODO Why is OperationSetWebContactInfo requested and not used?
protocolProvider.getOperationSet(OperationSetWebContactInfo.class);
}
this.add(sendMessageItem);
@ -641,16 +640,17 @@ private void callContact(Contact contact)
*/
private Contact getContactFromMetaContact(String itemID)
{
Iterator i = contactItem.getContacts();
Iterator<Contact> i = contactItem.getContacts();
while(i.hasNext())
while (i.hasNext())
{
Contact contact = (Contact)i.next();
Contact contact = i.next();
String id = contact.getAddress()
+ contact.getProtocolProvider().getProtocolName();
String id =
contact.getAddress()
+ contact.getProtocolProvider().getProtocolName();
if(itemID.equals(id))
if (itemID.equals(id))
{
return contact;
}

@ -24,7 +24,6 @@
import net.java.sip.communicator.service.protocol.event.*;
import net.java.sip.communicator.util.*;
/**
* The Message History Service stores messages exchanged through the various protocols
* Logs messages for all protocol providers that support basic instant messaging
@ -929,10 +928,9 @@ private void handleProviderAdded(ProtocolProviderService provider)
+ provider.getProtocolDisplayName());
// check whether the provider has a basic im operation set
OperationSetBasicInstantMessaging opSetIm
= (OperationSetBasicInstantMessaging) provider
.getSupportedOperationSets().get(
OperationSetBasicInstantMessaging.class.getName());
OperationSetBasicInstantMessaging opSetIm =
(OperationSetBasicInstantMessaging) provider
.getOperationSet(OperationSetBasicInstantMessaging.class);
if (opSetIm != null)
{
@ -943,10 +941,9 @@ private void handleProviderAdded(ProtocolProviderService provider)
logger.trace("Service did not have a im op. set.");
}
OperationSetMultiUserChat opSetMultiUChat
= (OperationSetMultiUserChat) provider
.getSupportedOperationSets().get(
OperationSetMultiUserChat.class.getName());
OperationSetMultiUserChat opSetMultiUChat =
(OperationSetMultiUserChat) provider
.getOperationSet(OperationSetMultiUserChat.class);
if (opSetMultiUChat != null)
{
@ -975,20 +972,18 @@ private void handleProviderAdded(ProtocolProviderService provider)
*/
private void handleProviderRemoved(ProtocolProviderService provider)
{
OperationSetBasicInstantMessaging opSetIm
= (OperationSetBasicInstantMessaging) provider
.getSupportedOperationSets().get(
OperationSetBasicInstantMessaging.class.getName());
OperationSetBasicInstantMessaging opSetIm =
(OperationSetBasicInstantMessaging) provider
.getOperationSet(OperationSetBasicInstantMessaging.class);
if (opSetIm != null)
{
opSetIm.removeMessageListener(this);
}
OperationSetMultiUserChat opSetMultiUChat
= (OperationSetMultiUserChat) provider
.getSupportedOperationSets().get(
OperationSetMultiUserChat.class.getName());
OperationSetMultiUserChat opSetMultiUChat =
(OperationSetMultiUserChat) provider
.getOperationSet(OperationSetMultiUserChat.class);
if (opSetMultiUChat != null)
{

@ -6,8 +6,6 @@
*/
package net.java.sip.communicator.impl.protocol.dict;
import java.util.*;
import net.java.dict4j.*;
import net.java.sip.communicator.service.protocol.*;
import net.java.sip.communicator.service.protocol.event.*;
@ -43,11 +41,6 @@ public class ProtocolProviderServiceDictImpl
*/
private Object initializationLock = new Object();
/**
* The hashtable with the operation sets that we support locally.
*/
private Hashtable supportedOperationSets = new Hashtable();
/**
* Indicates whether or not the provider is initialized and ready for use.
*/
@ -162,21 +155,6 @@ public AccountID getAccountID()
return accountID;
}
/**
* 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
* provider is based upon (like SIP, Jabber, ICQ/AIM, or others for
@ -211,20 +189,6 @@ public RegistrationState getRegistrationState()
return currentRegistrationState;
}
/**
* 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.
*

@ -6,8 +6,6 @@
*/
package net.java.sip.communicator.impl.protocol.gibberish;
import java.util.*;
import net.java.sip.communicator.service.protocol.*;
import net.java.sip.communicator.service.protocol.event.*;
import net.java.sip.communicator.util.*;
@ -38,11 +36,6 @@ public class ProtocolProviderServiceGibberishImpl
*/
private Object initializationLock = new Object();
/**
* The hashtable with the operation sets that we support locally.
*/
private Hashtable supportedOperationSets = new Hashtable();
/**
* Indicates whether or not the provider is initialized and ready for use.
*/
@ -140,21 +133,6 @@ public AccountID getAccountID()
return accountID;
}
/**
* 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
* provider is based upon (like SIP, Jabber, ICQ/AIM, or others for
@ -180,20 +158,6 @@ public RegistrationState getRegistrationState()
return currentRegistrationState;
}
/**
* 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.
*

@ -366,9 +366,9 @@ public void registrationStateChanged(RegistrationStateChangeEvent evt)
icqProvider.getAimConnection().getIcbmService()
.addIcbmListener(joustSimIcbmListener);
opSetPersPresence = (OperationSetPersistentPresenceIcqImpl)
icqProvider.getSupportedOperationSets()
.get(OperationSetPersistentPresence.class.getName());
opSetPersPresence =
(OperationSetPersistentPresenceIcqImpl) icqProvider
.getOperationSet(OperationSetPersistentPresence.class);
}
else if (evt.getNewState() == RegistrationState.REGISTERED)
{

@ -502,10 +502,9 @@ public void registrationStateChanged(RegistrationStateChangeEvent evt)
.getProperty("icq.custom.message.charset")) != null)
OscarTools.setDefaultCharset(customMessageEncoding);
opSetPersPresence
= (OperationSetPersistentPresenceIcqImpl) icqProvider
.getSupportedOperationSets().get(
OperationSetPersistentPresence.class.getName());
opSetPersPresence =
(OperationSetPersistentPresenceIcqImpl) icqProvider
.getOperationSet(OperationSetPersistentPresence.class);
//add ChatRoomMangagerListener
icqProvider.getAimConnection().getChatRoomManager()

@ -1243,9 +1243,8 @@ else if(evt.getNewState() == RegistrationState.REGISTERED)
if(parentProvider.USING_ICQ)
{
opSetExtendedAuthorizations =
(OperationSetExtendedAuthorizationsIcqImpl)
parentProvider.getSupportedOperationSets()
.get(OperationSetExtendedAuthorizations.class.getName());
(OperationSetExtendedAuthorizationsIcqImpl) parentProvider
.getOperationSet(OperationSetExtendedAuthorizations.class);
if(presenceQueryTimer == null)
presenceQueryTimer = new Timer();

@ -246,10 +246,9 @@ public void registrationStateChanged(RegistrationStateChangeEvent evt)
icqProvider.getAimConnection().getIcbmService()
.addIcbmListener(joustSimIcbmListener);
opSetPersPresence = (OperationSetPersistentPresenceIcqImpl)
icqProvider.getSupportedOperationSets()
.get(OperationSetPersistentPresence.class.getName());
opSetPersPresence =
(OperationSetPersistentPresenceIcqImpl) icqProvider
.getOperationSet(OperationSetPersistentPresence.class);
}
}
}

@ -33,11 +33,6 @@ public class ProtocolProviderServiceIcqImpl
private static final Logger logger =
Logger.getLogger(ProtocolProviderServiceIcqImpl.class);
/**
* The hashtable with the operation sets that we support locally.
*/
private Hashtable supportedOperationSets = new Hashtable();
private DefaultAppSession session = null;
private AimSession aimSession = null;
@ -437,33 +432,6 @@ public String getProtocolDisplayName()
return ProtocolNames.AIM;
}
/**
* Returns an array containing all operation sets supported by the
* current implementation.
*
* @return an array of OperationSet-s supported by this protocol
* provider implementation.
*/
public Map getSupportedOperationSets()
{
return supportedOperationSets;
}
/**
* 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());
}
/**
* Initialized the service implementation, and puts it in a sate where it
* could interoperate with other services. It is strongly recomended that

@ -37,12 +37,7 @@ public class ProtocolProviderServiceIrcImpl
/**
* We use this to lock access to initialization.
*/
private Object initializationLock = new Object();
/**
* The hashtable with the operation sets that we support locally.
*/
private Hashtable supportedOperationSets = new Hashtable();
private final Object initializationLock = new Object();
/**
* The operation set managing multi user chat.
@ -119,21 +114,6 @@ public AccountID getAccountID()
return accountID;
}
/**
* 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 underlying 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
* provider is based upon (like SIP, Jabber, ICQ/AIM, or others for
@ -159,20 +139,6 @@ public RegistrationState getRegistrationState()
return currentRegistrationState;
}
/**
* 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.
*

@ -271,9 +271,9 @@ public void registrationStateChanged(RegistrationStateChangeEvent evt)
if (evt.getNewState() == RegistrationState.REGISTERED)
{
opSetPersPresence = (OperationSetPersistentPresenceJabberImpl)
jabberProvider.getSupportedOperationSets()
.get(OperationSetPersistentPresence.class.getName());
opSetPersPresence =
(OperationSetPersistentPresenceJabberImpl) jabberProvider
.getOperationSet(OperationSetPersistentPresence.class);
jabberProvider.getConnection().addPacketListener(
new SmackMessageListener(),

@ -286,9 +286,9 @@ public void registrationStateChanged(RegistrationStateChangeEvent evt)
+ " to: " + evt.getNewState());
if (evt.getNewState() == RegistrationState.REGISTERED)
{
opSetPersPresence = (OperationSetPersistentPresenceJabberImpl)
jabberProvider.getSupportedOperationSets()
.get(OperationSetPersistentPresence.class.getName());
opSetPersPresence =
(OperationSetPersistentPresenceJabberImpl) jabberProvider
.getOperationSet(OperationSetPersistentPresence.class);
messageEventManager =
new MessageEventManager(jabberProvider.getConnection());

@ -35,11 +35,6 @@ public class ProtocolProviderServiceJabberImpl
private static final Logger logger =
Logger.getLogger(ProtocolProviderServiceJabberImpl.class);
/**
* The hashtable with the operation sets that we support locally.
*/
private Hashtable supportedOperationSets = new Hashtable();
/**
* Used to connect to a XMPP server.
*/
@ -451,33 +446,6 @@ public String getProtocolName()
return ProtocolNames.JABBER;
}
/**
* Returns an array containing all operation sets supported by the
* current implementation.
*
* @return an array of OperationSet-s supported by this protocol
* provider implementation.
*/
public Map getSupportedOperationSets()
{
return supportedOperationSets;
}
/**
* 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
* underlying implementation supports it or null otherwise.
*/
public OperationSet getOperationSet(Class opsetClass)
{
return (OperationSet)getSupportedOperationSets()
.get(opsetClass.getName());
}
/**
* Initialized the service implementation, and puts it in a sate where it
* could interoperate with other services. It is strongly recommended that
@ -708,9 +676,7 @@ private class JabberConnectionListener
public void connectionClosed()
{
OperationSetPersistentPresenceJabberImpl opSetPersPresence =
(OperationSetPersistentPresenceJabberImpl)
getSupportedOperationSets()
.get(OperationSetPersistentPresence.class.getName());
(OperationSetPersistentPresenceJabberImpl) getOperationSet(OperationSetPersistentPresence.class);
opSetPersPresence.fireProviderPresenceStatusChangeEvent(
opSetPersPresence.getPresenceStatus(), getJabberStatusEnum()

@ -28,7 +28,8 @@ public class MockProvider
/**
* The operation sets that our mock provider supports.
*/
private Hashtable supportedOperationSets = new Hashtable();
private final Map<String, OperationSet> supportedOperationSets =
new Hashtable<String, OperationSet>();
/**
* The presence operation set supported by the mock provider.
@ -127,7 +128,7 @@ public RegistrationState getRegistrationState()
* operation sets mapped against their class names (e.g.
* OperationSetPresence.class.getName()) .
*/
public Map getSupportedOperationSets()
public Map<String, OperationSet> getSupportedOperationSets()
{
return this.supportedOperationSets;
}
@ -141,7 +142,7 @@ public Map getSupportedOperationSets()
* @return returns an OperationSet of the specified <tt>Class</tt> if the
* undelying implementation supports it or null otherwise.
*/
public OperationSet getOperationSet(Class opsetClass)
public OperationSet getOperationSet(Class<? extends OperationSet> opsetClass)
{
return (OperationSet) getSupportedOperationSets()
.get(opsetClass.getName());

@ -168,9 +168,9 @@ public void registrationStateChanged(RegistrationStateChangeEvent evt)
if (evt.getNewState() == RegistrationState.REGISTERED)
{
opSetPersPresence = (OperationSetPersistentPresenceMsnImpl)
msnProvider.getSupportedOperationSets()
.get(OperationSetPersistentPresence.class.getName());
opSetPersPresence =
(OperationSetPersistentPresenceMsnImpl) msnProvider
.getOperationSet(OperationSetPersistentPresence.class);
msnProvider.getMessenger().
addMessageListener(new MsnMessageListener());

@ -1,3 +1,9 @@
/*
* SIP Communicator, the OpenSource Java VoIP and Instant Messaging client.
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
package net.java.sip.communicator.impl.protocol.msn;
import java.util.*;
@ -558,11 +564,9 @@ public void registrationStateChanged(RegistrationStateChangeEvent evt)
{
if (evt.getNewState() == RegistrationState.REGISTERED)
{
opSetPersPresence =
(OperationSetPersistentPresenceMsnImpl) msnProvider
.getSupportedOperationSets().get(
OperationSetPersistentPresence.class.getName());
.getOperationSet(OperationSetPersistentPresence.class);
msnProvider.getMessenger().addSwitchboardListener(
new MsnSwitchboardListener());

@ -233,9 +233,9 @@ public void registrationStateChanged(RegistrationStateChangeEvent evt)
+ " to: " + evt.getNewState());
if (evt.getNewState() == RegistrationState.REGISTERED)
{
opSetPersPresence = (OperationSetPersistentPresenceMsnImpl)
msnProvider.getSupportedOperationSets()
.get(OperationSetPersistentPresence.class.getName());
opSetPersPresence =
(OperationSetPersistentPresenceMsnImpl) msnProvider
.getOperationSet(OperationSetPersistentPresence.class);
}
}
}

@ -29,11 +29,6 @@ public class ProtocolProviderServiceMsnImpl
private static final Logger logger =
Logger.getLogger(ProtocolProviderServiceMsnImpl.class);
/**
* The hashtable with the operation sets that we support locally.
*/
private Hashtable supportedOperationSets = new Hashtable();
private MsnMessenger messenger = null;
/**
@ -247,33 +242,6 @@ public String getProtocolName()
return ProtocolNames.MSN;
}
/**
* Returns an array containing all operation sets supported by the
* current implementation.
*
* @return an array of OperationSet-s supported by this protocol
* provider implementation.
*/
public Map getSupportedOperationSets()
{
return supportedOperationSets;
}
/**
* 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());
}
/**
* Initialized the service implementation, and puts it in a sate where it
* could interoperate with other services. It is strongly recomended that

@ -6,8 +6,6 @@
*/
package net.java.sip.communicator.impl.protocol.rss;
import java.util.*;
import net.java.sip.communicator.service.protocol.*;
import net.java.sip.communicator.service.protocol.event.*;
import net.java.sip.communicator.util.*;
@ -37,12 +35,7 @@ public class ProtocolProviderServiceRssImpl
/**
* We use this to lock access to initialization.
*/
private Object initializationLock = new Object();
/**
* The hashtable with the operation sets that we support locally.
*/
private Hashtable supportedOperationSets = new Hashtable();
private final Object initializationLock = new Object();
/**
* Indicates whether or not the provider is initialized and ready for use.
@ -60,8 +53,6 @@ public class ProtocolProviderServiceRssImpl
*/
private OperationSetBasicInstantMessagingRssImpl basicInstantMessaging;
private boolean start = false;
/**
* The registration state that we are currently in. Note that in a real
* world protocol implementation this field won't exist and the registration
@ -140,21 +131,6 @@ public AccountID getAccountID()
return accountID;
}
/**
* 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
* provider is based upon (like SIP, Jabber, ICQ/AIM, or others for
@ -180,20 +156,6 @@ public RegistrationState getRegistrationState()
return currentRegistrationState;
}
/**
* 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.
*

@ -548,9 +548,9 @@ public void registrationStateChanged(RegistrationStateChangeEvent evt)
if (evt.getNewState() == RegistrationState.REGISTERED)
{
opSetPersPresence = (OperationSetPresenceSipImpl)
sipProvider.getSupportedOperationSets()
.get(OperationSetPersistentPresence.class.getName());
opSetPersPresence =
(OperationSetPresenceSipImpl) sipProvider
.getOperationSet(OperationSetPersistentPresence.class);
}
}
}

@ -8,6 +8,7 @@
import java.text.*;
import java.util.*;
import javax.sip.*;
import javax.sip.header.*;
import javax.sip.message.*;
@ -15,10 +16,10 @@
import org.w3c.dom.*;
import net.java.sip.communicator.service.protocol.*;
import net.java.sip.communicator.service.protocol.Message;
import net.java.sip.communicator.service.protocol.event.*;
import net.java.sip.communicator.util.*;
import net.java.sip.communicator.util.xml.*;
import net.java.sip.communicator.service.protocol.Message;
/**
* A implementation of the typing notification operation
@ -133,9 +134,9 @@ public void registrationStateChanged(RegistrationStateChangeEvent evt)
if (evt.getNewState() == RegistrationState.REGISTERED)
{
opSetPersPresence = (OperationSetPresenceSipImpl)
sipProvider.getSupportedOperationSets()
.get(OperationSetPersistentPresence.class.getName());
opSetPersPresence =
(OperationSetPresenceSipImpl) sipProvider
.getOperationSet(OperationSetPersistentPresence.class);
}
}
}

@ -9,6 +9,7 @@
import java.net.*;
import java.text.*;
import java.util.*;
import javax.sip.*;
import javax.sip.address.*;
import javax.sip.header.*;
@ -16,6 +17,7 @@
import org.osgi.framework.*;
import net.java.sip.communicator.impl.protocol.sip.security.*;
import net.java.sip.communicator.service.protocol.*;
import net.java.sip.communicator.service.protocol.event.*;
@ -23,12 +25,10 @@
import net.java.sip.communicator.service.version.Version;
import net.java.sip.communicator.util.*;
import gov.nist.javax.sip.*;
import gov.nist.javax.sip.header.*;
import gov.nist.javax.sip.address.*;
import gov.nist.javax.sip.message.*;
import gov.nist.javax.sip.stack.*;
import net.java.sip.communicator.impl.protocol.sip.security.*;
/**
* A SIP implementation of the Protocol Provider Service.
@ -44,12 +44,6 @@ public class ProtocolProviderServiceSipImpl
private static final Logger logger =
Logger.getLogger(ProtocolProviderServiceSipImpl.class);
/**
* The hashtable with the operation sets that we support locally.
*/
private Hashtable<String, OperationSet> supportedOperationSets
= new Hashtable<String, OperationSet>();
/**
* The identifier of the account that this provider represents.
*/
@ -70,12 +64,6 @@ public class ProtocolProviderServiceSipImpl
*/
private List<String> registeredEvents = new ArrayList<String>();
/**
* The SipFactory instance used to create the SipStack and the Address
* Message and Header Factories.
*/
private SipFactory sipFactory;
/**
* The AddressFactory used to create URLs ans Address objects.
*/
@ -159,11 +147,6 @@ public class ProtocolProviderServiceSipImpl
*/
private MaxForwardsHeader maxForwardsHeader = null;
/**
* The contact header we use in non REGISTER requests.
*/
private ContactHeader genericContactHeader = null;
/**
* The header that we use to identify ourselves.
*/
@ -277,40 +260,6 @@ public List<String> getKnownEventsList()
return this.registeredEvents;
}
/**
* Returns an array containing all operation sets supported by the current
* implementation. When querying this method users must be prepared to
* receive any sybset of the OperationSet-s defined by this service. They
* MUST ignore any OperationSet-s that they are not aware of and that may be
* defined by future version of this service. Such "unknown" OperationSet-s
* though not encouraged, may also be defined by service implementors.
*
* @return a java.util.Map containing instance of all supported operation
* sets mapped against their class names (e.g.
* OperationSetPresence.class.getName()) .
*/
public Map<String, OperationSet> getSupportedOperationSets()
{
return supportedOperationSets;
}
/**
* 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());
}
/**
* Starts the registration process. Connection details such as
* registration server, user name/number are provided through the
@ -569,7 +518,7 @@ protected void initialize(String sipAddress,
OperationSetDTMF.class.getName(), opSetDTMF);
//initialize our OPTIONS handler
ClientCapabilities capabilities = new ClientCapabilities(this);
new ClientCapabilities(this);
//initialize our display name
ourDisplayName = (String)accountID.getAccountProperties()
@ -923,7 +872,6 @@ public void run() {
headerFactory = null;
messageFactory = null;
addressFactory = null;
sipFactory = null;
sipSecurityManager = null;
methodProcessors.clear();
@ -1522,9 +1470,6 @@ private void initRegistrarConnection(SipAccountID accountID)
private void initRegistrarlessConnection(SipAccountID accountID)
throws IllegalArgumentException
{
String userID = (String) accountID.getAccountProperties()
.get(ProtocolProviderFactory.USER_ID);
//registrar transport
String registrarTransport = (String) accountID.getAccountProperties()
.get(ProtocolProviderFactory.PREFERRED_TRANSPORT);
@ -1836,7 +1781,8 @@ public void registerMethodProcessor(String method,
}
else
{
Class methodProcessorClass = methodProcessor.getClass();
Class<? extends MethodProcessor> methodProcessorClass =
methodProcessor.getClass();
for (Iterator<MethodProcessor> processorIter =
processors.iterator(); processorIter.hasNext();)
{
@ -1967,7 +1913,7 @@ public UserAgentHeader getSipCommUserAgentHeader()
{
try
{
List userAgentTokens = new LinkedList();
List<String> userAgentTokens = new LinkedList<String>();
Version ver =
SipActivator.getVersionService().getCurrentVersion();

@ -9,20 +9,21 @@
* SSH Suport in SIP Communicator - GSoC' 07 Project
*
*/
package net.java.sip.communicator.impl.protocol.ssh;
import java.io.*;
import java.util.*;
import com.jcraft.jsch.*;
import javax.swing.*;
import org.osgi.framework.*;
import net.java.sip.communicator.service.protocol.*;
import net.java.sip.communicator.service.protocol.event.*;
import net.java.sip.communicator.util.Logger;
import net.java.sip.communicator.service.gui.*;
import org.osgi.framework.*;
import com.jcraft.jsch.*;
/**
* A SSH implementation of the ProtocolProviderService.
*
@ -75,12 +76,7 @@ public class ProtocolProviderServiceSSHImpl
/**
* We use this to lock access to initialization.
*/
private Object initializationLock = new Object();
/**
* The hashtable with the operation sets that we support locally.
*/
private final Hashtable supportedOperationSets = new Hashtable();
private final Object initializationLock = new Object();
private OperationSetBasicInstantMessagingSSHImpl basicInstantMessaging;
@ -514,21 +510,6 @@ public AccountID getAccountID()
return accountID;
}
/**
* 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
* provider is based upon (like SIP, Jabber, ICQ/AIM, or others for
@ -554,20 +535,6 @@ public RegistrationState getRegistrationState()
return currentRegistrationState;
}
/**
* 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.
*

@ -233,9 +233,9 @@ public void registrationStateChanged(RegistrationStateChangeEvent evt)
if (evt.getNewState() == RegistrationState.REGISTERED)
{
opSetPersPresence = (OperationSetPersistentPresenceYahooImpl)
yahooProvider.getSupportedOperationSets()
.get(OperationSetPersistentPresence.class.getName());
opSetPersPresence =
(OperationSetPersistentPresenceYahooImpl) yahooProvider
.getOperationSet(OperationSetPersistentPresence.class);
yahooProvider.getYahooSession().
addSessionListener(new YahooMessageListener());

@ -582,11 +582,9 @@ public void registrationStateChanged(RegistrationStateChangeEvent evt)
{
if (evt.getNewState() == RegistrationState.REGISTERED)
{
opSetPersPresence
= (OperationSetPersistentPresenceYahooImpl) yahooProvider
.getSupportedOperationSets().get(
OperationSetPersistentPresence.class.getName());
opSetPersPresence =
(OperationSetPersistentPresenceYahooImpl) yahooProvider
.getOperationSet(OperationSetPersistentPresence.class);
yahooProvider.getYahooSession().addSessionListener(
new YahooMessageListener());

@ -219,9 +219,9 @@ public void registrationStateChanged(RegistrationStateChangeEvent evt)
+ " to: " + evt.getNewState());
if (evt.getNewState() == RegistrationState.REGISTERED)
{
opSetPersPresence = (OperationSetPersistentPresenceYahooImpl)
yahooProvider.getSupportedOperationSets()
.get(OperationSetPersistentPresence.class.getName());
opSetPersPresence =
(OperationSetPersistentPresenceYahooImpl) yahooProvider
.getOperationSet(OperationSetPersistentPresence.class);
yahooProvider.getYahooSession().addSessionListener(new TypingListener());
}

@ -7,7 +7,6 @@
package net.java.sip.communicator.impl.protocol.yahoo;
import java.io.*;
import java.util.*;
import net.java.sip.communicator.service.protocol.*;
import net.java.sip.communicator.service.protocol.event.*;
@ -29,11 +28,6 @@ public class ProtocolProviderServiceYahooImpl
private static final Logger logger =
Logger.getLogger(ProtocolProviderServiceYahooImpl.class);
/**
* The hashtable with the operation sets that we support locally.
*/
private Hashtable supportedOperationSets = new Hashtable();
private YahooSession yahooSession = null;
/**
@ -278,33 +272,6 @@ public String getProtocolName()
return ProtocolNames.YAHOO;
}
/**
* Returns an array containing all operation sets supported by the
* current implementation.
*
* @return an array of OperationSet-s supported by this protocol
* provider implementation.
*/
public Map getSupportedOperationSets()
{
return supportedOperationSets;
}
/**
* 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());
}
/**
* Initialized the service implementation, and puts it in a sate where it
* could interoperate with other services. It is strongly recomended that

@ -75,9 +75,9 @@ public BonjourService(int port,
this.id = acc.getUserID();
this.pps = pps;
opSetPersPresence = (OperationSetPersistentPresenceZeroconfImpl)
pps.getSupportedOperationSets()
.get(OperationSetPersistentPresence.class.getName());
opSetPersPresence =
(OperationSetPersistentPresenceZeroconfImpl) pps
.getOperationSet(OperationSetPersistentPresence.class);
props = new Hashtable();

@ -81,13 +81,15 @@ public ClientThread(Socket sock, BonjourService bonjourService)
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

@ -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 @@ protected void initialize(String userID,
}
}
/**
* 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
@ -193,20 +171,6 @@ public RegistrationState getRegistrationState()
return currentRegistrationState;
}
/**
* 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.
*

@ -155,10 +155,9 @@ private void handleProviderAdded(ProtocolProviderService provider)
logger.debug("Adding protocol provider " + provider.getProtocolName());
// check whether the provider has a basic im operation set
OperationSetBasicInstantMessaging opSetIm
= (OperationSetBasicInstantMessaging) provider
.getSupportedOperationSets().get(
OperationSetBasicInstantMessaging.class.getName());
OperationSetBasicInstantMessaging opSetIm =
(OperationSetBasicInstantMessaging) provider
.getOperationSet(OperationSetBasicInstantMessaging.class);
if (opSetIm != null)
{
@ -170,10 +169,9 @@ private void handleProviderAdded(ProtocolProviderService provider)
}
// check whether the provider has a sms operation set
OperationSetSmsMessaging opSetSms
= (OperationSetSmsMessaging) provider
.getSupportedOperationSets().get(
OperationSetSmsMessaging.class.getName());
OperationSetSmsMessaging opSetSms =
(OperationSetSmsMessaging) provider
.getOperationSet(OperationSetSmsMessaging.class);
if (opSetSms != null)
{
@ -184,10 +182,9 @@ private void handleProviderAdded(ProtocolProviderService provider)
logger.trace("Service did not have a sms op. set.");
}
OperationSetMultiUserChat opSetMultiUChat
= (OperationSetMultiUserChat) provider
.getSupportedOperationSets().get(
OperationSetMultiUserChat.class.getName());
OperationSetMultiUserChat opSetMultiUChat =
(OperationSetMultiUserChat) provider
.getOperationSet(OperationSetMultiUserChat.class);
if (opSetMultiUChat != null)
{
@ -216,20 +213,18 @@ private void handleProviderAdded(ProtocolProviderService provider)
*/
private void handleProviderRemoved(ProtocolProviderService provider)
{
OperationSetBasicInstantMessaging opSetIm
= (OperationSetBasicInstantMessaging) provider
.getSupportedOperationSets().get(
OperationSetBasicInstantMessaging.class.getName());
OperationSetBasicInstantMessaging opSetIm =
(OperationSetBasicInstantMessaging) provider
.getOperationSet(OperationSetBasicInstantMessaging.class);
if (opSetIm != null)
{
opSetIm.removeMessageListener(this);
}
OperationSetMultiUserChat opSetMultiUChat
= (OperationSetMultiUserChat) provider
.getSupportedOperationSets().get(
OperationSetMultiUserChat.class.getName());
OperationSetMultiUserChat opSetMultiUChat =
(OperationSetMultiUserChat) provider
.getOperationSet(OperationSetMultiUserChat.class);
if (opSetMultiUChat != null)
{

@ -348,10 +348,9 @@ public void handleProviderAdded(ProtocolProviderService provider)
logger.debug("Adding protocol provider " + provider.getProtocolName());
// check whether the provider has a basic telephony operation set
OperationSetBasicTelephony opSetTelephony
= (OperationSetBasicTelephony) provider
.getSupportedOperationSets().get(
OperationSetBasicTelephony.class.getName());
OperationSetBasicTelephony opSetTelephony =
(OperationSetBasicTelephony) provider
.getOperationSet(OperationSetBasicTelephony.class);
if (opSetTelephony != null)
{
@ -372,10 +371,9 @@ public void handleProviderAdded(ProtocolProviderService provider)
*/
private void handleProviderRemoved(ProtocolProviderService provider)
{
OperationSetBasicTelephony opSetTelephony
= (OperationSetBasicTelephony) provider
.getSupportedOperationSets().get(
OperationSetBasicTelephony.class.getName());
OperationSetBasicTelephony opSetTelephony =
(OperationSetBasicTelephony) provider
.getOperationSet(OperationSetBasicTelephony.class);
if (opSetTelephony != null)
{

@ -32,6 +32,12 @@ public abstract class AbstractProtocolProviderService
private final List<RegistrationStateChangeListener> registrationListeners =
new ArrayList<RegistrationStateChangeListener>();
/**
* The hashtable with the operation sets that we support locally.
*/
protected final Map<String, OperationSet> supportedOperationSets
= new Hashtable<String, OperationSet>();
/**
* Registers the specified listener with this provider so that it would
* receive notifications on changes of its state or other properties such
@ -92,6 +98,20 @@ public void fireRegistrationStateChanged( RegistrationState oldState,
logger.trace("Done.");
}
/**
* 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<? extends OperationSet> opsetClass)
{
return doGetSupportedOperationSets().get(opsetClass.getName());
}
/**
* Returns the protocol display name. This is the name that would be used
* by the GUI to display the protocol name.
@ -106,6 +126,31 @@ public String getProtocolDisplayName()
return (displayName == null) ? getProtocolName() : displayName;
}
/**
* Returns an array containing all operation sets supported by the current
* implementation. When querying this method users must be prepared to
* receive any subset of the OperationSet-s defined by this service. They
* MUST ignore any OperationSet-s that they are not aware of and that may be
* defined by future version of this service. Such "unknown" OperationSet-s
* though not encouraged, may also be defined by service implementors.
*
* @return a java.util.Map containing instance of all supported operation
* sets mapped against their class names (e.g.
* OperationSetPresence.class.getName()) .
*/
public Map<String, OperationSet> getSupportedOperationSets()
{
Map<String, OperationSet> supportedOperationSets =
doGetSupportedOperationSets();
return new Hashtable<String, OperationSet>(supportedOperationSets);
}
protected Map<String, OperationSet> doGetSupportedOperationSets()
{
return supportedOperationSets;
}
/**
* Indicates whether or not this provider is registered
*

@ -10,7 +10,6 @@
import net.java.sip.communicator.service.protocol.event.*;
/**
* The ProtocolProvider interface should be implemented by bundles that wrap
* Instant Messaging and telephony protocol stacks. It gives the user interface
@ -134,7 +133,7 @@ public void removeRegistrationStateChangeListener(
/**
* Returns an array containing all operation sets supported by the current
* implementation. When querying this method users must be prepared to
* receive any sybset of the OperationSet-s defined by this service. They
* receive any subset of the OperationSet-s defined by this service. They
* MUST ignore any OperationSet-s that they are not aware of and that may be
* defined by future version of this service. Such "unknown" OperationSet-s
* though not encouraged, may also be defined by service implementors.
@ -143,7 +142,7 @@ public void removeRegistrationStateChangeListener(
* sets mapped against their class names (e.g.
* OperationSetPresence.class.getName()) .
*/
public Map getSupportedOperationSets();
public Map<String, OperationSet> getSupportedOperationSets();
/**
* Returns the operation set corresponding to the specified class or null
@ -154,7 +153,7 @@ public void removeRegistrationStateChangeListener(
* @return returns an OperationSet of the specified <tt>Class</tt> if the
* undelying implementation supports it or null otherwise.
*/
public OperationSet getOperationSet(Class opsetClass);
public OperationSet getOperationSet(Class<? extends OperationSet> opsetClass);
/**
* Makes the service implementation close all open sockets and release

@ -91,12 +91,9 @@ public void setupContact()
mockProvider = new MockProvider("CallHistoryMockUser");
//store thre presence op set of the new provider into the fixture
Map supportedOperationSets =
mockProvider.getSupportedOperationSets();
mockBTelphonyOpSet =
(MockOperationSetBasicTelephony) supportedOperationSets.get(
OperationSetBasicTelephony.class.getName());
(MockOperationSetBasicTelephony) mockProvider
.getOperationSet(OperationSetBasicTelephony.class);
System.setProperty(MetaContactListService.PROVIDER_MASK_PROPERTY, "1");

@ -118,22 +118,20 @@ public class MclSlickFixture
mockP1Grp1.addContact(emilP1);
mockP1Grp1.addSubgroup(subMockP1Grp);
mockPresOpSetP1 = (MockPersistentPresenceOperationSet) mockP1
.getSupportedOperationSets().get(
OperationSetPresence.class.getName());
mockPresOpSetP1 =
(MockPersistentPresenceOperationSet) mockP1
.getOperationSet(OperationSetPresence.class);
mockPresOpSetP1.addMockGroup(mockP1Grp1);
//init mock provider 2
mockP2Grp1.addContact(emilP2);
mockPresOpSetP2 = (MockPersistentPresenceOperationSet) mockP2
.getSupportedOperationSets().get(
OperationSetPresence.class.getName());
mockPresOpSetP2 =
(MockPersistentPresenceOperationSet) mockP2
.getOperationSet(OperationSetPresence.class);
mockPresOpSetP2.addMockGroup(mockP2Grp1);
}
public MclSlickFixture(Object obj)
{
}

@ -78,14 +78,11 @@ public void start(BundleContext context)
MclSlickFixture.mockProvider = provider;
//store thre presence op set of the new provider into the fixture
Map supportedOperationSets =
MclSlickFixture.mockProvider.getSupportedOperationSets();
//get the operation set presence here.
MclSlickFixture.mockPresOpSet =
(MockPersistentPresenceOperationSet)supportedOperationSets.get(
OperationSetPersistentPresence.class.getName());
(MockPersistentPresenceOperationSet) MclSlickFixture.mockProvider
.getOperationSet(OperationSetPersistentPresence.class);
//add the meta contact list tests.
addTestSuite(TestMetaContactList.class);
@ -175,10 +172,9 @@ public static ServiceRegistration registerMockProviderService(
*/
private void fillMockContactList(MockProvider provider)
{
MockPersistentPresenceOperationSet mockOpSet
= (MockPersistentPresenceOperationSet)provider.
getSupportedOperationSets().get( OperationSetPersistentPresence.
class.getName());
MockPersistentPresenceOperationSet mockOpSet =
(MockPersistentPresenceOperationSet) provider
.getOperationSet(OperationSetPersistentPresence.class);
MockContactGroup root =
(MockContactGroup)mockOpSet.getServerStoredContactListRoot();
root.addContact( new MockContact("Ivan Ivanov", provider) );

@ -45,10 +45,9 @@ protected void setUp() throws Exception
super.setUp();
fixture.setUp();
OperationSetPersistentPresence opSetPresence
= (OperationSetPersistentPresence)fixture.mockProvider
.getSupportedOperationSets().get(
OperationSetPersistentPresence.class.getName());
OperationSetPersistentPresence opSetPresence =
(OperationSetPersistentPresence) fixture.mockProvider
.getOperationSet(OperationSetPersistentPresence.class);
mockGroup = (MockContactGroup)opSetPresence
.getServerStoredContactListRoot();

@ -189,10 +189,10 @@ public void testPartialContactListRestauration()
{
//verify that contents of the meta contact list matches contents of
//the mock provider we removed.
ContactGroup oldProtoRoot = ((OperationSetPersistentPresence)fixture
.mockProvider.getSupportedOperationSets().get(
OperationSetPersistentPresence.class.getName()))
.getServerStoredContactListRoot();
ContactGroup oldProtoRoot =
((OperationSetPersistentPresence) fixture.mockProvider
.getOperationSet(OperationSetPersistentPresence.class))
.getServerStoredContactListRoot();
fixture.assertGroupEquals(
(MockContactGroup)oldProtoRoot
@ -202,10 +202,10 @@ public void testPartialContactListRestauration()
//verify that the new mock provider has created unresolved contacts
//for all contacts in the meta cl.
ContactGroup newProtoRoot = ((OperationSetPersistentPresence)fixture
.replacementMockPr.getSupportedOperationSets().get(
OperationSetPersistentPresence.class.getName()))
.getServerStoredContactListRoot();
ContactGroup newProtoRoot =
((OperationSetPersistentPresence) fixture.replacementMockPr
.getOperationSet(OperationSetPersistentPresence.class))
.getServerStoredContactListRoot();
assertEquals("Newly loaded provider does not match the old one."
, oldProtoRoot
@ -239,32 +239,32 @@ public void testCompleteContactListRestauration()
.registerMockProviderService(fixture.replacementMockP2);
//Get references to the root groups of the 2 providers we removed
ContactGroup oldProtoMockP1Root = ((OperationSetPersistentPresence)
fixture.mockP1.getSupportedOperationSets().get(
OperationSetPersistentPresence.class.getName()))
.getServerStoredContactListRoot();
ContactGroup oldProtoMockP1Root =
((OperationSetPersistentPresence) fixture.mockP1
.getOperationSet(OperationSetPersistentPresence.class))
.getServerStoredContactListRoot();
ContactGroup oldProtoMockP2Root = ( (OperationSetPersistentPresence)
fixture.mockP2.getSupportedOperationSets().
get(OperationSetPersistentPresence.class.getName()))
.getServerStoredContactListRoot();
ContactGroup oldProtoMockP2Root =
((OperationSetPersistentPresence) fixture.mockP2
.getOperationSet(OperationSetPersistentPresence.class))
.getServerStoredContactListRoot();
//verify that contacts tnat unresolved contacts that have been created
//inside that the replacement mock providers match those in the
//providers we removed.
ContactGroup newProtoMockP1Root = ((OperationSetPersistentPresence)fixture
.replacementMockP1.getSupportedOperationSets().get(
OperationSetPersistentPresence.class.getName()))
.getServerStoredContactListRoot();
ContactGroup newProtoMockP1Root =
((OperationSetPersistentPresence) fixture.replacementMockP1
.getOperationSet(OperationSetPersistentPresence.class))
.getServerStoredContactListRoot();
assertEquals("Newly loaded provider does not match the old one."
, oldProtoMockP1Root
, newProtoMockP1Root);
ContactGroup newProtoMockP2Root = ((OperationSetPersistentPresence)fixture
.replacementMockP2.getSupportedOperationSets().get(
OperationSetPersistentPresence.class.getName()))
.getServerStoredContactListRoot();
ContactGroup newProtoMockP2Root =
((OperationSetPersistentPresence) fixture.replacementMockP2
.getOperationSet(OperationSetPersistentPresence.class))
.getServerStoredContactListRoot();
assertEquals("Newly loaded provider does not match the old one."
, oldProtoMockP2Root

@ -111,7 +111,7 @@ public void setupContact()
mockProvider = new MockProvider("MessageHistoryMockUser");
//store thre presence op set of the new provider into the fixture
Map supportedOperationSets =
Map<String, OperationSet> supportedOperationSets =
mockProvider.getSupportedOperationSets();
//get the operation set presence here.

@ -216,7 +216,8 @@ public static Bundle findProtocolProviderBundle(
public void clearProvidersLists()
throws Exception
{
Map supportedOperationSets1 = provider1.getSupportedOperationSets();
Map<String, OperationSet> supportedOperationSets1 =
provider1.getSupportedOperationSets();
if ( supportedOperationSets1 == null
|| supportedOperationSets1.size() < 1)
@ -238,7 +239,8 @@ public void clearProvidersLists()
+ "Operation Sets");
// lets do it once again for the second provider
Map supportedOperationSets2 = provider2.getSupportedOperationSets();
Map<String, OperationSet> supportedOperationSets2 =
provider2.getSupportedOperationSets();
if (supportedOperationSets2 == null
|| supportedOperationSets2.size() < 1)

@ -10,6 +10,7 @@
import java.util.*;
import junit.framework.*;
import net.java.sip.communicator.service.protocol.*;
import net.java.sip.communicator.service.protocol.event.*;
import net.java.sip.communicator.util.*;
@ -49,7 +50,7 @@ protected void setUp() throws Exception
super.setUp();
fixture.setUp();
Map supportedOperationSets1 =
Map<String, OperationSet> supportedOperationSets1 =
fixture.provider1.getSupportedOperationSets();
if ( supportedOperationSets1 == null
@ -82,7 +83,7 @@ protected void setUp() throws Exception
+ "implementation of at least one of the PresenceOperationSets");
}
Map supportedOperationSets2 =
Map<String, OperationSet> supportedOperationSets2 =
fixture.provider2.getSupportedOperationSets();
if ( supportedOperationSets2 == null

@ -9,6 +9,7 @@
import java.util.*;
import junit.framework.*;
import net.java.sip.communicator.service.protocol.*;
import net.java.sip.communicator.service.protocol.event.*;
import net.java.sip.communicator.util.*;
@ -73,7 +74,7 @@ protected void setUp() throws Exception
super.setUp();
fixture.setUp();
Map supportedOperationSets1 =
Map<String, OperationSet> supportedOperationSets1 =
fixture.provider1.getSupportedOperationSets();
if ( supportedOperationSets1 == null
@ -96,8 +97,8 @@ protected void setUp() throws Exception
+ "Operation Sets");
// lets do it once again for the second provider
Map supportedOperationSets2 =
fixture.provider2.getSupportedOperationSets();
Map<String, OperationSet> supportedOperationSets2 =
fixture.provider2.getSupportedOperationSets();
if (supportedOperationSets2 == null
|| supportedOperationSets2.size() < 1)

@ -51,7 +51,7 @@ protected void setUp() throws Exception
super.setUp();
fixture.setUp();
Map supportedOperationSets1 =
Map<String, OperationSet> supportedOperationSets1 =
fixture.provider1.getSupportedOperationSets();
if ( supportedOperationSets1 == null
@ -76,7 +76,7 @@ protected void setUp() throws Exception
}
// do it once again for the second provider
Map supportedOperationSets2 =
Map<String, OperationSet> supportedOperationSets2 =
fixture.provider2.getSupportedOperationSets();
if ( supportedOperationSets2 == null

@ -44,7 +44,7 @@ protected void setUp() throws Exception
super.setUp();
fixture.setUp();
Map supportedOperationSets1 =
Map<String, OperationSet> supportedOperationSets1 =
fixture.provider1.getSupportedOperationSets();
if ( supportedOperationSets1 == null
@ -90,7 +90,7 @@ protected void setUp() throws Exception
+ "implementation of at least one of the PresenceOperationSets");
}
Map supportedOperationSets2 =
Map<String, OperationSet> supportedOperationSets2 =
fixture.provider2.getSupportedOperationSets();
if ( supportedOperationSets2 == null

@ -145,20 +145,19 @@ public void testRegister()
*/
public void testOperationSetTypes() throws Exception
{
Map supportedOperationSets
= fixture.provider1.getSupportedOperationSets();
Map<String, OperationSet> supportedOperationSets =
fixture.provider1.getSupportedOperationSets();
//make sure that keys (which are supposed to be class names) correspond
//what the class of the values recorded against them.
Iterator setNames = supportedOperationSets.keySet().iterator();
while (setNames.hasNext())
// make sure that keys (which are supposed to be class names) correspond
// what the class of the values recorded against them.
for (Map.Entry<String, OperationSet> entry : supportedOperationSets
.entrySet())
{
String setName = (String) setNames.next();
Object opSet = supportedOperationSets.get(setName);
String setName = entry.getKey();
Object opSet = entry.getValue();
assertTrue(opSet + " was not an instance of "
+ setName + " as declared"
, Class.forName(setName).isInstance(opSet));
assertTrue(opSet + " was not an instance of " + setName
+ " as declared", Class.forName(setName).isInstance(opSet));
}
}

@ -48,7 +48,7 @@ protected void setUp() throws Exception
super.setUp();
fixture.setUp();
Map supportedOperationSets =
Map<String, OperationSet> supportedOperationSets =
fixture.provider.getSupportedOperationSets();
if ( supportedOperationSets == null

@ -75,7 +75,7 @@ protected void setUp() throws Exception
super.setUp();
fixture.setUp();
Map supportedOperationSets =
Map<String, OperationSet> supportedOperationSets =
fixture.provider.getSupportedOperationSets();
if ( supportedOperationSets == null

@ -53,7 +53,7 @@ protected void setUp() throws Exception
super.setUp();
fixture.setUp();
Map supportedOperationSets =
Map<String, OperationSet> supportedOperationSets =
fixture.provider.getSupportedOperationSets();
if ( supportedOperationSets == null

@ -47,7 +47,7 @@ protected void setUp() throws Exception
super.setUp();
fixture.setUp();
Map supportedOperationSets =
Map<String, OperationSet> supportedOperationSets =
fixture.provider.getSupportedOperationSets();
if ( supportedOperationSets == null

@ -42,7 +42,7 @@ protected void setUp() throws Exception
super.setUp();
fixture.setUp();
Map supportedOperationSets =
Map<String, OperationSet> supportedOperationSets =
fixture.provider.getSupportedOperationSets();
if ( supportedOperationSets == null

@ -146,11 +146,9 @@ public void testRegister()
// Here is registered the listener which will receive the first message
// This message is supposed to be offline message and as one is tested
// in TestOperationSetBasicInstantMessaging.testReceiveOfflineMessages()
Map supportedOperationSets =
fixture.provider.getSupportedOperationSets();
OperationSetBasicInstantMessaging opSetBasicIM =
(OperationSetBasicInstantMessaging)supportedOperationSets.get(
OperationSetBasicInstantMessaging.class.getName());
(OperationSetBasicInstantMessaging) fixture.provider
.getOperationSet(OperationSetBasicInstantMessaging.class);
fixture.offlineMsgCollector.register(opSetBasicIM);
//give time for the AIM server to notify everyone of our arrival
@ -236,24 +234,22 @@ public void testGetRegistrationState()
*/
public void testOperationSetTypes() throws Exception
{
Map supportedOperationSets
= fixture.provider.getSupportedOperationSets();
Map<String, OperationSet> supportedOperationSets =
fixture.provider.getSupportedOperationSets();
//make sure that keys (which are supposed to be class names) correspond
//what the class of the values recorded against them.
Iterator setNames = supportedOperationSets.keySet().iterator();
while (setNames.hasNext())
// make sure that keys (which are supposed to be class names) correspond
// what the class of the values recorded against them.
for (Map.Entry<String, OperationSet> entry : supportedOperationSets
.entrySet())
{
String setName = (String) setNames.next();
Object opSet = supportedOperationSets.get(setName);
String setName = entry.getKey();
Object opSet = entry.getValue();
assertTrue(opSet + " was not an instance of "
+ setName + " as declared"
, Class.forName(setName).isInstance(opSet));
assertTrue(opSet + " was not an instance of " + setName
+ " as declared", Class.forName(setName).isInstance(opSet));
}
}
/**
* A class that would plugin as a registration listener to a protocol
* provider and simply record all events that it sees and notify the

@ -7,7 +7,6 @@
package net.java.sip.communicator.slick.protocol.jabber;
import java.util.*;
import java.util.Map;
import org.osgi.framework.*;
@ -229,7 +228,8 @@ public static Bundle findProtocolProviderBundle(
public void clearProvidersLists()
throws Exception
{
Map supportedOperationSets1 = provider1.getSupportedOperationSets();
Map<String, OperationSet> supportedOperationSets1 =
provider1.getSupportedOperationSets();
if ( supportedOperationSets1 == null
|| supportedOperationSets1.size() < 1)
@ -251,7 +251,8 @@ public void clearProvidersLists()
+ "Operation Sets");
// lets do it once again for the second provider
Map supportedOperationSets2 = provider2.getSupportedOperationSets();
Map<String, OperationSet> supportedOperationSets2 =
provider2.getSupportedOperationSets();
if (supportedOperationSets2 == null
|| supportedOperationSets2.size() < 1)

@ -49,7 +49,7 @@ protected void setUp() throws Exception
super.setUp();
fixture.setUp();
Map supportedOperationSets1 =
Map<String, OperationSet> supportedOperationSets1 =
fixture.provider1.getSupportedOperationSets();
if ( supportedOperationSets1 == null
@ -82,7 +82,7 @@ protected void setUp() throws Exception
+ "implementation of at least one of the PresenceOperationSets");
}
Map supportedOperationSets2 =
Map<String, OperationSet> supportedOperationSets2 =
fixture.provider2.getSupportedOperationSets();
if ( supportedOperationSets2 == null

@ -96,7 +96,7 @@ protected void setUp() throws Exception
super.setUp();
fixture.setUp();
Map supportedOperationSets1 =
Map<String, OperationSet> supportedOperationSets1 =
fixture.provider1.getSupportedOperationSets();
if ( supportedOperationSets1 == null
@ -129,7 +129,7 @@ protected void setUp() throws Exception
+ "implementation of at least one of the PresenceOperationSets");
}
Map supportedOperationSets2 =
Map<String, OperationSet> supportedOperationSets2 =
fixture.provider2.getSupportedOperationSets();
if ( supportedOperationSets2 == null

@ -70,7 +70,7 @@ protected void setUp() throws Exception
super.setUp();
fixture.setUp();
Map supportedOperationSets1 =
Map<String, OperationSet> supportedOperationSets1 =
fixture.provider1.getSupportedOperationSets();
if ( supportedOperationSets1 == null
@ -93,8 +93,8 @@ protected void setUp() throws Exception
+ "Operation Sets");
// lets do it once again for the second provider
Map supportedOperationSets2 =
fixture.provider2.getSupportedOperationSets();
Map<String, OperationSet> supportedOperationSets2 =
fixture.provider2.getSupportedOperationSets();
if (supportedOperationSets2 == null
|| supportedOperationSets2.size() < 1)

@ -55,7 +55,7 @@ protected void setUp() throws Exception
super.setUp();
fixture.setUp();
Map supportedOperationSets1 =
Map<String, OperationSet> supportedOperationSets1 =
fixture.provider1.getSupportedOperationSets();
if ( supportedOperationSets1 == null
@ -80,7 +80,7 @@ protected void setUp() throws Exception
}
// do it once again for the second provider
Map supportedOperationSets2 =
Map<String, OperationSet> supportedOperationSets2 =
fixture.provider2.getSupportedOperationSets();
if ( supportedOperationSets2 == null

@ -44,7 +44,7 @@ protected void setUp() throws Exception
super.setUp();
fixture.setUp();
Map supportedOperationSets1 =
Map<String, OperationSet> supportedOperationSets1 =
fixture.provider1.getSupportedOperationSets();
if ( supportedOperationSets1 == null
@ -90,7 +90,7 @@ protected void setUp() throws Exception
+ "implementation of at least one of the PresenceOperationSets");
}
Map supportedOperationSets2 =
Map<String, OperationSet> supportedOperationSets2 =
fixture.provider2.getSupportedOperationSets();
if ( supportedOperationSets2 == null

@ -145,20 +145,19 @@ public void testRegister()
*/
public void testOperationSetTypes() throws Exception
{
Map supportedOperationSets
= fixture.provider1.getSupportedOperationSets();
Map<String, OperationSet> supportedOperationSets =
fixture.provider1.getSupportedOperationSets();
//make sure that keys (which are supposed to be class names) correspond
//what the class of the values recorded against them.
Iterator setNames = supportedOperationSets.keySet().iterator();
while (setNames.hasNext())
// make sure that keys (which are supposed to be class names) correspond
// what the class of the values recorded against them.
for (Map.Entry<String, OperationSet> entry : supportedOperationSets
.entrySet())
{
String setName = (String) setNames.next();
Object opSet = supportedOperationSets.get(setName);
String setName = entry.getKey();
Object opSet = entry.getValue();
assertTrue(opSet + " was not an instance of "
+ setName + " as declared"
, Class.forName(setName).isInstance(opSet));
assertTrue(opSet + " was not an instance of " + setName
+ " as declared", Class.forName(setName).isInstance(opSet));
}
}

@ -9,7 +9,7 @@
import org.osgi.framework.*;
import junit.framework.*;
import net.java.sip.communicator.service.protocol.*;
import java.util.Map;
import java.util.*;
/**
@ -214,7 +214,8 @@ public static Bundle findProtocolProviderBundle(
public void clearProvidersLists()
throws Exception
{
Map supportedOperationSets1 = provider1.getSupportedOperationSets();
Map<String, OperationSet> supportedOperationSets1 =
provider1.getSupportedOperationSets();
if ( supportedOperationSets1 == null
|| supportedOperationSets1.size() < 1)
@ -236,7 +237,8 @@ public void clearProvidersLists()
+ "Operation Sets");
// lets do it once again for the second provider
Map supportedOperationSets2 = provider2.getSupportedOperationSets();
Map<String, OperationSet> supportedOperationSets2 =
provider2.getSupportedOperationSets();
if (supportedOperationSets2 == null
|| supportedOperationSets2.size() < 1)

@ -49,7 +49,7 @@ protected void setUp() throws Exception
super.setUp();
fixture.setUp();
Map supportedOperationSets1 =
Map<String, OperationSet> supportedOperationSets1 =
fixture.provider1.getSupportedOperationSets();
if ( supportedOperationSets1 == null
@ -82,7 +82,7 @@ protected void setUp() throws Exception
+ "implementation of at least one of the PresenceOperationSets");
}
Map supportedOperationSets2 =
Map<String, OperationSet> supportedOperationSets2 =
fixture.provider2.getSupportedOperationSets();
if ( supportedOperationSets2 == null

@ -70,7 +70,7 @@ protected void setUp() throws Exception
super.setUp();
fixture.setUp();
Map supportedOperationSets1 =
Map<String, OperationSet> supportedOperationSets1 =
fixture.provider1.getSupportedOperationSets();
if ( supportedOperationSets1 == null
@ -93,8 +93,8 @@ protected void setUp() throws Exception
+ "Operation Sets");
// lets do it once again for the second provider
Map supportedOperationSets2 =
fixture.provider2.getSupportedOperationSets();
Map<String, OperationSet> supportedOperationSets2 =
fixture.provider2.getSupportedOperationSets();
if (supportedOperationSets2 == null
|| supportedOperationSets2.size() < 1)

@ -49,7 +49,7 @@ protected void setUp() throws Exception
super.setUp();
fixture.setUp();
Map supportedOperationSets1 =
Map<String, OperationSet> supportedOperationSets1 =
fixture.provider1.getSupportedOperationSets();
if ( supportedOperationSets1 == null
@ -74,7 +74,7 @@ protected void setUp() throws Exception
}
// do it once again for the second provider
Map supportedOperationSets2 =
Map<String, OperationSet> supportedOperationSets2 =
fixture.provider2.getSupportedOperationSets();
if ( supportedOperationSets2 == null

@ -44,7 +44,7 @@ protected void setUp() throws Exception
super.setUp();
fixture.setUp();
Map supportedOperationSets1 =
Map<String, OperationSet> supportedOperationSets1 =
fixture.provider1.getSupportedOperationSets();
if ( supportedOperationSets1 == null
@ -90,7 +90,7 @@ protected void setUp() throws Exception
+ "implementation of at least one of the PresenceOperationSets");
}
Map supportedOperationSets2 =
Map<String, OperationSet> supportedOperationSets2 =
fixture.provider2.getSupportedOperationSets();
if ( supportedOperationSets2 == null

@ -9,6 +9,7 @@
import java.util.*;
import junit.framework.*;
import net.java.sip.communicator.service.protocol.*;
import net.java.sip.communicator.service.protocol.event.*;
import net.java.sip.communicator.util.*;
@ -145,20 +146,19 @@ public void testRegister()
*/
public void testOperationSetTypes() throws Exception
{
Map supportedOperationSets
= fixture.provider1.getSupportedOperationSets();
Map<String, OperationSet> supportedOperationSets =
fixture.provider1.getSupportedOperationSets();
//make sure that keys (which are supposed to be class names) correspond
//what the class of the values recorded against them.
Iterator setNames = supportedOperationSets.keySet().iterator();
while (setNames.hasNext())
// make sure that keys (which are supposed to be class names) correspond
// what the class of the values recorded against them.
for (Map.Entry<String, OperationSet> entry : supportedOperationSets
.entrySet())
{
String setName = (String) setNames.next();
Object opSet = supportedOperationSets.get(setName);
String setName = entry.getKey();
Object opSet = entry.getValue();
assertTrue(opSet + " was not an instance of "
+ setName + " as declared"
, Class.forName(setName).isInstance(opSet));
assertTrue(opSet + " was not an instance of " + setName
+ " as declared", Class.forName(setName).isInstance(opSet));
}
}

@ -116,20 +116,21 @@ public void testRegister() throws OperationFailedException
*/
public void testOperationsSets() throws ClassNotFoundException
{
Map supportedOperationSets =
fixture.provider.getSupportedOperationSets();
//get the keys for the supported operation set. The keys are strings
//corresponding to class names.
Iterator setNames = supportedOperationSets.keySet().iterator();
while (setNames.hasNext())
{
String key = (String) setNames.next();
Object opSet = supportedOperationSets.get(key);
assertTrue(opSet + " was not an instance of " + key +"as declared",
Class.forName(key).isInstance(opSet));
}
Map<String, OperationSet> supportedOperationSets =
fixture.provider.getSupportedOperationSets();
// get the keys for the supported operation set. The keys are strings
// corresponding to class names.
for (Map.Entry<String, OperationSet> entry : supportedOperationSets
.entrySet())
{
String key = entry.getKey();
Object opSet = entry.getValue();
assertTrue(
opSet + " was not an instance of " + key + "as declared", Class
.forName(key).isInstance(opSet));
}
}
/**

@ -218,7 +218,8 @@ public static Bundle findProtocolProviderBundle(
public void clearProvidersLists()
throws Exception
{
Map supportedOperationSets1 = provider1.getSupportedOperationSets();
Map<String, OperationSet> supportedOperationSets1 =
provider1.getSupportedOperationSets();
if ( supportedOperationSets1 == null
|| supportedOperationSets1.size() < 1)
@ -240,7 +241,8 @@ public void clearProvidersLists()
+ "Operation Sets");
// lets do it once again for the second provider
Map supportedOperationSets2 = provider2.getSupportedOperationSets();
Map<String, OperationSet> supportedOperationSets2 =
provider2.getSupportedOperationSets();
if (supportedOperationSets2 == null
|| supportedOperationSets2.size() < 1)

@ -49,7 +49,7 @@ protected void setUp() throws Exception
super.setUp();
fixture.setUp();
Map supportedOperationSets1 =
Map<String, OperationSet> supportedOperationSets1 =
fixture.provider1.getSupportedOperationSets();
if ( supportedOperationSets1 == null
@ -82,7 +82,7 @@ protected void setUp() throws Exception
+ "implementation of at least one of the PresenceOperationSets");
}
Map supportedOperationSets2 =
Map<String, OperationSet> supportedOperationSets2 =
fixture.provider2.getSupportedOperationSets();
if ( supportedOperationSets2 == null

@ -73,7 +73,7 @@ protected void setUp() throws Exception
super.setUp();
this.fixture.setUp();
Map supportedOperationSets1 =
Map<String, OperationSet> supportedOperationSets1 =
this.fixture.provider1.getSupportedOperationSets();
if ( supportedOperationSets1 == null
@ -96,7 +96,7 @@ protected void setUp() throws Exception
+ "Operation Sets");
// lets do it once again for the second provider
Map supportedOperationSets2 =
Map<String, OperationSet> supportedOperationSets2 =
this.fixture.provider2.getSupportedOperationSets();
if (supportedOperationSets2 == null

@ -49,7 +49,7 @@ protected void setUp() throws Exception
super.setUp();
this.fixture.setUp();
Map supportedOperationSets1 =
Map<String, OperationSet> supportedOperationSets1 =
this.fixture.provider1.getSupportedOperationSets();
if ( supportedOperationSets1 == null
@ -74,7 +74,7 @@ protected void setUp() throws Exception
}
// do it once again for the second provider
Map supportedOperationSets2 =
Map<String, OperationSet> supportedOperationSets2 =
this.fixture.provider2.getSupportedOperationSets();
if (supportedOperationSets2 == null

@ -145,20 +145,19 @@ public void testRegister()
*/
public void testOperationSetTypes() throws Exception
{
Map supportedOperationSets
= fixture.provider1.getSupportedOperationSets();
Map<String, OperationSet> supportedOperationSets =
fixture.provider1.getSupportedOperationSets();
//make sure that keys (which are supposed to be class names) correspond
//what the class of the values recorded against them.
Iterator setNames = supportedOperationSets.keySet().iterator();
while (setNames.hasNext())
// make sure that keys (which are supposed to be class names) correspond
// what the class of the values recorded against them.
for (Map.Entry<String, OperationSet> entry : supportedOperationSets
.entrySet())
{
String setName = (String) setNames.next();
Object opSet = supportedOperationSets.get(setName);
String setName = entry.getKey();
Object opSet = entry.getValue();
assertTrue(opSet + " was not an instance of "
+ setName + " as declared"
, Class.forName(setName).isInstance(opSet));
assertTrue(opSet + " was not an instance of " + setName
+ " as declared", Class.forName(setName).isInstance(opSet));
}
}

@ -49,7 +49,7 @@ protected void setUp() throws Exception
super.setUp();
fixture.setUp();
Map supportedOperationSets1 =
Map<String, OperationSet> supportedOperationSets1 =
fixture.provider1.getSupportedOperationSets();
if ( supportedOperationSets1 == null
@ -82,7 +82,7 @@ protected void setUp() throws Exception
+ "implementation of at least one of the PresenceOperationSets");
}
Map supportedOperationSets2 =
Map<String, OperationSet> supportedOperationSets2 =
fixture.provider2.getSupportedOperationSets();
if ( supportedOperationSets2 == null

@ -70,7 +70,7 @@ protected void setUp() throws Exception
super.setUp();
fixture.setUp();
Map supportedOperationSets1 =
Map<String, OperationSet> supportedOperationSets1 =
fixture.provider1.getSupportedOperationSets();
if ( supportedOperationSets1 == null
@ -93,8 +93,8 @@ protected void setUp() throws Exception
+ "Operation Sets");
// lets do it once again for the second provider
Map supportedOperationSets2 =
fixture.provider2.getSupportedOperationSets();
Map<String, OperationSet> supportedOperationSets2 =
fixture.provider2.getSupportedOperationSets();
if (supportedOperationSets2 == null
|| supportedOperationSets2.size() < 1)

@ -51,7 +51,7 @@ protected void setUp() throws Exception
super.setUp();
fixture.setUp();
Map supportedOperationSets1 =
Map<String, OperationSet> supportedOperationSets1 =
fixture.provider1.getSupportedOperationSets();
if ( supportedOperationSets1 == null
@ -76,7 +76,7 @@ protected void setUp() throws Exception
}
// do it once again for the second provider
Map supportedOperationSets2 =
Map<String, OperationSet> supportedOperationSets2 =
fixture.provider2.getSupportedOperationSets();
if ( supportedOperationSets2 == null

@ -44,7 +44,7 @@ protected void setUp() throws Exception
super.setUp();
fixture.setUp();
Map supportedOperationSets1 =
Map<String, OperationSet> supportedOperationSets1 =
fixture.provider1.getSupportedOperationSets();
if ( supportedOperationSets1 == null
@ -90,7 +90,7 @@ protected void setUp() throws Exception
+ "implementation of at least one of the PresenceOperationSets");
}
Map supportedOperationSets2 =
Map<String, OperationSet> supportedOperationSets2 =
fixture.provider2.getSupportedOperationSets();
if ( supportedOperationSets2 == null

@ -145,20 +145,19 @@ public void testRegister()
*/
public void testOperationSetTypes() throws Exception
{
Map supportedOperationSets
= fixture.provider1.getSupportedOperationSets();
Map<String, OperationSet> supportedOperationSets =
fixture.provider1.getSupportedOperationSets();
//make sure that keys (which are supposed to be class names) correspond
//what the class of the values recorded against them.
Iterator setNames = supportedOperationSets.keySet().iterator();
while (setNames.hasNext())
// make sure that keys (which are supposed to be class names) correspond
// what the class of the values recorded against them.
for (Map.Entry<String, OperationSet> entry : supportedOperationSets
.entrySet())
{
String setName = (String) setNames.next();
Object opSet = supportedOperationSets.get(setName);
String setName = entry.getKey();
Object opSet = entry.getValue();
assertTrue(opSet + " was not an instance of "
+ setName + " as declared"
, Class.forName(setName).isInstance(opSet));
assertTrue(opSet + " was not an instance of " + setName
+ " as declared", Class.forName(setName).isInstance(opSet));
}
}

@ -9,7 +9,7 @@
import org.osgi.framework.*;
import junit.framework.*;
import net.java.sip.communicator.service.protocol.*;
import java.util.Map;
import java.util.*;
/**
@ -214,7 +214,8 @@ public static Bundle findProtocolProviderBundle(
public void clearProvidersLists()
throws Exception
{
Map supportedOperationSets1 = provider1.getSupportedOperationSets();
Map<String, OperationSet> supportedOperationSets1 =
provider1.getSupportedOperationSets();
if ( supportedOperationSets1 == null
|| supportedOperationSets1.size() < 1)
@ -236,7 +237,8 @@ public void clearProvidersLists()
+ "Operation Sets");
// lets do it once again for the second provider
Map supportedOperationSets2 = provider2.getSupportedOperationSets();
Map<String, OperationSet> supportedOperationSets2 =
provider2.getSupportedOperationSets();
if (supportedOperationSets2 == null
|| supportedOperationSets2.size() < 1)

Loading…
Cancel
Save