Jitsi: the OpenSource Java VoIP and Instant Messaging client.

net.java.sip.communicator.impl.protocol.msn
Class ProtocolProviderServiceMsnImpl

java.lang.Object
  extended by net.java.sip.communicator.service.protocol.AbstractProtocolProviderService
      extended by net.java.sip.communicator.impl.protocol.msn.ProtocolProviderServiceMsnImpl
All Implemented Interfaces:
ProtocolProviderService

public class ProtocolProviderServiceMsnImpl
extends AbstractProtocolProviderService

An implementation of the protocol provider service over the Msn protocol

Author:
Damian Minkov, Lubomir Marinov

Field Summary
 
Fields inherited from interface net.java.sip.communicator.service.protocol.ProtocolProviderService
BIND_RETRIES_DEFAULT_VALUE, BIND_RETRIES_PROPERTY_NAME
 
Constructor Summary
ProtocolProviderServiceMsnImpl()
           
 
Method Summary
 void fireRegistrationStateChanged(RegistrationState oldState, RegistrationState newState, int reasonCode, String reason)
          Creates a RegistrationStateChange event corresponding to the specified old and new states and notifies all currently registered listeners.
 AccountID getAccountID()
          Returns the AccountID that uniquely identifies the account represented by this instance of the ProtocolProviderService.
(package private)  net.sf.jml.MsnMessenger getMessenger()
          Returns the XMPPConnectionopened by this provider
 ProtocolIcon getProtocolIcon()
          Returns the msn protocol icon.
 String getProtocolName()
          Returns the short name of the protocol that the implementation of this provider is based upon (like SIP, Msn, ICQ/AIM, or others for example).
 RegistrationState getRegistrationState()
          Returns the state of the registration of this protocol provider
 TransportProtocol getTransportProtocol()
          Returns the "transport" protocol of this instance used to carry the control channel for the current protocol service.
protected  void initialize(String screenname, AccountID accountID)
          Initialized the service implementation, and puts it in a sate where it could interoperate with other services.
 boolean isSignalingTransportSecure()
          Indicate if the signaling transport of this protocol instance uses a secure (e.g.
(package private)  void reconnect(int reasonCode)
          Reconnects if fails fire connection failed.
 void register(SecurityAuthority authority)
          Starts the registration process.
 void shutdown()
          Makes the service implementation close all open sockets and release any resources that it might have taken and prepare for shutdown/garbage collection.
 void unregister()
          Ends the registration of this protocol provider with the service.
(package private)  void unregister(boolean fireEvent)
          Unregister and fire the event if requested
 
Methods inherited from class net.java.sip.communicator.service.protocol.AbstractProtocolProviderService
addRegistrationStateChangeListener, addSupportedOperationSet, clearRegistrationStateChangeListener, getOperationSet, getProtocolDisplayName, getSupportedOperationSets, isRegistered, removeRegistrationStateChangeListener, removeSupportedOperationSet, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface net.java.sip.communicator.service.protocol.ProtocolProviderService
hashCode
 

Constructor Detail

ProtocolProviderServiceMsnImpl

public ProtocolProviderServiceMsnImpl()
Method Detail

getRegistrationState

public RegistrationState getRegistrationState()
Returns the state of the registration of this protocol provider

Returns:
the RegistrationState that this provider is currently in or null in case it is in a unknown state.

register

public void register(SecurityAuthority authority)
              throws OperationFailedException
Starts the registration process. Connection details such as registration server, user name/number are provided through the configuration service through implementation specific properties.

Parameters:
authority - the security authority that will be used for resolving any security challenges that may be returned during the registration or at any moment while wer're registered.
Throws:
OperationFailedException - with the corresponding code it the registration fails for some reason (e.g. a networking error or an implementation problem).

reconnect

void reconnect(int reasonCode)
Reconnects if fails fire connection failed.

Parameters:
reasonCode - the appropriate SecurityAuthority reasonCode, which would specify the reason for which we're re-calling the login.

unregister

public void unregister()
Ends the registration of this protocol provider with the service.


isSignalingTransportSecure

public boolean isSignalingTransportSecure()
Description copied from interface: ProtocolProviderService
Indicate if the signaling transport of this protocol instance uses a secure (e.g. via TLS) connection.

Returns:
True when the connection is secured, false otherwise.

getTransportProtocol

public TransportProtocol getTransportProtocol()
Returns the "transport" protocol of this instance used to carry the control channel for the current protocol service.

Returns:
The "transport" protocol of this instance: TCP.

unregister

void unregister(boolean fireEvent)
Unregister and fire the event if requested

Parameters:
fireEvent - boolean

getProtocolName

public String getProtocolName()
Returns the short name of the protocol that the implementation of this provider is based upon (like SIP, Msn, ICQ/AIM, or others for example).

Returns:
a String containing the short name of the protocol this service is taking care of.

initialize

protected void initialize(String screenname,
                          AccountID accountID)
Initialized the service implementation, and puts it in a sate where it could interoperate with other services. It is strongly recomended that properties in this Map be mapped to property names as specified by AccountProperties.

Parameters:
screenname - the account id/uin/screenname of the account that we're about to create
accountID - the identifier of the account that this protocol provider represents.
See Also:
AccountID

shutdown

public void shutdown()
Makes the service implementation close all open sockets and release any resources that it might have taken and prepare for shutdown/garbage collection.


getAccountID

public AccountID getAccountID()
Returns the AccountID that uniquely identifies the account represented by this instance of the ProtocolProviderService.

Returns:
the id of the account represented by this provider.

getMessenger

net.sf.jml.MsnMessenger getMessenger()
Returns the XMPPConnectionopened by this provider

Returns:
a reference to the XMPPConnection last opened by this provider.

fireRegistrationStateChanged

public void fireRegistrationStateChanged(RegistrationState oldState,
                                         RegistrationState newState,
                                         int reasonCode,
                                         String reason)
Creates a RegistrationStateChange event corresponding to the specified old and new states and notifies all currently registered listeners.

Overrides:
fireRegistrationStateChanged in class AbstractProtocolProviderService
Parameters:
oldState - the state that the provider had before the change occurred
newState - the state that the provider is currently in.
reasonCode - a value corresponding to one of the REASON_XXX fields of the RegistrationStateChangeEvent class, indicating the reason for this state transition.
reason - a String further explaining the reason code or null if no such explanation is necessary.

getProtocolIcon

public ProtocolIcon getProtocolIcon()
Returns the msn protocol icon.

Returns:
the msn protocol icon

Jitsi: the OpenSource Java VoIP and Instant Messaging client.

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