atg.userprofiling
Class SessionEventTrigger

java.lang.Object
  extended by atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
      extended by atg.nucleus.GenericService
          extended by atg.nucleus.TimedOperationService
              extended by atg.servlet.pipeline.PipelineableServletImpl
                  extended by atg.servlet.pipeline.InsertableServletImpl
                      extended by atg.userprofiling.SessionEventTrigger
All Implemented Interfaces:
NameContextBindingListener, NameContextElement, atg.naming.NameContextPreBindingListener, NameResolver, AdminableService, ApplicationLogging, atg.nucleus.logging.ApplicationLoggingSender, atg.nucleus.logging.TraceApplicationLogging, atg.nucleus.logging.VariableArgumentApplicationLogging, ComponentNameResolver, Service, ServiceListener, InsertableServlet, PipelineableServlet, java.util.EventListener, javax.servlet.Servlet

public class SessionEventTrigger
extends InsertableServletImpl
implements atg.naming.NameContextPreBindingListener, NameContextBindingListener

This class fires off SessionEvents for new sessions and expired sessions.

It implements the request pipeline interface so that whenever a new session is created for a request, a SessionEvent can be fired.

Additionally it implements the NameContextBindingListener interface so it can listen to the SessionManager as it unbinds session objects (i.e. expires sessions) and thus fire a SessionEvent.

Why doesn't it also listen for the binding of session objects instead of sitting in the pipeline? If that was done, we could not get a handle to the request object or the profile object to pass along with the SessionEvent.

At this point you should note that SessionEvents for session expiration do not contain the request object.

This class must be inserted into the request pipeline (probably best to insert it after DynamoServlet) in order for it to watch for new sessions.

This class must be added to the SessionManager's list of nameContextBindingListeners in order for it to know when sessions are destroyed.


Field Summary
static java.lang.String CLASS_VERSION
          Class version string
 
Fields inherited from class atg.nucleus.GenericService
SERVICE_INFO_KEY
 
Fields inherited from interface atg.nucleus.logging.TraceApplicationLogging
DEFAULT_LOG_TRACE_STATUS
 
Fields inherited from interface atg.nucleus.logging.ApplicationLogging
DEFAULT_LOG_DEBUG_STATUS, DEFAULT_LOG_ERROR_STATUS, DEFAULT_LOG_INFO_STATUS, DEFAULT_LOG_WARNING_STATUS
 
Constructor Summary
SessionEventTrigger()
          Empty constructor.
 
Method Summary
 void doStartService()
          Starts the service.
 atg.service.event.EventDistributor getDistributor()
          The EventDistributor to send fired events to.
 atg.userprofiling.dms.DPSMessageSource getMessageSource()
          Returns property messageSource
 long getNumEndSessionEvents()
          Returns property NumEndSessionEvents
 long getNumNewSessionEvents()
          Returns property NumNewSessionEvents
 long getNumReferrerEvents()
          Returns property NumReferrerEvents
 java.lang.String getProfilePath()
          The full name of the Profile component for every request.
 java.lang.String getSessionManagerPath()
          The component name and path for the SessionManager.
 boolean isBroadcastExpiredSessionEvents()
          Returns property BroadcastExpiredSessionEvents
 boolean isBroadcastNewSessionEvents()
          Returns property BroadcastNewSessionEvents
 boolean isBroadcastReferrerEvents()
          Returns property BroadcastReferrerEvents
 void nameContextElementPreBound(NameContextBindingEvent pEvent)
          Called when a new session is created.
 void nameContextElementPreUnbound(NameContextBindingEvent pEvent)
          Called just before a session is destroyed.
 void nameContextElementUnbound(NameContextBindingEvent pEvent)
          Called just after a session is removed from its name context.
 void service(DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          Method called by the pipline to service the request.
 void setBroadcastExpiredSessionEvents(boolean pBroadcastExpiredSessionEvents)
          Sets property BroadcastExpiredSessionEvents
 void setBroadcastNewSessionEvents(boolean pBroadcastNewSessionEvents)
          Sets property BroadcastNewSessionEvents
 void setBroadcastReferrerEvents(boolean pBroadcastReferrerEvents)
          Sets property BroadcastReferrerEvents
 void setDistributor(atg.service.event.EventDistributor pValue)
          The EventDistributor to send fired events to.
 void setMessageSource(atg.userprofiling.dms.DPSMessageSource pMessageSource)
          Sets property messageSource
 void setProfilePath(java.lang.String pValue)
          The full name of the Profile component for every request.
 void setSessionManagerPath(java.lang.String pValue)
          The component name and path for the SessionManager.
 
Methods inherited from class atg.servlet.pipeline.InsertableServletImpl
getInsertAfterServlet, setInsertAfterServlet
 
Methods inherited from class atg.servlet.pipeline.PipelineableServletImpl
createAdminServlet, destroy, getAdminServlet, getNextServlet, getServletConfig, getServletInfo, init, isUsePathInfo, passRequest, passRequest, service, service, setNextServlet, setServletInfo, setUsePathInfo
 
Methods inherited from class atg.nucleus.TimedOperationService
getAverageRequestHandlingTime, getHandledRequestCount, getRequestStartTime, getTotalRequestHandlingTime, isKeepingStatistics, notifyHandledRequest, resetStatistics, setKeepingStatistics
 
Methods inherited from class atg.nucleus.GenericService
addLogListener, doStopService, getAbsoluteName, getLoggingForVlogging, getLogListenerCount, getLogListeners, getName, getNameContext, getNucleus, getRoot, getServiceConfiguration, getServiceInfo, isLoggingDebug, isLoggingError, isLoggingInfo, isLoggingTrace, isLoggingWarning, isRunning, logDebug, logDebug, logDebug, logError, logError, logError, logInfo, logInfo, logInfo, logTrace, logTrace, logTrace, logWarning, logWarning, logWarning, nameContextElementBound, removeLogListener, resolveName, resolveName, resolveName, resolveName, sendLogEvent, setLoggingDebug, setLoggingError, setLoggingInfo, setLoggingTrace, setLoggingWarning, setNucleus, setServiceInfo, startService, stopService
 
Methods inherited from class atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
vlogDebug, vlogDebug, vlogDebug, vlogDebug, vlogError, vlogError, vlogError, vlogError, vlogInfo, vlogInfo, vlogInfo, vlogInfo, vlogTrace, vlogTrace, vlogTrace, vlogTrace, vlogWarning, vlogWarning, vlogWarning, vlogWarning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface atg.naming.NameContextBindingListener
nameContextElementBound
 
Methods inherited from interface atg.servlet.pipeline.PipelineableServlet
getNextServlet, passRequest, setNextServlet
 
Methods inherited from interface javax.servlet.Servlet
destroy, getServletConfig, getServletInfo, init, service
 

Field Detail

CLASS_VERSION

public static java.lang.String CLASS_VERSION
Class version string

Constructor Detail

SessionEventTrigger

public SessionEventTrigger()
Empty constructor.

Method Detail

setDistributor

public void setDistributor(atg.service.event.EventDistributor pValue)
The EventDistributor to send fired events to.


getDistributor

public atg.service.event.EventDistributor getDistributor()
The EventDistributor to send fired events to.


setSessionManagerPath

public void setSessionManagerPath(java.lang.String pValue)
The component name and path for the SessionManager. Note that we must use the name and path instead of passing an actual reference to the manager to prevent a startup loop since this event trigger sits in the pipeline.


getSessionManagerPath

public java.lang.String getSessionManagerPath()
The component name and path for the SessionManager. Note that we must use the name and path instead of passing an actual reference to the manager to prevent a startup loop since this event trigger sits in the pipeline.


setProfilePath

public void setProfilePath(java.lang.String pValue)
The full name of the Profile component for every request.


getProfilePath

public java.lang.String getProfilePath()
The full name of the Profile component for every request.


getNumNewSessionEvents

public long getNumNewSessionEvents()
Returns property NumNewSessionEvents


getNumEndSessionEvents

public long getNumEndSessionEvents()
Returns property NumEndSessionEvents


getNumReferrerEvents

public long getNumReferrerEvents()
Returns property NumReferrerEvents


setBroadcastReferrerEvents

public void setBroadcastReferrerEvents(boolean pBroadcastReferrerEvents)
Sets property BroadcastReferrerEvents


isBroadcastReferrerEvents

public boolean isBroadcastReferrerEvents()
Returns property BroadcastReferrerEvents


setBroadcastNewSessionEvents

public void setBroadcastNewSessionEvents(boolean pBroadcastNewSessionEvents)
Sets property BroadcastNewSessionEvents


isBroadcastNewSessionEvents

public boolean isBroadcastNewSessionEvents()
Returns property BroadcastNewSessionEvents


setBroadcastExpiredSessionEvents

public void setBroadcastExpiredSessionEvents(boolean pBroadcastExpiredSessionEvents)
Sets property BroadcastExpiredSessionEvents


isBroadcastExpiredSessionEvents

public boolean isBroadcastExpiredSessionEvents()
Returns property BroadcastExpiredSessionEvents


setMessageSource

public void setMessageSource(atg.userprofiling.dms.DPSMessageSource pMessageSource)
Sets property messageSource


getMessageSource

public atg.userprofiling.dms.DPSMessageSource getMessageSource()
Returns property messageSource


doStartService

public void doStartService()
                    throws ServiceException
Starts the service.

Overrides:
doStartService in class InsertableServletImpl
Throws:
ServiceException - if the Service had a problem starting up

service

public void service(DynamoHttpServletRequest pRequest,
                    DynamoHttpServletResponse pResponse)
             throws java.io.IOException,
                    javax.servlet.ServletException
Method called by the pipline to service the request. Here is where we will watch for new sessions and fire off SessionEvents of type 'new'.

Overrides:
service in class PipelineableServletImpl
Throws:
java.io.IOException - if an error occurred while reading or writing the servlet request
javax.servlet.ServletException - if an error occurred while processing the servlet request

nameContextElementPreBound

public void nameContextElementPreBound(NameContextBindingEvent pEvent)
Called when a new session is created.

Specified by:
nameContextElementPreBound in interface atg.naming.NameContextPreBindingListener

nameContextElementUnbound

public void nameContextElementUnbound(NameContextBindingEvent pEvent)
Called just after a session is removed from its name context.

Specified by:
nameContextElementUnbound in interface NameContextBindingListener
Overrides:
nameContextElementUnbound in class GenericService

nameContextElementPreUnbound

public void nameContextElementPreUnbound(NameContextBindingEvent pEvent)
Called just before a session is destroyed.

Specified by:
nameContextElementPreUnbound in interface atg.naming.NameContextPreBindingListener