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

java.lang.Object
  extended by org.apache.catalina.session.ManagerBase
      extended by org.apache.catalina.session.StandardManager
          extended by org.mobicents.servlet.sip.core.session.SipStandardManager
All Implemented Interfaces:
java.beans.PropertyChangeListener, java.util.EventListener, javax.management.MBeanRegistration, org.apache.catalina.Lifecycle, org.apache.catalina.Manager, SipManager

public class SipStandardManager
extends org.apache.catalina.session.StandardManager
implements SipManager

Extension of the Standard implementation of the Manager interface provided by Tomcat to be able to make the httpsession available as ConvergedHttpSession as for Spec JSR289 Section 13.5 and to handle management of sip sessions and sip application sessions for a given container (context)

Author:
Jean Deruelle

Field Summary
protected static java.lang.String info
          The descriptive information about this implementation.
protected static java.lang.String name
          The descriptive name of this Manager implementation (for logging).
 
Fields inherited from class org.apache.catalina.session.StandardManager
lifecycle, maxActiveSessions, pathname, processingTime, rejectedSessions, started
 
Fields inherited from class org.apache.catalina.session.ManagerBase
algorithm, container, DEFAULT_ALGORITHM, devRandomSource, digest, distributable, domain, duplicates, entropy, expiredSessions, initialized, log, maxActive, maxInactiveInterval, mserver, oname, processExpiresFrequency, random, randomClass, randomIS, sessionAverageAliveTime, sessionCounter, sessionIdLength, sessionMaxAliveTime, sessions, sm, support
 
Fields inherited from interface org.apache.catalina.Lifecycle
AFTER_START_EVENT, AFTER_STOP_EVENT, BEFORE_START_EVENT, BEFORE_STOP_EVENT, DESTROY_EVENT, INIT_EVENT, PERIODIC_EVENT, START_EVENT, STOP_EVENT
 
Constructor Summary
SipStandardManager()
           
 
Method Summary
 void dumpSipApplicationSessions()
           
 void dumpSipSessions()
           
 MobicentsSipApplicationSession findSipApplicationSession(javax.servlet.http.HttpSession httpSession)
          Retrieves the sip application session holding the converged http session in parameter
 int getActiveSipApplicationSessions()
          Returns the number of active sessions
 int getActiveSipSessions()
          Returns the number of active sessions
 java.util.Iterator<MobicentsSipApplicationSession> getAllSipApplicationSessions()
          
 java.util.Iterator<MobicentsSipSession> getAllSipSessions()
          
 org.apache.catalina.Container getContainer()
           
 int getExpiredSipApplicationSessions()
          Gets the number of sessions that have expired.
 int getExpiredSipSessions()
          Gets the number of sessions that have expired.
 java.lang.String getInfo()
          Return descriptive information about this Manager implementation and the corresponding version number, in the format <description>/<version>.
 int getMaxActiveSipApplicationSessions()
          Return the maximum number of active Sessions allowed, or -1 for no limit.
 int getMaxActiveSipSessions()
          Return the maximum number of active Sessions allowed, or -1 for no limit.
 java.lang.String getName()
          Return the descriptive short name of this Manager implementation.
protected  org.apache.catalina.session.StandardSession getNewSession()
           
 int getRejectedSipApplicationSessions()
          Number of sip session creations that failed due to maxActiveSipSessions
 int getRejectedSipSessions()
          Number of sip session creations that failed due to maxActiveSipSessions
 MobicentsSipApplicationSession getSipApplicationSession(SipApplicationSessionKey key, boolean create)
          Retrieve a sip application session from its key.
 int getSipApplicationSessionAverageAliveTime()
          Gets the average time (in seconds) that expired sessions had been alive.
 int getSipApplicationSessionCounter()
          Total sessions created by this manager.
 int getSipApplicationSessionMaxAliveTime()
          Gets the longest time (in seconds) that an expired session had been alive.
 SipFactoryImpl getSipFactoryImpl()
           
 MobicentsSipSession getSipSession(SipSessionKey key, boolean create, SipFactoryImpl sipFactoryImpl, MobicentsSipApplicationSession sipApplicationSessionImpl)
          Retrieve a sip session from its key.
 int getSipSessionAverageAliveTime()
          Gets the average time (in seconds) that expired sessions had been alive.
 int getSipSessionCounter()
          Total sessions created by this manager.
 int getSipSessionMaxAliveTime()
          Gets the longest time (in seconds) that an expired session had been alive.
 void init()
           
 java.lang.String listSipApplicationSessionIds()
          For debugging: return a list of all session ids currently active
 java.lang.String listSipSessionIds()
          For debugging: return a list of all session ids currently active
 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 setExpiredSipApplicationSessions(int expiredSipApplicationSessions)
          Sets the number of sessions that have expired.
 void setExpiredSipSessions(int expiredSipSessions)
          Sets the number of sessions that have expired.
 void setMaxActiveSipApplicationSessions(int max)
          Set the maximum number of actives Sip Application Sessions allowed, or -1 for no limit.
 void setMaxActiveSipSessions(int max)
          Set the maximum number of actives Sip Sessions allowed, or -1 for no limit.
 void setRejectedSipApplicationSessions(int rejectedSipApplicationSessions)
           
 void setRejectedSipSessions(int rejectedSipSessions)
           
 void setSipApplicationSessionAverageAliveTime(int sipApplicationSessionAverageAliveTime)
          Sets the average time (in seconds) that expired sessions had been alive.
 void setSipApplicationSessionCounter(int sipApplicationSessionCounter)
           
 void setSipApplicationSessionMaxAliveTime(int sipApplicationSessionMaxAliveTime)
          Sets the longest time (in seconds) that an expired session had been alive.
 void setSipFactoryImpl(SipFactoryImpl sipFactoryImpl)
           
 void setSipSessionAverageAliveTime(int sipSessionAverageAliveTime)
          Sets the average time (in seconds) that expired sessions had been alive.
 void setSipSessionCounter(int sipSessionCounter)
           
 void setSipSessionMaxAliveTime(int sipSessionMaxAliveTime)
          Sets the longest time (in seconds) that an expired session had been alive.
 
Methods inherited from class org.apache.catalina.session.StandardManager
addLifecycleListener, createSession, doLoad, doUnload, file, findLifecycleListeners, getMaxActiveSessions, getPathname, getRejectedSessions, load, propertyChange, removeLifecycleListener, setMaxActiveSessions, setPathname, setRejectedSessions, start, stop, unload
 
Methods inherited from class org.apache.catalina.session.ManagerBase
add, addPropertyChangeListener, backgroundProcess, createEmptySession, createSession, destroy, expireSession, findSession, findSessions, generateSessionId, getActiveSessions, getAlgorithm, getClassName, getDigest, getDistributable, getDomain, getDuplicates, getEngine, getEntropy, getExpiredSessions, getJvmRoute, getLastAccessedTime, getMaxActive, getMaxInactiveInterval, getObjectName, getProcessExpiresFrequency, getProcessingTime, getRandom, getRandomBytes, getRandomClass, getRandomFile, getSession, getSessionAttribute, getSessionAverageAliveTime, getSessionCounter, getSessionIdLength, getSessionMaxAliveTime, listSessionIds, postDeregister, postRegister, preDeregister, preRegister, processExpires, remove, removePropertyChangeListener, setAlgorithm, setDistributable, setDuplicates, setEntropy, setExpiredSessions, setMaxActive, setMaxInactiveInterval, setProcessExpiresFrequency, setProcessingTime, setRandomClass, setRandomFile, setSessionAverageAliveTime, setSessionCounter, setSessionIdLength, setSessionMaxAliveTime
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.catalina.Manager
add, addPropertyChangeListener, backgroundProcess, createEmptySession, createSession, createSession, findSession, findSessions, getActiveSessions, getDistributable, getExpiredSessions, getMaxActive, getMaxInactiveInterval, getRejectedSessions, getSessionAverageAliveTime, getSessionCounter, getSessionIdLength, getSessionMaxAliveTime, load, remove, removePropertyChangeListener, setDistributable, setExpiredSessions, setMaxActive, setMaxInactiveInterval, setRejectedSessions, setSessionAverageAliveTime, setSessionCounter, setSessionIdLength, setSessionMaxAliveTime, unload
 

Field Detail

info

protected static final java.lang.String info
The descriptive information about this implementation.

See Also:
Constant Field Values

name

protected static java.lang.String name
The descriptive name of this Manager implementation (for logging).

Constructor Detail

SipStandardManager

public SipStandardManager()
Method Detail

init

public void init()
Overrides:
init in class org.apache.catalina.session.ManagerBase

getNewSession

protected org.apache.catalina.session.StandardSession getNewSession()
Overrides:
getNewSession in class org.apache.catalina.session.ManagerBase

getSipFactoryImpl

public SipFactoryImpl getSipFactoryImpl()
Specified by:
getSipFactoryImpl in interface SipManager
Returns:
the SipFactoryImpl

setSipFactoryImpl

public void setSipFactoryImpl(SipFactoryImpl sipFactoryImpl)
Specified by:
setSipFactoryImpl in interface SipManager
Parameters:
sipFactoryImpl - the SipFactoryImpl to set

getContainer

public org.apache.catalina.Container getContainer()
Specified by:
getContainer in interface org.apache.catalina.Manager
Overrides:
getContainer in class org.apache.catalina.session.ManagerBase
Returns:
the container

setContainer

public void setContainer(org.apache.catalina.Container container)
Specified by:
setContainer in interface org.apache.catalina.Manager
Overrides:
setContainer in class org.apache.catalina.session.StandardManager
Parameters:
container - the container to set

removeSipSession

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

Specified by:
removeSipSession in interface SipManager
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

Specified by:
removeSipApplicationSession in interface SipManager
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.

Specified by:
getSipApplicationSession in interface SipManager
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.

Specified by:
getSipSession in interface SipManager
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

getAllSipSessions

public java.util.Iterator<MobicentsSipSession> getAllSipSessions()


getAllSipApplicationSessions

public java.util.Iterator<MobicentsSipApplicationSession> getAllSipApplicationSessions()


findSipApplicationSession

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

Specified by:
findSipApplicationSession in interface SipManager
Returns:
the sip application session holding a reference to it or null if none references it

dumpSipSessions

public void dumpSipSessions()
Specified by:
dumpSipSessions in interface SipManager

dumpSipApplicationSessions

public void dumpSipApplicationSessions()
Specified by:
dumpSipApplicationSessions in interface SipManager

removeAllSessions

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

Specified by:
removeAllSessions in interface SipManager

getInfo

public java.lang.String getInfo()
Return descriptive information about this Manager implementation and the corresponding version number, in the format <description>/<version>.

Specified by:
getInfo in interface org.apache.catalina.Manager
Overrides:
getInfo in class org.apache.catalina.session.StandardManager

getName

public java.lang.String getName()
Return the descriptive short name of this Manager implementation.

Overrides:
getName in class org.apache.catalina.session.StandardManager

getMaxActiveSipSessions

public int getMaxActiveSipSessions()
Return the maximum number of active Sessions allowed, or -1 for no limit.

Specified by:
getMaxActiveSipSessions in interface SipManager

setMaxActiveSipSessions

public void setMaxActiveSipSessions(int max)
Set the maximum number of actives Sip Sessions allowed, or -1 for no limit.

Specified by:
setMaxActiveSipSessions in interface SipManager
Parameters:
max - The new maximum number of sip sessions

getMaxActiveSipApplicationSessions

public int getMaxActiveSipApplicationSessions()
Return the maximum number of active Sessions allowed, or -1 for no limit.

Specified by:
getMaxActiveSipApplicationSessions in interface SipManager

setMaxActiveSipApplicationSessions

public void setMaxActiveSipApplicationSessions(int max)
Set the maximum number of actives Sip Application Sessions allowed, or -1 for no limit.

Specified by:
setMaxActiveSipApplicationSessions in interface SipManager
Parameters:
max - The new maximum number of sip application sessions

getRejectedSipSessions

public int getRejectedSipSessions()
Number of sip session creations that failed due to maxActiveSipSessions

Specified by:
getRejectedSipSessions in interface SipManager
Returns:
The count

setRejectedSipSessions

public void setRejectedSipSessions(int rejectedSipSessions)
Specified by:
setRejectedSipSessions in interface SipManager

getRejectedSipApplicationSessions

public int getRejectedSipApplicationSessions()
Number of sip session creations that failed due to maxActiveSipSessions

Specified by:
getRejectedSipApplicationSessions in interface SipManager
Returns:
The count

setRejectedSipApplicationSessions

public void setRejectedSipApplicationSessions(int rejectedSipApplicationSessions)
Specified by:
setRejectedSipApplicationSessions in interface SipManager

setSipSessionCounter

public void setSipSessionCounter(int sipSessionCounter)
Specified by:
setSipSessionCounter in interface SipManager

getSipSessionCounter

public int getSipSessionCounter()
Total sessions created by this manager.

Specified by:
getSipSessionCounter in interface SipManager
Returns:
sessions created

getActiveSipSessions

public int getActiveSipSessions()
Returns the number of active sessions

Specified by:
getActiveSipSessions in interface SipManager
Returns:
number of sessions active

getSipSessionMaxAliveTime

public int getSipSessionMaxAliveTime()
Gets the longest time (in seconds) that an expired session had been alive.

Specified by:
getSipSessionMaxAliveTime in interface SipManager
Returns:
Longest time (in seconds) that an expired session had been alive.

setSipSessionMaxAliveTime

public void setSipSessionMaxAliveTime(int sipSessionMaxAliveTime)
Sets the longest time (in seconds) that an expired session had been alive.

Specified by:
setSipSessionMaxAliveTime in interface SipManager
Parameters:
sessionMaxAliveTime - Longest time (in seconds) that an expired session had been alive.

getSipSessionAverageAliveTime

public int getSipSessionAverageAliveTime()
Gets the average time (in seconds) that expired sessions had been alive.

Specified by:
getSipSessionAverageAliveTime in interface SipManager
Returns:
Average time (in seconds) that expired sessions had been alive.

setSipSessionAverageAliveTime

public void setSipSessionAverageAliveTime(int sipSessionAverageAliveTime)
Sets the average time (in seconds) that expired sessions had been alive.

Specified by:
setSipSessionAverageAliveTime in interface SipManager
Parameters:
sessionAverageAliveTime - Average time (in seconds) that expired sessions had been alive.

setSipApplicationSessionCounter

public void setSipApplicationSessionCounter(int sipApplicationSessionCounter)
Specified by:
setSipApplicationSessionCounter in interface SipManager

getSipApplicationSessionCounter

public int getSipApplicationSessionCounter()
Total sessions created by this manager.

Specified by:
getSipApplicationSessionCounter in interface SipManager
Returns:
sessions created

getActiveSipApplicationSessions

public int getActiveSipApplicationSessions()
Returns the number of active sessions

Specified by:
getActiveSipApplicationSessions in interface SipManager
Returns:
number of sessions active

getSipApplicationSessionMaxAliveTime

public int getSipApplicationSessionMaxAliveTime()
Gets the longest time (in seconds) that an expired session had been alive.

Specified by:
getSipApplicationSessionMaxAliveTime in interface SipManager
Returns:
Longest time (in seconds) that an expired session had been alive.

setSipApplicationSessionMaxAliveTime

public void setSipApplicationSessionMaxAliveTime(int sipApplicationSessionMaxAliveTime)
Sets the longest time (in seconds) that an expired session had been alive.

Specified by:
setSipApplicationSessionMaxAliveTime in interface SipManager
Parameters:
sessionMaxAliveTime - Longest time (in seconds) that an expired session had been alive.

getSipApplicationSessionAverageAliveTime

public int getSipApplicationSessionAverageAliveTime()
Gets the average time (in seconds) that expired sessions had been alive.

Specified by:
getSipApplicationSessionAverageAliveTime in interface SipManager
Returns:
Average time (in seconds) that expired sessions had been alive.

setSipApplicationSessionAverageAliveTime

public void setSipApplicationSessionAverageAliveTime(int sipApplicationSessionAverageAliveTime)
Sets the average time (in seconds) that expired sessions had been alive.

Specified by:
setSipApplicationSessionAverageAliveTime in interface SipManager
Parameters:
sessionAverageAliveTime - Average time (in seconds) that expired sessions had been alive.

getExpiredSipSessions

public int getExpiredSipSessions()
Gets the number of sessions that have expired.

Specified by:
getExpiredSipSessions in interface SipManager
Returns:
Number of sessions that have expired

setExpiredSipSessions

public void setExpiredSipSessions(int expiredSipSessions)
Sets the number of sessions that have expired.

Specified by:
setExpiredSipSessions in interface SipManager
Parameters:
expiredSessions - Number of sessions that have expired

getExpiredSipApplicationSessions

public int getExpiredSipApplicationSessions()
Gets the number of sessions that have expired.

Specified by:
getExpiredSipApplicationSessions in interface SipManager
Returns:
Number of sessions that have expired

setExpiredSipApplicationSessions

public void setExpiredSipApplicationSessions(int expiredSipApplicationSessions)
Sets the number of sessions that have expired.

Specified by:
setExpiredSipApplicationSessions in interface SipManager
Parameters:
expiredSessions - Number of sessions that have expired

listSipSessionIds

public java.lang.String listSipSessionIds()
For debugging: return a list of all session ids currently active


listSipApplicationSessionIds

public java.lang.String listSipApplicationSessionIds()
For debugging: return a list of all session ids currently active



Copyright © 2008. All Rights Reserved.