Jitsi: the OpenSource Java VoIP and Instant Messaging client.

net.java.sip.communicator.service.protocol.event
Class SubscriptionEvent

java.lang.Object
  extended by java.util.EventObject
      extended by net.java.sip.communicator.service.protocol.event.SubscriptionEvent
All Implemented Interfaces:
Serializable

public class SubscriptionEvent
extends EventObject

SubscriptionEvents indicate creation removal or failure of a given Subscription. Note that in SIP Communicator the terms Subscription and Contact are quite similar: A contact becomes available and it is possible to query its presence status and user information, once a subscription for this contact has been created.

Author:
Emil Ivov
See Also:
Serialized Form

Field Summary
static int ERROR_UNSPECIFIED
          Error code unknown
static int SUBSCRIPTION_CREATED
          Indicates that the SubscriptionEvent instance was triggered by the creation of a new subscription
static int SUBSCRIPTION_FAILED
          Indicates that the SubscriptionEvent instance was triggered by the fact that no confirmation of the successful completion of a new subscription has been received.
static int SUBSCRIPTION_REMOVED
          Indicates that the SubscriptionEvent instance was triggered by the removal of an existing subscription
static int SUBSCRIPTION_RESOLVED
          Indicates that the SubscriptionEvent instance was triggered by the fact that the presence of a particular contact in the contact list has been confirmed by the server (resolved).
 
Fields inherited from class java.util.EventObject
source
 
Constructor Summary
SubscriptionEvent(Contact source, ProtocolProviderService provider, ContactGroup parentGroup, int eventID)
          Creates a new Subscription event according to the specified parameters.
SubscriptionEvent(Contact source, ProtocolProviderService provider, ContactGroup parentGroup, int eventID, int errorCode, String errorReason)
          Creates a new Subscription event according to the specified parameters.
 
Method Summary
 int getErrorCode()
          If event is SUBSCRIPTION_FAILED, returns the error code of the failed event
 String getErrorReason()
          If event is SUBSCRIPTION_FAILED, returns the reason of the error for the failed event
 int getEventID()
          Returns an event id specifying whether the type of this event (e.g.
 ContactGroup getParentGroup()
          Returns (if applicable) the group containing the contact that cause this event.
 Contact getSourceContact()
          Returns the provider that the source contact belongs to.
 ProtocolProviderService getSourceProvider()
          Returns the provider that the source contact belongs to.
 String toString()
          Returns a String representation of this ContactPresenceStatusChangeEvent
 
Methods inherited from class java.util.EventObject
getSource
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

SUBSCRIPTION_CREATED

public static final int SUBSCRIPTION_CREATED
Indicates that the SubscriptionEvent instance was triggered by the creation of a new subscription

See Also:
Constant Field Values

SUBSCRIPTION_REMOVED

public static final int SUBSCRIPTION_REMOVED
Indicates that the SubscriptionEvent instance was triggered by the removal of an existing subscription

See Also:
Constant Field Values

SUBSCRIPTION_FAILED

public static final int SUBSCRIPTION_FAILED
Indicates that the SubscriptionEvent instance was triggered by the fact that no confirmation of the successful completion of a new subscription has been received.

See Also:
Constant Field Values

SUBSCRIPTION_RESOLVED

public static final int SUBSCRIPTION_RESOLVED
Indicates that the SubscriptionEvent instance was triggered by the fact that the presence of a particular contact in the contact list has been confirmed by the server (resolved).

See Also:
Constant Field Values

ERROR_UNSPECIFIED

public static final int ERROR_UNSPECIFIED
Error code unknown

See Also:
Constant Field Values
Constructor Detail

SubscriptionEvent

public SubscriptionEvent(Contact source,
                         ProtocolProviderService provider,
                         ContactGroup parentGroup,
                         int eventID)
Creates a new Subscription event according to the specified parameters.

Parameters:
source - the Contact instance that this subscription pertains to.
provider - the ProtocolProviderService instance where this event occurred
parentGroup - the ContactGroup underwhich the corresponding Contact is located
eventID - one of the SUBSCRIPTION_XXX static fields indicating the nature of the event.

SubscriptionEvent

public SubscriptionEvent(Contact source,
                         ProtocolProviderService provider,
                         ContactGroup parentGroup,
                         int eventID,
                         int errorCode,
                         String errorReason)
Creates a new Subscription event according to the specified parameters.

Parameters:
source - the Contact instance that this subscription pertains to.
provider - the ProtocolProviderService instance where this event occurred
parentGroup - the ContactGroup underwhich the corresponding Contact is located
eventID - one of the SUBSCRIPTION_XXX static fields indicating the nature of the event.
errorCode - the error code
errorReason - the error reason string
Method Detail

getSourceProvider

public ProtocolProviderService getSourceProvider()
Returns the provider that the source contact belongs to.

Returns:
the provider that the source contact belongs to.

getSourceContact

public Contact getSourceContact()
Returns the provider that the source contact belongs to.

Returns:
the provider that the source contact belongs to.

getParentGroup

public ContactGroup getParentGroup()
Returns (if applicable) the group containing the contact that cause this event. In the case of a non persistent presence operation set this field is null.

Returns:
the ContactGroup (if there is one) containing the contact that caused the event.

toString

public String toString()
Returns a String representation of this ContactPresenceStatusChangeEvent

Overrides:
toString in class EventObject
Returns:
A a String representation of this SubscriptionEvent.

getEventID

public int getEventID()
Returns an event id specifying whether the type of this event (e.g. SUBSCRIPTION_CREATED, SUBSCRIPTION_FAILED and etc.)

Returns:
one of the SUBSCRIPTION_XXX int fields of this class.

getErrorCode

public int getErrorCode()
If event is SUBSCRIPTION_FAILED, returns the error code of the failed event

Returns:
error code

getErrorReason

public String getErrorReason()
If event is SUBSCRIPTION_FAILED, returns the reason of the error for the failed event

Returns:
the String reason for the error

Jitsi: the OpenSource Java VoIP and Instant Messaging client.

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