Jitsi: the OpenSource Java VoIP and Instant Messaging client.

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

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

public class RegistrationStateChangeEvent
extends PropertyChangeEvent

Instances of this class represent a change in the status of the provider that triggerred them. A status change may have occurred because the user requested it or because an error or a failure have occurred, in which case the reason and reason code would be set accordingly.

Keep in mind that reasons are not localized and services such as the user interface should only show them in a "details box". In the rest of the time, such services should consult the error code and provide corresponding, localized, reason phrases.

Note, that we have tried to provide a maximum number of error codes in order to enumerate all possible reason codes that may be returned from servers in the various protocols. Each protocol would only return a subset of these.

Author:
Emil Ivov
See Also:
Serialized Form

Field Summary
static int REASON_AUTHENTICATION_FAILED
          Indicates that the server has refused registration due to a problem with the authentication (most probably a wrong password).
static int REASON_CLIENT_LIMIT_REACHED_FOR_IP
          Indicates that we have too many existing registrations from the local IP address and the server won't allow us to open any more of them.
static int REASON_INTERNAL_ERROR
          Indicates that an internal application error has occurred and it resulted in the state transition indicated by this event.
static int REASON_MULTIPLE_LOGINS
          Indicates that the same user identifier has logged somewhere else.
static int REASON_NON_EXISTING_USER_ID
          Indicates that the server does not recognize the used identifier that we tried to register with.
static int REASON_NOT_SPECIFIED
          Indicates that no reason is specified for this event transition.
static int REASON_RECONNECTION_RATE_LIMIT_EXCEEDED
          Indicates that we have been disconnecting and reconnecting to the server at a rate that ha become too fast.
static int REASON_SERVER_NOT_FOUND
          Indicates that the specified server was not found (i.e.
static int REASON_TLS_REQUIRED
          Indicates that the specified server does not support TLS and the has required TLS use.
static int REASON_USER_REQUEST
          Indicates that the change in the registration state that has just occurred has been requested by the user.
 
Fields inherited from class java.util.EventObject
source
 
Constructor Summary
RegistrationStateChangeEvent(ProtocolProviderService source, RegistrationState oldValue, RegistrationState newValue, int reasonCode, String reason)
          Creates an event instance indicating a change of the provider state from oldValue to newValue.
 
Method Summary
 RegistrationState getNewState()
          Returns the status of the provider after this event took place.
 RegistrationState getOldState()
          Returns the status of the provider before this event took place.
 ProtocolProviderService getProvider()
          Returns the provider that has generated this event
 String getReason()
          Returns a (non localized) String containing information further explaining the reason code, or null if no particular reason has been specified.
 int getReasonCode()
          One of the REASON_XXX fields, indicating the reason code returned by the server in order to explain the state transition.
 String toString()
          Returns a string representation of this event.
 
Methods inherited from class java.beans.PropertyChangeEvent
getNewValue, getOldValue, getPropagationId, getPropertyName, setPropagationId
 
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

REASON_NOT_SPECIFIED

public static final int REASON_NOT_SPECIFIED
Indicates that no reason is specified for this event transition.

See Also:
Constant Field Values

REASON_USER_REQUEST

public static final int REASON_USER_REQUEST
Indicates that the change in the registration state that has just occurred has been requested by the user.

See Also:
Constant Field Values

REASON_AUTHENTICATION_FAILED

public static final int REASON_AUTHENTICATION_FAILED
Indicates that the server has refused registration due to a problem with the authentication (most probably a wrong password).

See Also:
Constant Field Values

REASON_MULTIPLE_LOGINS

public static final int REASON_MULTIPLE_LOGINS
Indicates that the same user identifier has logged somewhere else. This code is often returned when transitting into disconnected state. Some protocols, however, support multiple logins and servers would only return this code for purely informational reasons.

See Also:
Constant Field Values

REASON_NON_EXISTING_USER_ID

public static final int REASON_NON_EXISTING_USER_ID
Indicates that the server does not recognize the used identifier that we tried to register with.

See Also:
Constant Field Values

REASON_CLIENT_LIMIT_REACHED_FOR_IP

public static final int REASON_CLIENT_LIMIT_REACHED_FOR_IP
Indicates that we have too many existing registrations from the local IP address and the server won't allow us to open any more of them.

See Also:
Constant Field Values

REASON_RECONNECTION_RATE_LIMIT_EXCEEDED

public static final int REASON_RECONNECTION_RATE_LIMIT_EXCEEDED
Indicates that we have been disconnecting and reconnecting to the server at a rate that ha become too fast. We're temporarily banned and would have to wait a bit before trying again. It is often a good idea for the user interface to prevent the user from actually trying again for a certain amount of time.

See Also:
Constant Field Values

REASON_INTERNAL_ERROR

public static final int REASON_INTERNAL_ERROR
Indicates that an internal application error has occurred and it resulted in the state transition indicated by this event.

See Also:
Constant Field Values

REASON_SERVER_NOT_FOUND

public static final int REASON_SERVER_NOT_FOUND
Indicates that the specified server was not found (i.e. the fqdn was not resolved or the ip address was not reachable).

See Also:
Constant Field Values

REASON_TLS_REQUIRED

public static final int REASON_TLS_REQUIRED
Indicates that the specified server does not support TLS and the has required TLS use.

See Also:
Constant Field Values
Constructor Detail

RegistrationStateChangeEvent

public RegistrationStateChangeEvent(ProtocolProviderService source,
                                    RegistrationState oldValue,
                                    RegistrationState newValue,
                                    int reasonCode,
                                    String reason)
Creates an event instance indicating a change of the provider state from oldValue to newValue.

Parameters:
source - the provider that generated the event
oldValue - the status the source provider was in before entering the new state.
newValue - the status the source provider is currently in.
reasonCode - a value corresponding to one of the REASON_XXX fields of this class, indicating the reason for this state transition.
reason - a String further explaining the reason code or null if no such explanation is necessary.
Method Detail

getProvider

public ProtocolProviderService getProvider()
Returns the provider that has generated this event

Returns:
the provider that generated the event.

getOldState

public RegistrationState getOldState()
Returns the status of the provider before this event took place.

Returns:
a RegistrationState instance indicating the event the source provider was in before it entered its new state.

getNewState

public RegistrationState getNewState()
Returns the status of the provider after this event took place. (i.e. at the time the event is being dispatched).

Returns:
a RegistrationState instance indicating the event the source provider is in after the status change occurred.

toString

public String toString()
Returns a string representation of this event.

Overrides:
toString in class EventObject
Returns:
a String containing the name of the event as well as the names of the old and new RegistrationStates

getReasonCode

public int getReasonCode()
One of the REASON_XXX fields, indicating the reason code returned by the server in order to explain the state transition.

Returns:
a value corresponding to one of the REASON_XXX fields of this class.

getReason

public String getReason()
Returns a (non localized) String containing information further explaining the reason code, or null if no particular reason has been specified. Keep in mind that reason String-s returned by this method are not localized and services such as the user interface should only show them in a "details box". In the rest of the time, such services should consult the error code and provide corresponding, localized, reason phrases.

Returns:
a non localized String explaining the reason for the state transition.

Jitsi: the OpenSource Java VoIP and Instant Messaging client.

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