SIP Communicator: the OpenSource Java VoIP and Instant Messaging client.

net.java.sip.communicator.service.protocol
Class AbstractOperationSetPersistentPresence<T extends ProtocolProviderService>

java.lang.Object
  extended by net.java.sip.communicator.service.protocol.AbstractOperationSetPersistentPresence<T>
All Implemented Interfaces:
OperationSet, OperationSetPersistentPresence, OperationSetPresence
Direct Known Subclasses:
MockPersistentPresenceOperationSet, OperationSetPersistentPresenceDictImpl, OperationSetPersistentPresenceGibberishImpl, OperationSetPersistentPresenceIcqImpl, OperationSetPersistentPresenceJabberImpl, OperationSetPersistentPresenceMsnImpl, OperationSetPersistentPresenceRssImpl, OperationSetPersistentPresenceSSHImpl, OperationSetPersistentPresenceYahooImpl, OperationSetPersistentPresenceZeroconfImpl, OperationSetPresenceSipImpl

public abstract class AbstractOperationSetPersistentPresence<T extends ProtocolProviderService>
extends Object
implements OperationSetPersistentPresence

Represents a default implementation of OperationSetPersistentPresence in order to make it easier for implementers to provide complete solutions while focusing on implementation-specific details.

Author:
Lubomir Marinov

Field Summary
protected  T parentProvider
          The provider that created us.
 
Constructor Summary
protected AbstractOperationSetPersistentPresence(T parentProvider)
          Initializes a new AbstractOperationSetPersistentPresence instance created by a specific ProtocolProviderService .
 
Method Summary
 void addContactPresenceStatusListener(ContactPresenceStatusListener listener)
          Implementation of the corresponding ProtocolProviderService method.
 void addProviderPresenceStatusListener(ProviderPresenceStatusListener listener)
          Adds a listener that would receive events upon changes of the provider presence status.
 void addServerStoredGroupChangeListener(ServerStoredGroupListener listener)
          Registers a listener that would receive events upon changes in server stored groups.
 void addSubscriptionListener(SubscriptionListener listener)
          Registers a listener that would get notifications any time a new subscription was successfully added, has failed or was removed.
protected  void fireContactPresenceStatusChangeEvent(Contact source, ContactGroup parentGroup, PresenceStatus oldValue)
          Notifies all registered listeners of the new event.
 void fireContactPresenceStatusChangeEvent(Contact source, ContactGroup parentGroup, PresenceStatus oldValue, PresenceStatus newValue)
           
 void fireContactPropertyChangeEvent(String eventID, Contact source, Object oldValue, Object newValue)
          Notify all subscription listeners of the corresponding contact property change event.
protected  void fireProviderStatusChangeEvent(PresenceStatus oldValue)
          Notifies all registered listeners of the new event.
protected  void fireProviderStatusChangeEvent(PresenceStatus oldValue, PresenceStatus newValue)
          Notify all provider presence listeners of the corresponding event change
protected  void fireProviderStatusMessageChangeEvent(String oldStatusMessage, String newStatusMessage)
          Notify all provider presence listeners that a new status message has been set.
protected  void fireServerStoredGroupEvent(ContactGroup source, int eventID)
          Notifies all registered listeners of the new event.
 void fireSubscriptionEvent(Contact source, ContactGroup parentGroup, int eventID)
          Notifies all registered listeners of the new event.
 void fireSubscriptionEvent(Contact source, ContactGroup parentGroup, int eventID, int errorCode, String errorReason)
           
 void fireSubscriptionMovedEvent(Contact source, ContactGroup oldParent, ContactGroup newParent)
          Notifies all registered listeners of the new event.
 void removeContactPresenceStatusListener(ContactPresenceStatusListener listener)
          Removes the specified listener so that it won't receive any further updates on contact presence status changes
 void removeProviderPresenceStatusListener(ProviderPresenceStatusListener listener)
          Unregisters the specified listener so that it does not receive further events upon changes in local presence status.
 void removeServerStoredGroupChangeListener(ServerStoredGroupListener listener)
          Removes the specified group change listener so that it won't receive any further events.
 void removeSubscriptionListener(SubscriptionListener listener)
          Removes the specified subscription listener.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface net.java.sip.communicator.service.protocol.OperationSetPersistentPresence
createServerStoredContactGroup, createUnresolvedContact, createUnresolvedContactGroup, getServerStoredContactListRoot, moveContactToGroup, removeServerStoredContactGroup, renameServerStoredContactGroup, subscribe, subscribe, unsubscribe
 
Methods inherited from interface net.java.sip.communicator.service.protocol.OperationSetPresence
createUnresolvedContact, findContactByID, getCurrentStatusMessage, getPresenceStatus, getSupportedStatusSet, publishPresenceStatus, queryContactStatus, setAuthorizationHandler
 

Field Detail

parentProvider

protected final T extends ProtocolProviderService parentProvider
The provider that created us.

Constructor Detail

AbstractOperationSetPersistentPresence

protected AbstractOperationSetPersistentPresence(T parentProvider)
Initializes a new AbstractOperationSetPersistentPresence instance created by a specific ProtocolProviderService .

Parameters:
parentProvider - the ProtocolProviderService which created the new instance
Method Detail

addContactPresenceStatusListener

public void addContactPresenceStatusListener(ContactPresenceStatusListener listener)
Implementation of the corresponding ProtocolProviderService method.

Specified by:
addContactPresenceStatusListener in interface OperationSetPresence
Parameters:
listener - a presence status listener.

addProviderPresenceStatusListener

public void addProviderPresenceStatusListener(ProviderPresenceStatusListener listener)
Adds a listener that would receive events upon changes of the provider presence status.

Specified by:
addProviderPresenceStatusListener in interface OperationSetPresence
Parameters:
listener - the listener to register for changes in our PresenceStatus.

addServerStoredGroupChangeListener

public void addServerStoredGroupChangeListener(ServerStoredGroupListener listener)
Registers a listener that would receive events upon changes in server stored groups.

Specified by:
addServerStoredGroupChangeListener in interface OperationSetPersistentPresence
Parameters:
listener - a ServerStoredGroupChangeListener impl that would receive events upon group changes.

addSubscriptionListener

public void addSubscriptionListener(SubscriptionListener listener)
Description copied from interface: OperationSetPresence
Registers a listener that would get notifications any time a new subscription was successfully added, has failed or was removed.

Specified by:
addSubscriptionListener in interface OperationSetPresence
Parameters:
listener - the SubscriptionListener to register

fireContactPresenceStatusChangeEvent

protected void fireContactPresenceStatusChangeEvent(Contact source,
                                                    ContactGroup parentGroup,
                                                    PresenceStatus oldValue)
Notifies all registered listeners of the new event.

Parameters:
source - the contact that has caused the event.
parentGroup - the group that contains the source contact.
oldValue - the status that the source contact detained before changing it.

fireContactPresenceStatusChangeEvent

public void fireContactPresenceStatusChangeEvent(Contact source,
                                                 ContactGroup parentGroup,
                                                 PresenceStatus oldValue,
                                                 PresenceStatus newValue)

fireContactPropertyChangeEvent

public void fireContactPropertyChangeEvent(String eventID,
                                           Contact source,
                                           Object oldValue,
                                           Object newValue)
Notify all subscription listeners of the corresponding contact property change event.

Parameters:
eventID - the String ID of the event to dispatch
source - the ContactJabberImpl instance that this event is pertaining to.
oldValue - the value that the changed property had before the change occurred.
newValue - the value that the changed property currently has (after the change has occurred).

fireProviderStatusChangeEvent

protected void fireProviderStatusChangeEvent(PresenceStatus oldValue)
Notifies all registered listeners of the new event.

Parameters:
oldValue - the presence status we were in before the change.

fireProviderStatusChangeEvent

protected void fireProviderStatusChangeEvent(PresenceStatus oldValue,
                                             PresenceStatus newValue)
Notify all provider presence listeners of the corresponding event change

Parameters:
oldValue - the status our stack had so far
newValue - the status we have from now on

fireProviderStatusMessageChangeEvent

protected void fireProviderStatusMessageChangeEvent(String oldStatusMessage,
                                                    String newStatusMessage)
Notify all provider presence listeners that a new status message has been set.

Parameters:
oldStatusMessage - the status message our stack had so far
newStatusMessage - the status message we have from now on

fireServerStoredGroupEvent

protected void fireServerStoredGroupEvent(ContactGroup source,
                                          int eventID)
Notifies all registered listeners of the new event.

Parameters:
source - the contact that has caused the event.
eventID - an identifier of the event to dispatch.

fireSubscriptionEvent

public void fireSubscriptionEvent(Contact source,
                                  ContactGroup parentGroup,
                                  int eventID)
Notifies all registered listeners of the new event.

Parameters:
source - the contact that has caused the event.
parentGroup - the group that contains the source contact.
eventID - an identifier of the event to dispatch.

fireSubscriptionEvent

public void fireSubscriptionEvent(Contact source,
                                  ContactGroup parentGroup,
                                  int eventID,
                                  int errorCode,
                                  String errorReason)

fireSubscriptionMovedEvent

public void fireSubscriptionMovedEvent(Contact source,
                                       ContactGroup oldParent,
                                       ContactGroup newParent)
Notifies all registered listeners of the new event.

Parameters:
source - the contact that has been moved..
oldParent - the group where the contact was located before being moved.
newParent - the group where the contact has been moved.

removeContactPresenceStatusListener

public void removeContactPresenceStatusListener(ContactPresenceStatusListener listener)
Removes the specified listener so that it won't receive any further updates on contact presence status changes

Specified by:
removeContactPresenceStatusListener in interface OperationSetPresence
Parameters:
listener - the listener to remove.

removeProviderPresenceStatusListener

public void removeProviderPresenceStatusListener(ProviderPresenceStatusListener listener)
Unregisters the specified listener so that it does not receive further events upon changes in local presence status.

Specified by:
removeProviderPresenceStatusListener in interface OperationSetPresence
Parameters:
listener - ProviderPresenceStatusListener

removeServerStoredGroupChangeListener

public void removeServerStoredGroupChangeListener(ServerStoredGroupListener listener)
Removes the specified group change listener so that it won't receive any further events.

Specified by:
removeServerStoredGroupChangeListener in interface OperationSetPersistentPresence
Parameters:
listener - the ServerStoredGroupChangeListener to remove

removeSubscriptionListener

public void removeSubscriptionListener(SubscriptionListener listener)
Removes the specified subscription listener.

Specified by:
removeSubscriptionListener in interface OperationSetPresence
Parameters:
listener - the listener to remove.

SIP Communicator: the OpenSource Java VoIP and Instant Messaging client.

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