Jitsi: the OpenSource Java VoIP and Instant Messaging client.

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

java.lang.Object
  extended by net.java.sip.communicator.impl.protocol.sip.UriHandlerSipImpl
All Implemented Interfaces:
EventListener, UriHandler, AccountManagerListener, org.osgi.framework.ServiceListener

public class UriHandlerSipImpl
extends Object
implements UriHandler, org.osgi.framework.ServiceListener, AccountManagerListener

The sip implementation of the URI handler. This class handles sip URIs by trying to establish a call to them.

Author:
Emil Ivov, Lubomir Marinov

Field Summary
 
Fields inherited from interface net.java.sip.communicator.service.argdelegation.UriHandler
PROTOCOL_PROPERTY
 
Constructor Summary
UriHandlerSipImpl(ProtocolProviderFactorySipImpl protoFactory)
          Creates an instance of this uri handler, so that it would start handling URIs by passing them to the providers registered by protoFactory .
 
Method Summary
 void dispose()
          Disposes of this UriHandler by, for example, removing the listeners it has added in its constructor (in order to prevent memory leaks, for one).
 String getProtocol()
          Returns the protocol that this handler is responsible for or "sip" in other words.
 void handleAccountManagerEvent(AccountManagerEvent event)
          Notifies this listener about an event fired by a specific AccountManager.
 void handleUri(String uri)
          Parses the specified URI and creates a call with the currently active telephony operation set.
 void registerHandlerService()
          Registers this UriHandler with the bundle context so that it could start handling URIs
 ProtocolProviderService selectHandlingProvider(String uri)
          Returns the default provider that we are supposed to handle URIs through or null if there aren't any.
 void serviceChanged(org.osgi.framework.ServiceEvent event)
          The point of implementing a service listener here is so that we would only register our own uri handling service and thus only handle URIs while the factory is available as an OSGi service.
 void unregisterHandlerService()
          Unregisters this UriHandler from the bundle context.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UriHandlerSipImpl

public UriHandlerSipImpl(ProtocolProviderFactorySipImpl protoFactory)
                  throws NullPointerException
Creates an instance of this uri handler, so that it would start handling URIs by passing them to the providers registered by protoFactory .

Parameters:
protoFactory - the provider that created us.
Throws:
NullPointerException - if protoFactory is null.
Method Detail

dispose

public void dispose()
Disposes of this UriHandler by, for example, removing the listeners it has added in its constructor (in order to prevent memory leaks, for one).


handleAccountManagerEvent

public void handleAccountManagerEvent(AccountManagerEvent event)
Description copied from interface: AccountManagerListener
Notifies this listener about an event fired by a specific AccountManager.

Specified by:
handleAccountManagerEvent in interface AccountManagerListener
Parameters:
event - the AccountManagerEvent describing the AccountManager firing the notification and the other details of the specific notification.

registerHandlerService

public void registerHandlerService()
Registers this UriHandler with the bundle context so that it could start handling URIs


unregisterHandlerService

public void unregisterHandlerService()
Unregisters this UriHandler from the bundle context.


getProtocol

public String getProtocol()
Returns the protocol that this handler is responsible for or "sip" in other words.

Specified by:
getProtocol in interface UriHandler
Returns:
the "sip" string to indicate that this handler is responsible for handling "sip" uris.

handleUri

public void handleUri(String uri)
Parses the specified URI and creates a call with the currently active telephony operation set.

Specified by:
handleUri in interface UriHandler
Parameters:
uri - the SIP URI that we have to call.

serviceChanged

public void serviceChanged(org.osgi.framework.ServiceEvent event)
The point of implementing a service listener here is so that we would only register our own uri handling service and thus only handle URIs while the factory is available as an OSGi service. We remove ourselves when our factory unregisters its service reference.

Specified by:
serviceChanged in interface org.osgi.framework.ServiceListener
Parameters:
event - the OSGi ServiceEvent

selectHandlingProvider

public ProtocolProviderService selectHandlingProvider(String uri)
                                               throws OperationFailedException
Returns the default provider that we are supposed to handle URIs through or null if there aren't any. Depending on the implementation this method may require user intervention so make sure you don't rely on a quick outcome when calling it.

Parameters:
uri - the uri that we'd like to handle with the provider that we are about to select.
Returns:
the provider that we should handle URIs through.
Throws:
OperationFailedException - with code OPERATION_CANCELED if the users.

Jitsi: the OpenSource Java VoIP and Instant Messaging client.

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