org.opengts.war.tools
Class RTConfigContextListener

java.lang.Object
  extended by org.opengts.war.tools.RTConfigContextListener
All Implemented Interfaces:
java.util.EventListener, javax.servlet.http.HttpSessionListener, javax.servlet.ServletContextListener

public class RTConfigContextListener
extends java.lang.Object
implements javax.servlet.ServletContextListener, javax.servlet.http.HttpSessionListener

This class initializes and loads the servlet configuration properties into the Runtime configuration class RTConfig. A reference to this class is typically placed in the Servlet 'web.xml' file as follows:

   <listener>
       <listener-class>org.opengts.war.tools.RTConfigContextListener</listener-class>
   </listener>
 


Nested Class Summary
static interface RTConfigContextListener.HttpSessionFilter
           
 
Field Summary
static java.lang.String PARM_ACCOUNT
           
static java.lang.String PARM_USER
           
static java.lang.String[] PROP_DBConfig_init
           
static java.lang.String[] PROP_DebugMode
           
static java.lang.Object ServletLock
           
 
Constructor Summary
RTConfigContextListener()
           
 
Method Summary
 void contextDestroyed(javax.servlet.ServletContextEvent sce)
          This method is called by the Servlet container when the Servlet context is destroyed
 void contextInitialized(javax.servlet.ServletContextEvent sce)
          This method is called by the Servlet container when the Servlet context is initialized
 int getSessionCount(RTConfigContextListener.HttpSessionFilter filter)
          Returns the current number of open sessions
static int GetSessionCount(javax.servlet.ServletContext sc)
          Returns the current number of sessions
static int GetSessionCount(javax.servlet.ServletContext sc, RTConfigContextListener.HttpSessionFilter filter)
          Returns the current number of sessions matching the specified filter
static javax.servlet.http.HttpSession GetSessionForID(javax.servlet.ServletContext sc, java.lang.String id)
          Gets the HttpSession for the specified id (JSESSIONID)
 javax.servlet.http.HttpSession getSessionForID(java.lang.String id)
          Gets the HttpSession for the specified id (JSESSIONID)
 java.util.Collection<javax.servlet.http.HttpSession> getSessions()
          Returns a list of current HttpSession instances
 void sessionCreated(javax.servlet.http.HttpSessionEvent se)
          This method is called by the Servlet container when a HttpSession is created
 void sessionDestroyed(javax.servlet.http.HttpSessionEvent se)
          This method is called by the Servlet container when a HttpSession is destroyed
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PARM_ACCOUNT

public static final java.lang.String PARM_ACCOUNT
See Also:
Constant Field Values

PARM_USER

public static final java.lang.String PARM_USER
See Also:
Constant Field Values

PROP_DebugMode

public static final java.lang.String[] PROP_DebugMode

PROP_DBConfig_init

public static final java.lang.String[] PROP_DBConfig_init

ServletLock

public static final java.lang.Object ServletLock
Constructor Detail

RTConfigContextListener

public RTConfigContextListener()
Method Detail

GetSessionCount

public static int GetSessionCount(javax.servlet.ServletContext sc)
Returns the current number of sessions

Parameters:
sc - The ServletContext
Returns:
The current number of sessions

GetSessionCount

public static int GetSessionCount(javax.servlet.ServletContext sc,
                                  RTConfigContextListener.HttpSessionFilter filter)
Returns the current number of sessions matching the specified filter

Parameters:
sc - The ServletContext
filter - The HttpSession filter (total session counter returned if filter is null)
Returns:
The current number of sessions matching the specified filter

GetSessionForID

public static javax.servlet.http.HttpSession GetSessionForID(javax.servlet.ServletContext sc,
                                                             java.lang.String id)
Gets the HttpSession for the specified id (JSESSIONID)

Parameters:
sc - The ServletContext
id - The JSESSIONID
Returns:
The HttpSession, or null if the JSESSIONID was not found

contextInitialized

public void contextInitialized(javax.servlet.ServletContextEvent sce)
This method is called by the Servlet container when the Servlet context is initialized

Specified by:
contextInitialized in interface javax.servlet.ServletContextListener
Parameters:
sce - A ServletContextEvent instance

contextDestroyed

public void contextDestroyed(javax.servlet.ServletContextEvent sce)
This method is called by the Servlet container when the Servlet context is destroyed

Specified by:
contextDestroyed in interface javax.servlet.ServletContextListener
Parameters:
sce - A ServletContextEvent instance

sessionCreated

public void sessionCreated(javax.servlet.http.HttpSessionEvent se)
This method is called by the Servlet container when a HttpSession is created

Specified by:
sessionCreated in interface javax.servlet.http.HttpSessionListener
Parameters:
se - The HttpSessionEvent

sessionDestroyed

public void sessionDestroyed(javax.servlet.http.HttpSessionEvent se)
This method is called by the Servlet container when a HttpSession is destroyed

Specified by:
sessionDestroyed in interface javax.servlet.http.HttpSessionListener
Parameters:
se - The HttpSessionEvent

getSessionForID

public javax.servlet.http.HttpSession getSessionForID(java.lang.String id)
Gets the HttpSession for the specified id (JSESSIONID)

Parameters:
id - The JSESSIONID
Returns:
The HttpSession, or null if the JSESSIONID was not found

getSessions

public java.util.Collection<javax.servlet.http.HttpSession> getSessions()
Returns a list of current HttpSession instances

Returns:
A list of HttpSession instances

getSessionCount

public int getSessionCount(RTConfigContextListener.HttpSessionFilter filter)
Returns the current number of open sessions

Parameters:
filter - The HttpSession filter
Returns:
The current number of open sessions