Jitsi: the OpenSource Java VoIP and Instant Messaging client.

net.java.sip.communicator.impl.protocol.sip
Class OperationSetContactTypeInfoImpl

java.lang.Object
  extended by net.java.sip.communicator.impl.protocol.sip.OperationSetContactTypeInfoImpl
All Implemented Interfaces:
OperationSet, OperationSetContactTypeInfo

public class OperationSetContactTypeInfoImpl
extends Object
implements OperationSetContactTypeInfo

Operation set used for type of contacts, retrieving changing and creating contacts with types. Stores contact type in a node in the xcap document.

Author:
Damian Minkov

Constructor Summary
OperationSetContactTypeInfoImpl(OperationSetPresenceSipImpl parentOperationSet)
          Creates the operation set.
 
Method Summary
 String getContactType(Contact contact)
          Access the contact type.
 void setContactType(Contact contact, String contactType)
          Sets the contact type of the contact.
 void subscribe(ContactGroup parent, String contactIdentifier, String contactType)
          Persistently adds a subscription for the presence status of the contact corresponding to the specified contactIdentifier and indicates that it should be added to the specified group of the server stored contact list.
 void subscribe(String contactIdentifier, String contactType)
          Persistently adds a subscription for the presence status of the contact corresponding to the specified contactIdentifier to the top level group.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OperationSetContactTypeInfoImpl

OperationSetContactTypeInfoImpl(OperationSetPresenceSipImpl parentOperationSet)
Creates the operation set.

Parameters:
parentOperationSet -
Method Detail

getContactType

public String getContactType(Contact contact)
Access the contact type. If none specified null is returned.

Specified by:
getContactType in interface OperationSetContactTypeInfo
Parameters:
contact - the contact to be queried for type.
Returns:
the contact type or null if missing.

setContactType

public void setContactType(Contact contact,
                           String contactType)
Sets the contact type of the contact.

Specified by:
setContactType in interface OperationSetContactTypeInfo
Parameters:
contact - the contact to be changed.
contactType - the type set to the contact.

subscribe

public void subscribe(String contactIdentifier,
                      String contactType)
               throws IllegalArgumentException,
                      IllegalStateException,
                      OperationFailedException
Persistently adds a subscription for the presence status of the contact corresponding to the specified contactIdentifier to the top level group. Note that this method, unlike the subscribe method in OperationSetPresence, is going the subscribe the specified contact in a persistent manner or in other words, it will add it to a server stored contact list and thus making the subscription for its presence status last along multiple registrations/logins/signons.

Apart from an exception in the case of an immediate failure, the method won't return any indication of success or failure. That would happen later on through a SubscriptionEvent generated by one of the methods of the SubscriptionListener.

Specified by:
subscribe in interface OperationSetContactTypeInfo
Parameters:
contactIdentifier - the contact whose status updates we are subscribing for.

contactType - the type of the newly created contact.
Throws:
OperationFailedException - with code NETWORK_FAILURE if subscribing fails due to errors experienced during network communication
IllegalArgumentException - if contact is not a contact known to the underlying protocol provider
IllegalStateException - if the underlying protocol provider is not registered/signed on a public service.

subscribe

public void subscribe(ContactGroup parent,
                      String contactIdentifier,
                      String contactType)
               throws IllegalArgumentException,
                      IllegalStateException,
                      OperationFailedException
Persistently adds a subscription for the presence status of the contact corresponding to the specified contactIdentifier and indicates that it should be added to the specified group of the server stored contact list. Note that apart from an exception in the case of an immediate failure, the method won't return any indication of success or failure. That would happen later on through a SubscriptionEvent generated by one of the methods of the SubscriptionListener.

Specified by:
subscribe in interface OperationSetContactTypeInfo
Parameters:
contactIdentifier - the contact whose status updates we are subscribing for.
parent - the parent group of the server stored contact list where the contact should be added.

contactType - the type of the newly created contact.
Throws:
OperationFailedException - with code NETWORK_FAILURE if subscribing fails due to errors experienced during network communication
IllegalArgumentException - if contact or parent are not a contact known to the underlying protocol provider.
IllegalStateException - if the underlying protocol provider is not registered/signed on a public service.

Jitsi: the OpenSource Java VoIP and Instant Messaging client.

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