@ Override public void contextInitialized ( ServletContextEvent event ) { super . contextInitialized ( event ) ; _dict . addTypeSet ( org . xillium . data . validation . StandardDataTypes . class ) ; _packaged = _context . getResourcePaths ( "/WEB-INF/lib/" ) ; _extended = discover ( System . getProperty ( "xillium.service.ExtensionsRoot" ) ) ; // servlet mappings must be registered before this method returns Functor < Void , ServiceModule > functor = new Functor < Void , ServiceModule > ( ) { public Void invoke ( ServiceModule module ) { _context . getServletRegistration ( "dispatcher" ) . addMapping ( "/" + module . simple + "/*" ) ; return null ; } } ; ServiceModule . scan ( _context , _packaged , functor , _logger ) ; ServiceModule . scan ( _context , _extended , functor , _logger ) ; try { XmlWebApplicationContext wac = new XmlWebApplicationContext ( ) ; wac . setServletContext ( _context ) ; wac . refresh ( ) ; wac . start ( ) ; try { // let the life cycle control take over PlatformControl controlling = wac . getBean ( CONTROLLING , PlatformControl . class ) ; ManagementFactory . getPlatformMBeanServer ( ) . registerMBean ( controlling . bind ( this , wac , Thread . currentThread ( ) . getContextClassLoader ( ) ) , new ObjectName ( controlling . getClass ( ) . getPackage ( ) . getName ( ) , "type" , controlling . getClass ( ) . getSimpleName ( ) ) ) ; if ( controlling . isAutomatic ( ) ) { controlling . reload ( ) ; } } catch ( BeansException x ) { // go ahead with platform realization realize ( wac , null ) ; } catch ( Exception x ) { _logger . warning ( Throwables . getFirstMessage ( x ) ) ; } } catch ( BeanDefinitionStoreException x ) { _logger . warning ( Throwables . getFirstMessage ( x ) ) ; } }
Tries to load an XML web application contenxt upon servlet context initialization . If a PlatformControl is detected in the web application contenxt registers it with the platform MBean server and stop . Otherwise continues to load all module contexts in the application .