org.lastbamboo.common.sip.proxy
Class SipRegistrarImpl

java.lang.Object
  extended by javax.management.NotificationBroadcasterSupport
      extended by org.lastbamboo.common.sip.proxy.SipRegistrarImpl
All Implemented Interfaces:
NotificationBroadcaster, NotificationEmitter, SipRegistrar, SipRegistrarImplMBean

public class SipRegistrarImpl
extends NotificationBroadcasterSupport
implements SipRegistrar, SipRegistrarImplMBean

Registrar for SIP clients. TODO: Also create a map of reader/writers to SIP URIs for more efficient removals??


Constructor Summary
SipRegistrarImpl(org.lastbamboo.common.sip.stack.message.SipMessageFactory factory, org.lastbamboo.common.sip.stack.transport.SipTcpTransportLayer transportLayer)
          Creates a new registrar.
 
Method Summary
 void addRegistrationListener(RegistrationListener listener)
          Adds the specified listener for registration events.
 org.littleshoot.mina.common.IoSession getIoSession(URI uri)
          Accesses the reader/writer for sending a message to the specified URI.
 Collection<URI> getRegistered()
          Get registered URIs
 int getSipMaxRegistered()
          Accessor for the maximum number of registrations we've seen.
 int getSipNumRegistered()
          Accessor for the number of registered SIP clients.
 void handleRegister(org.lastbamboo.common.sip.stack.message.Register register, org.littleshoot.mina.common.IoSession session)
          Processes the specified register request.
 boolean hasRegistration(URI uri)
          Determines whether or not we have a registration for the specified SIP URI.
 void sessionClosed(org.littleshoot.mina.common.IoSession session)
          Called when an IO session has closed -- we have lost a connection to a client.
 String toString()
           
 
Methods inherited from class javax.management.NotificationBroadcasterSupport
addNotificationListener, getNotificationInfo, handleNotification, removeNotificationListener, removeNotificationListener, sendNotification
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SipRegistrarImpl

public SipRegistrarImpl(org.lastbamboo.common.sip.stack.message.SipMessageFactory factory,
                        org.lastbamboo.common.sip.stack.transport.SipTcpTransportLayer transportLayer)
Creates a new registrar.

Parameters:
factory - The factory for creating messages for responding to register requests.
transportLayer - The transport layer for actually sending data.
Method Detail

handleRegister

public void handleRegister(org.lastbamboo.common.sip.stack.message.Register register,
                           org.littleshoot.mina.common.IoSession session)
Description copied from interface: SipRegistrar
Processes the specified register request.

Specified by:
handleRegister in interface SipRegistrar
Parameters:
register - The register request to process.
session - The class for writing message back to the client.

getIoSession

public org.littleshoot.mina.common.IoSession getIoSession(URI uri)
Description copied from interface: SipRegistrar
Accesses the reader/writer for sending a message to the specified URI.

Specified by:
getIoSession in interface SipRegistrar
Parameters:
uri - The URI to send a message to.
Returns:
The reader/writer for the specified URI, or null if we don't have information about the URI.

hasRegistration

public boolean hasRegistration(URI uri)
Description copied from interface: SipRegistrar
Determines whether or not we have a registration for the specified SIP URI.

Specified by:
hasRegistration in interface SipRegistrar
Parameters:
uri - The SIP URI to check for a registration for.
Returns:
true if we have a registration for the URI, otherwise false.

sessionClosed

public void sessionClosed(org.littleshoot.mina.common.IoSession session)
Description copied from interface: SipRegistrar
Called when an IO session has closed -- we have lost a connection to a client.

Specified by:
sessionClosed in interface SipRegistrar
Parameters:
session - The closed session.

addRegistrationListener

public void addRegistrationListener(RegistrationListener listener)
Description copied from interface: SipRegistrar
Adds the specified listener for registration events.

Specified by:
addRegistrationListener in interface SipRegistrar
Parameters:
listener - The listener to add.

getSipNumRegistered

public int getSipNumRegistered()
Description copied from interface: SipRegistrarImplMBean
Accessor for the number of registered SIP clients.

Specified by:
getSipNumRegistered in interface SipRegistrarImplMBean
Returns:
The number of registered SIP clients.

getSipMaxRegistered

public int getSipMaxRegistered()
Description copied from interface: SipRegistrarImplMBean
Accessor for the maximum number of registrations we've seen.

Specified by:
getSipMaxRegistered in interface SipRegistrarImplMBean
Returns:
The maximum number of registrations we've seen.

getRegistered

public Collection<URI> getRegistered()
Description copied from interface: SipRegistrar
Get registered URIs

Specified by:
getRegistered in interface SipRegistrar
Returns:
The registered URIs.

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2013 LittleShoot. All Rights Reserved.