Jitsi: the OpenSource Java VoIP and Instant Messaging client.

net.java.sip.communicator.impl.protocol.jabber
Class OperationSetContactCapabilitiesJabberImpl

java.lang.Object
  extended by net.java.sip.communicator.service.protocol.AbstractOperationSetContactCapabilities<ProtocolProviderServiceJabberImpl>
      extended by net.java.sip.communicator.impl.protocol.jabber.OperationSetContactCapabilitiesJabberImpl
All Implemented Interfaces:
EventListener, UserCapsNodeListener, ContactPresenceStatusListener, OperationSet, OperationSetContactCapabilities

public class OperationSetContactCapabilitiesJabberImpl
extends AbstractOperationSetContactCapabilities<ProtocolProviderServiceJabberImpl>
implements UserCapsNodeListener, ContactPresenceStatusListener

Represents an OperationSet to query the OperationSets supported for a specific Jabber Contact. The OperationSets reported as supported for a specific Jabber Contact are considered by the associated protocol provider to be capabilities possessed by the Jabber Contact in question.

Author:
Lyubomir Marinov, Yana Stamcheva

Field Summary
 
Fields inherited from class net.java.sip.communicator.service.protocol.AbstractOperationSetContactCapabilities
parentProvider
 
Constructor Summary
OperationSetContactCapabilitiesJabberImpl(ProtocolProviderServiceJabberImpl parentProvider)
          Initializes a new OperationSetContactCapabilitiesJabberImpl instance which is to be provided by a specific ProtocolProviderServiceJabberImpl.
 
Method Summary
 void contactPresenceStatusChanged(ContactPresenceStatusChangeEvent evt)
          Removes the capabilities when the user goes offline.
 void fireContactCapabilitiesChanged(String user)
          Fires event that contact capabilities has changed.
protected
<U extends OperationSet>
U
getOperationSet(Contact contact, Class<U> opsetClass, boolean online)
          Gets the OperationSet corresponding to the specified Class and supported by the specified Contact.
protected  Map<String,OperationSet> getSupportedOperationSets(Contact contact, boolean online)
          Gets the OperationSets supported by a specific Contact.
(package private)  void setDiscoveryManager(ScServiceDiscoveryManager discoveryManager)
          Sets the ScServiceDiscoveryManager which is the discoveryManager of AbstractOperationSetContactCapabilities.parentProvider.
 void userCapsNodeAdded(String user, String node, boolean online)
          Notifies this listener that an EntityCapsManager has added a record for a specific user about the caps node the user has.
 void userCapsNodeRemoved(String user, String node, boolean online)
          Notifies this listener that an EntityCapsManager has removed a record for a specific user about the caps node the user has.
 
Methods inherited from class net.java.sip.communicator.service.protocol.AbstractOperationSetContactCapabilities
addContactCapabilitiesListener, fireContactCapabilitiesEvent, getOperationSet, getSupportedOperationSets, isOnline, removeContactCapabilitiesListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OperationSetContactCapabilitiesJabberImpl

public OperationSetContactCapabilitiesJabberImpl(ProtocolProviderServiceJabberImpl parentProvider)
Initializes a new OperationSetContactCapabilitiesJabberImpl instance which is to be provided by a specific ProtocolProviderServiceJabberImpl.

Parameters:
parentProvider - the ProtocolProviderServiceJabberImpl which will provide the new instance
Method Detail

getOperationSet

protected <U extends OperationSet> U getOperationSet(Contact contact,
                                                     Class<U> opsetClass,
                                                     boolean online)
Gets the OperationSet corresponding to the specified Class and supported by the specified Contact. If the returned value is non-null, it indicates that the Contact is considered by the associated protocol provider to possess the opsetClass capability. Otherwise, the associated protocol provider considers contact to not have the opsetClass capability.

Overrides:
getOperationSet in class AbstractOperationSetContactCapabilities<ProtocolProviderServiceJabberImpl>
Type Parameters:
U - the type extending OperationSet for which the specified contact is to be checked whether it possesses it as a capability
Parameters:
contact - the Contact for which the opsetClass capability is to be queried
opsetClass - the OperationSet Class for which the specified contact is to be checked whether it possesses it as a capability
online - true if contact is online; otherwise, false
Returns:
the OperationSet corresponding to the specified opsetClass which is considered by the associated protocol provider to be possessed as a capability by the specified contact; otherwise, null
See Also:
AbstractOperationSetContactCapabilities.getOperationSet(Contact, Class)

getSupportedOperationSets

protected Map<String,OperationSet> getSupportedOperationSets(Contact contact,
                                                             boolean online)
Gets the OperationSets supported by a specific Contact. The returned OperationSets are considered by the associated protocol provider to capabilities possessed by the specified contact.

Overrides:
getSupportedOperationSets in class AbstractOperationSetContactCapabilities<ProtocolProviderServiceJabberImpl>
Parameters:
contact - the Contact for which the supported OperationSet capabilities are to be retrieved
online - true if contact is online; otherwise, false
Returns:
a Map listing the OperationSets considered by the associated protocol provider to be supported by the specified contact (i.e. to be possessed as capabilities). Each supported OperationSet capability is represented by a Map.Entry with key equal to the OperationSet class name and value equal to the respective OperationSet instance
See Also:
AbstractOperationSetContactCapabilities.getSupportedOperationSets( Contact)

setDiscoveryManager

void setDiscoveryManager(ScServiceDiscoveryManager discoveryManager)
Sets the ScServiceDiscoveryManager which is the discoveryManager of AbstractOperationSetContactCapabilities.parentProvider.

Parameters:
discoveryManager - the ScServiceDiscoveryManager which is the discoveryManager of AbstractOperationSetContactCapabilities.parentProvider

userCapsNodeAdded

public void userCapsNodeAdded(String user,
                              String node,
                              boolean online)
Notifies this listener that an EntityCapsManager has added a record for a specific user about the caps node the user has.

Specified by:
userCapsNodeAdded in interface UserCapsNodeListener
Parameters:
user - the user (full JID)
node - the entity caps node#ver
online - indicates if the user is currently online
See Also:
UserCapsNodeListener.userCapsNodeAdded(String, String, boolean)

userCapsNodeRemoved

public void userCapsNodeRemoved(String user,
                                String node,
                                boolean online)
Notifies this listener that an EntityCapsManager has removed a record for a specific user about the caps node the user has.

Specified by:
userCapsNodeRemoved in interface UserCapsNodeListener
Parameters:
user - the user (full JID)
node - the entity caps node#ver
online - indicates if the given user is online
See Also:
UserCapsNodeListener.userCapsNodeRemoved(String, String, boolean)

contactPresenceStatusChanged

public void contactPresenceStatusChanged(ContactPresenceStatusChangeEvent evt)
Removes the capabilities when the user goes offline.

Specified by:
contactPresenceStatusChanged in interface ContactPresenceStatusListener
Parameters:
evt - the ContactPresenceStatusChangeEvent that notified us

fireContactCapabilitiesChanged

public void fireContactCapabilitiesChanged(String user)
Fires event that contact capabilities has changed.

Parameters:
user - the user to search for its contact.

Jitsi: the OpenSource Java VoIP and Instant Messaging client.

Jitsi, the OpenSource Java VoIP and Instant Messaging client.
Distributable under LGPL license.