org.mobicents.servlet.sip.core.session
Class SipManagerDelegate

java.lang.Object
  extended by org.mobicents.servlet.sip.core.session.SipManagerDelegate
Direct Known Subclasses:
ClusteredSipManagerDelegate, SipStandardManagerDelegate

public abstract class SipManagerDelegate
extends java.lang.Object

This class handles the management of sip sessions and sip application sessions for a given container (context) It is a delegate since it is used by many manager implementations classes (Standard and clustered ones)

Author:
Jean Deruelle

Field Summary
protected  org.apache.catalina.Container container
           
protected  java.util.concurrent.ConcurrentHashMap<SipApplicationSessionKey,MobicentsSipApplicationSession> sipApplicationSessions
           
protected  SipFactoryImpl sipFactoryImpl
           
protected  java.util.concurrent.ConcurrentHashMap<SipSessionKey,MobicentsSipSession> sipSessions
           
 
Constructor Summary
SipManagerDelegate()
           
 
Method Summary
 void changeSessionKey(SipSessionKey oldKey, SipSessionKey newKey)
           
protected  MobicentsSipSession createDerivedSipSession(MobicentsSipSession parentSipSession, SipSessionKey sessionKey)
          clone the parent sip session given in parameter except its attributes (they will be shared) and add it to the internal map of derived sessions identifying it by its ToTag
 void dumpSipApplicationSessions()
           
 void dumpSipSessions()
           
 MobicentsSipApplicationSession findSipApplicationSession(javax.servlet.http.HttpSession httpSession)
          Retrieves the sip application session holding the converged http session in parameter
 java.util.Iterator<MobicentsSipApplicationSession> getAllSipApplicationSessions()
          Retrieve all sip application sessions currently hold by the session manager
 java.util.Iterator<MobicentsSipSession> getAllSipSessions()
          Retrieve all sip sessions currently hold by the session manager
 org.apache.catalina.Container getContainer()
           
protected abstract  MobicentsSipApplicationSession getNewMobicentsSipApplicationSession(SipApplicationSessionKey key, SipContext sipContext)
           
protected abstract  MobicentsSipSession getNewMobicentsSipSession(SipSessionKey key, SipFactoryImpl sipFactoryImpl, MobicentsSipApplicationSession mobicentsSipApplicationSession)
           
 MobicentsSipApplicationSession getSipApplicationSession(SipApplicationSessionKey key, boolean create)
          Retrieve a sip application session from its key.
 SipFactoryImpl getSipFactoryImpl()
           
 MobicentsSipSession getSipSession(SipSessionKey key, boolean create, SipFactoryImpl sipFactoryImpl, MobicentsSipApplicationSession sipApplicationSessionImpl)
          Retrieve a sip session from its key.
 void removeAllSessions()
          Remove the sip sessions and sip application sessions
 MobicentsSipApplicationSession removeSipApplicationSession(SipApplicationSessionKey key)
          Removes a sip application session from the manager by its key
 MobicentsSipSession removeSipSession(SipSessionKey key)
          Removes a sip session from the manager by its key
 void setContainer(org.apache.catalina.Container container)
           
 void setSipFactoryImpl(SipFactoryImpl sipFactoryImpl)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

sipApplicationSessions

protected java.util.concurrent.ConcurrentHashMap<SipApplicationSessionKey,MobicentsSipApplicationSession> sipApplicationSessions

sipSessions

protected java.util.concurrent.ConcurrentHashMap<SipSessionKey,MobicentsSipSession> sipSessions

sipFactoryImpl

protected SipFactoryImpl sipFactoryImpl

container

protected org.apache.catalina.Container container
Constructor Detail

SipManagerDelegate

public SipManagerDelegate()
Method Detail

getSipFactoryImpl

public SipFactoryImpl getSipFactoryImpl()
Returns:
the SipFactoryImpl

setSipFactoryImpl

public void setSipFactoryImpl(SipFactoryImpl sipFactoryImpl)
Parameters:
sipFactoryImpl - the SipFactoryImpl to set

getContainer

public org.apache.catalina.Container getContainer()
Returns:
the container

setContainer

public void setContainer(org.apache.catalina.Container container)
Parameters:
container - the container to set

removeSipSession

public MobicentsSipSession removeSipSession(SipSessionKey key)
Removes a sip session from the manager by its key

Parameters:
key - the identifier for this session
Returns:
the sip session that had just been removed, null otherwise

removeSipApplicationSession

public MobicentsSipApplicationSession removeSipApplicationSession(SipApplicationSessionKey key)
Removes a sip application session from the manager by its key

Parameters:
key - the identifier for this session
Returns:
the sip application session that had just been removed, null otherwise

getSipApplicationSession

public MobicentsSipApplicationSession getSipApplicationSession(SipApplicationSessionKey key,
                                                               boolean create)
Retrieve a sip application session from its key. If none exists, one can enforce the creation through the create parameter to true.

Parameters:
key - the key identifying the sip application session to retrieve
create - if set to true, if no session has been found one will be created
Returns:
the sip application session matching the key

getSipSession

public MobicentsSipSession getSipSession(SipSessionKey key,
                                         boolean create,
                                         SipFactoryImpl sipFactoryImpl,
                                         MobicentsSipApplicationSession sipApplicationSessionImpl)
Retrieve a sip session from its key. If none exists, one can enforce the creation through the create parameter to true. the sip factory cannot be null if create is set to true.

Parameters:
key - the key identifying the sip session to retrieve
create - if set to true, if no session has been found one will be created
sipFactoryImpl - needed only for sip session creation.
sipApplicationSessionImpl - to associate the SipSession with if create is set to true, if false it won't be used
Returns:
the sip session matching the key
Throws:
java.lang.IllegalArgumentException - if create is set to true and sip Factory is null

changeSessionKey

public void changeSessionKey(SipSessionKey oldKey,
                             SipSessionKey newKey)

createDerivedSipSession

protected MobicentsSipSession createDerivedSipSession(MobicentsSipSession parentSipSession,
                                                      SipSessionKey sessionKey)
clone the parent sip session given in parameter except its attributes (they will be shared) and add it to the internal map of derived sessions identifying it by its ToTag

Parameters:
parentSipSession - the parent sip session holding the newly created derived session
sessionKey - the key of the new derived session to create
Returns:
the newly created derived session

getAllSipSessions

public java.util.Iterator<MobicentsSipSession> getAllSipSessions()
Retrieve all sip sessions currently hold by the session manager

Returns:
an iterator on the sip sessions

getAllSipApplicationSessions

public java.util.Iterator<MobicentsSipApplicationSession> getAllSipApplicationSessions()
Retrieve all sip application sessions currently hold by the session manager

Returns:
an iterator on the sip sessions

findSipApplicationSession

public MobicentsSipApplicationSession findSipApplicationSession(javax.servlet.http.HttpSession httpSession)
Retrieves the sip application session holding the converged http session in parameter

Parameters:
convergedHttpSession - the converged session to look up
Returns:
the sip application session holding a reference to it or null if none references it

dumpSipSessions

public void dumpSipSessions()

dumpSipApplicationSessions

public void dumpSipApplicationSessions()

removeAllSessions

public void removeAllSessions()
Remove the sip sessions and sip application sessions


getNewMobicentsSipSession

protected abstract MobicentsSipSession getNewMobicentsSipSession(SipSessionKey key,
                                                                 SipFactoryImpl sipFactoryImpl,
                                                                 MobicentsSipApplicationSession mobicentsSipApplicationSession)

getNewMobicentsSipApplicationSession

protected abstract MobicentsSipApplicationSession getNewMobicentsSipApplicationSession(SipApplicationSessionKey key,
                                                                                       SipContext sipContext)


Copyright © 2008. All Rights Reserved.