Initialization Process
Last modified by Caleb James DeLisle on 2011/03/18 09:28
XWiki initialization process
Java servlet container creates a servletcontext and in web/standard/trunks/webapp/WEB-INF/web.xml
- This line:
<listener-class>org.xwiki.container.servlet.XWikiServletContextListener</listener-class>causes the method contextInitialized() in the class XWikiServletContextListener to be called. - The contextInitialized() method creates an EmbeddableComponentManager which is the registry where each of the XWiki modules are registered.
- Upon initialization, EmbeddableComponentManager starts ComponentAnnotationLoader which loads all of the components that are specified in any of the /WEB-INF/components.txt files. More information about XWiki components.
- XWikiServletContextListener creates a new StackingComponentEventManager so that component registration and unregistration events will be seen by the Observation Module.
- XWikiServletContextListener calls DefaultServletContainerInitializer which sets up the DefaultContainer component. The DefaultContainer component contains a stack of request, response, session triplets for each thread of execution. Different user sessions are guaranteed to occupy different threads so the easiest way to keep user specific information separate and available is to differentiate by thread. The reason for keeping a stack of triplets per thread is because a request may invoke a script which makes another request in the same thread.
- XWikiServletContextListener gets the DefaultObservationManager, sends it a new ApplicationStartedEvent, and tells the StackingComponentEventManager to dump all of it's stored events into DefaultObservationManager and send any future events directly to DefaultObservationManager.
- Finally XWikiServletContextListener adds the EmbeddableComponentManager to the servlet context so that it can be gotten by the old uncomponentized code.
XWiki is now initialized and it sits waiting for it's first request.