atg.service.webappregistry
Class ServletContextWebAppRegistry

java.lang.Object
  extended by atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
      extended by atg.nucleus.GenericService
          extended by atg.service.webappregistry.WebAppRegistry
              extended by atg.service.webappregistry.ServletContextWebAppRegistry
All Implemented Interfaces:
atg.naming.AbsoluteNameable, NameContextBindingListener, NameContextElement, atg.naming.NameContextParentable, NameResolver, AdminableService, atg.nucleus.Configured, ApplicationLogging, atg.nucleus.logging.ApplicationLoggingSender, atg.nucleus.logging.TraceApplicationLogging, VariableArgumentApplicationLogging, ComponentNameResolver, Service, ServiceListener, java.util.EventListener
Direct Known Subclasses:
ServletContextListenerWebAppRegistry

public class ServletContextWebAppRegistry
extends WebAppRegistry

This is an implementation of WebAppRegistry. This implementation registers apps defined by a ServletContext. It is used by NucleusServlet to register Dynamo specific WebApps.

In addition, this registry checks for the differing versions of the DSP tag library, since it gets invoked by NucleusServlet during start-up, providing a time when the Thread's context ClassLoader is set for the web-app.

See Also:
WebAppRegistry NucleusServlet ServletContextListenerWebAppRegistery

Nested Class Summary
static interface ServletContextWebAppRegistry.ServletContextWebAppRegistryListener
          An interface for notifications when a web-app gets added or deleted.
static class ServletContextWebAppRegistry.TaglibFingerPrint
          A data-structure for holding the check-sum of DSP taglib resources.
 
Field Summary
static java.lang.String CLASS_VERSION
          Class version string
protected static java.util.ResourceBundle sResources
          Our resource bundle.
 
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
ServletContextWebAppRegistry()
           
 
Method Summary
static void addWebApp(WebApp pWebApp)
          Add the specified web-app and send out an event to any listeners.
protected  void checkFingerPrintOfWebApp(WebApp pWebApp)
          Check the finger-print of the DSP taglib of the specified WebApp against the expected result.
 void checkWebAppFingerPrints()
          Check the fingerprints of that DSP taglib in the various web-apps.
protected  ServletContextWebAppRegistry.TaglibFingerPrint createTaglibFingerPrint(WebApp pWebApp, java.lang.ClassLoader pClassLoader)
          Create a TaglibFingerPrint from the specified ClassLoader.
 void doStartService()
          Called after the service has been created, placed into the naming hierarchy, and initialized with its configured property values.
protected  void doStartupChecks()
          Perform the various startup checks, and register so that checkFingerPrintOfWebApp() gets called whenever additional WebApps are registered.
 void doStopService()
          doStopService
static java.lang.String getRealPath(javax.servlet.ServletContext sc, java.lang.String pUrl)
          Return the path to the input resource pUrl.
 java.util.Map<javax.servlet.ServletContext,java.lang.ref.WeakReference<java.lang.ClassLoader>> getServletContextToClassLoader()
          Returns property serlvetContextToClassLoader.
 java.util.List<ServletContextWebAppRegistry.ServletContextWebAppRegistryListener> getServletContextWepAppRegistryListeners()
          Returns property ServletContextWepAppRegistryListeners.
 ServletContextWebAppRegistry.TaglibFingerPrint getTaglibFingerPrint()
          Return the DSP taglib fingerprint.
 java.util.Map<java.lang.String,WebApp> getWebApps()
          Get the Map of currently deployed web applications
protected  boolean matchesExpected(ServletContextWebAppRegistry.TaglibFingerPrint pOther, WebApp pWebApp)
          Return whether the checksums in TaglibFingerPrint match the expected checksums.
static void register(javax.servlet.ServletContext pServletContext)
          Notification that the web application is ready to process requests.
static void unregister(javax.servlet.ServletContext pServletContext)
          Notification that the web application is ready to process requests.
 
Methods inherited from class atg.service.webappregistry.WebAppRegistry
addListener, createAdminServlet, getHiddenWebApps, getSiteHttpServerName, getSiteHttpServerPort, getUrl, getUrl, getWebAppByContextRoot, getWebAppByName, getWebAppByProperty, isHiddenWebApp, register, removeListener, removeWebApp, savePropertyFilesToDir, sendEvent, setHiddenWebApps, setSiteHttpServerName, setSiteHttpServerPort, toString, unregister
 
Methods inherited from class atg.nucleus.GenericService
addLogListener, getAbsoluteName, getAdminServlet, getAdminServletOutputStreamEncoding, getLoggingForVlogging, getLogListenerCount, getLogListeners, getName, getNameContext, getNucleus, getRoot, getServiceConfiguration, getServiceInfo, isAdminServletUseServletOutputStream, isLoggingDebug, isLoggingError, isLoggingInfo, isLoggingTrace, isLoggingWarning, isRunning, logDebug, logDebug, logDebug, logError, logError, logError, logInfo, logInfo, logInfo, logTrace, logTrace, logTrace, logWarning, logWarning, logWarning, nameContextElementBound, nameContextElementUnbound, removeLogListener, reResolveThis, resolveName, resolveName, resolveName, resolveName, sendLogEvent, setAdminServletOutputStreamEncoding, setAdminServletUseServletOutputStream, setLoggingDebug, setLoggingError, setLoggingInfo, setLoggingTrace, setLoggingWarning, setNucleus, setServiceInfo, startService, stopService
 
Methods inherited from class atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
vlogDebug, vlogDebug, vlogDebug, vlogDebug, vlogDebugTrace, 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, wait, wait, wait
 

Field Detail

CLASS_VERSION

public static java.lang.String CLASS_VERSION
Class version string


sResources

protected static final java.util.ResourceBundle sResources
Our resource bundle.

Constructor Detail

ServletContextWebAppRegistry

public ServletContextWebAppRegistry()
Method Detail

getWebApps

public java.util.Map<java.lang.String,WebApp> getWebApps()
Description copied from class: WebAppRegistry
Get the Map of currently deployed web applications

Specified by:
getWebApps in class WebAppRegistry
Returns:
a Map of deployed WebApps

getServletContextWepAppRegistryListeners

public java.util.List<ServletContextWebAppRegistry.ServletContextWebAppRegistryListener> getServletContextWepAppRegistryListeners()
Returns property ServletContextWepAppRegistryListeners. A list of listeners.


getServletContextToClassLoader

public java.util.Map<javax.servlet.ServletContext,java.lang.ref.WeakReference<java.lang.ClassLoader>> getServletContextToClassLoader()
Returns property serlvetContextToClassLoader. A map from ServletContext to ClassLoader


getTaglibFingerPrint

public ServletContextWebAppRegistry.TaglibFingerPrint getTaglibFingerPrint()
Return the DSP taglib fingerprint.


getRealPath

public static java.lang.String getRealPath(javax.servlet.ServletContext sc,
                                           java.lang.String pUrl)
Return the path to the input resource pUrl. If the WebApp is in the form of a war file than this will return null.

Parameters:
sc - a ServletContext value
pUrl - a String value
Returns:
a String value

addWebApp

public static void addWebApp(WebApp pWebApp)
Add the specified web-app and send out an event to any listeners.

Parameters:
pWebApp - the web app to add

register

public static void register(javax.servlet.ServletContext pServletContext)
Notification that the web application is ready to process requests.

Parameters:
pServletContext - a ServletContext value

unregister

public static void unregister(javax.servlet.ServletContext pServletContext)
Notification that the web application is ready to process requests.

Parameters:
pServletContext - a ServletContext value

doStartService

public void doStartService()
Description copied from class: WebAppRegistry
Called after the service has been created, placed into the naming hierarchy, and initialized with its configured property values. Makes sure all the required properties have been set in the .properties file.

Overrides:
doStartService in class WebAppRegistry

doStartupChecks

protected void doStartupChecks()
Perform the various startup checks, and register so that checkFingerPrintOfWebApp() gets called whenever additional WebApps are registered.


checkWebAppFingerPrints

public void checkWebAppFingerPrints()
Check the fingerprints of that DSP taglib in the various web-apps.


doStopService

public void doStopService()
Description copied from class: WebAppRegistry
doStopService

Overrides:
doStopService in class WebAppRegistry

checkFingerPrintOfWebApp

protected void checkFingerPrintOfWebApp(WebApp pWebApp)
Check the finger-print of the DSP taglib of the specified WebApp against the expected result.


matchesExpected

protected boolean matchesExpected(ServletContextWebAppRegistry.TaglibFingerPrint pOther,
                                  WebApp pWebApp)
Return whether the checksums in TaglibFingerPrint match the expected checksums.

Parameters:
pOther - the taglib finger print associated with pWebApp
pWebApp - the web application whose finger print is being checked.
Returns:
true if everything found matches, false otherwise.

createTaglibFingerPrint

protected ServletContextWebAppRegistry.TaglibFingerPrint createTaglibFingerPrint(WebApp pWebApp,
                                                                                 java.lang.ClassLoader pClassLoader)
                                                                          throws java.io.IOException
Create a TaglibFingerPrint from the specified ClassLoader.

Parameters:
pWebApp - the web-app from which to create a DSP taglib finger print .
pClassLoader - the classloader associated with pWebApp
Throws:
java.io.IOException